Skip to content

fix(audit): name a local dependency whose content changed since the lock - #4474

Merged
Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
danielmeppiel-audit-local-dep-parity-4447
Nov 21, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
danielmeppiel-audit-local-dep-parity-4447

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

Trust and integrity consistency: apm audit --ci names a local dependency whose content changed since the lock, as apm install --frozen does. Both commands reach one verdict on the same tree.

  • install/local_content_verdict.py local_content_reasons is now the one local-dependency content verdict. It holds the logic that was inside InstallService._verify_frozen_local_content, which now calls it and still raises the same FrozenInstallError.
  • policy/ci_checks.py _check_content_integrity reports the same dependencies (local dependency '<path>' content differs from its locked snapshot). The content-integrity check fails, and the drift replay still runs and reports its own findings.
  • The install-deployment-package-content-hash and install-deployment-single-file-materialization guards now point at the new owner.
  • Lifecycle security table: G|audit-ci|definition-changed|native is no longer a strict known cell. fix(install): policy-blocked install names a runnable next step #4418 tags it with audit --ci passes a local dependency whose content changed since the lock, which install --frozen refuses #4447.

Issue and approved scope

Issue: Fixes #4447

Human scope-approval comment: #4447 (comment)

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

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

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

New test: tests/integration/test_local_dependency_content_parity_lifecycle.py::test_audit_ci_and_frozen_refuse_alike_a_changed_local_dependency. It drives the installed CLI and runs a paired audit --ci / install --frozen probe on one state: both exit 1 and name the dependency, and the project and lockfile are unchanged. The G|audit-ci|definition-changed|native lifecycle cell now runs as a required cell.

Command Result
uv run --frozen --extra dev ruff check / ruff format --check (CI paths) passed
uv run --frozen --extra dev python -m pylint --disable=all --enable=R0801 --min-similarity-lines=10 --fail-on=R0801 ... passed (10.00/10)
bash scripts/lint-architecture-boundaries.sh passed
uv run --frozen --extra dev python scripts/check_complexity_ratchet.py --base-ref origin/main passed
uv run --frozen --extra dev python -m tests.lifecycle.witnesses up to date
APM_BINARY_PATH=.venv/bin/apm uv run --frozen --extra dev pytest -n 2 on the new test, 25 local/replacement/audit-replay integration modules, unit policy, frozen and architecture tests, the ledger and the flipped cell 2258 passed, 1 xfailed

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • N/A -- this PR does not change OpenAPM-observable behaviour.

apm-spec-waiver: audit --ci reports local dependency content drift through the verdict install --frozen already applies; no normative change

The local-dependency content verdict install --frozen applies moves to one
owner (install/local_content_verdict.py); the audit --ci content-integrity
check reports the same dependencies, so both commands reach one verdict.

apm-spec-waiver: audit --ci reports local dependency content drift through the verdict install --frozen already applies; no normative change

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.37.0 milestone Nov 20, 2026
Copilot AI balanced review requested due to automatic review settings November 20, 2026 18:52
Co-authored-by: copilot-swe-agent[bot] <[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

User-workspace audits read the manifest from the wrong root, the mutation test targets outdated code, and local-content failures can disappear from SARIF alerts when combined with other violations.

3 open issues
What changed in this PR

This PR addresses #4447 by sharing the local-dependency content verdict between apm audit --ci and apm install --frozen, so audit can name dependencies that changed since their locked snapshot.

Changes:

  • Extracts frozen-install verification into a shared helper and adds its diagnostics to audit.
  • Redirects architecture guards to the extracted helper.
  • Adds lifecycle regression coverage, promotes the affected security cell to required coverage, and records the fix.
File Description
src/​apm_cli/​install/​local_content_verdict.py Extracts the shared local-content verdict.
src/​apm_cli/​install/​service.py Delegates frozen verification to the shared helper.
src/​apm_cli/​policy/​ci_checks.py Includes local-content drift in audit integrity checks.
scripts/​architecture_linter/​checks/​install_single_file.py Redirects the materialization guard to the helper.
scripts/​architecture_linter/​checks/​install_package_content_hash.py Updates the guarded hash-verification location.
tests/​integration/​test_local_dependency_content_parity_lifecycle.py Checks matching refusals and unchanged project state.
tests/​lifecycle/​security/​gate_slices/​native.py Removes the affected cell's known-failure exemption.
tests/​quality/​generated_obligations.json Refreshes required security and journey witnesses.
tests/​fixtures/​lifecycle_bug_ledger.json Records #4447 and its regression coverage.
CHANGELOG.md Documents the audit diagnostic improvement.

Review effort: Balanced

"read_local_package_source": {"virtual_file_subdirectory", "load_frontmatter"},
},
SERVICE: {"_verify_frozen_local_content": {"compute_local_package_hash"}},
LOCAL_VERDICT: {"local_content_reasons": {"compute_local_package_hash"}},
project_root, lock, targets
)
staged_drift = lock.staged_hash_drift(project_root)
local_drift = _local_content_drift(project_root, lock)
remedies.extend(restore_drifted_files_remedy(bundle=bundle) for bundle in sorted(owners))
if local_drift:
# install --frozen refuses the same local dependencies (#4447).
parts.extend(local_drift)
apm-spec-waiver: audit --ci reports local dependency content drift through the verdict install --frozen already applies; no normative change

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit ae0b3ae into main Nov 21, 2026
1 check passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-audit-local-dep-parity-4447 branch November 21, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

audit --ci passes a local dependency whose content changed since the lock, which install --frozen refuses

2 participants