Repository navigation
fix(audit): one message for a changed package copy across owners - #4485
Daniel Meppiel (danielmeppiel) wants to merge 3 commits into
Conversation
apm audit --ci named a changed package copy differently depending on the owner that found it. The audit materialization check, native Agent Plugin admission and the Codex native registrar now print one message from core/cache_drift.py: 'package cache differs from its locked content', followed by each owner's existing remedy. Tests pin the single message for every drift case; ledger row and CHANGELOG line. apm-spec-waiver: diagnostic wording unified across audit owners; no normative behaviour change Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The canonical drift owner lacks an owner-registry entry and a static delegation guard with a hermetic regression test, leaving producers’ use of the shared vocabulary unenforced.
1 open issue
What changed in this PR
This PR unifies package-cache drift wording across APM’s audit materialization check, native Agent Plugin admission, and Codex native registrar. It preserves existing integrity checks and owner-specific recovery advice.
Changes:
- Adds a shared diagnostic formatter and routes all three reporting paths through it.
- Updates lifecycle and registrar assertions to expect the common wording.
- Records the fix in the lifecycle bug ledger and changelog.
| File | Description |
|---|---|
tests/unit/test_codex_native_registrar.py |
Updates the expected same-pin drift diagnostic. |
tests/integration/test_native_plugin_cache_audit.py |
Checks shared wording while retaining remedy assertions. |
tests/integration/test_codex_native_plugin_lifecycle.py |
Checks consistent wording across cache mutations and rejects old replay wording. |
tests/fixtures/lifecycle_bug_ledger.json |
Links issue #4480 to regression coverage. |
src/apm_cli/install/native_plugin_admission.py |
Uses the shared formatter for native plugin cache drift. |
src/apm_cli/install/audit_replay.py |
Uses the shared formatter for stale user-scope package copies. |
src/apm_cli/core/cache_drift.py |
Defines the common drift phrase and formatter. |
src/apm_cli/codex_plugins/registrar.py |
Uses the shared formatter for Codex source-identity drift. |
CHANGELOG.md |
Documents the unified audit diagnostic. |
Review effort: Balanced
| def package_cache_drift(subject: str, remedy: str) -> str: | ||
| """Return the drift message for *subject*, followed by its *remedy*.""" | ||
| return f"{subject}: {PACKAGE_CACHE_DRIFT}; {remedy}" |
… across owners Co-authored-by: Copilot App <[email protected]> # Conflicts: # tests/fixtures/lifecycle_bug_ledger.json # tests/integration/test_codex_native_plugin_lifecycle.py
…4485, #4294, #4315, #4505 Co-authored-by: Copilot App <[email protected]>
) The one package cache drift message module needs a canonical owner; it joins the ci-audit-scratch-materialization decision with audit_replay. Co-authored-by: Copilot App <[email protected]>
|
Closing as superseded: this change shipped in v0.37.0 through the release train (#4424). Its core source and test files are byte-identical on main, and the linked issues are closed as completed in 0.37.0. The only remaining differences are in shared files that every train PR touches (CHANGELOG, bug ledger, owner registry). Nothing is left to land. -- regent, 0.37 milestone close-out |

Description
apm audit --cinames a changed package copy with one message, whichever owner detects it:install/audit_replay.py),install/native_plugin_admission.py),codex_plugins/registrar.py).All three now build the message through
core/cache_drift.py:<subject>: package cache differs from its locked content; <remedy>. Each owner keeps its existing remedy. What counts as drift is unchanged.Follow-up to #4470 (#4449): the codex lifecycle test now pins the single message for every drift case (hashed file, unhashed cache file, mode change), replacing the two per-source needles.
Issue and approved scope
Fixes #4480 -- scope record: #4480 (comment)
Completes the issue.
Type of change
Testing
Updated assertions:
tests/integration/test_codex_native_plugin_lifecycle.py(_audit_cache): one message for every case, and the old replay wording is absent.tests/integration/test_native_plugin_cache_audit.py::test_native_cache_tamper_fails_installed_audittests/unit/test_codex_native_registrar.py::test_source_identity_refusal_precedes_native_access[same-pin]Ruff and the complexity ratchet are clean.
Changelog
## [Unreleased]inCHANGELOG.md.Spec conformance (OpenAPM v0.1)
apm-spec-waiver: diagnostic wording unified across audit owners; no normative behaviour change