Skip to content

test(lifecycle): M-SOURCE marketplace op, HOSTID and U-FIRST-PARTY-MCP (T-2 drain 3) - #4637

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

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

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

T-2 (M-SOURCE) drain 3, source PR for corpus train 3. Stacked on #4624 (train 2) and #4619; once they land, the top commit is the only change.

  • U-FIRST-PARTY-MCP (lead ruling R4). An MCP server the project declares in its own apm.yml is first-party. The executables gate governs executables "from dependencies" (enterprise/control-executables.mdx), and consumer/install-mcp-servers.md admits a server by having you "Re-declare it in your apm.yml". The 8 pairs MCP source (inline-mcp, mcp-registry) x executable-gate level (unapproved-exec, allowed, denied-executable, revoked-after-deploy) map to one must-cover rule cell, rule|U-FIRST-PARTY-MCP|root-declared-mcp-not-gated. The M-SOURCE gate-on install witnesses it: with executables.allow empty, each root-declared server is configured in .mcp.json, recorded in the lock, and named by no Parked MCP server line. GATE=none and the org-policy denied-dependency stay obligations. A change that starts gating root MCP fails this cell. Machine rule ids credit themselves (witnesses.credited_ids, shared with the test that checks credits), and test_generator_rules pins the mapping.

  • Marketplace op. apm marketplace update NAME runs three times with catalog packages installed: single target, multi target, and gate off. It must leave the project byte-identical (forbidden project writes; only the catalog cache under APM_HOME may change). It earns the T3/T5 cells of the marketplace forms (skill, hook, bin, MCP) and the OP=marketplace context pairs: NET, SCOPE, TGT, SELECT (named catalog), DEPLOYED=clean, GATE.

  • HOSTID (E1), read from the observed lock row.

    • Default host: bare key, host github.com, no port.
    • GHES host on port 8443: the lock records host and port.
    • Registry proxy (PROXY_REGISTRY_URL): the lock records registry_prefix: artifactory/github and keeps the bare logical key.

    Each runs across install, lock, update and uninstall, together with the lock state the step starts from (absent, stale, consistent). X ids now carry one or more FACTOR=value contexts (X|install|git-object|HOSTID=qualified-host-port|LOCK=stale).

Counts (python -m tests.lifecycle.generator --counts):

baseline required known-failing
before (#4624 head) 1247 1242 0
after 1196 1286 0

T-2 baseline: 412 -> 364. T-3 spillover: 243 -> 240.

Left for later batches (T-2): HOSTID x audit and x newer-generator lock, marketplace-git under the proxy or a ported host, marketplace op x lsp/canvas (needs catalog entries), approve-deny/audit per form, the marketplace-local/-file sources, and world extensions.

PR shard cost: 3 marketplace refreshes plus a HOSTID pass of 8 commands, about +20 s on CI. The running total of my additions is about +48 s of the +90 s budget.

Issue and approved scope

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

Human scope-approval comment: #4564 (comment). R4 is the Q&L lead's ruling on that scope.

Does this PR complete the issue, or what remains? No. #4564 closes when the baseline is <= 500 (now 1196).

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 (engine driver, receipts dir set): 3 passed.

  • pytest tests/quality/test_promise_obligations.py tests/quality/test_generated_obligations.py tests/lifecycle/generator/test_generator_rules.py with those receipts: 79 passed (ratchet holds).

  • Lint contract, each step with its real exit code: uvx [email protected] check and format --check, pylint R0801, lint-auth-signals.sh, check_complexity_ratchet.py --base-ref origin/main, python -m tests.quality.taxonomy --changed, and python -m tests.lifecycle.generator --check: all pass.

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]>
… 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]>
…P (T-2 drain 3)

- U-FIRST-PARTY-MCP (lead ruling R4): an MCP server the project declares
  in its own apm.yml is first-party; the executables gate governs
  servers from dependencies (control-executables.mdx) and never parks
  it. The 8 pairs MCP source x executable-gate level map to one
  must-cover rule cell, rule|U-FIRST-PARTY-MCP|root-declared-mcp-not-gated,
  witnessed by the M-SOURCE gate-on install (configured, locked, no
  "Parked MCP server" line naming them). Machine rule ids credit
  themselves (witnesses.credited_ids).
- Marketplace op: `apm marketplace update NAME` runs with catalog
  packages installed (single target, multi target, gate off) and must
  leave the project untouched; it earns T3/T5 cells of the marketplace
  forms and OP=marketplace context pairs.
- HOSTID (E1), read from the observed lock row: the default host
  (bare key), a GHES host on port 8443 (host and port recorded) and the
  registry proxy (registry_prefix recorded, bare logical key), across
  install/lock/update/uninstall and the lock state each starts from.
  X ids now carry one or more FACTOR=value contexts.

Counts: 1247/1242 -> 1196/1286 (T-2 412 -> 364; T-3 243 -> 240).

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 HOSTID receipts do not validate exact declaration values or canonical lock keys, and the refresh witness can pass from cache without proving catalog revalidation.

2 open issues
What changed in this PR

Extends the lifecycle test corpus for #4564, building on #4619 and #4624 to reduce unwitnessed obligations without changing production behavior.

Changes:

  • Adds marketplace refresh checks and host/port/proxy identity coverage to M-SOURCE.
  • Consolidates root-declared MCP executable-gate cases into one witnessed rule and supports multi-factor receipt contexts.
  • Regenerates obligations and refusal replays, including bundle --update rejection and retirement of the fixed stale-pin failure.
File Description
tests/​quality/​lifecycle_obligations.json Regenerates required cells, mappings, witnesses, and replay hashes.
tests/​lifecycle/​replay/​rows/​generated_cover-15-refusals.yaml Receives the pack --update refusal case.
tests/​lifecycle/​replay/​rows/​generated_cover-14-refusals.yaml Rebalances generated refusal cases.
tests/​lifecycle/​replay/​rows/​generated_cover-13-refusals.yaml Adds bundle --update rejection with a message assertion.
tests/​lifecycle/​model/​state.py Adds an executable-gate state transition.
tests/​lifecycle/​machines/​test_m_source.py Adds marketplace, host identity, and root MCP checks; retires the stale-pin known failure.
tests/​lifecycle/​generator/​witnesses.py Supports multi-factor contexts and direct rule-cell credit.
tests/​lifecycle/​generator/​test_generator_rules.py Checks first-party MCP and bundle-refusal mappings.
tests/​lifecycle/​generator/​rules.py Defines first-party MCP equivalence and bundle modifier refusals.
tests/​lifecycle/​generator/​covering.py Includes configured refusal messages in generated replay steps.

Review effort: Balanced

…h must revalidate

Review on #4637:
- HOSTID comes from the declaration (default host, GHES on port 8443,
  registry proxy) and the lock row must match it exactly: host, port,
  registry_prefix and the canonical unique key (bare, or host:port
  qualified); uninstall reads the pre-step lock.
- `apm marketplace update NAME` must show a successful request for the
  named catalog in the egress log before it earns its receipts.

Refs #4564

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 6bad182 into main Nov 21, 2026
42 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the ql-w1-t2-drain-3 branch November 21, 2026 15:36
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
… changes

Rebase reds after the corpus PRs (#4637, #4619) met #3921's contract:
- J05 (code + cells): the O6 oracle requires every changed file to be
  announced. The native report said '.agents/plugins' and 'Claude Code
  settings' without naming files; it now prints '.agents/plugins/' and each
  settings file it rewrote with its harness label. J05 expects the native
  deploy (no loose .claude/commands) and its cold replay removes every
  deployed root; golden regenerated.
- M-SOURCE (cells): at project scope a Claude plugin deploys whole, so the
  model expects only its gated native unit; the oracle still observes the
  carried skill and MCP surfaces, so a loose deploy fails. The gate-off pass
  also asserts the plugin root is deployed (bin/ plugins stay parked without
  --trust-bin).

Co-authored-by: Copilot App <[email protected]>
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