Repository navigation
test(lifecycle): M-GATE matrix credits OP x PRIM x GATE cells (T-1 batch 1) - #4575
Daniel Meppiel (danielmeppiel) wants to merge 10 commits into
Conversation
A deterministic spine on the shared lifecycle world walks six gate levels (gate off, allowed, revoked after deploy, denied before deploy, unapproved, org dependency deny) and credits G1 machine ids through check_obligation after I1-I9 on every step. witnesses.py translates them anchored on GATE. Refs #4564 Refs #4565 Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
The gate matrix can issue unsupported receipts because it misses incomplete deployments, widening prune steps, unexpected MCP servers and instruction changes, while crediting bin outcomes it never observes.
5 open issues
What changed in this PR
Adds a deterministic M-GATE lifecycle matrix to advance the obligation coverage work in #4564. The changes are test-only and connect gate scenarios to generated coverage receipts.
Changes:
- Exercises six gate states through real CLI sequences, including MCP-only installs and dependency-deny refusals.
- Extracts a reusable step runner and extends the test model and world with gate-off and deny-all-dependencies states.
- Regenerates the obligation catalog, moving 172 cells from baseline to required.
| File | Description |
|---|---|
tests/quality/lifecycle_obligations.json |
Records new matrix witnesses and updated coverage counts. |
tests/lifecycle/world/test_world.py |
Adds expected results for the dependency-deny policy. |
tests/lifecycle/world/services.py |
Defines the matrix's dependency-deny policy. |
tests/lifecycle/model/state.py |
Models gate-off and dependency-deny states. |
tests/lifecycle/model/expected.py |
Allows expected executable deployment when the gate is off. |
tests/lifecycle/machines/test_m_gate.py |
Runs the project-scope matrix and checks receipt completeness. |
tests/lifecycle/machines/_kit.py |
Extracts StepRunner for deterministic and rule-based tests. |
tests/lifecycle/machines/_gate_matrix.py |
Implements gate transitions, CLI sequences, and receipt evidence. |
tests/lifecycle/generator/witnesses.py |
Maps matrix IDs to GATE-anchored obligations. |
Review effort: Balanced
Refs #4564 Co-authored-by: Copilot App <[email protected]>
Credit no bin cell (no spine step observes a bin outcome), keep .github/instructions unchanged under install --mcp, compare MCP servers against a set read before the command, hold prune under a dependency deny to never-widen, and require each resolving step to deploy exactly the model's observable set. Refs #4564 Co-authored-by: Copilot App <[email protected]>
#4006/#4019 shifted the update command options by 8 lines, so test_every_rule_cites_code_that_still_says_it failed on the merge. Refs #4564 Co-authored-by: Copilot App <[email protected]>
|
Superseded by the train #4598, test(lifecycle): corpus train 1 (T-1 batch 1 + T-2 drain 1). The train merges this branch with |
Per review on the corpus train: drop other-file credits (no compile-staged output is asserted for copilot) and MCP credits of install --mcp (the requested registry server is never gated). The U7 oracle now asserts the requested server is declared, locked and configured, that no other server appears, and that only servers the gate no longer allows may go, with a negative control for each defect. Refs #4564 Co-authored-by: Copilot App <[email protected]>
Refs #4564 Co-authored-by: Copilot App <[email protected]>
U-BIN-OPS (definition rule, OP x PRIM x GATE only): bin/ deploys only for a marketplace plugin at user scope (exec_gate.plugin_bin_deployable); audit, prune, pack and marketplace have no user-scope form and a local bundle is never a marketplace plugin, so a gate level of bin/ under them is vacuous (the #4575 review: an absence U-BIN guarantees proves nothing about the gate). It removes 9 baseline cells and 11 required T1 cells whose covering receipts only proved bin/ absent (T-1 required -11 by design). An org-policy level stays its own cell (U2 no-collapse); OP x SRC x PRIM and OP x PRIM cells keep their absence witnesses. A tripwire binds the rule to the live CLI (no --global on audit, prune, pack, marketplace), the U-BIN predicate pin and the closed-world bin/ writer pin. U-FIRST-PARTY-MCP now also maps OP=mcp-install x PRIM=mcp at the executable gate levels: install --mcp declares the server in the root apm.yml, so it is first-party and never gated. Refs #4095 #4565 Co-authored-by: Copilot App <[email protected]>
U-BIN-OPS (definition rule, OP x PRIM x GATE only): bin/ deploys only for a marketplace plugin at user scope (exec_gate.plugin_bin_deployable); audit, prune, pack and marketplace have no user-scope form and a local bundle is never a marketplace plugin, so a gate level of bin/ under them is vacuous (the #4575 review: an absence U-BIN guarantees proves nothing about the gate). It removes 9 baseline cells and 11 required T1 cells whose covering receipts only proved bin/ absent (T-1 required -11 by design). An org-policy level stays its own cell (U2 no-collapse); OP x SRC x PRIM and OP x PRIM cells keep their absence witnesses. A tripwire binds the rule to the live CLI (no --global on audit, prune, pack, marketplace), the U-BIN predicate pin and the closed-world bin/ writer pin. U-FIRST-PARTY-MCP now also maps OP=mcp-install x PRIM=mcp at the executable gate levels: install --mcp declares the server in the root apm.yml, so it is first-party and never gated. Refs #4095 #4565 Co-authored-by: Copilot App <[email protected]>
U-BIN-OPS (definition rule, OP x PRIM x GATE only): bin/ deploys only for a marketplace plugin at user scope (exec_gate.plugin_bin_deployable); audit, prune, pack and marketplace have no user-scope form and a local bundle is never a marketplace plugin, so a gate level of bin/ under them is vacuous (the #4575 review: an absence U-BIN guarantees proves nothing about the gate). It removes 9 baseline cells and 11 required T1 cells whose covering receipts only proved bin/ absent (T-1 required -11 by design). An org-policy level stays its own cell (U2 no-collapse); OP x SRC x PRIM and OP x PRIM cells keep their absence witnesses. A tripwire binds the rule to the live CLI (no --global on audit, prune, pack, marketplace), the U-BIN predicate pin and the closed-world bin/ writer pin. U-FIRST-PARTY-MCP now also maps OP=mcp-install x PRIM=mcp at the executable gate levels: install --mcp declares the server in the root apm.yml, so it is first-party and never gated. Refs #4095 #4565 Co-authored-by: Copilot App <[email protected]>

Description
M-GATE credited no generated obligation:
generator/witnesses.pyread only M-SOURCE and M-SCOPE-LOCK, and the covering replay never producesGATE=nonefor executables (gate off),denied-dependency(org dependency deny), a skill beside a revoked executable (U2), or a GATE forinstall --mcp(U7). So those T1/T2 cells stayed baseline.This PR adds a deterministic GATE matrix spine (
tests/lifecycle/machines/_gate_matrix.py) on the shared lifecycle world. It walks six gate levels in turn:executablesblock)deny-all-deps)The spine runs about 40 real CLI commands. Every step runs
check_cross_cutting(I1-I9, with I4 againstexpected_deployed). Thenoracles.check_obligationcredits machine idsG1|<op>|<prim>|<gate>|<scope>with e2e-evidence:install --mcpsteps: the non-MCP surfaces are unchanged, and no other server is configured.witnesses.pytranslates the ids with GATE as an anchor: only implied ids that name GATE are credited, so a refusal under a dependency deny never discharges a success cell.Supporting changes:
ModelState.exec_gate(default on): with the gate off, executables are allowed.StepRunneris extracted fromMachineBase, so a deterministic spine can reuse the step runner without being a Hypothesis machine.Ruling applied (Q&L lead, 2026-11-21):
apm pruneunder a dependency deny is non-reconciling for I4. prune removes only undeclared packages, and declared denied dependencies stay until the user removes them.Obligation counts (
tests/quality/lifecycle_obligations.json, regenerated after merging main):Total moved: 137 (121 T-1 + 16 T-7b
GATE=denied-dependencypairs). After review, the spine credits no bin or other-file cell and no MCP cell ofinstall --mcp, the U7 oracle asserts that the requested server is declared, locked and configured (with a negative control), (no step observes a bin outcome at project scope, U-BIN). Each resolving step must now deploy exactly the model's observable set, and prune under a dependency deny must never widen. CI time of the matrix test: 47 s (Lifecycle Smoke shard, engine driver).Issue and approved scope
Issue: Refs #4564 (0.38 lifecycle burn-down), Refs #4565 (epic)
Human scope-approval comment: #4564 (comment)
Does this PR complete the issue, or what remains? Partial. T-1 batches 2 and 3 remain: user scope (T2), bundle-install, pack, and the marketplace proposals. T-3 (#4097) follows.
Type of change
Testing
Validation (engine driver, macOS, host-guarded):
pytest tests/lifecycle/machines/test_m_gate.py::test_gate_matrix_credits_op_prim_gate_cells-> 1 passed, everyG1|id earned a receipt. The call took 135-157 s locally under load 33; CI timing is pending.pytest tests/quality/test_promise_obligations.py tests/quality/test_generated_obligations.py tests/lifecycle/generator/test_generator_rules.py tests/quality/test_gate_cell_obligations.py-> 80 passedpytest tests/lifecycle/world/test_world.py -k deny-all-depsandtest_m_scope_lock.py -k sequences(checks the MachineBase refactor) -> passedpython -m tests.lifecycle.generator --check-> up to date--base-ref origin/main) andtests.quality.taxonomy --changed-> all cleanChangelog
## [Unreleased]inCHANGELOG.md.Spec conformance (OpenAPM v0.1)