Skip to content

test(lifecycle): M-SOURCE context ids, native and bundle primitives (T-2 drain 1) - #4592

Closed
Daniel Meppiel (danielmeppiel) wants to merge 4 commits into
mainfrom
danielmeppiel-ql-w1-t2-source-drain
Closed

Daniel Meppiel (danielmeppiel) wants to merge 4 commits into
mainfrom
danielmeppiel-ql-w1-t2-source-drain

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

First T-2 (M-SOURCE) baseline drain of the 0.38 burn-down. 78 lifecycle obligations move from baseline to required (T-2 lane 496 -> 418). One more becomes a strict known cell, which a product bug found here now tracks.

  • Context ids. tests/lifecycle/machines/test_m_source.py credits X|<op>|<form>|<FACTOR>=<value> through oracles.check_obligation. The credit happens at the real steps that ran in that state: scope, network, unchanged single or multi target set, gate level of executable kinds (unapproved-exec; GATE=none only when no executables gate is configured, which the next batch witnesses), a clean prior deployment, and the --force, --update, --frozen and --target modifiers. X_CONTEXT lists the set statically, and the spine asserts that every id earns a receipt. tests/lifecycle/generator/witnesses.py reads each id as {OP, SRC, FACTOR}. That discharges pairs like SRC=native-plugin|FORCE=on and SRC=inline-mcp|TGT=multi-unchanged, which the spine already ran but never credited.
  • Native plugins now name the primitives they carry: skill and mcp, plus bin through p-native-claude-bin. They are observed by those primitives, so an unapproved native deployment is an I4 violation.
  • Local bundles. The LSP bundle (p-lsp:bundle) joins the bundle form. Compile and lock of a bundle stay baseline until the gate-off batch deploys its artifacts (review). Update, prune and uninstall of a bundle stay U8 rule cells.
  • context_pass() runs once in the spine: retarget to multi, install, install --force --update --target ..., install --frozen, a forced bundle reinstall, then retarget back. Unchanged-target credit is judged per slot (review).
  • Strict known cell X|install|pkg-registry|UPDATE=on ([BUG] A git-to-registry source switch leaves the stale git .apm-pin in apm_modules until install --update #4572). Switching p-skill from git to the package registry leaves the git .apm-pin in apm_modules/lifecycle/p-skill. It survives repeated apm install until install --update drops it, so I2 fails on a converged state. The cell is matched on that exact path, so pair|SRC=pkg-registry|UPDATE=on is known-failing.

Obligation counts (tests/quality/lifecycle_obligations.json, regenerated on the merge with main 0c349e03):

baseline required known-failing
before 1468 1023 0
after 1390 1100 1

T-2 baseline: 496 -> 418. Other lanes are unchanged.

PR shard cost: the spine adds 11 CLI steps. Profiled locally on the same host and run: 91 -> 101 commands, about +26 s at about 2.5 s per command, plus one bundle install after review. That is about +22 s at CI's roughly 2 s per command. The generated-sequence test is unchanged at 4 examples on PR and 25 nightly.

Issue and approved scope

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

Human scope-approval comment: #4564 (comment)

Does this PR complete the issue, or what remains? No. #4564 closes when the baseline is <= 500 (now 1390). The next T-2 batches cover 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)

Commands run on the merged tree (engine driver, .venv/bin/apm 0.37.0, GIT_EXEC_PATH unset):

  • pytest tests/lifecycle/machines/test_m_source.py with APM_LIFECYCLE_RECEIPTS_DIR set: 2 passed (spine 426 s on a loaded shared host, generated sequences 46 s).
  • pytest tests/quality/test_promise_obligations.py -k merged_receipts over those receipts: 1 passed (ratchet holds, nothing left to promote).
  • pytest tests/quality/test_promise_obligations.py tests/quality/test_generated_obligations.py tests/lifecycle/generator/test_generator_rules.py: 74 passed.
  • python -m tests.lifecycle.generator --check: up to date.
  • Lint contract: uvx [email protected] check and format --check (src, tests, scripts) pass; pylint R0801 10.00/10; lint-auth-signals.sh clean; check_complexity_ratchet.py --base-ref origin/main clean; python -m tests.quality.taxonomy --changed: tm006 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.

…T-2 drain 1)

M-SOURCE now credits context ids X|<op>|<form>|<FACTOR>=<value> at the
real steps that ran in that state (scope, network, unchanged target set,
gate, a clean prior deployment, --force/--update/--frozen/--target), and
the generator reads each one as {OP, SRC, FACTOR}. Native plugins name
the primitives they carry (skill, mcp, bin via p-native-claude-bin), the
LSP bundle joins the bundle form, and compile/lock now act on a project
holding a local bundle. One context pass (multi-target, force/update,
frozen, bundle reinstall) adds 10 CLI steps to the spine.

Baseline 1468 -> 1380 (T-2 496 -> 408); one strict known cell:
X|install|pkg-registry|UPDATE=on (#4572, a git->registry source switch
leaves a stale .apm-pin until install --update drops it).

Also re-anchors the update.py evidence lines of the generator rules,
which drifted on main (test_every_rule_cites_code_that_still_says_it).

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

Coverage receipts are credited without primitive-specific deployment or bundle artifact evidence, while shared target history incorrectly credits unchanged-target behavior across unrelated sources.

3 open issues
What changed in this PR

This PR advances the lifecycle coverage work in #4564 by extending M-SOURCE witnesses, reducing the baseline from 1,468 to 1,380 obligations without changing production code.

Changes:

  • Adds context receipts for source, target, gate, scope, network, and install modifiers, plus a multi-target spine pass.
  • Expands native-plugin primitive and local-bundle coverage; records the stale git-pin bug in #4572 as a strict known failure.
  • Regenerates the obligation catalog with 87 additional required cells and one known-failing cell, and refreshes update-command evidence anchors.
File Description
tests/​quality/​lifecycle_obligations.json Updates witness aliases, obligation statuses, counts, and digest.
tests/​lifecycle/​machines/​test_m_source.py Adds context crediting, fixtures, spine steps, and the strict known cell.
tests/​lifecycle/​generator/​witnesses.py Translates context IDs into factor assignments for generated obligations.
tests/​lifecycle/​generator/​rules.py Reanchors evidence references to current update-command lines.

Review effort: Balanced

…nfigured

GATE=none is GateLevel('none', authority=None): no executables gate.
The lifecycle world configures executables.allow, so a skill-only
package there has no gate level; its GATE=none cells move to the
gate-off phase of the next batch.

Refs #4564

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

# Conflicts:
#	tests/quality/lifecycle_obligations.json
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Superseded by the train #4598, test(lifecycle): corpus train 1 (T-1 batch 1 + T-2 drain 1). The train merges this branch with --no-ff (authorship preserved) together with the other ready corpus batch, and regenerates tests/quality/lifecycle_obligations.json once. This PR stays open and linked until the train lands.

…gets, bundle ops)

- Native plugins are observed by the primitives they carry (skill, MCP)
  as well as the gated native unit, so an unapproved native deployment
  is an I4 violation the oracle sees.
- TGT=*-unchanged is judged per slot: a step is "unchanged" for a form
  only when that form's last resolving step ran under the same targets.
  The context pass installs the bundle twice under the multi-target set.
- compile and lock no longer act on a local bundle in this batch: an
  unapproved bundle deploys nothing, so those cells wait for the
  gate-off batch, where its artifacts are deployed and checked.

Baseline 1468 -> 1390 (T-2 496 -> 418), 1 strict known (#4572).

Refs #4564

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

Copy link
Copy Markdown
Collaborator Author

Superseded by #4598 (corpus train 1), which folded this branch at 52732d2 and merged as bfff927. Counts on main after the train: baseline 1253 / required 1237 / known-failing 1; T-2 baseline 496 -> 418, strict known X|install|pkg-registry|UPDATE=on (#4572).

@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-ql-w1-t2-source-drain branch November 23, 2026 08:29
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