Skip to content

test(lifecycle): corpus train 2 (T-3 batch 1 + T-1 batch 2 + U-MKT) - #4614

Closed
Daniel Meppiel (danielmeppiel) wants to merge 18 commits into
mainfrom
ql/corpus-train-2
Closed

Daniel Meppiel (danielmeppiel) wants to merge 18 commits into
mainfrom
ql/corpus-train-2

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

Corpus train 2 lands the next ready lifecycle-corpus batches with ONE regenerated tests/quality/lifecycle_obligations.json. Sources are merged with --no-ff.

Rule U-MKT (Q&L ruling 2026-11-21) says that marketplace commands act on catalogs, never on deployed primitives.

  • Evidence (the rule's evidence field in tests/lifecycle/generator/rules.py, anchors checked by test_every_rule_cites_code_that_still_says_it):
    • src/apm_cli/commands/marketplace/__init__.py:372 (def add(source, name: add registers a catalog);
    • docs/src/content/docs/reference/cli/marketplace.md:292 (apm marketplace update refreshes registered catalogs);
    • docs/src/content/docs/consumer/installing-from-marketplaces.md:112 (apm marketplace update "refreshes the cached list and nothing else");
    • apm marketplace --help, where every consumer and authoring command acts on catalogs or the marketplace: block, and rules.py ACCEPTS marketplace = {SELECT}.
  • A primitive reaches a project only through apm install <plugin>@<marketplace> (OP=install, SRC=marketplace-*), which M-SOURCE covers.
  • Mapping: every OP=marketplace x PRIM cell without SRC maps onto rule|U-MKT|marketplace-never-touches-deployed. The org-policy GATE level stays its own cells (U2 no-collapse), and OP x SRC x PRIM stays with the source lane.
  • Witness at TWO gate levels, per the ruling's condition: in the M-GATE matrix, apm marketplace add <world catalog> runs at the allowed level and apm marketplace update runs at the revoked-after-deploy level (denied executables still deployed). Both are checked with I5 forbidding any project write and with e2e-evidence that every project byte (deployed surfaces and the lockfile) is unchanged. A third apm marketplace update under the org dependency deny witnesses the six OP=marketplace x PRIM x GATE=denied-dependency cells directly. The JSON is produced by python -m tests.lifecycle.generator on the merged tree, never hand-merged.
Source Lane What it adds
#4604 (W2, branch w2-t3-lock-drift): M-SCOPE-LOCK drift spine T-3 Stale and absent lockfiles plus the side doors (deny, install --mcp, local bundle, marketplace list) at every lock state; LOCK-anchored lock context. The #4600 strict cell is retired: the fix (#4616) is on main.
branch w2-t1-b2-umkt (W2): M-GATE matrix batch 2 T-1 User-scope gate spine (T2 FROZEN x SCOPE=user x GATE, with user-scope surfaces observed). Rule U-MKT (Q&L ruling 2026-11-21): OP=marketplace x PRIM maps onto one rule cell, witnessed at the allowed and revoked levels with every project byte unchanged; the org-policy level keeps its own cells. p-lsp under allowed. credits() becomes the single definition of what a machine receipt discharges.

Each batch alone on main:

#4624 (W1, T-2 drain 2) and #4619 landed on main on their own and are no longer sources of this train.

Train, regenerated on the merged tree at 9e7046f (current main 11f8f58; python -m tests.lifecycle.generator --counts):

baseline known-failing required
main (11f8f58) 1196 0 1286
train 2 1057 0 1393

Baseline by lane: T-1 133 -> 95, T-3 240 -> 142, T-2 364 -> 362, T-7b 47 -> 46; other lanes unchanged.

W4's T-6b batch rides train 3.

Issue and approved scope

Issue: Refs #4564, Refs #4565

Human scope-approval comment: #4564 (comment)

Does this PR complete the issue, or what remains? No. #4564 closes at baseline <= 500.

Type of change

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

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

Results:

  • Source branches (engine driver, host-guarded):
  • Train head:
    • python -m tests.lifecycle.generator --check: up to date
    • pytest tests/quality/test_promise_obligations.py tests/quality/test_generated_obligations.py tests/lifecycle/generator/test_generator_rules.py: 77 passed
    • Lint contract (ruff 0.15.12 check and format, complexity ratchet, lint-auth-signals.sh, tests.quality.taxonomy --changed, check_test_assertions.py): clean

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • N/A -- this PR does not change OpenAPM-observable behaviour.

…ckfiles

A second scope-lock spine drives a stale lockfile (the manifest and the lock
disagree on the toggle package), an absent lockfile and the side-door commands
(deny, install --mcp, a local bundle, marketplace list) through every lock
state the lockfile spine leaves open. Each step runs I1-I9; admitted side
doors also assert their own outcome. Lockfile cells now carry the context
their step acted on and credit, anchored on LOCK, the pairs it implies.
apm marketplace list creating ~/.apm/marketplaces.json is a strict known
cell (#4600).

Refs #4564
Refs #4097

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

The GATE matrix gains a user-scope spine (install --frozen at every gate
level an approval store reaches, T2 FROZEN x SCOPE=user x GATE) with the
user-scope copilot surfaces observed (Bench.surface_globs). Marketplace
commands map onto rule U-MKT (Q&L ruling 2026-11-21): one rule cell
witnessed at the allowed and revoked levels with every project byte
unchanged; the org-policy level keeps its own cells, witnessed under the
dependency deny. The allowed level also uninstalls and reinstalls p-lsp.

Refs #4564
Refs #4095

Co-authored-by: Copilot App <[email protected]>
credits() is the one place that says which ids a machine receipt
discharges (rule ids themselves, anchored cells only their anchor), and
the witness test reads it. U-MKT evidence follows main's line moves.

Refs #4564

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 tests can credit coverage despite missing gate-level witnesses, durable bundle installation state, or verified lock reconciliation, allowing no-op or incomplete behavior to pass.

3 open issues
What changed in this PR

Expands APM's lifecycle test corpus toward the baseline-reduction goal in #4564, without changing production behavior.

Changes:

  • Adds stale and absent lockfile scenarios, alternate command paths, and strict known-failure coverage for #4600.
  • Extends user-scope gate coverage and introduces the U-MKT marketplace equivalence rule.
  • Centralizes receipt-credit logic and regenerates obligations, reducing baseline cells from 1,253 to 1,108.
File Description
tests/​quality/​lifecycle_obligations.json Regenerates obligation mappings, witnesses, counts, and known failures.
tests/​lifecycle/​machines/​test_m_scope_lock.py Adds lock-drift sequences and alternate command coverage.
tests/​lifecycle/​machines/​test_m_gate.py Enables user-scope matrix execution and rule-receipt checks.
tests/​lifecycle/​machines/​_kit.py Observes user deployment locations and handles absent-lock provenance.
tests/​lifecycle/​machines/​_gate_matrix.py Adds user gate sequences and marketplace preservation checks.
tests/​lifecycle/​generator/​witnesses.py Translates drift context and centralizes receipt credits.
tests/​lifecycle/​generator/​test_generator_rules.py Validates witness credits through the shared credit logic.
tests/​lifecycle/​generator/​rules.py Defines U-MKT while preserving separate org-policy coverage.

Review effort: Balanced

…record

Per review on corpus train 2: outcome checks now run before a drift cell
is credited. A resolving command must leave a readable lockfile whose rows
match the manifest and that records each deployed declared skill; a local
bundle install must record p-lsp's approval key and LSP type in
apm_modules/.local-bundle-pending.json while its server stays parked.

Refs #4564

Co-authored-by: Copilot App <[email protected]>
Per review on corpus train 2: the allowed and the revoked marketplace
probes each hold their checked step; the rule cell's receipts are emitted
only once both levels are present, so dropping either probe leaves the
rule uncovered (negative control: umkt_ready per dropped level).

Refs #4564

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel Daniel Meppiel (danielmeppiel) added the full-integration Run the full integration suite (ci-integration.yml) on this PR before merge label Nov 21, 2026
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Superseded by #4700 (corpus train 3, combined), which carries this train's content as car 1 on current main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-integration Run the full integration suite (ci-integration.yml) on this PR before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants