Skip to content

test(lifecycle): M-SOURCE gate-off pass and bundle refusal rules (T-2 drain 2) - #4624

Merged
Daniel Meppiel (danielmeppiel) merged 3 commits into
mainfrom
ql-w1-t2-drain-2
Nov 21, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 3 commits into
mainfrom
ql-w1-t2-drain-2

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Description

T-2 (M-SOURCE) drain 2 for corpus train 2. It carries the three lead rulings on #4564: R1 is witnessed, R2 and R3 are applied.

Stacked on #4619 (the single owner of the #4572 main red). This branch contains #4619's commit fc9857fc; once #4619 lands, the diff below it is the only change.

  • R1: GATE=none is witnessed, not removed. GATE=none means no executables gate is configured (GateLevel("none", authority=None)), which is the default user path. tests/lifecycle/machines/test_m_source.py gains gate_off_pass():

    1. Drop the executables block (an edit step).
    2. Install every declared form, and assert before any receipt that each declared MCP server (registry io.github.lifecycle/p-registry and inline p-inline) is configured in .mcp.json, recorded in the lock's mcp_servers, and printed no Parked MCP server line.
    3. Restore the block and install again. Package executables must be retired, and the project's own MCP servers must stay configured and locked (first-party).

    Both installs require the deployed set to equal the model's observable surfaces (as _gate_matrix does), and MCP names are matched exactly.

    ModelState.with_exec_gate() drives the reference model; expected_deployed already treats GATE=none as deployable. The context ids X|install|<form>|GATE=none are earned there for inline-mcp, mcp-registry, plugin-at-mkt, native and pkg-registry.

  • R2. A local bundle install refuses --update (src/apm_cli/commands/install.py:1299 rejected_flags, install/local_bundle_handler.py:84, exit 2). UPDATE leaves ACCEPTS["bundle-install"], with REFUSAL_EVIDENCE at install.py:1299. The covering replay now runs apm install <bundle> --update as a refusal step and pins the message not valid with a local bundle install (REFUSAL_MESSAGES, used by refusal_rows).

  • R3. A SRC=local-bundle pair that carries a modifier bundle install refuses (FROZEN or UPDATE) maps through U8 to bundle-install, then to its refusal cell. test_u8_mappings_name_the_cell_or_refusal_each_shape_lands_on gets the matching independent clause (2 cells).

Not in this PR: the bundle's own GATE=none cell. With the gate off, a local bundle's MCP name clashes with the marketplace p-exec plugin ("Bundle MCP server name conflicts with another owner"; correct behaviour). Installing it alone shows that the reference model does not yet track bundle-deployed executables. That cell and compile/lock of a bundle come in a later batch.

Counts (python -m tests.lifecycle.generator --counts, on main 7fb04a1 + #4619):

baseline required known-failing
before 1253 1238 0
after 1247 1242 0

T-2 baseline: 418 -> 412. R1 witnesses 5 cells and R2/R3 map 3 cells to refusals. Review then exposed a drain-1 mislabel: root-declared MCP servers are first-party and never parked, so their 2 GATE=unapproved-exec pairs return to baseline (removal rule proposed). One new required refusal cell is witnessed by the covering replay: refusal|OP=bundle-install|UPDATE=on, exit 2.

PR shard cost: the gate-off pass adds 2 edits and 2 installs, plus 1 refusal step in the covering replay. That is about +6 s on CI.

Issue and approved scope

Issue: Refs #4564 (Refs #4565, the epic)

Human scope-approval comment: #4564 (comment). Rulings R1-R3 come from the Q&L lead on that scope.

Does this PR complete the issue, or what remains? No. #4564 closes when the baseline is <= 500 (now 1247). Next T-2 batches: the marketplace op and HOSTID, approve-deny and audit per form, the marketplace-local and marketplace-file sources, and world extensions.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally

  • All existing tests pass

  • Added tests for new functionality (if applicable)

  • pytest tests/lifecycle/machines/test_m_source.py tests/lifecycle/replay/test_covering_replay.py -k "test_source or cover-13 or cover-14 or cover-15" (engine driver, receipts dir set): 5 passed.

  • pytest tests/quality/test_promise_obligations.py tests/quality/test_generated_obligations.py tests/lifecycle/generator/test_generator_rules.py tests/lifecycle/model with those receipts: passed (generator rules 29/29 after the U8 oracle clause).

  • python -m tests.lifecycle.generator --check: up to date.

  • Lint contract: uvx [email protected] check and format --check pass; check_complexity_ratchet.py --base-ref origin/main clean; python -m tests.quality.taxonomy --changed ok.

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.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.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

#4597 fixed #4572 (a git -> registry switch now drops the stale
.apm-pin) but left the strict KnownCell registry-source-switch-stale-pin
in test_m_source.py. The cell no longer fails, so the source spine
(test_source_spine_covers_every_form_and_op, lifecycle_smoke shard 4)
fails strict on every PR. Drop the cell and its KNOWN_CELLS_BY_ID entry;
the regenerated pair X|install|pkg-registry|UPDATE=on moves from
known-failing to required.

Refs #4572, #4565

Co-authored-by: Copilot App <[email protected]>
… drain 2)

R1 (lead ruling): GATE=none means no executables gate is configured,
the default user path. M-SOURCE gains a gate-off pass: drop the
executables block, install every declared form, assert each declared
MCP server (registry and inline) is configured in .mcp.json and
recorded in the lock with no parking line, then restore the gate and
install again (executables retire, I4). ModelState gains
with_exec_gate; the X ids X|install|<form>|GATE=none are earned there
for inline-mcp, mcp-registry, plugin-at-mkt, native and pkg-registry.

R2: a local bundle install refuses --update (install.py rejected_flags,
exit 2), so UPDATE leaves ACCEPTS["bundle-install"]; the covering
replay pins the "not valid with a local bundle install" message on the
refusal step (REFUSAL_MESSAGES).

R3: a SRC=local-bundle pair carrying a modifier bundle install refuses
(FROZEN, UPDATE) maps through U8 to bundle-install, then to its
refusal cell.

Counts: baseline 1253 -> 1245, required 1237 -> 1244 (T-2 418 -> 410).

Refs #4564
Refs #4565

Co-authored-by: Copilot App <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The lifecycle tests can credit invalid deployments because they fail to verify all expected plugins, removal of unapproved MCP servers after gate restoration, and exact server names.

3 open issues
What changed in this PR

This test-only PR advances the lifecycle coverage work in #4564 by exercising gate-disabled installs and mapping unsupported local-bundle modifiers to refusal cases. It also includes the stacked #4619 cleanup for the fixed stale-pin issue.

Changes:

  • Adds a gate-off/install/gate-on sequence and MCP configuration checks to M-SOURCE.
  • Adds bundle --update refusal coverage and updates generator mappings.
  • Regenerates replay rows and lifecycle obligations, promoting five gate-off cells to required coverage.
File Description
tests/​quality/​lifecycle_obligations.json Updates coverage status, refusal mappings, witnesses, and hashes.
tests/​lifecycle/​replay/​rows/​generated_cover-15-refusals.yaml Receives the pack-update refusal step.
tests/​lifecycle/​replay/​rows/​generated_cover-14-refusals.yaml Rebalances refusal steps.
tests/​lifecycle/​replay/​rows/​generated_cover-13-refusals.yaml Adds bundle-update refusal and message checks.
tests/​lifecycle/​model/​state.py Adds an executable-gate state transition.
tests/​lifecycle/​machines/​test_m_source.py Adds gate-off coverage and retires the stale-pin known cell.
tests/​lifecycle/​generator/​test_generator_rules.py Checks local-bundle modifier refusal mappings.
tests/​lifecycle/​generator/​rules.py Defines bundle-update refusal and source mapping rules.
tests/​lifecycle/​generator/​covering.py Carries expected refusal messages into generated rows.

Review effort: Balanced

@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Folded into corpus train 2 #4614 (merged with --no-ff at 1407673, with #4619 carried along); the ledger is regenerated once there. This PR stays open as the linked source. Its only red is the known Windows flake #4601 (test_cache_atomicity).

… are first-party

Review on #4624:
- Both installs of the gate-off pass now require the deployed set to
  equal the model's observable surfaces (as _gate_matrix does), so a
  parked native or marketplace plugin fails the GATE=none credit.
- MCP server names are matched exactly (the registry server by its
  full id or short name), not by prefix.
- Restoring the gate retires package executables, while the project's
  own MCP servers (declared in its apm.yml) stay configured and locked:
  they are first-party and never parked. The restore install asserts it.

That also corrects drain 1: a root-declared MCP server has no
executable-gate level while the gate is on, so the inline-mcp and
mcp-registry X ids no longer claim GATE=unapproved-exec (2 pairs back
to baseline; a removal rule is proposed to the lead).

Counts: 1253/1238 -> 1247/1242 (T-2 418 -> 412).

Refs #4564

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 4e1eafc into main Nov 21, 2026
82 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the ql-w1-t2-drain-2 branch November 21, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants