Skip to content

test(lifecycle): corpus train 3 (combined: T-1/T-2/T-3/T-6a/T-6b/T-6e) - #4700

Merged
Daniel Meppiel (danielmeppiel) merged 47 commits into
mainfrom
ql/corpus-train-3c
Nov 22, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 47 commits into
mainfrom
ql/corpus-train-3c

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

Corpus train 3 (combined), built as one coupled unit: one regenerated tests/quality/lifecycle_obligations.json (never hand-merged; python -m tests.lifecycle.generator), one CI and Integration run, and each car merged with --no-ff so authorship is preserved. It supersedes #4614 (train 2), whose content is car 1.

Car Source Lane What it adds
1 #4614 / ql/corpus-train-2: #4604 (W2, M-SCOPE-LOCK drift spine) + w2-t1-b2-umkt (W2, M-GATE batch 2 and rule U-MKT) T-3, T-1 Stale and absent lockfiles plus the side doors at every lock state, with LOCK-anchored context; the user-scope gate matrix; U-MKT (OP=marketplace x PRIM is one rule cell, witnessed at two gate levels). The #4600 strict cell is retired: its fix (#4616) is on main.
2 w2-t1-b3-bundle-pack + w2-t1-b4-bin (W2, M-GATE side doors) T-1 Local-bundle install and apm pack --dry-run at five gate levels (exact deployed and packed sets); bin/ of a Claude marketplace plugin at user scope with --trust-bin at five gate levels.
3 danielmeppiel-t6b-ownership @26d604048 (W4, T-6b) T-6b Ownership scenarios: DEPLOYED x operation pairs, unowned, edited and unknown-provenance assets.
4 danielmeppiel-w3-t6a-history @52ce20eeff3 (W3, T-6a) T-6a Target-history rows; rule U11 (--frozen refuses any declared-target change).
5 danielmeppiel-w3-t6e-offline @00e1932e9 (W3, T-6e) T-6e Offline and network-state cells.
6 #4711 / ql-w1-t2-drain-4 (W1, T-2 drain 4) T-2 M-SOURCE marketplace-local and marketplace-file forms (140 T-2 cells).
7 b260b74 (W4, cherry-picked) T-6b Credits the lost-lock deny retirement cells (`pair

Train-level fixes (no product change):

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

baseline known-failing required
main (488a4b1) 1196 0 1286
after car 1 1057 0 1393
after cars 1-4 775 7 1665
cars 1-5 731 7 1709
combined train (cars 1-7, after review fixes) 602 7 1838

Baseline by lane, main -> train: T-1 133 -> 56, T-2 364 -> 220, T-3 240 -> 142, T-6a 201 -> 109, T-6b 141 -> 1, T-6e 42 -> 0, T-7b 47 -> 46; T-6c unchanged (28).

Known-failing cells, each a strict known cell citing an open issue:

When one of these issues is fixed on main, the flip-on-close gate requires dropping its strict cell in the same pass.

Isolation from the product rows in the same landing window

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)

Run locally through the host guard (-n 2), on the car heads before the final main fold:

  • pytest tests/lifecycle/machines/test_m_gate.py tests/lifecycle/scenarios/test_history_upgrade.py tests/lifecycle/scenarios/test_ownership_siblings.py tests/quality/test_scenario_refusal_credit.py tests/quality/test_promise_obligations.py tests/quality/test_generated_obligations.py tests/lifecycle/generator/test_generator_rules.py: 239 passed, 1 failed. The failure was [BUG] A refused apm install -g still rewrites ~/.apm/apm.lock.yaml (adds mcp_target_servers: {}) #4685, now a strict known cell; that test and the [BUG] A failed install on a user LSP entry conflict still changes apm.lock.yaml #4697 test pass after the change.
  • pytest tests/lifecycle/machines/test_m_scope_lock.py plus the obligation tests on car 1 at main e182672: 95 passed.
  • ruff check / ruff format --check (0.15.12), pylint R0801, scripts/lint-auth-signals.sh, scripts/check_complexity_ratchet.py --base-ref origin/main, scripts/check_test_assertions.py, scripts/check_exact_test_duplicates.py, python -m tests.quality.taxonomy --changed, python -m tests.lifecycle.generator --check: clean at the head.

CI with the full-integration label is the authority for the combined head.

Changelog

  • One fragment per section, changelog.d/<pr>.<section>.md, holding
    one line: user-visible effect first, 25 words or fewer, ending with
    (#PR); breaking changes only under upgrade notes; no Highlights; no
    new lines under ## [Unreleased]. See changelog.d/README.md and
    .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.

…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]>
…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]>
…every operation

Discharges the T-6b pair obligations (DEPLOYED in {edited, unowned,
present-provenance-unknown} crossed with OP, modifiers, SRC, PRIM, GATE,
TGT and NET) with real-CLI oracle receipts in
tests/lifecycle/scenarios/test_ownership_siblings.py.

- The user's bytes are declared (Scenario.user_write) and must survive
  (I1-X2); a closed gate that keeps them is exempt from I4 only when the
  keep is announced and audit --ci detects it (I4-X2).
- Declared refusals earn credit only through EXPECTED_REFUSALS (exit code,
  cause, the promise it upholds, its source); a refusal on any other pair,
  or a declared pair that exits 0, fails the step
  (tests/quality/test_scenario_refusal_credit.py negative controls).
- run(says=...) asserts announced outcomes and records them as evidence.
- Product failures are strict known cells: #4626 (edited hook, canvas and
  LSP files overwritten silently), #4628 (a user's LSP entry taken over),
  #4268 (refused install --mcp writes first), #4634 (local bundle reinstall
  after a lost lockfile leaves MCP lock state the gates reject).
- TGT reads the declared target set before the step: narrowed drops at
  least one declared target (a switch counts); widened adds and drops none.

T-6b obligations: 141 baseline -> 132 required, 6 known-failing, 3 baseline.

Refs #4564 #4565

Co-authored-by: Copilot App <[email protected]>
Two deterministic spines credit OP x PRIM x GATE for the side doors:
apm install <local bundle> (a run-time packed p-bmix bundle with a skill,
an instruction, a hook and an MCP server, plus the world's p-lsp bundle)
and apm pack --dry-run over git dependencies, each at five gate levels
(unapproved, denied before deploy, allowed, revoked after deploy, gate
off). Every step runs I1-I9; bundle installs must leave exactly the
per-bundle model set and record parked executables as pending; pack must
ship exactly the dependency executables the gate deploys and never a
managed MCP server.

Refs #4564
Refs #4095

Co-authored-by: Copilot App <[email protected]>
Target history (ruling #3): install and every command after a declared
target change, with real-CLI receipts crediting the scenario-lane pairs
their assignments imply (CREDITS). U11 maps changed-TGT x FROZEN onto
refusal|TGT=changed|FROZEN=on, witnessed by
test_frozen_refuses_a_target_change. Strict known cells: #4636 (uninstall
after a target change) and #4638 (frozen widened refusal leaves hook
config).

Refs #4564, #4565, #4100

Co-authored-by: Copilot App <[email protected]>
Each offline row installs online, closes the network (closed proxy, as the
source machine does) and runs one command through the scenario kit with
I1-I9: a converged project (single and multi target), a local-only update,
parked then denied executables, a native plugin, registry/MCP/bundle/pack
sources and git/local/file marketplaces. 42 baseline cells become required.

Refs #4104, #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

Active test-evidence gaps assign coverage without valid witnesses, leave required pack receipts unmet, and allow stale output expectations or missing native-plugin ownership records to pass unchecked.

5 open issues
What changed in this PR

This test-only PR expands APM’s lifecycle coverage toward the baseline-reduction goal in #4564, without changing product behavior.

Changes:

  • Extends gate and lock-state machines across user scope, bundles, packing, and plugin binaries.
  • Adds ownership, target-history, and offline scenarios with explicit refusal checks.
  • Updates obligation generation and runs the new refusal-credit checks in CI.
File Description
tests/​utils/​lifecycle_evidence.py Adds a known repeated-output expectation.
tests/​quality/​test_scenario_refusal_credit.py Tests refusal-credit validation.
tests/​quality/​test_generated_obligations.py Adds marketplace witness negative controls.
tests/​lifecycle/​scenarios/​test_ownership_siblings.py Expands ownership-preservation scenarios.
tests/​lifecycle/​scenarios/​test_network_offline.py Adds offline lifecycle scenarios.
tests/​lifecycle/​scenarios/​test_history_upgrade.py Adds target-history and frozen-refusal coverage.
tests/​lifecycle/​scenarios/​_kit.py Supports declared refusals and output evidence.
tests/​lifecycle/​machines/​test_m_scope_lock.py Adds stale/absent lock and side-door coverage.
tests/​lifecycle/​machines/​test_m_gate.py Runs expanded gate-machine scenarios.
tests/​lifecycle/​machines/​_kit.py Adds user-scope deployment observations.
tests/​lifecycle/​machines/​_gate_matrix.py Extends user-scope and marketplace gate coverage.
tests/​lifecycle/​machines/​_gate_bundle.py Adds bundle-install and pack gate machines.
tests/​lifecycle/​machines/​_gate_bin.py Adds user-scope plugin-bin gate coverage.
tests/​lifecycle/​generator/​witnesses.py Maps new machine and scenario witnesses.
tests/​lifecycle/​generator/​test_generator_rules.py Validates shared machine IDs and credits.
tests/​lifecycle/​generator/​rules.py Defines marketplace and frozen-target rules.
tests/​lifecycle/​generator/​emit.py Registers scenario-backed refusal witnesses.
tests/​lifecycle/​generator/​covering.py Excludes scenario refusals from generated replay rows.
.github/​workflows/​main-architecture-ratchets.yml Runs refusal-credit checks on main.
.github/​workflows/​ci.yml Runs refusal-credit checks in CI.

Review effort: Balanced

Comment thread tests/utils/lifecycle_evidence.py Resolved
…sts the refusal-credit module

Co-authored-by: Copilot App <[email protected]>
A hook-only package, deployed and approved, loses its lockfile; a deny
or a dropped approval then retires the hook on the next install.

Refs #4564 #4565

Co-authored-by: Copilot App <[email protected]>
(cherry picked from commit b260b74)
Project-scope history and offline rows no longer credit PRIM=bin (U-BIN), pack history rows are refusals and credit nothing, the registry package stays in the scenario that selects the registry, user-scope scenarios observe plugin bin/ and set user_scope for I1, and the uninstall hint-repeat output cell (closed #4636) is retired.

Co-authored-by: Copilot App <[email protected]>
Adds W3's guard test_every_scenario_credit_names_a_collected_node (from danielmeppiel-w3-t6a-history-v2); the 40 target-history keys were built target-first and named nodes pytest never collects.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
…-read each local catalog

Regenerate on the re-stack. refresh_marketplace(every=True) now adds a
probe plugin to each local/file catalog before the refresh and credits
their cells only when the command reports the refreshed count (2 plugins)
for that catalog, then restores it: a skipped or stale read fails.

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit c0a78c3 into main Nov 22, 2026
62 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the ql/corpus-train-3c branch November 22, 2026 15:09
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