Repository navigation
plan/apply P3: frozen flag read only by its owner (#4012) - #4016
Merged
Daniel Meppiel (danielmeppiel) merged 9 commits intoNov 20, 2026
Merged
Conversation
This was referenced Nov 20, 2026
Closed
Merged
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-animated-journey
branch
3 times, most recently
from
November 20, 2026 08:22
459c4ea to
d82ee91
Compare
…ag (#4012) The frozen-install-mutation-eligibility owner exposes one FrozenDisposition. Cleanup, lockfile and service integration consume it instead of reading the flag; service integration requires it keyword-only with no default. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…4012) install-deployment-frozen-flag-reader rejects any read of the install frozen flag (attribute, getattr/hasattr, subscript, attrgetter, class pattern) outside InstallService, and requires the disposition keyword-only with no default at the cleanup and service-integration seams. sys.frozen stays allowed. Registered on the existing frozen-install-mutation-eligibility owner with a mutation case and focused bypass tests. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…4012) Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…ers (#4012) A bare boolean can carry the flag past the attribute scan. Only the Click option origin and the five owner-fed parameters may declare 'frozen'; any other function parameter named 'frozen' now fails the guard. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…tion (#4012) The lockfile content-hash stream promotion added on main (#4000) read getattr(ctx, "frozen", False). Route it through InstallService.frozen_disposition (withhold_lockfile_writes), which the closed-world frozen-flag guard requires. run_service_integrations gains a PLR0913 noqa: main added claude_native_keys beside the required disposition. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
November 20, 2026 08:37
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 08:37
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-animated-journey
branch
from
November 20, 2026 08:38
d82ee91 to
c05e69f
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The guard misses frozen-flag reads in mapping patterns while incorrectly rejecting write-only subscripts and get/pop fallback values, requiring detection fixes and regression coverage.
3 open issues
What changed in this PR
This refactor centralizes install --frozen flag reads in InstallService, supporting the plan/apply ownership work in #4012 and preparing named contracts for subsequent cleanup changes. It is intended to preserve existing install behavior.
Changes:
- Introduces
FrozenDispositionand routes install consumers through the owner. - Adds a source-wide architecture guard and required disposition arguments at cleanup and service-integration boundaries.
- Updates regression tests, test contexts, ownership metadata, and conformance records.
| File | Description |
|---|---|
tests/unit/scripts/test_architecture_runner.py |
Registers the new guard in the expected inventory. |
tests/unit/install/test_lsp_integration.py |
Supplies dispositions to service-integration tests. |
tests/unit/install/test_frozen_service_boundary.py |
Passes the owner-derived disposition. |
tests/unit/install/test_architecture_invariants.py |
Adjusts module line budgets. |
tests/unit/install/test_absent_dependency_claim_reconciliation.py |
Makes the test context explicitly non-frozen. |
tests/unit/install/phases/test_lockfile_union.py |
Adds explicit frozen fields to test contexts. |
tests/unit/install/phases/test_lockfile_cross_package_reconcile.py |
Adds an explicit frozen field. |
tests/spec_conformance/test_lockfile_reqs.py |
Tests disposition facets and missing-input rejection. |
tests/integration/test_skipped_integration_preserves_deployments.py |
Updates the context for strict flag access. |
tests/integration/test_cross_package_collision_file_survival.py |
Updates the context for strict flag access. |
tests/integration/test_architecture_owner_rule_mutations.py |
Adds guard mutations and updates existing checks. |
src/apm_cli/install/service.py |
Defines the disposition and owner accessors. |
src/apm_cli/install/service_integration.py |
Requires and consumes the disposition. |
src/apm_cli/install/pipeline.py |
Obtains the replay lockfile through the owner. |
src/apm_cli/install/phases/resolve.py |
Uses the owner-derived resolver flag. |
src/apm_cli/install/phases/lockfile.py |
Uses the disposition for reconciliation eligibility. |
src/apm_cli/install/phases/integrate.py |
Routes frozen validation gating through the owner. |
src/apm_cli/install/phases/content_hash_stream.py |
Uses the disposition to withhold hash promotion. |
src/apm_cli/install/phases/cleanup.py |
Requires the disposition for orphan retention. |
src/apm_cli/install/helpers/plan_inputs.py |
Routes update gating through the owner. |
src/apm_cli/install/dry_run_plan.py |
Obtains frozen planning state from the owner. |
src/apm_cli/commands/install.py |
Derives and forwards the disposition. |
scripts/architecture_linter/checks/install_uninstall_and_resolution.py |
Updates resolver-routing checks. |
scripts/architecture_linter/checks/install_package_content_hash.py |
Updates hash-promotion guard checks. |
scripts/architecture_linter/checks/install_frozen_and_audit.py |
Adds flag-read and required-argument checks. |
scripts/architecture_linter/checks/install_deployment_analyzers.py |
Registers the flag-reader rule. |
scripts/architecture_linter/checks/install_base_integrator_and_contraction.py |
Updates replay and cleanup call checks. |
CONFORMANCE.md |
Updates the frozen requirement's test count. |
CONFORMANCE.json |
Records the new conformance test. |
CHANGELOG.md |
Describes the internal ownership refactor. |
.apm/architecture/owners/install-deployment.json |
Extends the existing owner record and guard list. |
Review effort: Balanced
Review fold on the closed-world guard:
- Subscripts count only in Load context, so options["frozen"] = False and
del options["frozen"] are not reads; augmented assignments still are.
- Mapping patterns (case {"frozen": value}) are reads.
- For get/pop only the first argument is the key; defaults are ignored.
Mutation cases cover the mapping and augmented forms; a regression case
proves writes, deletes and defaults pass.
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-animated-journey
branch
2 times, most recently
from
November 20, 2026 09:06
dad9c2b to
82423e9
Compare
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-animated-journey
branch
November 20, 2026 10:02
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.
InstallService(install/service.py, the registeredfrozen-install-mutation-eligibilityowner) is now the only code that reads the installfrozenflag. It exposes oneFrozenDisposition; cleanup, lockfile and service integration consume it instead of reading the flag. A new closed-world architecture guard rejects any other read anywhere insrc/apm_cli. No behavior change.Problem.
ctx.frozen/getattr(ctx, "frozen", False)directly (cleanup, lockfile, service integration, integrate, resolve, pipeline, dry-run plan, plan inputs, the install adapter). Each restated part of the frozen decision outside its owner.phases/lockfile.py,install/service_integration.py) usedgetattr(..., False), so a context missing the field silently ran as non-frozen (fail-open).Approach.
InstallService.frozen_disposition(source)only; readssource.frozendirectly (missing field ->AttributeError)if ctx.frozen:_run_cleanup(..., *, frozen_disposition)(required) ->.retain_package_orphansgetattr(self.ctx, "frozen", False).withhold_lockfile_writesgetattr(ctx, "frozen", False) is Truerun_service_integrations(..., *, frozen_disposition)(required) ->.withhold_lockfile_writesctx.frozenInstallService.frozen_disposition(ctx).replay/frozen_replay_lockfile(ctx); logic unchangedImplementation
install/service.pyFrozenDisposition(replay,retain_package_orphans,withhold_lockfile_writes),frozen_disposition(),frozen_replay_lockfile()install/phases/cleanup.py,phases/lockfile.py,service_integration.pyServiceCommandContextno longer declaresfrozencommands/install.py,pipeline.py,phases/integrate.py,phases/resolve.py,dry_run_plan.py,helpers/plan_inputs.pyscripts/architecture_linter/checks/install_frozen_and_audit.pyinstall-deployment-frozen-flag-reader: AST scan of everysrc/apm_cli/**/*.pyexcept the owner for.frozenloads,getattr/hasattr(x, "frozen"),["frozen"],attrgetter/.get/.pop("frozen"),case X(frozen=...); a function parameter namedfrozenoutside the Click origin and five owner-fed sites;sys.frozen(PyInstaller) allowed; no exemption marker. Also requires the disposition keyword-only with no default at the cleanup and service-integration seams.apm/architecture/owners/install-deployment.jsonTrade-offs
replay. The two named facets map to the same value today; they exist so P1 (plan/apply P1: one orphan removal owner #4011) and [BUG] Stale cleanup still trusts a lockfile hash that matches a file APM never deployed #3701 can rebase onto named consumer contracts.source.frozenwith no default, so eightSimpleNamespacetest contexts gainedfrozen=False. That is the intended behavior: a missing field no longer means "not frozen".phases/resolve.pygrows to 1001 lines (one import); its budget entry is added intest_architecture_invariants.py.pipeline.pystays at 1000 viafrozen_replay_lockfile.Benefits
frozenflag instead of nine.bash scripts/lint-architecture-boundaries.sh.Validation
bash scripts/lint-architecture-boundaries.sh: clean.lint-auth-signals.sh): clean.APM_BINARY_PATH=.venv/bin/apm pytest tests/integration/test_frozen_*.py tests/integration/test_git_semver_subdirectory_frozen_replay_lifecycle.py tests/integration/test_local_single_file_frozen_lifecycle.py tests/integration/test_obsolete_dependency_claim_frozen_control.py tests/integration/test_tls_frozen_hook.py): 61 passed, 41 skipped (APM_E2E_TESTSnetwork cases). Unchanged files; includestest_frozen_undeclared_package_retention_lifecycle.py(passed).pytest tests/unit/scripts tests/integration/test_architecture_owner_rule_mutations.py: 1315 passed, 1 failed. The failure istest_independent_owner_additions_merge_without_instruction_or_lock_conflicts, which runsgit commitand is rejected by this host's commit-signing service (environmental, unrelated).origin/main. The 10 tests touched by this change pass.orphan_check: OK; Mode B: satisfied by the newreq-lk-006conformance test;CONFORMANCE.{md,json}regenerated.Scenario evidence
--frozenkeeps an undeclared package's files, checkout and claimstests/integration/test_frozen_undeclared_package_retention_lifecycle.py(unchanged)--frozennever rewrites the lock; consumers cannot omit the dispositiontests/spec_conformance/test_lockfile_reqs.py::test_frozen_lock_withholding_is_decided_once_and_cannot_be_omitted(req-lk-006)MutationCaseinstall-deployment-frozen-flag-readerfrozenparametertest_frozen_flag_reads_outside_owner_fail_guardKnown limits
frozenparameter (e.g.if frozen:incommands/install.py,install/mcp/integration.py) or copied into a differently named local is not traced. Today every such value is the Click option or comes from the owner's disposition.How to test
bash scripts/lint-architecture-boundaries.shis clean.if frozen_disposition.retain_package_orphans:ininstall/phases/cleanup.pywithif ctx.frozen:; rerun; the guard reportsinstall-deployment-frozen-flag-reader.Rebase after #4022
#4022 (#4013) lands first. It adds
InstallService.enforce_frozen_restored(ctx.transitive_failures)inside the owner and calls it inphases/integrate.py, inside the block gated by the owner (if InstallService.frozen_disposition(ctx).replay and ...after this PR). It reads no flag, so the guard accepts it as-is.git merge-treeof this branch with #4022's head: no conflicts.Issue and approved scope
Issue: Fixes #4012
Human scope-approval comment: #4012 (comment)
Does this PR complete the issue, or what remains? Completes it. Out of scope and unchanged: #3702, dry-run behavior, what
--frozenrefuses.Type of change
Testing
Changelog
## [Unreleased]->### Changed(internal; required by the approved scope).Spec conformance (OpenAPM v0.1)
@pytest.mark.req("req-lk-006")test added undertests/spec_conformance/.CONFORMANCE.{md,json}regenerated and committed.Co-authored-by: Copilot [email protected]