Repository navigation
fix(install): one locked-source verdict for audit --ci, install, --frozen and update - #4385
Merged
Daniel Meppiel (danielmeppiel) merged 13 commits intoNov 21, 2026
Conversation
…' into danielmeppiel-cache-integrity-parity-4356
…pdate The audit --ci replay reads locked git sources through the same persistent cache as install, --frozen and update (attach_persistent_git_cache), so both commands recompute content_hash over the same bytes and reach one verdict. A re-fetch of an existing apm_modules copy is staged with the install transaction, so a refused install leaves apm_modules as it was. update reports a refusal through the [x] error line. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
… probes and ledger Adds the install-deployment-locked-source-cache closed-world guard and its mutation case, installed-CLI paired audit --ci / install --frozen probes and an update refusal probe, ledger rows and a CHANGELOG line. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 15:43
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…ntegrity-parity-4356
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A critical staging-path collision causes installs with nested transitive dependencies to fail before the parent package downloads, requiring isolated backups and coverage for both staging orders and rollback.
1 open issue
What changed in this PR
This PR aligns locked-source integrity checks across audit, install, frozen install, and update, addressing #4356, #4353, and #4363.
Changes:
- Centralizes persistent Git cache attachment for consistent source verification.
- Stages existing package copies for rollback and adds an error marker to update refusals.
- Adds lifecycle regressions and architecture guards, and promotes repaired integrity cases to required checks.
| File | Description |
|---|---|
tests/unit/scripts/test_architecture_runner.py |
Registers the new guard in the expected inventory. |
tests/quality/generated_obligations.json |
Updates required integrity witnesses and known failures. |
tests/lifecycle/security/test_integrity.py |
Requires repaired integrity cases; retains uninstall exclusions. |
tests/integration/test_locked_source_cache_parity_lifecycle.py |
Tests verdict parity, refusal preservation, and update diagnostics. |
tests/integration/test_architecture_owner_rule_mutations.py |
Tests detection of missing replay cache wiring. |
tests/fixtures/lifecycle_bug_ledger.json |
Records the three fixes and regression coverage. |
src/apm_cli/install/transaction.py |
Adds the existing-copy staging helper. |
src/apm_cli/install/sources.py |
Stages copies before sequential re-fetches. |
src/apm_cli/install/phases/resolve.py |
Uses shared cache attachment. |
src/apm_cli/install/phases/integrate.py |
Stages mismatching copies instead of deleting them. |
src/apm_cli/install/phases/download.py |
Stages copies before parallel re-fetches. |
src/apm_cli/install/drift.py |
Attaches the shared cache to audit replay. |
src/apm_cli/commands/update.py |
Routes dependency and integration failures through error logging. |
src/apm_cli/commands/outdated.py |
Reuses shared cache attachment. |
src/apm_cli/cache/git_cache.py |
Defines the canonical cache-attachment helper. |
scripts/architecture_linter/checks/install_locked_source_cache.py |
Guards cache attachment and re-fetch staging routes. |
scripts/architecture_linter/checks/install_deployment_analyzers.py |
Registers the new architecture check. |
CHANGELOG.md |
Documents verification parity and refusal preservation. |
.apm/architecture/owners/install-deployment.json |
Records shared cache and staging ownership. |
Review effort: Balanced
…omission cell to #4389 Co-authored-by: copilot-swe-agent[bot] <[email protected]>
6 of 10 tasks
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The audit --ci replay attaches the persistent git cache read-only: it serves an existing checkout for the locked commit and never creates, evicts or records cache entries; any miss falls back to a fresh clone. Updates the integrate re-download unit test for the staged copy. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
A nested copy staged before its parent no longer occupies the parent's backup path; both staging orders roll back byte for byte. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
5 of 10 tasks
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…--ci, install, --frozen and update Co-authored-by: Copilot App <[email protected]> # Conflicts: # tests/fixtures/lifecycle_bug_ledger.json
…lay cache Co-authored-by: copilot-swe-agent[bot] <[email protected]>
… re-fetch A content hash refusal can only reject a row that records content_hash, so only those copies are staged with the install transaction; rows without one re-fetch in place as before. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…--ci, install, --frozen and update Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…--ci, install, --frozen and update Co-authored-by: Copilot App <[email protected]>
…names unhashed rows Under require_hashes both readers refuse and name the row; by default both accept it alike. The dependency-content-hashes audit check names the rows. apm-spec-waiver: aligns which local package copy install, --frozen, update and audit --ci read; req-lk-015 refusal and diagnostic unchanged Co-authored-by: copilot-swe-agent[bot] <[email protected]>
This was referenced Nov 20, 2026
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-cache-integrity-parity-4356
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
Trust and integrity consistency:
apm audit --ci,apm install(including--frozen) andapm updateread locked git sources through one cache, so they recomputecontent_hashover the same bytes and reach one verdict. A refused install leavesapm_modulesbyte for byte as it was, and a refusedapm updatereports the mismatch with an[x]line.cache/git_cache.pyattach_persistent_git_cacheis the one place a downloader gets the persistent git cache. Install's resolve phase,apm outdatedand theapm audit --cireplay (install/drift.py run_replay) all use it. When a package copy and its cached checkout both differ from the lock, audit now refuses with the shared entry/expected/observed line, asinstall --frozendoes. With a clean cache, both pass.install/transaction.pystage_existing_copyhands an existingapm_modules/<pkg>copy to the install transaction before a re-fetch replaces it (parallel pre-download, the sequential download and the integrate re-download). On refusal the transaction restores it, including.apm-pin. On success the transaction discards the saved copy. Only lock rows that record acontent_hashare staged, since only those can be refused on a content-hash mismatch. Audit reads the shared cache read-only: it never creates, evicts or records cache entries.commands/update.pyroutesDirectDependencyErrorandRequiredIntegrationErrorthroughInstallLogger.error, so the refusal carries[x]. Exit code and wording are unchanged.install-deployment-locked-source-cache, owned bypackage-content-hash:attach_persistent_git_cache;stage_existing_copy;persistent_git_cache.A MutationCase with the same id removes the replay's cache wiring.
I|approval-pins|audit-ci|disk-or-cachenow expects the shared content-hash line, the same lineinstall --frozenexpects for that cell.uninstall-prune|disk-or-cachecells stay strict under a neutral pending marker. They cover uninstall retaining an edited target file, not a content-hash refusal.Issue and approved scope
Issue: Fixes #4356
Issue: Fixes #4353
Issue: Fixes #4363
Human scope-approval comment: #4356 (comment), #4353 (comment), #4363 (comment)
Does this PR complete the issue, or what remains? It completes all three issues.
Type of change
Testing
New tests:
tests/integration/test_locked_source_cache_parity_lifecycle.py::test_audit_ci_and_frozen_refuse_alike_when_every_copy_differs: drives the installed CLI withHOMEisolated. It runs a pairedaudit --ci/install --frozenprobe plus plaininstallon one state, and checks the project, lockfile andapm_modulesare byte-identical after each refusal.tests/integration/test_locked_source_cache_parity_lifecycle.py::test_update_refusal_names_the_mismatch_as_an_errortests/lifecycle/security/test_integrity.py::test_integrity_row: thegit-content_hashandapproval-pinscells for these issues now run as required cells.tests/integration/test_trust_integrity_consistency_lifecycle.py::test_frozen_and_audit_refuse_alike_a_git_row_without_content_hash_under_require_hashes: drives the installed CLI. Withsecurity.integrity.require_hashes: true, a git row with nocontent_hashmakesinstall --frozenandaudit --ciboth exit 1 and name the row; the project, lockfile andapm_modulesare unchanged. Thedependency-content-hashesaudit check now names the rows in its message.tests/integration/test_trust_integrity_consistency_lifecycle.py::test_frozen_and_audit_agree_on_a_git_row_without_content_hash_by_default: under the documented default, both readers accept such a row alike.install-deployment-locked-source-cacheintests/integration/test_architecture_owner_rule_mutations.pyValidation evidence (local, on the merge with current
main):uv run --frozen --extra dev ruff check/ruff format --checkonsrc/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.pyuv run --frozen --extra dev python -m pylint --disable=all --enable=R0801 --min-similarity-lines=10 --fail-on=R0801 src/apm_cli/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.pybash scripts/lint-auth-signals.sh;bash scripts/lint-architecture-boundaries.shrelative_toguards fromci.ymluv run --frozen --extra dev python scripts/check_complexity_ratchet.py --base-ref origin/mainuv run --frozen --extra dev python -m tests.lifecycle.witnessesChangelog
## [Unreleased]inCHANGELOG.md:user-visible effect first, 25 words or fewer, ending with
(#PR);breaking changes only under upgrade notes; no Highlights; see
.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
CONFORMANCE.{md,json}regeneratedapm-spec-waiver: aligns which local package copy install, --frozen, update and audit --ci read; req-lk-015 refusal and diagnostic unchanged