Repository navigation
fix(install): deny retirement consistency when the lockfile is absent - #4644
Merged
Daniel Meppiel (danielmeppiel) merged 10 commits intoNov 21, 2026
Merged
Daniel Meppiel (danielmeppiel) merged 10 commits into
Daniel Meppiel (danielmeppiel) merged 10 commits into
Conversation
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
When apm.lock.yaml has no record of a package, its local deployment receipts stand in for the prior deployed files, so install retires what the executables gate no longer deploys and keeps edited bytes recorded exactly as with a kept lockfile. A parked self-defined MCP server whose runtime entry still equals its declaration is removed the same way. Co-authored-by: Copilot App <[email protected]>
…nup owners Co-authored-by: Copilot App <[email protected]>
…ineer-sec-ql-hardening
Co-authored-by: Copilot App <[email protected]>
apm-spec-waiver: lost-lockfile install now converges to the existing kept-lockfile retirement behaviour; no new contract. Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
November 21, 2026 16:08
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 21, 2026 16:08
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Two critical issues can delete user-owned MCP servers without evidence of an APM write and remove still-deployed Cowork skills because receipt paths and current claim locators do not match.
2 open issues
What changed in this PR
This PR extends install cleanup to recover prior deployments when the lockfile is missing, aiming to make deny retirement consistent with the kept-lockfile flow.
Changes:
- Uses installation-local receipts for stale-file cleanup and preserves recovered hashes during lockfile rebuilding.
- Adds declaration-based retirement of unrecorded, parked MCP entries.
- Adds kept/lost-lock lifecycle tests and documents the behavior.
| File | Description |
|---|---|
tests/integration/test_deny_retirement_without_lock_lifecycle.py |
Tests retirement and edited-hook audit behavior with kept or lost locks. |
src/apm_cli/integration/mcp_config_view.py |
Retains parked MCP declarations for cleanup. |
src/apm_cli/integration/cleanup.py |
Exposes owner-filtered receipt claims. |
src/apm_cli/install/phases/lockfile.py |
Reconciles recovered files and hashes into the new lockfile. |
src/apm_cli/install/phases/cleanup.py |
Uses receipt-backed prior records and protects current deployments. |
src/apm_cli/install/mcp/parked_retirement.py |
Adds declaration-matching cleanup for unrecorded MCP entries. |
src/apm_cli/install/mcp/integration.py |
Invokes parked-entry retirement for selected runtimes. |
src/apm_cli/install/context.py |
Carries recovered deployment records between phases. |
src/apm_cli/core/deployment_ledger.py |
Adds an optional owner filter to receipt lookup. |
docs/src/content/docs/reference/cli/deny.md |
Documents lost-lock retirement and edited-file handling. |
changelog.d/4644.fixed.md |
Adds a user-facing fix announcement. |
.apm/architecture/owners/install-deployment.json |
Includes parked retirement in the MCP ownership registry. |
Review effort: Balanced
… proof An unrecorded MCP entry that equals a parked declaration may be the user's own, so it is removed only when the install started without a lockfile and local deployment receipts show APM integrated the declaring package here. Without a prior lock, this run's root-local files also join the survivor set. Re-anchors the lifecycle rule citations that moved. Co-authored-by: Copilot App <[email protected]>
Lost-lockfile stand-ins now take each receipt's lock value from the canonical deployment-path codec for the run's targets, so a file under an external root compares with this run's claims in the same spelling. MCP entry retirement without a lockfile is withdrawn from this change: no per-entry write evidence exists, so equality alone never removes one. Co-authored-by: Copilot App <[email protected]>
… are withheld A dropped lock entry for a package the gate still admits keeps its existing behaviour: an existing file stays a local collision and is never retired. A path this run skipped as an existing local file is never stale. Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-pgm-engineer-sec-ql-hardening
branch
November 21, 2026 20:21
This was referenced Nov 22, 2026
Merged
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
When
apm.lock.yamlhas no record of a package (the lockfile was lost, not committed, or regenerated),apm installdid not retire the hook files the executables gate no longer deploys for it, because cleanup only used the prior lock as the record of what was deployed. A project without its lockfile now converges exactly like one that kept it:deployed_files(DeploymentEvidence.receipted_claims,install/phases/cleanup.py). Each receipt is spelled by the canonical deployment-path codec for the run's targets (for examplecowork://for an external root), so it compares with current claims in the same spelling. The normal stale-file cleanup then retires what the package no longer deploys, still gated by deployment evidence. Lockfile assembly reconciles the same stand-in record, so an edited file is kept and recorded with APM's hash, andapm audit --cireports it, the same as with a kept lock.surviving_deployed_pathsstill projects this run's claims, including root-local files, so a peer package's or the project's own file is never treated as stale.deployment_ledger.receipt_hashestakes an optional owner filter. MCP entries are out of scope here: without a lockfile there is no per-entry write evidence, and equality with a declaration never removes one.Issue and approved scope
Issue: none; scope set by the maintainers.
Human scope-approval comment: approved by the maintainers.
Does this PR complete the issue, or what remains? It completes the lost-lockfile retirement item.
Type of change
Testing
tests/integration/test_deny_retirement_without_lock_lifecycle.py(real binary, parametrized[kept|lost]): deny retires the hook (and, with the lock kept, the MCP entry), and an edited hook is kept and named byapm audit --ci. Both[lost]cases fail on main and pass with this change.Unit:
tests/unit/test_deployment_materialization_receipts.pypins the stand-in spelling for a project target and an external (cowork://) root; red before this change.Changelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
CONFORMANCE.{md,json}regeneratedapm-spec-waiver: lost-lockfile install now converges to the existing kept-lockfile retirement behaviour; no new contract.