Repository navigation
fix(install): retain trustworthy rendered skill receipts - #3344
Conversation
Bind successful final loose-skill writes to installation identity and canonical ownership, preserving edits across lockfile checkout and cold replay. Keep frozen inventory policy and lock bytes unchanged. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 13c28cd3-d648-498c-97d8-95dd47e91145
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 13c28cd3-d648-498c-97d8-95dd47e91145
Stage complete bytes in the existing atomic I/O owner, publish create-only controls with exclusive hard links, and fail explicitly on collisions or unsupported filesystems. Preserve default replacement behavior. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 13c28cd3-d648-498c-97d8-95dd47e91145
There was a problem hiding this comment.
🟡 Changes recommended
Receipt handling still blocks valid updates after certain target and uninstall transitions, and cleanup repeatedly processes installation-wide state.
4 open issues
What changed in this PR
This PR adds installation-local receipts for successful rendered skill writes, allowing unchanged deployments to update after lockfile checkout or cold-cache replay while protecting user edits.
Changes:
- Record rendered hashes and bind them to installation identity, physical destinations, and canonical ownership.
- Integrate receipt recording and retirement with deployment, cleanup, and atomic file publication.
- Add lifecycle, failure-injection, and architecture tests, plus recovery documentation.
| File | Description |
|---|---|
tests/unit/utils/test_atomic_io.py |
Tests exclusive publication and collision preservation. |
tests/unit/test_deployment_materialization_receipts.py |
Tests receipt validation, isolation, retirement, and failures. |
tests/unit/install/test_pipeline_ownership_snapshot.py |
Tests pipeline failure propagation and snapshot cleanup. |
tests/integration/test_skill_materialization_receipt_lifecycle.py |
Adds installed-CLI preservation and replay controls. |
tests/integration/test_architecture_skill_provenance_scope.py |
Updates the pipeline mutation seam. |
tests/integration/test_architecture_materialization_receipts.py |
Adds receipt-owner boundary mutation tests. |
src/apm_cli/utils/atomic_io.py |
Adds create-only atomic publication. |
src/apm_cli/integration/skill_integrator.py |
Records successful final rendered writes. |
src/apm_cli/integration/cleanup.py |
Retires receipts for removed or absent outputs. |
src/apm_cli/integration/base_integrator.py |
Uses receipt baselines and tracks actual writes. |
src/apm_cli/install/pipeline.py |
Creates live sessions and binds committed claims. |
src/apm_cli/core/deployment_ledger.py |
Owns receipt identity, validation, persistence, and retirement. |
scripts/architecture_linter/checks/install_base_integrator_and_contraction.py |
Guards receipt ownership and lifecycle routing. |
packages/apm-guide/.apm/skills/apm-usage/commands.md |
Documents local-state requirements and recovery. |
docs/src/content/docs/reference/cli/install.md |
Explains receipt-based preservation and limitations. |
.apm/architecture/owners/install-deployment.json |
Extends the existing deployment-provenance owner. |
Review effort: Balanced
Exercise successful receipt creation and updates without frozen lock rewrites, and absent-lock/MCP mismatch rejection without local evidence promotion. Use real temporary deploy roots in the existing gitignore scope tests rather than truthy synthetic filesystem state. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 13c28cd3-d648-498c-97d8-95dd47e91145
Preserve exact receipt side-effect and failed-lock recovery boundaries in lifecycle contracts. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 13c28cd3-d648-498c-97d8-95dd47e91145
Refresh authenticated same-writer target handoffs through real guarded copies. Batch confirmed cleanup outcomes, retire actual uninstall removals before survivor copies, and bind rebuilt survivor receipts only after successful final lock persistence. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 13c28cd3-d648-498c-97d8-95dd47e91145
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 13c28cd3-d648-498c-97d8-95dd47e91145
Compose landed #3346 and #3347; preserve receipt source and both conformance bindings. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 13c28cd3-d648-498c-97d8-95dd47e91145
|
The bounded #3339 receipt correction at All four original review threads are resolved. The correction uses authenticated genuine copies for target handoffs, one outcome-based cleanup retirement, and actual survivor writes bound only after final lock persistence. Independent bounded static reviews found no high-confidence issue; no new review panel is claimed. The final public test/docs merge leaves all 29 receipt files and production/linter bytes unchanged. Fresh current-head proof has 48 owner witnesses and 125 changed MCP/update-plan cases, zero failures/errors/skips, plus canonical current-main lint and ratchets. Both strict owner-verification booleans pass; full canonical architecture evidence includes the required dual guardrail. Earlier 580dc95 topology, routing, conformance and six causal-mutant/eight-assertion results remain explicitly attributed to that head and bound to unchanged relevant bytes, not relabelled as fresh executions. Current-head CI, Spec/Mode B and required gate completed SUCCESS on attempt 1. Both architecture executions, both lifecycle shards and both strict aggregates succeeded. Terminal rollup: 28 successes, two neutral reports, one intended skip; no failure/cancellation. Historical reds, cancelled runs and failed evidence drivers remain preserved; the unchanged 2,995-case run was not replayed. Full native Cowork CLI acceptance, #3246's inventory-veto dispute and full nonpublishing main/release validation remain outside this PR's qualification. Only #3339 is a closing target. Merge Master assessment: ship_nowIndependent final qualification confirms exact head The latest live rollup is 29 successes, two neutral reports and one intended skip (32 terminal checks, including another metadata-only eligibility publication). Own CI, Spec and required gate remain successful; actual CodeQL analyses pass with no open PR alerts. Missing imposed native CodeQL is covered only by the existing explicit exception, not represented as a scan pass. Current ADMIN/always-bypass authority and the exclusive merge lease are verified. Recommend one exact-head guarded normal merge under the existing human CI mandate, closing only #3339. The full actual-main nonpublishing recovery mission remains open with its existing owner; no release, publication, deployment or native acceptance is authorized here. Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors. |
Compose landed #3343 without changing receipt production, guards or tests. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 13c28cd3-d648-498c-97d8-95dd47e91145

Description
fix(install): retain trustworthy rendered skill receipts
TL;DR
Restore loose-skill convergence after checking out a newer lockfile over an older local deployment, including cold frozen replay. The existing deployment-provenance owner retains installation-local evidence of actual successful rendered writes while current source selection and canonical ownership remain authoritative. Authenticated target handoffs and uninstall survivor rebuilds retain that authority through genuine writes, not identical adoption. Edits, foreign ownership and unsafe state paths remain protected.
Important
This fixes the six original deployed-byte regressions without changing their assertions. It does not implement the separate frozen manifest-version veto in #3246 or claim full-release validation.
Problem (WHY)
#3311's acquired-manifest correction and original credit remain intact; this PR repairs the subsequent deployment lifecycle. The ordered copy, rewrite, hash and receipt sequence follows Agent Skills' guidance to be prescriptive "when operations are fragile, consistency matters, or a specific sequence must be followed".
Approach (WHAT)
deployed_path_entryas the sole compatibility-key encoder; carry its admitted key through binding.Implementation (HOW)
core/deployment_ledger.pyinstall/pipeline.pyintegration/base_integrator.py;integration/skill_integrator.pyintegration/cleanup.py;install/phases/cleanup.pyfinally; standalone callers remain immediate.integration/skill_support.py;commands/uninstall/engine.pycommands/uninstall/cli.pyutils/atomic_io.py.apm/architecture/owners/install-deployment.json;scripts/architecture_linter/checks/install_base_integrator_and_contraction.pytests/unit/test_deployment_materialization_receipts.py;tests/unit/utils/test_atomic_io.pytests/unit/install/test_pipeline_ownership_snapshot.py;tests/unit/integration/test_skill_materialization_completion.pytests/unit/install/phases/test_cleanup_phase.py;tests/unit/commands/test_uninstall_atomic_selection.pytests/integration/test_skill_materialization_receipt_lifecycle.pytests/integration/test_architecture_materialization_receipts.py;tests/integration/test_architecture_skill_provenance_scope.pytests/spec_conformance/test_frozen_materialization_receipt_reqs.py;CONFORMANCE.{json,md}req-lk-006; derived bindings only.tests/unit/install/test_gitignore_scope_guard.py;tests/integration/test_required_lifecycle_state_machine.pydocs/src/content/docs/reference/cli/{install,uninstall}.md;packages/apm-guide/.apm/skills/apm-usage/commands.mdDiagram
Dashed nodes are new local evidence steps; source admission and canonical claims still authorize deployment.
flowchart LR subgraph Authorize P["Current admitted source plan"] L["Canonical deployment claims"] B["Installation-bound rendered baseline"] end subgraph Materialize C["BaseIntegrator guarded copy"] R["SkillIntegrator rewrite and hash"] end subgraph Evidence W["Record actual successful writer"] F["Atomic rendered receipt"] K["Bind surviving writes to committed claims"] end P --> C L --> B B --> C C --> R R --> W W --> F F --> K L --> K K -->|"Next live install"| B classDef new stroke-dasharray: 5 5; class B,W,F,K new;Trade-offs
.apm-local/and~/.apm/deployment-receipts/remain local; copied identities cannot bypass root checks. Create-only publication requires hard-link support, without replacement fallback.Benefits
Issue and approved scope
Issue: #3339. Closes #3339.
Human scope-approval comment: no public scope comment is claimed. The responsible human explicitly answered the exact CI-fix approval-record blocker:
This is task-specific authorization, not a fabricated
apm-scope:v1record or successful label-gated helper result; historicalneeds-evidenceremains historical. Review contact: Daniel Meppiel (@danielmeppiel).Does this PR complete the issue, or what remains? It implements the bounded #3339 correction, with current-head local and hosted qualification complete. Exclusive merge-manager qualification and landing remain; full nonpublishing main validation is separate. #3246, #3206 and #3188 are not closing targets.
Type of change
Testing
Validation
Current candidate:
f90e07fff27f524917935281eb70f5c7fe1e2fcd, ordered parents580dc95ccand actual public main5a9eff6ca(#3343). This final four-path public test/docs merge leaves all 29 receipt files and all production/linter bytes unchanged. The earlier public #3346/#3347 composition at 580dc95 separately preserved 25 receipt files and explicitly three-way verified/regenerated the four documentation/conformance intersections. No sibling implementation is copied or reimplemented.Fresh f90e07f results: 48 owner witnesses / 125 changed MCP and update-plan module cases, each zero failures/errors/skips, plus current-main canonical lint/static and assertion/duplication ratchets. Full architecture schema validation and strict verification cover 5 owners / 48 unique current-head XML-bound witnesses, with both
verified=trueandterminal_evidence_required=true. The 580dc95 routing, registered mutation, conformance and six causal-mutant results remain explicitly attributed to that head; their relevant source/guard/test bytes are unchanged. No unchanged 2,995-case replay or old-head relabelling.Hosted result: current-head CI 39780433881, Spec/Mode B 39780433971 and required gate 39780434025 completed SUCCESS on attempt 1. Terminal rollup: 28 SUCCESS, 2 NEUTRAL, 1 intended SKIPPED; no failures/cancellations. Architecture contracts: 188 passed (whole job 173s); scaling: 1 passed (133s); strict aggregate SUCCESS. Lifecycle shards: 200 passed/5 skipped (250s) and 196 passed/8 skipped (345s); strict aggregate SUCCESS. All remaining workflows succeeded. This is current PR-head proof, not full nonpublishing main/release validation.
Current-head commands and separately attributed supporting evidence
Runtime: macOS, Python 3.12.10, owned editable/source CLI
.venv/bin/apm.evidencedenotes the retained session artifact directory;coordinatordenotes the coordinating session directory. The serial command below exited 0. Its exact command manifest, unchanged source hashes, fresh XML hashes and owner seal are in3339-final-f90e07fff-results.json, SHA-2565256580bb388ce9079b0ee634e7e0784256eba397b5c21ce2a87feb39ca4e8de. Prior 580dc95 evidence remains in packet SHA369956b6d555bc65c04bf0a18b39109465a22376621a90abace97444300e43fe.Separate pytest summaries, in execution order:
bash "$evidence/3339-ci-mirror.sh"uv run --frozen --extra dev python scripts/check_test_assertions.pyuv run --frozen --extra dev python scripts/check_exact_test_duplicates.pyuv run --frozen --extra dev python -m tests.spec_conformance.orphan_check;bash tests/spec_conformance/mode_b_detector.shuv run --frozen --extra dev python -m pytest tests/spec_conformance --collect-only -p no:randomly --no-header -q, immediately followed byuv run --frozen --extra dev python -m tests.spec_conformance.gen_statementandgit diff --exit-code -- CONFORMANCE.json CONFORMANCE.mdreq-cf-001has 10 bindings andreq-lk-006has 32. No generation or borrowed collection was needed for the final test-only merge..venv/bin/python .agents/skills/autopilot-pr-merge-worker/scripts/owner_touch_gate.py verify --base 5a9eff6cab1fa9e511a14455659863dcc14da707 --head f90e07fff27f524917935281eb70f5c7fe1e2fcd --completion "$evidence/3339-final-f90e07fff-owner-completion.json"3339-qualify-public-reconciliation.py --child MODEarchitecture_evidence_v2schema validationowner-extension,dual_guardrail_required=true, actual boundary-lint and behavioral/static/causal evidence; sealed intermediate owner mapping is preserved separately./opt/homebrew/bin/mmdc -i "$evidence/3339-flow.mmd" -o "$evidence/3339-review-flow.svg" --quietHistorical evidence and genuine reds, not current-head qualification
834f050passed 2,679 affected cases.d9d21a76bseparately passed 8/144/15/3 runs; its hosted lifecycle failed four functional cases, not a timeout. Initial four local skips remain non-proof.19943separately passed 2,688/8/8/3; its lifecycle job cancelled at the ten-minute cap without a terminal test summary.580dc95ccseparately passed 48 owner / 144 topology / 60 I5 / 27 routing / 6 registered mutation / 8 conformance cases, zero FES; six causal mutants produced eight intended failures. Its CI, Spec and required gate all succeeded on attempt 1, including both strict aggregates. That qualified head preceded the final public test-only #3343 merge; none of its results are relabelled as f90e07f executions.95834131cseparately passed 2,995/10/8/3/3. Its six runtime mutants produced eight intended failures. One driver omitted the fifth-owner annotation; another expected one static case rather than the actual three passes. Both failed drivers remain preserved; separate sealing used already-executed evidence, not reruns. The lost initial owner mapping is explicitly labelled reconstruction in provenance SHAdf3fe90ef59db4357ef91dc0d85b5c5943846cbc618bef3e52c7f98aa86b110a.The sole 958341 CI attempt was cancelled by the five-minute combined architecture budget despite printed passes. Both lifecycle shards (whole jobs 452s/435s), their strict aggregate, Spec/Mode B and required gate passed. This remains a cancelled historical run, not clearance. Public #3347 subsequently split those unchanged contracts/scaling selections into separately budgeted executions and a strict original-name aggregate.
Handoff red XML SHA prefix:
454965249332; survivor red:74b577915859, attributed to dirty source snapshotf84e4e06f56ac, not clean 19943. Canonical batching red was3 == 1; invalid legacy-fixture probes are not proof. Immutable local/hosted packet SHAs remainc61ecacba67f48f9ac6320d0443a730f1267e79b06aa3c062ca644603fe2b78aandb92c6ae2ddb66eaa92c64d52e24b079d7898d297c397ae04d22465d4ed9064d4.Scenario Evidence
tests/integration/test_manifest_version_snapshot_lifecycle.py(unchanged regression traps for #3339)tests/integration/test_skill_materialization_receipt_lifecycle.py::test_user_edit_equal_to_old_version_remains_protectedtests/integration/test_skill_materialization_receipt_lifecycle.py::test_untrusted_receipt_does_not_replace_legacy_deployment;tests/unit/test_deployment_materialization_receipts.pytests/integration/test_skill_materialization_receipt_lifecycle.py;tests/integration/test_required_lifecycle_state_machine.py::test_required_global_audit_rule_matrix_for_external_rootstests/integration/test_shared_skill_preservation_lifecycle.py;tests/unit/install/test_pipeline_ownership_snapshot.pytests/unit/utils/test_atomic_io.pytests/spec_conformance/test_frozen_materialization_receipt_reqs.py(req-lk-006)tests/integration/test_ownership_invariant_lifecycle.py::test_global_update_preserves_owned_external_skill_targets;tests/integration/test_required_lifecycle_state_machine.py::test_required_failed_lock_write_bounds_partial_state_and_recoverstests/integration/test_skill_materialization_receipt_lifecycle.py::test_unchanged_shared_target_handoff_retains_update_authoritytests/integration/test_skill_materialization_receipt_lifecycle.py::test_uninstall_last_writer_records_actual_survivor_materializationtests/unit/install/phases/test_cleanup_phase.pytests/unit/test_deployment_materialization_receipts.py::test_uninstall_retires_before_recreating_and_binding_survivor_receipt;tests/unit/commands/test_uninstall_atomic_selection.pyHow to test
APM_BINARY_PATH="$PWD/.venv/bin/apm"andAPM_E2E_TESTS=1; run the manifest-snapshot and receipt-lifecycle modules withuv run --extra dev python -m pytest; expect real local/Git and project/user convergence.uv run --extra dev python -m pytest tests/spec_conformance/test_frozen_materialization_receipt_reqs.py; expect eight passes. Collect the full suite before regeneration, which must leave derived files unchanged.tests/integration/test_architecture_owner_rule_mutations.py -k "provenance or skills-root-derivation"; expect no diagnostics and six passing cases.Spec conformance (OpenAPM v0.1)
If this PR changes behaviour that an OpenAPM v0.1
req-XXXcovers,confirm the three-step ritual in the
development guide:
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.
Existing req-lk-006 governs frozen lock immutability and enumerated pre-mutation refusals. Eight real-consumer cases bind this local-write seam to that unchanged contract, not a normative receipt-format mandate. Spec prose, manifest, schemas and IDs are unchanged; no waiver.
req-lk-019and #3246's separate inventory-veto dispute remain untouched.Co-authored-by: Copilot [email protected]