Repository navigation
test(lifecycle): M-GATE approve under an org deny exits 1 naming the org layer; strict Known #4923 - #4924
Conversation
…nd name the org layer (#4919) The nightly falsifier set_policy(org-deny), declare(hook), update, decide(hook, approve) expected approve to exit 0 because the hook package was installed. The documented contract is deny wins (reference/cli/approve.md, 'Approving a denied package'): when a named package is still blocked by a deny in another layer, approve exits 1 and names that layer and how to lift it. commands/approve.py records the grant, prints '<pkg> is still denied (...); the approval has no effect until that deny is lifted: the org policy denies it ...', and exits 1. The model now expects exit 1 with the org layer named for an org-denied installed package; the org deny itself is untouched. Regression test: test_approve_under_an_org_deny_refuses_and_names_the_org_layer replays the falsifier and checks the hook stays undeployed. Refs #4919 Co-authored-by: Copilot App <[email protected]>
… 1: strict Known #4923 The narrowed nightly run 45115510222 showed the second half of the #4919 falsifier. With the exit code expectation fixed, a new approval under the org deny records the grant in apm.yml and then exits 1, a failed command that changed durable state (I7). Filed as #4923. GATE KNOWN_CELLS holds it strict (project scope, applies only to a new grant). The spine now revokes and re-approves the hook under the org deny so the cell fails every run. Refs #4919 Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the test-only lifecycle update, while the separate durable-state bug is tracked as a strict known failure.
No open issues 🎉
What changed in this PR
This PR corrects the GATE lifecycle model for approvals blocked by an organization deny, addressing the stale expectation behind #4919 while tracking the separate durable-state bug in #4923. It changes test infrastructure only, not CLI behavior.
Changes:
- Expect exit 1 and an organization-layer explanation when approving an installed, org-denied package.
- Add a regression replay and mandatory revoke/re-approve sequence, checking that the hook remains undeployed.
- Register #4923 as a strict known failure for a refused approval that writes a new grant.
| File | Description |
|---|---|
tests/quality/known_cell_issue_states.json |
Records #4923 as open for known-failure validation. |
tests/lifecycle/machines/test_m_gate.py |
Adds the regression replay and mandatory org-denied approval sequence. |
tests/lifecycle/machines/_gate_kit.py |
Corrects approval expectations and registers the strict known failure. |
Review effort: Balanced
Co-authored-by: Copilot App <[email protected]>
The refusal cell now runs approve directly and asserts the exit code, the org-layer message, and that the hook file is not deployed. Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
The repeat is not a new grant, so the snapshot, I7 and write-set oracles guard it; the manifest must stay byte-identical. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because the org-denied lifecycle checks can accept unrelated manifest changes without verifying that the targeted grant was recorded.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
# Conflicts: # tests/quality/known_cell_issue_states.json
There was a problem hiding this comment.
🟡 Changes recommended
The #4923 exception can accept unrelated manifest corruption during an org-denied approval because it ignores before/after snapshots instead of limiting changes to the verified grant and required approval metadata.
1 open issue
Review effort: Balanced
The exception now requires the grant for the approved package and an otherwise identical manifest; any unrelated manifest change stays fatal. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The known-cell matcher incorrectly rejects a named-approval transition that removes the package’s matching deny, causing an unexpected I7 failure and requiring a narrowly scoped matcher fix with regression coverage.
1 open issue
1 resolved since last review
Review effort: Balanced
# Conflicts: # tests/quality/known_cell_issue_states.json
There was a problem hiding this comment.
🟡 Changes recommended
The Known comparison still rejects reachable approval transitions that remove a matching project deny, causing unexcused I7 failures for the existing write-before-refusal bug and requiring a narrow fix with regression coverage.
2 open issues
1 resolved since last review
Review effort: Balanced
…s own deny Approve removes the same-store deny for the package before it saves the grant; the matcher now undoes exactly that, and a replay pins the deny -> org-deny -> approve sequence. Drops five v0.38.1 changelog fragments a main merge restored. Co-authored-by: Copilot App <[email protected]>
# Conflicts: # tests/quality/known_cell_issue_states.json
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported, and the remaining manifest-write bug is tracked separately as known issue #4923.
No open issues 🎉
2 resolved since last review
Review effort: Balanced


Description
The nightly GATE state machine (#4919, run 45113537038 at main b8a12c2) falsified
set_policy(org-deny) -> declare(hook) -> update -> decide(hook, approve): approve exited 1 where the model expected 0.Classification:
reference/cli/approve.md, "Approving a denied package": when a named package is still blocked by a deny in another layer, approve exits 1 and names that layer and how to lift it. The CLI does exactly that ("... is still denied (org-deny); ... the org policy denies it; ask its owner to change apm-policy.yml").GateMachine.decidenow expects exit 1 and the named org layer for an installed package an org deny still blocks. The org deny is never weakened, and the regression test checks that the hook stays undeployed.apm.ymlbefore exiting 1, so a failed command changes durable state. It is a strict known cell inKNOWN_CELLS(gate-cell-approve-org-deny, law I7, applying only to a new grant). The mandatory spine now revokes and re-approves the hook under the org deny, so the cell fails every run until [BUG] apm approve writes the grant to apm.yml and then exits 1 when an org deny still blocks the package #4923 is fixed.Regression test:
test_m_gate.py::test_approve_under_an_org_deny_refuses_and_names_the_org_layerreplays the falsifier.Issue and approved scope
Issue: Refs #4919, Refs #4923
Human scope-approval comment: QL owns the lifecycle machines (#4919 lane, assigned by the Quality & Lifecycle VP).
Does not close #4919 (the next green scheduled GATE run closes it) or #4923 (needs the product fix).
Type of change
Testing
Scratch dispatch of the GATE nightly on this head (binary driver, 25 fresh examples per scope; sequences, mandatory spine and the regression test): run 45116537410, 5 passed. Locally only ruff and the guarded generator, witnesses and known_cell_issues (host rule 17(g)).
Changelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.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.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.