Skip to content

test(lifecycle): credits earned as claimed: unchanged targets, user-scope gate, per-target routes - #4756

Closed
Daniel Meppiel (danielmeppiel) wants to merge 1 commit into
mainfrom
w2b-credit-integrity-followup
Closed

Daniel Meppiel (danielmeppiel) wants to merge 1 commit into
mainfrom
w2b-credit-integrity-followup

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

Fast follow-up to #4711 (stacked on its frozen head c6da09b; retargets to main once #4711 merges). It fixes three credit-integrity findings from Copilot's review of the earlier lapse train head. None of them changes an obligation status: the ledger stays at 531 / 5 / 1911 on #4711. With these fixes, the credits are earned the way the ledger claims.

  1. Lane routing of unchanged targets (tests/lifecycle/generator/emit.py). lane_for used endswith(("widened", "narrowed", "changed")), which also matched single-unchanged and multi-unchanged. An unchanged target set is not target history, so pair|TGT={single,multi}-unchanged|NET=offline now routes to T-6e (offline), not T-6a. Both cells stay required. The bare TGT=changed refusal cell keeps T-6a. New case: test_generator_rules.py::test_only_a_changed_target_set_routes_an_offline_pair_to_target_history checks the router and the committed ledger.
  2. User-scope gate in the M-GATE matrix (tests/lifecycle/machines/_gate_matrix.py). The model turned the gate on for every approve. A user-scope approval (APM_HOME/config.json) never opens the gate, though: security/executables.py enables it only for a manifest executables: block, a user deny or an org signal. So the user-scope "allowed" probes ran with the gate off. Now approve opens the gate only at project scope. The user pass opts the user manifest in with gate_on(), as the bin spine does, and assert_gate_enforced checks on the real CLI that the lock records exec_status: deployed for each approved package. package_exec_decision omits that status while the gate is off. The credited ids are unchanged and are now earned with the gate on.
  3. Per-target file routing (tests/lifecycle/scenarios/test_file_routing.py). A deployed-route row only checked that some file carried the instruction marker. It now asserts the marker under every current target's instruction root (KNOWN_TARGETS[...].primitives["instructions"]) and under no dropped target's.

Issue and approved scope

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

Human scope-approval comment: #4564 (comment)

Does not complete #4564: test-corpus credit-integrity fixes only.

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 (host_guard, real CLI, -n 2): test_file_routing.py, test_m_gate.py::test_gate_matrix_credits_op_prim_gate_cells (project + user), tests/lifecycle/generator, test_generated_obligations.py, test_promise_obligations.py, test_gate_cell_obligations.py: 111 passed. python -m tests.lifecycle.generator --check is up to date; ledger status 531 / 5 / 1911 (unchanged; 2 lane moves). [email protected] check/format, AQ, duplicate and taxonomy ratchets are clean.

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.

…cope gate, per-target routes

emit.lane_for routes TGT=*-unchanged offline pairs to T-6e (exact change tokens; bare TGT=changed stays T-6a). The M-GATE user pass opts the user manifest into the gate (a user approval never opens it) and asserts the lock records exec_status=deployed. File-routing rows assert the instruction under every current target's root and no dropped target's. Ledger status unchanged (531/5/1911).

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 compile and bundle-install checks omit targets, allowing the Copilot scenario to pass without verifying that its instruction exists under .github/instructions/.

1 open issue
What changed in this PR

This follow-up to #4711 strengthens lifecycle test evidence without changing production behavior or obligation statuses.

Changes:

  • Routes unchanged-target offline obligations to the offline lane and adds regression coverage.
  • Explicitly enables the executable gate for approval probes and checks deployed trust status.
  • Adds instruction-routing assertions for current and dropped targets.
File Description
tests/​quality/​lifecycle_obligations.json Moves two unchanged-target offline cells to T-6e.
tests/​lifecycle/​scenarios/​test_file_routing.py Adds per-target instruction placement checks.
tests/​lifecycle/​machines/​_gate_matrix.py Corrects approval gate modeling and verifies lockfile trust status.
tests/​lifecycle/​generator/​test_generator_rules.py Tests changed versus unchanged target lane routing.
tests/​lifecycle/​generator/​emit.py Matches exact target-change tokens instead of suffixes.

Review effort: Balanced

if route == "deployed":
assert marked, "a deployed instruction is a target file carrying the marker"
assert not any(name.endswith(("AGENTS.md", "GEMINI.md")) for name in marked), marked
for name in targets:
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Superseded by #4758: corpus train 5 folds this commit (7302d8e) as is, so it lands there with one regenerate instead of taking a separate desk slot. No ledger status change either way.

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