Repository navigation
#3701 (1/2) record deployment receipts for every file primitive - #4023
Merged
Daniel Meppiel (danielmeppiel) merged 8 commits intoNov 20, 2026
Merged
Conversation
…3701) Integrators report final-rendered writes (never adopted or skipped files) in IntegrationResult.rendered_writes; the install service records them through the installation-bound DeploymentMaterializationSession, which now locates writes under any target deploy root. Skill plugin bin copies are recorded too. cowork:// lockfile rows now carry hashes. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…req-lk-012 (#3701) Integrators report each final-rendered write with note_rendered_write; the deployment ledger owner drains and records them per integrator call, including writes before a failure. Keeps hook and skill integrators under the file-length guard. Adds installed-CLI receipt lifecycle tests and a req-lk-012 conformance test for cowork:// deployed-file hashes. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…3701) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Closed
5 of 14 tasks
…ycle oracles (#3701) Receipts stay in the existing APM_HOME/deployment-receipts store. The diamond uninstall step now declares that store because the survivor rebuild rewrites the shared instruction and records its receipt; the skill receipt oracle filters to skill members since other primitives are receipted too. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
This was referenced Nov 20, 2026
Main grew install/services.py and skill_integrator.py. Fold the integrator receipt bracketing into deployment_ledger.recorded_writes and let _copy_plugin_file report its own write. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Merged
6 of 10 tasks
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
November 20, 2026 08:39
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 08:39
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-literate-broccoli
branch
November 20, 2026 08:39
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Cowork lockfile handling incorrectly includes symlink targets, while the architecture guard can miss unreported hook-bundle writes, with regression coverage gaps for both issues.
2 open issues
What changed in this PR
This is the receipt-plumbing half of #3701. It extends local deployment evidence beyond skills, preparing stale cleanup to require stronger proof in the follow-up PR; cleanup enforcement is unchanged here.
Changes:
- Report final-rendered file writes and record them through the installation-bound receipt session, including writes completed before an integrator fails.
- Add content hashes for
cowork://deployed-file entries. - Extend architecture guards, receipt lifecycle tests, and conformance coverage.
| File | Description |
|---|---|
| tests/unit/test_deployment_materialization_receipts.py | Tests non-skill receipts and target-root boundaries. |
| tests/unit/integration/test_deployed_files_manifest.py | Tests Cowork deployed-file hashing. |
| tests/spec_conformance/test_cowork_deployed_hash_reqs.py | Adds canonical Cowork hash conformance coverage. |
| tests/integration/test_required_lifecycle_state_machine.py | Updates expectations for additional primitive receipts. |
| tests/integration/test_file_primitive_receipt_lifecycle.py | Tests installed-CLI receipts and receipt-less adoption. |
| tests/integration/test_architecture_materialization_receipts.py | Adds receipt-routing mutation cases. |
| src/apm_cli/integration/skill_integrator.py | Shares receipt ownership and reports plugin writes. |
| src/apm_cli/integration/prompt_integrator.py | Reports rendered prompt writes. |
| src/apm_cli/integration/kiro_hook_integrator.py | Reports Kiro hook document writes. |
| src/apm_cli/integration/instruction_integrator.py | Reports rendered instruction writes. |
| src/apm_cli/integration/hook_integrator.py | Uses LF-only JSON output and reports writes. |
| src/apm_cli/integration/hook_bundle.py | Reports copied assets and generated sidecars. |
| src/apm_cli/integration/command_integrator.py | Reports rendered command writes. |
| src/apm_cli/integration/canvas_integrator.py | Reports copied canvas bundle files. |
| src/apm_cli/integration/base_integrator.py | Adds shared write-report collection and draining. |
| src/apm_cli/integration/agent_integrator.py | Reports rendered agent writes. |
| src/apm_cli/install/services.py | Wraps integrator calls in receipt recording. |
| src/apm_cli/install/phases/lockfile.py | Resolves Cowork entries for content hashing. |
| src/apm_cli/core/deployment_ledger.py | Extends receipt locations and drains reported writes. |
| scripts/architecture_linter/checks/mutation_hook_contract.py | Recognizes the updated hook JSON writer. |
| scripts/architecture_linter/checks/install_base_integrator_and_contraction.py | Adds write-reporting and receipt-routing guards. |
| CONFORMANCE.md | Updates the req-lk-012 test count. |
| CONFORMANCE.json | Registers the new Cowork conformance test. |
Review effort: Balanced
| "with recorded_writes(integrators.skill, integrators.skill, projection_targets,", | ||
| ), | ||
| **{ | ||
| f"src/apm_cli/integration/{name}.py": ("note_rendered_write(",) |
| if cowork_root is None: | ||
| continue | ||
| try: | ||
| _full = from_lockfile_path(_rel, cowork_root) |
3 of 9 tasks
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
main's phases/lockfile.py reached 1017 lines when #4023 merged, with no KNOWN_LARGE_MODULES entry; the frozen disposition adds three. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
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
Draft, PR 1 of 2 for #3701 (receipt plumbing). Stale cleanup must not trust a lockfile hash alone. Before cleanup can require evidence (PR 2), APM has to record that evidence. Until now, local deployment receipts covered only skills.
This PR records an installation-bound receipt for every final-rendered write of every file primitive:
bin/and.claude-plugin/plugin.json) reports every final-rendered write withBaseIntegrator.note_rendered_write. Adopted and skipped files are never reported, so receipt-less adoption does not extend beyond the existing skill rule (the record puts that out of scope).record_rendered_writes(incore/deployment_ledger.py, the receipt owner) drains those reports after every integrator call inintegrate_package_primitives, including writes made before a failure, and records them through the liveDeploymentMaterializationSession. The session is the one already bound for the integrate phase of install and the uninstall survivor rebuild. Drift replay and dry runs have no session, so they record nothing.DeploymentMaterializationSession.recordnow locates writes under any target deploy root, not only skill roots. It refuses symlinks and paths outside every target root instead of recording them.cowork://lockfile rows now carry content hashes:compute_deployed_hashesdecodes them under the resolved Cowork root. That brings these rows under req-lk-012 (canonicalsha256envelope for every deployed file), cited by a new conformance test.install-deployment-provenance-statenow requires every file-primitive writer to report writes and the install service to record them, with mutation traps.Not in this PR (PR 2, stacked): enforcement in the cleanup owner (receipt or locked-render equality required), the render fallback, removing the
cowork://hash exemption, integrator sync and skill path migration, lifecycle tests, docs and CHANGELOG.Issue and approved scope
Issue: Refs #3701
Human scope-approval comment: #3701 (comment) (apm-scope:v1, record-present via
scripts/governance/eligibility.cjs)Does this PR complete the issue, or what remains? No. This is part 1 of the two dependent PRs the record calls for. PR 2 adds enforcement and the render fallback.
Type of change
Testing
APM_BINARY_PATH=.venv/bin/apm uv run --extra dev pytest tests/integration/test_file_primitive_receipt_lifecycle.py tests/spec_conformance/test_cowork_deployed_hash_reqs.py tests/unit/test_deployment_materialization_receipts.py tests/unit/integration/test_deployed_files_manifest.py(149 passed);tests/integration/test_architecture_materialization_receipts.pyplus related owner-rule mutations (43 passed); lint chain andscripts/lint-architecture-boundaries.shclean.pytest tests/unithas no new failures. The local failures (git signing, network and credential fixtures) also fail onmainin this sandbox.Changelog
Spec conformance (OpenAPM v0.1)
@pytest.mark.req("req-lk-012")intests/spec_conformance/test_cowork_deployed_hash_reqs.py(cowork:// rows now hashed per the existing requirement; no spec text change).