Skip to content

test(lifecycle): T-2 HOSTID pairs and offline-source cells (stacked on train 5) - #4789

Closed
Daniel Meppiel (danielmeppiel) wants to merge 55 commits into
mainfrom
danielmeppiel-w4-t2-hostid
Closed

Daniel Meppiel (danielmeppiel) wants to merge 55 commits into
mainfrom
danielmeppiel-w4-t2-hostid

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

T-2 corpus lane (#4096): credits the HOSTID pairs and the T-2 offline-source cells left in the baseline after train 5.

Stacked on train 5 (#4758, ql/corpus-train-5 @ e1e9faf). Until #4758 merges, this PR's diff includes train 5; after it merges, only the files below remain. Whichever of #4758, #4769 and this PR lands later must re-merge main and regenerate.

Own changes vs train 5:

  • tests/lifecycle/scenarios/test_host_identity_pairs.py (new). For each host identity (bare-default, proxy-logical, qualified-host-port), real CLI:
    • audit replays the exact lock row;
    • a newer-generator lock is refused with the lock bytes unchanged;
    • a git-marketplace plugin records its host identity.
  • tests/lifecycle/scenarios/test_compile_source_files.py (new): compile over an instruction package served from git and from a git catalog, and over a native Claude plugin with an agent (each a scenario-local served repo). compile leaves the lock bytes and every marked deployed file unchanged; the instruction stays under copilot's instruction root with its text and in the lock. Credits T3|OP=compile|SRC={git, marketplace-git, native-plugin}|PRIM=other-file (split with W1: b9 earns the other 12 T-2 triples).
  • Both new modules carry lifecycle_smoke, so Lifecycle Smoke (Linux) runs them on this PR. Without it they would run only in the main-only nightly.
  • tests/lifecycle/scenarios/_kit.py: adds T-2 to SCENARIO_LANES. Declares the three pair|LOCK=newer-generator|HOSTID=* refusals; a refusal never discharges a success cell.
  • tests/lifecycle/generator/witnesses.py: registers the module.
  • tests/quality/lifecycle_obligations.json: regenerated.

Effect vs train 5: 17 cells move baseline -> required (10 HOSTID; 4 offline registry/MCP/bundle cells already witnessed by test_network_offline, now counted once T-2 is a scenario lane). 3 compile x other-file triples. Baseline 37 -> 20.

I dropped my earlier test_local_bundle_commands.py: train 5's test_m_source (b8) already witnesses lock/compile x local-bundle, so it added no credit.

Left in T-2 baseline (13): W1's b9 earns 12 triples; T5|OP=mcp-install|SRC=inline-mcp|DRYRUN=on is W2b's.

Issue and approved scope

Issue: Refs #4096

Human scope-approval comment: QL VP assignment of the T-2 corpus lane (#4096, accepted lifecycle corpus epic). Test-only.

Does this PR complete the issue, or what remains? Partial: the 13 T-2 cells above remain, owned by W1's b9 and W2b.

Type of change

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

Testing

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

Local: ruff check / format --check (0.15.12), python -m tests.lifecycle.generator --check, scripts/check_test_assertions.py, scripts/check_exact_test_duplicates.py, and tests.quality.taxonomy --changed all pass. The scenario modules run in CI (Integration dispatched on this branch) rather than locally, per the host-capacity rule.

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
  • Manifest edit
  • Test edit
  • CONFORMANCE.{md,json} regenerated
  • N/A -- this PR does not change OpenAPM-observable behaviour.

… now required

Merge main (keep U11 and U-FIRST-PARTY-MCP), drop the #4636 strict cells and
the uninstall output cell, credit every uninstall history row, regenerate.

Refs #4100, #4565

Co-authored-by: Copilot App <[email protected]>
…les and marketplaces

Seven first-command-after-a-target-change rows x four TGT changes, and fix
the history row CREDITS keys (pytest ids are row-tgt; 48 credits named
nodes that never ran). New quality guard: every scenario credit names a
collected node (negative control: the old keys fail it). T-6a 101 -> 165
required.

Refs #4100, #4565

Co-authored-by: Copilot App <[email protected]>
Three MCP owners (current .mcp.json, legacy .github/mcp.json receipts,
removed-vscode .vscode/mcp.json) from the 0.36.0 fixtures, one command per
row: heal on install/update/stale-lock install, keep the retired file on
uninstall/prune/install --mcp/lockless install; a newer-generator lock is
refused for every owner. U-MCPOWN-USER (lead ruling) removes user-scope x
retired owner, bound to split_mcp_claims(user_scope=True) with a negative
control. T-6a 165 -> 196 required (6 left, unchanged-TGT cells T-6e covers).

Refs #4100, #4565

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

# Conflicts:
#	tests/lifecycle/generator/rules.py
#	tests/lifecycle/generator/witnesses.py
#	tests/lifecycle/scenarios/test_history_upgrade.py
#	tests/quality/lifecycle_obligations.json
… cells)

The user-scope bin spine gains a denied-dependency segment: the org
policy denies the plugin, the user has approved it, and a user-scope
command discovers no org policy (#3703), so install, install --frozen,
install --mcp, lock and update keep bin/ the deny should retire
(strict known I4 cells, KNOWN_DD). approve, compile and uninstall under
the deny hold every law and earn their ids.

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]>
…wn cells

- p-skill joins the pack set (plain file ships at every gate level)
- a canvas-only pack project; its three parked levels are strict R
  known cells tracking #4714 (pack refuses a gate-parked canvas)
- the world serves p-canvas from git for pack only (GIT_PACK_ONLY)
- the pack side door also credits the OP x PRIM pair

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

The deny-all-deps world policy also denies every MCP server (**), so at
the denied-dependency level install --mcp of the registry server is a
refusal that preserves state; with the gate off the requested server is
declared, locked and configured. Both levels now credit PRIM=mcp.

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

compile deduplicates an instruction .github/instructions/ already holds,
so the matrix observes compile x other-file through a forced render: at
the gate-off and revoked-after-deploy levels, where the gate keeps the
plain files, AGENTS.md must carry the instruction body. The render also
credits the OP x PRIM pair.

Co-authored-by: Copilot App <[email protected]>
- route the T-3 lane through scenario credits (SCENARIO_LANES); machine
  witnesses still win
- new tests/lifecycle/scenarios/test_user_scope.py: first install from
  every source, install --mcp, approved executables, plugin bin/, target
  changes, modifiers, offline and the deployed states, all under HOME
- package-source helpers move to scenarios/_sources.py (scope-aware;
  marketplace registration at user scope is a global input)

Co-authored-by: Copilot App <[email protected]>
The M-SOURCE spine now drives two more ops through the real CLI:

- audit_pass: `apm audit --dry-run` then `apm audit` on each converged
  remote-skill state and after the registry exec pass; read-only for every
  declared form, local bundles included.
- decide_pass: `apm approve --all` pins every installed package with
  executables; a local bundle is approved by the content key `approve
  --pending` prints and installed again as that hint says; `apm deny` of a
  catalog plugin and the `apm install` its hint names retire its
  executables (I4); the gate is then restored. The model now carries the
  executables decisions, so the deploy oracle checks approved state.

The p-lsp bundle stays parked: its LSP server shares the local p-lsp's name,
and once the bundle owns it the manifest install is refused by design.

R5 (Q&L ruling): approve-deny x {mcp-registry, inline-mcp} maps onto
U-FIRST-PARTY-MCP; approve decides only installed packages
(scan_installed_executable_packages), witnessed by a live-scan test.

Ledger vs #4711: baseline 531 -> 452 (75 T-2 cells required, 4 mapped by
R5); T-2 baseline 220 -> 141.

Refs #4564
Refs #4565

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

# Conflicts:
#	tests/lifecycle/scenarios/test_ownership_siblings.py
…ck lock cells

- new scenarios/test_deployed_absent.py: gate levels over an absent
  deployment, offline and target-change redeploys, uninstall and
  marketplace with nothing deployed, an approved local bundle at both
  scopes (runs the approval hint the parked install prints)
- new scenarios/test_pack_lock_states.py: pack builds from a stale lock;
  pack refuses a lock a newer APM wrote (declared NEWER_LOCK refusal)
- user-scope canvas row; the kit observes user-scope lsp and canvas
  surfaces; the world table records the user-scope canvas path
- pair|DEPLOYED=absent|GATE=denied-dependency joins POLICY_REFUSALS

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

# Conflicts:
#	tests/lifecycle/scenarios/test_ownership_siblings.py
#	tests/quality/lifecycle_obligations.json
…ane-w3b

# Conflicts:
#	tests/lifecycle/generator/witnesses.py
#	tests/lifecycle/scenarios/_kit.py
#	tests/quality/lifecycle_obligations.json
…pendency deny

The local-bundle spine packs a canvas into p-bmix and installs both bundles under an org dependency deny (the install refuses and changes nothing); the pack spine packs under the same deny (pack refuses and ships nothing). Bundle installs that deploy credit the local-bundle source cells they act on.

Co-authored-by: Copilot App <[email protected]>
…t-only one

machine_witnesses took the first spine by node id; when that spine held only strict known cells (the user-scope bin spine under a dependency deny, #3703) the project matrix's passing receipts were hidden and five pairs read known-failing.

Co-authored-by: Copilot App <[email protected]>
…remote LSP)

Restores the b5 M-SOURCE code the b5 squash left unstaged (audit_pass,
decide_pass, the parked p-lsp bundle) and adds b6:

- decide_pass drives every package with executables through allowed,
  denied-executable and revoked-after-deploy, with an install (and a
  marketplace update) at each level; local bundles are approved by the
  content key approve --pending prints, after the deny (the p-exec
  bundle's hook file shares the p-exec package's name).
- lsp_source_pass declares the git-published p-lsp as a git shorthand and
  from the world's git catalog, through install/update/prune/compile/lock,
  audit, approve and a withdrawn approval, and uninstall.
- prune_pending: install keeps a departed dependency's apm_modules checkout
  and prune removes it (install.md), so prune after such a change is not a
  converged byte no-op.

Ledger vs train 5 @9e909beb: baseline 385 -> 351; T-2 baseline 94 left.

Refs #4564
Refs #4565

Co-authored-by: Copilot App <[email protected]>
The U-MCPOWN-USER reader test also checks the ledger records exactly the retired-owner removals; the DEPLOYED=absent uninstall test reads the lockfile on disk.

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

Train 5's M-SOURCE b7 earns canvas/LSP from git, catalog and registry and
the native plugin's hook and LSP, so the scenario copies go; the module
keeps compile and lock over a local bundle (test_local_bundle_commands.py).

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

test_m_source (T-2 b8) already proves lock and compile keep every local
bundle's records, so this module credited no new cell. Regenerated on
train 5 (e1e9faf): 14 cells flip (10 HOSTID, 4 offline sources),
baseline 37 -> 23.

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 22, 2026 18:34
@danielmeppiel Daniel Meppiel (danielmeppiel) added the full-integration Run the full integration suite (ci-integration.yml) on this PR before merge label Nov 22, 2026

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 witnesses are excluded from PR validation, and audit cells can receive credit without successful replay because they lack strict CI auditing and an explicit clean-drift check.

2 open issues
What changed in this PR

Expands APM’s lifecycle test coverage for host identity and offline sources in T-2 (#4096). The current diff also includes train 5 (#4758); the additional T-2 work credits 14 cells beyond that train without changing production behavior.

Changes:

  • Adds host-identity scenarios for audit, newer-lock refusal, and marketplace installs.
  • Extends lifecycle scenarios, machine coverage, and deployment assertions carried by train 5.
  • Updates witness selection, obligation rules, generated replay rows, and CI duration estimates.
File Description
tests/​quality/​test_scenario_refusal_credit.py Extends validation to lockfile refusal credits.
tests/​lifecycle/​world/​test_world.py Corrects the user-scope canvas expectation.
tests/​lifecycle/​world/​services.py Expands dependency and MCP denial fixtures.
tests/​lifecycle/​world/​registry.py Publishes LSP and canvas fixtures.
tests/​lifecycle/​world/​packages.py Adds native executable and git canvas fixtures.
tests/​lifecycle/​world/​builder.py Registers the additional package sources.
tests/​lifecycle/​scenarios/​test_user_scope.py Adds user-scope lifecycle scenarios.
tests/​lifecycle/​scenarios/​test_target_history_sources.py Covers target changes across sources and gates.
tests/​lifecycle/​scenarios/​test_policy_pairs.py Reuses source helpers and adds lock-state credits.
tests/​lifecycle/​scenarios/​test_pack_lock_states.py Covers stale-lock packing and newer-lock refusal.
tests/​lifecycle/​scenarios/​test_ownership_siblings.py Adds lock context and updates defect tracking.
tests/​lifecycle/​scenarios/​test_mcp_ownership_history.py Covers current and retired MCP ownership.
tests/​lifecycle/​scenarios/​test_lock_states.py Adds cross-factor lock-state scenarios.
tests/​lifecycle/​scenarios/​test_host_identity_pairs.py Adds HOSTID audit, refusal, and marketplace scenarios.
tests/​lifecycle/​scenarios/​test_history_upgrade.py Uses successful audit and pack history cases.
tests/​lifecycle/​scenarios/​test_file_routing.py Checks instruction placement per target.
tests/​lifecycle/​scenarios/​test_deployed_absent.py Covers missing deployments and restoration.
tests/​lifecycle/​scenarios/​_sources.py Centralizes scenario source setup.
tests/​lifecycle/​scenarios/​_kit.py Strengthens oracles and enables T-2/T-3 credits.
tests/​lifecycle/​replay/​rows/​generated_cover-08-exec-git-single-deny-mcp.yaml Removes an inapplicable bin credit.
tests/​lifecycle/​replay/​rows/​generated_cover-06-exec-git-single-approve-mcp.yaml Aligns the row ID and removes a bin credit.
tests/​lifecycle/​replay/​rows/​generated_cover-05-exec-lsp-git-single-deny-mcp.yaml Aligns the generated row ID.
tests/​lifecycle/​replay/​rows/​generated_cover-03-skill-exec-git-multi-unapproved-mcp.yaml Removes inapplicable bin gate credits.
tests/​lifecycle/​replay/​rows/​generated_cover-02-skill-exec-canvas-local-multi-deny-mcp.yaml Removes inapplicable audit and prune bin credits.
tests/​lifecycle/​replay/​rows/​generated_cover-01-skill-exec-lsp-canvas-git-single-approve-mcp.yaml Removes inapplicable audit and prune bin credits.
tests/​lifecycle/​machines/​test_m_source.py Expands source operations, gates, and primitive assertions.
tests/​lifecycle/​machines/​test_m_gate.py Extends gate coverage and hook reapproval checks.
tests/​lifecycle/​machines/​_gate_matrix.py Adds instruction rendering and explicit gate checks.
tests/​lifecycle/​machines/​_gate_bundle.py Extends canvas, packing, and policy-denial coverage.
tests/​lifecycle/​machines/​_gate_bin.py Adds tracked user-scope policy-denial cases.
tests/​lifecycle/​journeys/​enterprise/​E03-proxy-only-air-gapped.yaml Updates the expected marketplace plugin count.
tests/​lifecycle/​generator/​witnesses.py Registers scenarios and prefers passing witnesses.
tests/​lifecycle/​generator/​test_generator_rules.py Adds rule and witness-selection regression checks.
tests/​lifecycle/​generator/​rules.py Refines bin, MCP, and ownership obligation rules.
tests/​lifecycle/​generator/​emit.py Distinguishes unchanged targets from target changes.
.github/​ci-durations/​linux-x86_64.json Adds timing estimates for test shard balancing.

Review effort: Balanced

scenario.run("install", credit=first)
_assert_row(scenario, hostid)
scenario.assert_deployed()
step = scenario.run("audit", credit=[{"OP": "audit", "HOSTID": hostid}])
…primitive (T-2)

The world's remote packages ship skills only, so each row serves its own
package from a scenario-local git repository: an instruction package from
git and from a git catalog, and a native Claude plugin with an agent. compile
leaves the lock bytes and every marked deployed file unchanged, and the
instruction stays under copilot's instruction root and in the lock.

Credits T3|OP=compile|SRC={git, marketplace-git, native-plugin}|PRIM=other-file.
Both T-2 scenario modules join Lifecycle Smoke so PR CI runs them.

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 native-plugin scenario uses a scope that prevents the required lock record, while the host-identity audit assertions can pass even when replay fails or is skipped.

2 open issues
1 resolved since last review

Review effort: Balanced

… not registered

claude_plugins/admission.py registers a plugin natively only at user
scope; at project scope the plugin's agents/ deploy under .claude/agents
and are recorded in the lock like any primitive. The native-plugin row
now asserts that deployed agent instead of a native_plugin lock record.

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.

🔵 Needs a closer look

The lifecycle test can award HOSTID credit for failed or skipped audit replay, and its misplaced ref installs the default branch instead of the intended tag.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Place the dependency ref inside source to test the pinned version

tests/​lifecycle/​scenarios/​test_host_identity_pairs.py:120

The ref is ignored in this catalog shape: parse_plugin_entry retains the source object, and _source_pin reads ref from that object, not the surrounding plugin entry. This therefore installs the ported repository's default branch rather than v1.0.0; identical branch/tag contents hide the mistake. Move the pin inside source so the fixture exercises the intended pinned dependency.

1 resolved since last review

Review effort: Balanced

…SOURCE instruction

#4005 routes Claude '**' instructions to AGENTS.md through compile, so the M-SOURCE instruction uses a file-type glob (as test_file_routing does on main) and keeps a per-file rule on every deployed target the other-file oracle checks. The user-scope native-plugin row reports ~/.claude and the install output when Claude settings are missing.

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

p-native-claude ships an MCP server, so a first user-scope install parks the whole plugin (exit 0, no Claude settings) until it is approved; that is the gate working. The row now installs, approves and installs again; only that install earns SRC=native-plugin, and it must leave a user lock row and an enabled ~/.claude/settings.json entry.

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.

🔵 Needs a closer look

The HOSTID audit test can pass when drift replay fails or is skipped because it accepts a successful exit code and rereads an unchanged lock row instead of verifying that replay ran and completed cleanly.

1 open issue

Review effort: Balanced

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.

🔵 Needs a closer look

The HOSTID tests can falsely credit dependency replay because audit may exit successfully when replay fails or is skipped, and unchanged lock rows do not prove replay ran and succeeded.

1 open issue

Review effort: Balanced

@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Superseded by train 6 #4814, which carries this PR's commits with a single regenerate (generated-file-coupled PRs land serially). Closing to avoid a duplicate landing.

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