Repository navigation
fix(install): skill adoption accepts a locked-render match without a local receipt; cleanup retains files the install kept - #4258
Merged
Daniel Meppiel (danielmeppiel) merged 35 commits intoNov 21, 2026
Conversation
…cleanup retains kept skill members Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…es render or own receipt; lifecycle tests Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…-switch skill trust Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…e is still cleaned Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
November 20, 2026 11:46
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 11:46
…d bytes Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved issues make user-scope and Cowork recovery unusable, allow stale receipts to bypass baseline validation, and introduce O(M*K) cleanup costs.
3 open issues
What changed in this PR
Addresses #4229 and #4230 by refining skill adoption after checkout changes and preventing install cleanup from deleting declared files that were left unwritten.
Changes:
- Refines receipt trust and allows skill adoption through current or locked rendered content.
- Carries kept members into cleanup retention and adds directory-level recovery guidance.
- Adds regression coverage, architecture guards, and updated installation documentation.
| File | Description |
|---|---|
tests/unit/test_deployment_materialization_receipts.py |
Updates receipt-trust expectations. |
tests/unit/scripts/test_architecture_runner.py |
Registers the new guard inventory. |
tests/unit/integration/test_skill_preflight.py |
Checks expanded recovery guidance. |
tests/unit/integration/test_skill_adoption.py |
Covers mixed receipt and render matches. |
tests/unit/integration/test_cleanup_helper.py |
Tests kept-member retention and deletion controls. |
tests/integration/test_checkout_switch_skill_lifecycle.py |
Exercises checkout switching, recovery, and cleanup. |
tests/integration/test_architecture_owner_rule_mutations.py |
Adds mutations for both architecture guards. |
tests/fixtures/lifecycle_bug_ledger.json |
Records regressions for both issues. |
src/apm_cli/integration/skill_preflight.py |
Supplies the recovery directory. |
src/apm_cli/integration/skill_integrator.py |
Records skipped members and prioritizes adopted baselines. |
src/apm_cli/integration/skill_adoption.py |
Compares members against trusted receipts or renders. |
src/apm_cli/integration/cleanup.py |
Retains kept members before deletion checks. |
src/apm_cli/integration/base_integrator.py |
Adds skill-directory recovery instructions. |
src/apm_cli/install/phases/integrate.py |
Collects kept skill members into install state. |
src/apm_cli/install/phases/cleanup.py |
Passes kept members into cleanup evidence. |
src/apm_cli/install/context.py |
Stores kept deployment values. |
src/apm_cli/core/deployment_ledger.py |
Refines receipt trust and tracks kept members. |
scripts/architecture_linter/checks/install_deployment_analyzers.py |
Registers the new architecture checks. |
scripts/architecture_linter/checks/install_checkout_skill_trust.py |
Guards receipt trust and cleanup retention. |
docs/src/content/docs/reference/cli/install.md |
Documents adoption, retention, and recovery behavior. |
CHANGELOG.md |
Summarizes the user-visible fixes. |
.apm/architecture/owners/install-deployment.json |
Updates ownership contracts and guard references. |
Review effort: Balanced
apm-spec-waiver: retention and adoption stay within req-lk-024 evidence rules; no new normative surface Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…smoke Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…te recovery; O(1) kept lookup Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Merged
6 of 10 tasks
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
… computing stale files (#4230) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
… the reconciler (#4230) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
5 of 10 tasks
…R1-R4 no-loss controls Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…oject and user scope Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…er match without a local receipt; cleanup retains files the install kept Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…er match without a local receipt; cleanup retains files the install kept Co-authored-by: Copilot App <[email protected]>
…; strict known cell for step 5 Co-authored-by: copilot-swe-agent[bot] <[email protected]>
5 of 10 tasks
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…nverges Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…er match without a local receipt; cleanup retains files the install kept Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
#4258 makes kept a required keyword (explicit kept=() at non-install callers); #4394's frozen_withdrawal caller predates that and relied on the old default. Co-authored-by: Copilot App <[email protected]>
…4230) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…er match without a local receipt; cleanup retains files the install kept Co-authored-by: Copilot App <[email protected]> # Conflicts: # src/apm_cli/integration/cleanup.py # tests/fixtures/lifecycle_bug_ledger.json # tests/quality/lifecycle_obligations.json
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…er match without a local receipt; cleanup retains files the install kept Co-authored-by: Copilot App <[email protected]> # Conflicts: # tests/fixtures/lifecycle_bug_ledger.json # tests/quality/lifecycle_obligations.json
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-scaling-telegram
branch
November 21, 2026 05:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Skill adoption accepts a locked-render match without a local receipt, and cleanup retains files the install kept.
Required tests for the step-5 contract and the cleanup rule:
tests/integration/test_checkout_switch_skill_lifecycle.py::test_branch_switch_then_source_edit_never_deletes_skill_members(clean, dirty): after a branch round trip, a source edit to a skill with no trustworthy baseline exits non-zero, keeps the user's bytes, keepsapm.lock.yamlbyte-unchanged and prints a recovery scoped to that skill. Running the recovery converges and keeps a genuine edit in another deployed skill.tests/integration/test_checkout_switch_skill_lifecycle.py::test_discarded_deploy_then_source_edit_installsand::test_user_scope_discarded_deploy_then_source_edit_installs(checkout, stash, reset): the revert variant installs in one step and deletes nothing.::test_member_skipped_as_modified_is_never_stale(project, user): a skipped member is never cleaned as stale.::test_member_removed_from_source_is_still_cleaned: a member removed from source is still deleted.::test_source_edit_after_branch_round_trip_installs_without_recovery: strict expected failure tracked by Round-trip a source edit after a branch switch without a manual recovery step (multi-hash receipt history) #4428.Receipt trust has one owner (
DeploymentMaterializationSession.baseline). A receipt is trusted when its owner and claim signature bind to the current lock claim AND either the lock records the receipted hash or the file still holds the receipted bytes. The lock can only withdraw trust, never grant it. A receipt written under another checkout's lock therefore never vouches for, or refuses, different bytes on disk.Skill adoption (
skill_adoption.skill_tree_baselines, shared by preflight and materialization) skips adoption only when every file in the tree still holds the bytes this installation receipted there. Otherwise each member matches its own trusted receipt or the current or locked (link-rewritten) render. Adopted hashes take precedence over a receipt the file no longer holds.Cleanup retains kept members. Members that the skill integrator declares but leaves unwritten are recorded as kept (
DeploymentMaterializationSession.keep->ctx.kept_deployed_values->DeploymentEvidence.kept).remove_stale_deployed_filesretains them before any deletion gate, so their lockfile entries carry forward.Actionable refusal. When no trustworthy baseline exists for a locally edited skill (no receipt matches the disk, and no render does), install refuses without changing anything. It names the deployed skill directory and the recovery: move it aside (or delete it if it holds no edits), then run
apm install. This is the strict known cell; multi-hash receipt history is planned for 0.38.Two closed-world guards plus mutation cases:
install-deployment-skill-adoption-trusted-receiptandinstall-deployment-cleanup-retains-kept-members.Steward note
apm.lock.yamlunchanged, and prints a recovery scoped to the refused skill. Running it rewrites only that skill and never overwrites edited files elsewhere. Installing the edit in one step needs multi-hash receipt history, tracked by Round-trip a source edit after a branch switch without a manual recovery step (multi-hash receipt history) #4428 (0.38.0) and pinned by a strict expected-failure cell.test_receipt_outlives_checked_out_hash_only_while_disk_holds_it(a receipt for another lock's hash vouches only for bytes the file still holds) and the refusal guidance pinned intest_cold_skill_receipt_preservation(scoped recovery, no global--force).Issue and approved scope
Issue: Fixes #4229
Issue: Fixes #4230
Human scope-approval comment: #4229 (comment) and #4230 (comment)
Does this PR complete the issue, or what remains? Completes both issues.
Type of change
Testing
Validation evidence:
APM_BINARY_PATH=.venv/bin/apm uv run --extra dev pytest tests/integration/test_checkout_switch_skill_lifecycle.py tests/integration/test_frozen_no_rewrite_e2e.py tests/integration/test_cold_restore_skill_adoption_lifecycle.py-> passeduv run --extra dev pytest tests/unit/integration tests/unit/test_deployment_materialization_receipts.py tests/quality/test_lifecycle_bug_ledger.py tests/unit/scripts/test_architecture_runner.py-> passedChangelog
## [Unreleased]inCHANGELOG.md.Spec conformance (OpenAPM v0.1)
apm-spec-waiver: retention and adoption stay within req-lk-024 evidence rules; no new normative surface