Repository navigation
Trust and integrity consistency: install --frozen and audit --ci agree on executable approvals - #4272
Merged
Daniel Meppiel (danielmeppiel) merged 10 commits intoNov 20, 2026
Conversation
Installed-CLI lifecycle test: install --frozen and audit --ci reach the same verdict when a hook approval pin does not match the package content, and a plain install retires the hook from every config and the lockfile. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The trust owner now answers whether a locked hook file is still admitted by its pinned approval. apm install --frozen asks it before anything deploys, and apm audit --ci asks it as the hook-approval-pins check, so both reach one verdict with one remediation. A package none of whose hook files matches its pin is no longer admissible, so apm install retires its hooks from every config and from the lockfile, as for a revoked approval. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Closed-world architecture rule install-deployment-hook-pin-frozen-audit-parity: install --frozen and audit --ci verify locked hook approval pins through install/exec_gate.py and the security/trust.py owner, and no other module calls that route. One mutation case drops the frozen verification. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
) Adds the req-sc-011 conformance test, the hook-approval-pins baseline check reference, the frozen-mode note, the bug-ledger row and the changelog entry. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
#4188) audit --ci resolves the executables trust context for the hook-approval-pins check only when a locked package deploys hook files, so projects without hooks keep their policy discovery unchanged. Baseline check counts include the new check. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
November 20, 2026 11:49
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 11:49
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved trust-check defects allow frozen installs to retire deployed hooks despite changed pins or removed grants, while CI audit can mutate personal approval state and let user grants affect its verdict.
5 open issues
Hook audit can mutate user approvals and include personal consent · New Partial hook approval hides deployed-file pin changes from frozen checks · New Frozen install skips deployed hooks after their final grant is removed · New Audit guard accepts the checker definition without a caller invocation · New Native-plugin approvals are incorrectly rejected by loose hook-pin checks · New
What changed in this PR
This PR addresses #4188 by routing frozen-install and CI-audit hook approval checks through the shared executable-trust owner. It also updates normal install to retire hooks when none of their pinned approvals match.
Changes:
- Adds shared hook-pin verification for
install --frozenandaudit --ci. - Adds lifecycle, unit, conformance, and architecture-guard coverage.
- Updates approval documentation, baseline checks, and release notes.
| File | Description |
|---|---|
tests/unit/test_audit_policy_command.py |
Updates the expected baseline-check count. |
tests/unit/security/test_trust_admission.py |
Tests hook admission and recorded-pin mismatches. |
tests/unit/scripts/test_architecture_runner.py |
Registers the new guard in the expected inventory. |
tests/unit/policy/test_ci_checks.py |
Updates the expected CI-check count. |
tests/spec_conformance/test_hook_pin_parity_reqs.py |
Adds paired frozen/audit verdict checks. |
tests/integration/test_hook_approval_pin_parity_lifecycle.py |
Covers refusal, retirement, and reapproval through the CLI. |
tests/integration/test_architecture_owner_rule_mutations.py |
Adds a frozen-check bypass mutation. |
tests/fixtures/lifecycle_bug_ledger.json |
Records #4188 and its regression coverage. |
src/apm_cli/security/trust.py |
Adds shared mismatch decisions and content-aware hook admission. |
src/apm_cli/policy/ci_checks.py |
Adds the hook-approval-pins baseline check. |
src/apm_cli/install/service.py |
Adds frozen hook-pin enforcement. |
src/apm_cli/install/phases/integrate.py |
Invokes enforcement before hook deployment or retirement. |
src/apm_cli/install/exec_gate.py |
Adapts locked dependencies to shared pin verification. |
src/apm_cli/install/deployment_plan.py |
Reports parked hooks when none are admitted. |
scripts/architecture_linter/checks/install_portable_trust.py |
Adds a shared-routing architecture guard. |
packages/apm-guide/.apm/skills/apm-usage/governance.md |
Documents the new baseline check. |
docs/src/content/docs/reference/cli/install.md |
Explains frozen hook-pin verification. |
docs/src/content/docs/reference/cli/approve.md |
Documents retirement and frozen/audit refusal. |
docs/src/content/docs/reference/baseline-checks.md |
Describes hook-pin failures and remediation. |
CONFORMANCE.md |
Updates the requirement’s test count. |
CONFORMANCE.json |
Registers the new conformance test. |
CHANGELOG.md |
Adds the user-facing fix summary. |
.apm/architecture/owners/install-deployment.json |
Records the shared verification route and guard. |
Review effort: Balanced
Comment on lines
+1209
to
+1225
| from ..constants import APM_MODULES_DIR | ||
| from ..install.errors import PolicyViolationError | ||
| from ..install.exec_gate import locked_hook_pin_mismatches | ||
| from ..security.executables import resolve_project_exec_allow_map | ||
|
|
||
| modules_root = ( | ||
| prepared_replay.modules_root | ||
| if prepared_replay is not None | ||
| else project_root / APM_MODULES_DIR | ||
| ) | ||
|
|
||
| def trust_ctx() -> Any: | ||
| # Resolved only when a locked package deploys hook files. | ||
| allow = resolve_project_exec_allow_map( | ||
| deployment_root, manifest, user_scope=user_scope, no_policy=no_policy | ||
| ) | ||
| return getattr(allow, "trust_context", None) |
Comment on lines
+833
to
+837
| recorded_deployed = ( | ||
| recorded_status in (None, TRUST_DEPLOYED) or EXEC_TYPE_HOOKS in recorded_allowed | ||
| ) | ||
| root = install_path.resolve() | ||
| hook_files = HookIntegrator().find_hook_files(root) if recorded_deployed else [] |
Comment on lines
+842
to
+843
| if ctx is None or not ctx.gate_enabled or not has_item_pins(ctx, package_keys, EXEC_TYPE_HOOKS): | ||
| return [] |
| _EXEC_GATE: ("def locked_hook_pin_mismatches(", "recorded_hook_pin_mismatches("), | ||
| _SERVICE: ("mismatches = locked_hook_pin_mismatches(lockfile, modules_dir, trust_ctx)",), | ||
| "src/apm_cli/install/phases/integrate.py": ("InstallService.enforce_frozen_hook_pins(",), | ||
| _CI_CHECKS: ("mismatches = locked_hook_pin_mismatches(", "_check_hook_approval_pins("), |
Comment on lines
+734
to
+738
| recorded_hook_pin_mismatches( | ||
| _ctx, | ||
| tuple(_candidate_keys(pkg_key)), | ||
| install_path, | ||
| package=_strip_version(pkg_key), |
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…zen-approval-parity
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-s14-frozen-approval-parity
branch
November 20, 2026 13:07
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…n_retirement #4272 grew install/service.py, so the frozen presence step moves out of the owner into install/frozen_retirement.enforce_frozen_presence; the owner keeps one call. The closed-world guard fragments and mutation cases follow the move, with a new case for the owner skipping the presence step. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
This was referenced Nov 20, 2026
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 install --frozenandapm audit --cireach the same verdict on hook approval pins, and the lockfile's hook records follow the current approvals. Everything goes through the executables-trust owner.security/trust.py(owner): hook admission compares a package's hook files to their pins.recorded_hook_pin_mismatcheslists the lockfile-recorded hook files that their pin no longer admits.install/exec_gate.py:locked_hook_pin_mismatchesis the single route from the lockfile to the owner.install --frozen:InstallService.enforce_frozen_hook_pinsruns in the integrate phase before anything is deployed. When it refuses, the project and lockfile stay unchanged.audit --ci: the newhook-approval-pinscheck uses the same route.apm installretires hooks whose pin no longer matches, together with their merged config entries.install-deployment-hook-pin-frozen-audit-parity: only the frozen and audit paths call the shared route, and onlyexec_gatecalls the owner. A mutation case with the same id covers it.reference/baseline-checks.md,reference/cli/install.mdandreference/cli/approve.md, plus the apm-guidegovernance.md.Issue and approved scope
Issue: Fixes #4188
Human scope-approval comment: #4188 (comment)
Does this PR complete the issue, or what remains? It completes the issue.
Type of change
Testing
New tests:
tests/integration/test_hook_approval_pin_parity_lifecycle.py::test_frozen_and_audit_refuse_alike_when_a_hook_pin_does_not_match[claude|copilot]: drives the installed CLI withHOMEisolated. It runs a pairedinstall --frozen/audit --ciprobe on the same state and asserts the snapshot is unchanged when the command refuses.tests/integration/test_hook_approval_pin_parity_lifecycle.py::test_install_retires_a_hook_whose_pin_no_longer_matches[claude|copilot]tests/spec_conformance/test_hook_pin_parity_reqs.py::test_frozen_install_and_audit_agree_on_a_hook_approval_pin(req-sc-011)tests/unit/security/test_trust_admission.py(3 cases)install-deployment-hook-pin-frozen-audit-parityintests/integration/test_architecture_owner_rule_mutations.pyValidation evidence (local, on the merge with current
main):uv run --frozen --extra dev ruff check src/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.pyuv run --frozen --extra dev ruff format --check(same paths)uv 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.shbash 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.spec_conformance.gen_statementAPM_BINARY_PATH=.venv/bin/apm uv run --frozen --extra dev pytest -n 2 tests/integration/test_hook_approval_pin_parity_lifecycle.py tests/spec_conformance tests/unit/security tests/unit/policy tests/unit/scripts/test_architecture_runner.py tests/unit/test_audit_policy_command.py tests/unit/install/test_architecture_invariants.py tests/quality/test_lifecycle_bug_ledger.pyplus the global audit rule matrix and 30 approval/executables/frozen/native-plugin/trust lifecycle modules undertests/integration/install-deployment-hook-pin-frozen-audit-parityand architecture runnerChangelog
## [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)
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended (req-sc-011).CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.