Repository navigation
fix(frozen): frozen fails when a gated hook was retired but the lock still claims it (#4043) - #4054
Merged
Daniel Meppiel (danielmeppiel) merged 26 commits intoNov 21, 2026
Conversation
This was referenced Nov 20, 2026
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-animated-journey
branch
from
November 20, 2026 08:03
69d12c4 to
385c7e5
Compare
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-frozen-retired-hook-4043
branch
from
November 20, 2026 08:03
e96841b to
d6f545f
Compare
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-animated-journey
branch
from
November 20, 2026 08:15
385c7e5 to
459c4ea
Compare
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-frozen-retired-hook-4043
branch
from
November 20, 2026 08:15
d6f545f to
51e6e34
Compare
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-animated-journey
branch
from
November 20, 2026 08:22
459c4ea to
d82ee91
Compare
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-frozen-retired-hook-4043
branch
from
November 20, 2026 08:24
51e6e34 to
fa87f1b
Compare
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-animated-journey
branch
from
November 20, 2026 08:38
d82ee91 to
c05e69f
Compare
… it (#4043) audit --ci and install --frozen now share one deployed-file presence verifier (find_missing_deployed_files in policy/ci_checks.py). Frozen post-deploy verification fails, naming each recorded file now missing and the repair command, instead of exiting 0 while the lock still claims a hook the executables gate retired. Deny still wins; the lock is never written. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
#4043) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
) The frozen no-rewrite unit fixtures recorded claims they never deployed; the shared presence verifier now (correctly) reports those as missing. Adds the CHANGELOG Fixed line. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…le (#4043) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-frozen-retired-hook-4043
branch
2 times, most recently
from
November 20, 2026 10:50
2b09cf3 to
a9679af
Compare
…4043) Steward ruling I7-X1: a failed command preserves durable state except removing a deployed executable whose current decision is deny or revoked; that removal is always applied and reported by path with remediation. - install --frozen names each retired file and its decision source (org policy denies <pkg>, <pkg> is denied locally, <pkg> is no longer approved locally) through the exec gate owner (withheld_executable_sources over trust.package_withholding_layers), with the runnable repair command. - --dry-run previews the retirement without removing anything. - The GATE oracle encodes I7-X1 as a closed exception (lock never changes, no allowed surface goes, no file beyond the retired ones and their receipts) and drops the strict gate-cell-c-retire cell. - The frozen-mutation-eligibility guard requires the closed exception and the owner routing, with four mutation cases. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…ted (#4043) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-frozen-retired-hook-4043
branch
from
November 20, 2026 11:01
a9679af to
4c0cf56
Compare
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
November 20, 2026 11:23
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 11:23
Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The retirement preview reads the wrong manifest for --root installs and excludes partially admitted packages, causing incorrect approval decisions and missed executable retirements.
2 open issues
What changed in this PR
This PR aligns frozen-install verification with audit when a denied or unapproved hook is removed but remains recorded in apm.lock.yaml. It adds a shared presence check while preserving hook retirement and leaving the lockfile unchanged.
Changes:
- Add missing-file verification, retirement diagnostics, and dry-run retirement previews.
- Extend lifecycle, unit, conformance, and architecture-guard coverage.
- Update CLI documentation, the changelog, and generated conformance records.
| File | Description |
|---|---|
tests/utils/lifecycle_oracle.py |
Adds a failure-state exception for executable retirement. |
tests/unit/install/test_frozen.py |
Adds missing-file coverage and realistic deployed-file fixtures. |
tests/spec_conformance/test_lockfile_reqs.py |
Checks frozen refusal, audit agreement, and unchanged lock bytes. |
tests/integration/test_executables_deny_retires_hooks_lifecycle.py |
Exercises deny/revoke, preview, frozen refusal, and recovery. |
tests/integration/test_architecture_owner_rule_mutations.py |
Adds verifier-routing and retirement-exception mutation cases. |
tests/integration/_gate_machine_kit.py |
Maps executable artifacts and removes the frozen/audit mismatch expectation. |
src/apm_cli/security/trust.py |
Exposes the policy layers withholding executables. |
src/apm_cli/policy/ci_checks.py |
Extracts the shared deployed-file presence verifier. |
src/apm_cli/install/service.py |
Checks missing recorded files before post-deploy hash verification. |
src/apm_cli/install/presentation/dry_run.py |
Displays executable retirement previews. |
src/apm_cli/install/frozen_retirement.py |
Builds retirement reasons and frozen-error diagnostics. |
src/apm_cli/install/exec_gate.py |
Resolves withholding reasons through executable-trust decisions. |
src/apm_cli/commands/install.py |
Passes --no-policy into dry-run presentation. |
scripts/architecture_linter/checks/install_frozen_and_audit.py |
Guards shared verification and retirement-exception checks. |
docs/src/content/docs/reference/cli/install.md |
Documents missing-file refusal, retirement previews, and recovery. |
docs/src/content/docs/reference/cli/deny.md |
Describes frozen and dry-run behavior after denial. |
CONFORMANCE.md |
Updates the deployed-file verification test count. |
CONFORMANCE.json |
Registers the new conformance test. |
CHANGELOG.md |
Records the frozen-install behavior change. |
.apm/architecture/owners/install-deployment.json |
Extends the frozen owner’s contract to file presence. |
Review effort: Balanced
… read-only (#4043) Frozen keeps an undeclared package's lock claims without deploying it (#3662), so the post-deploy presence check now covers only the packages the install resolved (InstallResult.active_package_keys). The dry-run retirement preview replays packages through drift._build_package_info, which loaded apm.yml with create_config=True and created ~/.apm/config.json. Replay now reads config without creating it, so dry-run stays read-only. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…e2e (tm006) 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]>
…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]>
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]>
#4093/#4095 moved the cross-cutting oracle to tests/lifecycle/oracles.py and the GATE kit to tests/lifecycle/machines/_gate_kit.py, and I7 now also rejects any changed durable file. I7-X1 follows: a failed command may only remove the retired executables' files, the directories their cleanup emptied, and their receipts; gate-cell-c-pair stays removed. The guard fragments and mutation cases point at the new oracle, with a case for receipts written without a retirement. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…d types Review fold on #4054: - Trust grants come from the manifest the install gate reads (the source project under --root DIR, APM_HOME at user scope), while modules stay beside the lock. - The exec gate owner judges only the types the lock records as deployed, so a partially admitted package (exec_allowed_types) whose approved type is revoked is named by --frozen and previewed by --dry-run. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…ging main Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Main replaced security.executables.project_manifest_path with the scope owner's scope_manifest_path (1cfd9ac). Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…ite exec_gate lines - The GATE reference model expected install --frozen to exit 0 unless the lockfile is missing, encoding #4043. Frozen now also exits 1 after it retired a hook the lock still records (I7-X1). - The generator rule citations into exec_gate.py follow its new lines. - I7-X1 returns early when no surface changed. 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]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…4053) Rebased onto #4054 with main: service.py is at its 1000-line budget, so the stale-decision refusal lives in install/frozen_retirement beside the presence step, returned rather than raised outside the owner. Org policy for the staleness check routes through classify_discovery_outcome; update keeps main's classify_project_policy. The guard fragments and mutation cases follow; the lifecycle module gets tm006 markers; generator citations into exec_gate.py follow its lines. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
This was referenced Nov 20, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-frozen-retired-hook-4043
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
TL;DR. After
apm deny(or a removed approval),apm install --frozenremoved the package's hook but kept its lock record and exited 0, whileapm audit --ciexited 1. Frozen post-deploy verification inInstallServicenow runs the same deployed-file presence check that audit uses. Frozen now exits 1, names each recorded file that is missing, and says to runapm installwithout--frozenand commitapm.lock.yaml. Deny still wins and the lockfile is never written.Important
Stacked on #4016 (base
danielmeppiel-animated-journey). CI does not run on a non-mainbase, so the evidence below is the local CI mirror.Problem.
install/phases/cleanup.py(in-package stale pass) retires a hook that the gate stops deploying, as fix(install): retire a package's hooks when apm deny or a removed approval gates them #3944 intends, including under--frozen._enforce_frozen_no_rewritechecked selections, unrecorded claims and hash drift. It did not check presence, andverify_deployed_file_hashesdeliberately skips missing files._check_deployed_files_presentdid check presence, soinstall --frozen && audit --cigave two answers. The lock still claimed a file that was gone.Approach.
InstallServicefrozen post-deploy verification (frozen-install-mutation-eligibility)find_missing_deployed_files()inpolicy/ci_checks.py; auditdeployed-files-presentand frozen both call it (same path resolution, URI skip, gitignore filter)apm installwithout--frozen, then commitapm.lock.yamlImplementation
policy/ci_checks.pyfind_missing_deployed_files(project_root, lock, targets) -> (missing, gitignored_skipped);_check_deployed_files_presentdelegates to it (output unchanged)install/service.py_enforce_frozen_no_rewriteraisesFrozenInstallError("--frozen: files recorded in apm.lock.yaml are missing from disk.")listing each path, with the repair tip; docstring now lists three checks.apm/architecture/owners/install-deployment.jsonscripts/architecture_linter/checks/install_frozen_and_audit.pyinstall-deployment-frozen-mutation-eligibilityrequires the shared presence verifier in the owner and in audittests/integration/test_executables_deny_retires_hooks_lifecycle.pydeny/revoke)tests/unit/install/test_frozen.pytests/spec_conformance/test_lockfile_reqs.pyreq-lk-017case: a missing recorded file fails frozen and audit; lock bytes unchangedTrade-offs
--target,--only) now fail if a recorded file of an unselected target is absent from disk. Audit already failed in that state; the two now agree.settings.json), orphan removal (plan/apply P1: one orphan removal owner #4011), deletion evidence ([BUG] Stale cleanup still trusts a lockfile hash that matches a file APM never deployed #3701).Benefits
apm install --frozen && apm audit --cigive one answer on deployed-file presence (both usefind_missing_deployed_files).Validation
New test fails on
main67936cd (CLI version line0.36.1 (67936cd7d)), both cases at the frozen step:On this branch:
APM_BINARY_PATH=.venv/bin/apm pytest tests/integration/test_executables_deny_retires_hooks_lifecycle.pypytest tests/unit/install/test_frozen.pypytest tests/integration/test_architecture_owner_rule_mutations.py -k frozenpytest tests/unit/policy tests/unit/install tests/spec_conformance+ frozen lifecycle suite (incl. undeclared-retention, deployed-hash)pwsh)pytest tests/unit tests/integration -k "frozen or audit or deny or executables or gate"audit-policy-discovery,audit-replay-config-modules-rootmutation fixtures, which fail identically onmain67936cd); 44 errors (host git signing)lint-auth-signals.sh,lint-architecture-boundaries.shorphan_check,gen_statement(committed), Mode B vsmainand vs stack baseScenario evidence
test_frozen_fails_when_a_gated_hook_retires_but_the_lock_still_claims_it[deny|revoke]denied/gated_pending_approval; frozen and audit both exit 0test_frozen_fails_closed_when_a_recorded_deployed_file_is_missing(req-lk-017)test_frozen_undeclared_package_retention_lifecycle.py,test_frozen_deployed_hash_lifecycle.py,TestEnforceFrozenDeployedHashesHow to test
APM_BINARY_PATH=$PWD/.venv/bin/apm uv run --extra dev pytest tests/integration/test_executables_deny_retires_hooks_lifecycle.py -k frozeninstall/service.py, replacefind_missing_deployed_files(deploy_root, committed, targets)with([], False); the test above andbash scripts/lint-architecture-boundaries.shboth fail.Pre-merge
mainafter plan/apply P3: frozen flag read only by its owner (#4012) #4016 merges._enforce_frozen_no_rewrite); keep the presence check between unrecorded claims and hash drift.Issue and approved scope
Issue: Fixes #4043
Human scope-approval comment: #4043 (comment)
Does this PR complete the issue, or what remains? Completes it.
Type of change
Testing
mainfailures noted above)Changelog
## [Unreleased]->### Fixed.Spec conformance (OpenAPM v0.1)
@pytest.mark.req("req-lk-017")test added undertests/spec_conformance/.CONFORMANCE.{md,json}regenerated and committed.Co-authored-by: Copilot [email protected]