Skip to content

Trust and integrity consistency: audit --ci and install --frozen agree on locked content hashes - #4271

Merged
Daniel Meppiel (danielmeppiel) merged 21 commits into
mainfrom
danielmeppiel-s13-audit-frozen-hash-parity
Nov 20, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 21 commits into
mainfrom
danielmeppiel-s13-audit-frozen-hash-parity

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

Trust and integrity consistency: apm audit --ci and apm install --frozen reach the same verdict on locked package content hashes. Audit's locked-copy replay uses the shared content-hash verdict from the package-content-hash / locked-copy-validity owner, in both directions (an edited lock hash and a stale replay copy).

Draft: the lane is finishing tests, guard and CI. The description is completed before review.

Issue and approved scope

Issue: Fixes #4187
Issue: Fixes #4165

Human scope-approval comment: #4187 (comment) , #4165 (comment)

Does this PR complete the issue, or what remains? It completes both issues.

Type of change

  • Bug fix

Testing

  • Tested locally (in progress)
  • All existing tests pass
  • Added tests for new functionality (if applicable)

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md.

… audit --ci

apm audit --ci now asks the same owner as apm install (and --frozen)
whether package bytes at the locked commit match the lock row's
content_hash: warm copy checks, reused live copies and scratch downloads
all route through install/source_helpers.locked_content_mismatch.

Adds the install-deployment-locked-content-verdict architecture guard,
its mutation case, and a lifecycle test pairing audit --ci with
install --frozen on the same lockfile state (#4187).

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.37.0 milestone Nov 20, 2026
…--frozen

- One owner line names the entry, the locked content_hash and the observed
  value; install, install --frozen and the audit --ci replay all use it.
- audit --ci reports an apm_modules copy that contradicts the lock before
  verifying from the locked source, and includes the line when the locked
  source cannot be reached.
- Re-anchor two audit tests to the frozen/audit agreement: a cache copy
  that contradicts the lock gets one verdict from both commands, and an
  unverifiable one fails closed in both.

Spec: req-lk-015

Co-authored-by: Copilot App <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical issues leave conformance assertions unreliable, allow registry audit replay to accept edited content hashes, and reject valid bare SHA-256 hashes.

3 open issues
What changed in this PR

This PR aims to align apm audit --ci and apm install --frozen on locked package content hashes, addressing stale-cache false drift reports while preserving audit's read-only behavior.

Changes:

  • Introduces a shared content-hash verdict and consistent mismatch diagnostics.
  • Checks cached and freshly downloaded Git content during audit replay.
  • Adds lifecycle and conformance coverage, plus an architecture guard for shared verification.
File Description
tests/​unit/​scripts/​test_architecture_runner.py Registers the new guard in the expected inventory.
tests/​unit/​install/​test_architecture_invariants.py Updates the replay module's size allowance.
tests/​spec_conformance/​test_lockfile_reqs.py Adds audit hash checks for both lockfile streams.
tests/​integration/​test_virtual_skill_audit_e2e.py Covers stale-copy recovery and unreachable sources.
tests/​integration/​test_unrecorded_drift_lifecycle_e2e.py Updates drift expectations for verified replay content.
tests/​integration/​test_locked_package_hash_parity_lifecycle.py Adds warm/cold audit and frozen-install parity probes.
tests/​integration/​test_architecture_owner_rule_mutations.py Adds a mutation case for bypassing verification.
tests/​fixtures/​lifecycle_bug_ledger.json Records the hash-parity regression coverage.
src/​apm_cli/​install/​sources.py Routes fresh-install checks through the shared verdict.
src/​apm_cli/​install/​source_helpers.py Defines shared verification and diagnostic helpers.
src/​apm_cli/​install/​phases/​integrate.py Reports expected and observed hashes before refreshing.
src/​apm_cli/​install/​drift.py Checks cached copies and fresh Git replay content.
src/​apm_cli/​install/​audit_replay.py Detects stale content and reports replay mismatches.
scripts/​architecture_linter/​checks/​install_locked_content_verdict.py Guards shared verification call paths.
scripts/​architecture_linter/​checks/​install_deployment_analyzers.py Registers the verification guard.
CONFORMANCE.md Updates the displayed conformance test count.
CONFORMANCE.json Records the new parameterized conformance cases.
CHANGELOG.md Documents the intended audit/install consistency fix.
.apm/​architecture/​owners/​install-deployment.json Extends content-hash ownership and guard references.

Review effort: Balanced

Comment thread src/apm_cli/install/drift.py Resolved
Comment thread src/apm_cli/install/source_helpers.py Resolved
…ownloading

install --frozen reports the shared locked-content line (entry, expected,
observed) for an apm_modules copy whose bytes contradict the lock, before it
verifies from the locked source.

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>

# Conflicts:
#	tests/fixtures/lifecycle_bug_ledger.json
…dict guard; adapt spec test to the new return shape

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>

# Conflicts:
#	tests/fixtures/lifecycle_bug_ledger.json
…locked source

A cached copy that contradicts the lock is named with the entry, the
expected and the observed envelope, verified from the locked source, and
the command then passes with the lockfile and deployed files unchanged.
Steward-approved I3 re-anchor (#4271).

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The package-content-hash owner compares a bare hex content_hash and a
sha256: envelope as the same digest (req-lk-016); the cached, fresh and
legacy-plugin checks of the shared locked-content verdict use it.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The audit --ci scratch replay now checks a registry package against its
locked content_hash through the same verdict as git packages, so warm and
cold audit replay agree with install --frozen on registry rows. Adds the
registry warm/cold paired probe and re-anchors the guard's mutation case.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 7c70e60 into main Nov 20, 2026
44 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-s13-audit-frozen-hash-parity branch November 20, 2026 14:00
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Main's #4271 replay content check adds a free-text 'apm install' tip; it now renders replay-cache-content-stale.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Fold [Unreleased] into the untagged [0.37.0] - 2026-11-20 block. Contributor, CI and test-only lines are dropped per the cut-release DROP list; exact duplicate lines from parallel merges are removed; the #4126/#4276 plugin-type lines are merged; the #4187 placeholder now names #4271. pyproject.toml is already 0.37.0. Refreshed again on the final release train; its train merge on main is the RC SHA.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Fold [Unreleased] into the untagged [0.37.0] - 2026-11-20 block on the final release train. Contributor, CI and test-only lines are dropped per the cut-release DROP list; exact duplicates from parallel merges are removed; the #4126/#4276 plugin-type lines are merged; the #4187 placeholder names #4271. pyproject.toml is already 0.37.0. The train merge on main is the RC SHA.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
Fold [Unreleased] into the untagged [0.37.0] block on the final release train. Contributor, CI and test-only lines are dropped per the cut-release DROP list; exact duplicates from parallel merges are removed; the #4126/#4276 plugin-type lines are merged; the #4187 placeholder names #4271. pyproject.toml is already 0.37.0. The train merge on main is the RC SHA.

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants