Repository navigation
test(lifecycle): a required harness cell whose witness skips or is not collected fails - #5800
Open
Daniel Meppiel (danielmeppiel) wants to merge 79 commits into
Open
Daniel Meppiel (danielmeppiel) wants to merge 79 commits into
Daniel Meppiel (danielmeppiel) wants to merge 79 commits into
Conversation
…t collected fails A required cell in tests/quality/harness_conformance.json must earn a passing receipt. Until now ReceiptWitnessPlugin only checked witnesses that passed, so a skipped witness left its required cell unproven without failing anything. - ReceiptWitnessPlugin fails a skipped or xfailed witness of a required cell (setup or call phase), naming every cell and the skip reason. A cell that no longer applies leaves through the contract (applies()), not a run-time skip. Skips of nodes that witness no required cell stay skips. - harness_ratchet.uncollected_witnesses(): every required witness node must be collected (pytest --collect-only over the witness modules), so a renamed or unparametrized witness is refused. - Mutation tests: a required witness that skips fails the gate (pytester), a skip outside required cells stays a skip, and a dropped node is named as not collected. Refs #5796 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Required witness xfails can still leave the test run successful because reports converted to failed retain report.wasxfail, causing pytest to exclude them from its failure count and the evidence collector to record them as xfails. Separately, the collection subprocess inherits the parent’s receipt session and consumes pending receipts during its collection-only merge; if later witnesses emit receipts, the parent’s final merge can overwrite the session file and lose earlier evidence.
2 open issues
What changed in this PR
Strengthens lifecycle harness conformance checks for required witnesses, addressing the test-only portion of #5796.
Changes:
- Adds checks for skipped or xfailed required witnesses.
- Detects required witness nodes missing from collection.
- Adds mutation tests while preserving skips outside required cells.
| File | Description |
|---|---|
| tests/quality/test_harness_conformance.py | Adds collection checks and skip mutation tests. |
| tests/lifecycle/obligations.py | Converts required-witness skips into failure reports. |
| tests/lifecycle/harness_ratchet.py | Collects witness node IDs and identifies missing nodes. |
Review effort: Balanced
| "addopts=", | ||
| *paths, | ||
| ], | ||
| cwd=root, |
Comment on lines
+280
to
+281
| report.outcome = "failed" | ||
| report.longrepr = failure |
…easured; plain skips and untracked xfails fail Refs #5796 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…quired cells A required cell's witness passes with a receipt, or is a strict KnownFailure listed in required_known_failing whose tracking equals the ledger issue, whose issue is open (closed-issue gate), and whose failure matches. Any other xfail, a skip in any phase, an uncollected node or a strict XPASS fails. The ledger only shrinks against the merge-base; a base without the section compares against the frozen 8-cell #5797 set. Refs #5796 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adds src/apm_cli/lens/: model.py, the stdlib-only interface contract of the apm list inventory (frozen dataclasses Source, Evidence, HarnessRef, Location, Item, CoverageCell, NotVisible, Inventory), and verdict.py, the only evidence -> state judgment (state, folder_content, item_state). Registers the lens-observation owner with guard registry-delegation-lens-observation: model.py imports only the standard library, only verdict.py writes an APM health state, and no lens module writes, deletes, spawns or opens a socket. One mutation case proves it. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
J13 step 1 now runs 'apm run --list' against an O1 golden captured from today's 'apm list' (the 0.39 scripts table), and asserts it runs nothing. Step 4's diagnose advice moves to 'apm run --list'. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
'apm run --list' prints the 'apm list' scripts table or the No scripts found panel byte-for-byte, exits 0 and runs nothing, so bare 'apm list' can switch to the agent-config inventory. The script-not-found hint and the docs now point to 'apm run --list'. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adds the test-only R0 layer of the apm list test plan: structured oracles, pending-witness promises, laws, schema, mutations and static guards. No committed cells: every HC-LIST promise stays pending-witness, so the harness ratchet is untouched. - oracles.Evidence gains json_equal and rows_equal (parsed path plus expected value), checked inside check_obligation; a mismatch or an unparseable output fails with no receipt. - tests/lifecycle/list_oracle.py is the one parser of apm list output (schema-validated JSON views; text rows by header column spans; summary and footer by exact clause and line). - HC-LIST-01..15 and HC-LIST-03.targets appended to harness_contract.py as pending-witness; HC-LIST-07 carries scopes=(user,) with a citation. - P-LAW-list.* laws in the property catalog as forward laws citing #5745; the ledger guard accepts a law only when bug-referenced or forward with a cited issue. - JSON Schema plus 4 outcome fixtures; S137 AST guard; C6 clone proof; tests/lifecycle/mutations/list.yaml. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
lens/apm_layers.py reads one scope's lockfile once and turns its deployment ledger rows into logical items: kind and name come from the target layout, rows for one physical path are deduped (targets kept apart), and projections of one package item collapse into one item with several locations. Each unique physical file is classified once through deps/file_provenance.classify_file (made public at its owner). Folder items get a bounded recursive name walk without link following: a file outside the record makes the folder modified, a partial walk leaves it unverifiable. Recorded values that escape their root are rejected lexically, before any filesystem call. 'orphaned' is not produced in 0.40 (declared is 'yes' for every locked owner). Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
'apm run --list' no longer imports from list_cmd, whose scripts body goes away when bare 'apm list' switches to the inventory. The renderer lives in run.py (a new module would need an architecture owner); output stays byte-identical. The list_cmd unit cases are ported to test_run_list.py. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
lens/inventory.build(ctx) reads each requested scope's APM layer once, asks the reader package for native observations (an empty scan until the readers land) and joins them: a native observation at or inside a path an APM item lists is dropped, so one physical path is one location; a scope whose lockfile is unreadable turns its native items into not-checked. APM locations take HARNESSES from the reader records and keep ledger targets apart. --target and NAME selection run before states are summarised, and under exactly one --target same-name copies get the documented ORDER (higher/lower with order_rank, coexist, or unknown; a missing copy is never ranked). The context carries the keys the renderer needs. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…es detection The build input key for the --target selection is 'harnesses' (the target vocabulary guard rejects a raw targets read in src). build() resolves the detected harnesses (signal folders at the project and home roots, apm.yml targets and ledger targets, kept to harness reader records) and passes the selection and the detected set to the readers' scan. ORDER under one target now uses the readers' tier_of and the record's ranked/coexist/unknown rule: copies in one tier tie, and a copy whose tier cannot be read is unknown. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
MCP ledger rows (uri locators under target mcp, one per runtime) become MCP claims instead of file items. The inventory joins each claim to the readers' observation of that server name for that runtime at that scope: the location takes the observed config path and entry pointer, the observation is claimed (not listed again as unrecorded), and the entry is compared with the recorded fingerprint through the ownership owner's mcp_native_hash, imported only when an entry is compared. Entry values are read only for that comparison and never returned; the item carries the readers' keys-only shape. An entry not observed is unverifiable. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Mark test_run_list.py as component (it writes apm.yml and drives Click), and keep the docs truthful while bare 'apm list' still lists scripts. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Run tests/quality/test_list_{conformance_guards,oracle}.py in the
ratchet contracts job (ci.yml and merge-train.yml, kept identical).
- P-LAW-list.* forward laws are phase 0: no spine transition covers them
until the list observation invariant lands.
- list_oracle: the command kind and Commands section; an empty inventory
summary has no clause; rows() refuses -v detail lines, and details()
attaches them to the row above.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
User-scope APM items now say they are declared in the $APM_HOME manifest, shown as ~/.apm/apm.yml when it sits under the home root; project items keep apm.yml. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The oracle unit test credited a pending-witness cell id; use a neutral cell id so the pending-witness leak guard stays clean. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Under -g the project scope has no root, so context.roots values may be null. Reader order rules name the item kind (skill), unlike sources (skills); HC-LIST-10 now applies where a skill rule is recorded. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…paths
- Item names drop any extension the registry gives the primitive, so one
instruction deployed as name.instructions.md and name.md is one item.
- ORDER ranks each copy by the tier of its best location the target reads;
only copies sharing a best tier tie.
- Recorded paths that map to no primitive layout, and paths not confined to
their root, are coverage cells, never a made-up 'file' item; 'canvas'
joins the kind vocabulary.
- User-scope rows under $HOME are matched under the target root install
resolves (root variables such as CLAUDE_CONFIG_DIR honoured).
- Path dedupe and the ancestor manifest hint are separator-agnostic
('../apm.yml' on every OS).
- The folder walk cap is a read_layer parameter, so tests pass it instead
of patching the owner.
Refs #5754
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The lens read-only guard reserves .replace( for Path.replace; check both POSIX and Windows component forms instead. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- HC-LIST-01..10, 13, 14, 15 and 03.targets are live; 348 cells move to required (never baseline) with witnesses in test_list_conformance.py and test_list_readers_conformance.py. HC-LIST-11, 12 and 16 stay pending-witness. - The witness helper is check_witness (it calls check_obligation). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
A recorded value with a .. component is refused even when it normalizes back inside the target root, in POSIX and Windows spellings, and nothing is looked up on it. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Claude's docs: with CLAUDE_CONFIG_DIR set, 'The same applies to .claude.json, which otherwise sits at ~/.claude.json' (claude-directory). APM's claude adapter writes user MCP there too (resolve_user_claude_unresolved_path). Refs #5746, #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…e first-run journey - INV-L1 includes the project's own local deployed files, which list shows as APM items (spine mandatory replay green on every variant). - imports.list is measured on an empty project with an empty HOME and a minimal environment, the journey the row was measured on. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
An APM MCP row for a runtime with no signal folder (opencode at user scope) left the runtime undetected, so its documented MCP file was never read and the entry never matched. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Hermes keeps MCP servers under mcp_servers in config.yaml; the entry reader parsed only JSON and TOML, so a hermes entry APM wrote was unverifiable. YAML goes through the bounded yaml_io loader. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…s exact path Hermes and Windsurf document only a user MCP file, so a project install writes there. When no same-scope observation matches, the claim is matched only at the exact file the runtime's adapter writes for that scope, never by name across scopes: a same-name user entry APM did not write stays not installed by APM. Refs #5754 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
linux 108 (CI runner) and darwin 111 (local) on the first-run journey; a platform with no row is held to the CI maximum. A drop must tighten the row in the same PR; the trim to +90 is #5817. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… 111 - The live-promise and C6 (b) guards scan test_list_conformance.py and test_list_readers_conformance.py. - imports.list: linux measured 111 on the CI runner (train t1203010), equal to darwin; exact, shrink-only, trim in #5817. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
list-missing-items joins COMPONENT_ONLY: apm list only observes, the printed sentence is asserted in tests/unit/lens/test_render.py, and its 'apm install' is the executed dependencies-not-installed command. apm-spec-waiver: lazy PEP 562 exports in integration/__init__.py and the commands packages; import-time only, no OpenAPM-observable behaviour change Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
apm-spec-waiver: deps/file_provenance.py classify_file rename (C) and integration/__init__.py lazy PEP 562 exports (D); import-time only, no req-* behaviour change Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…t (S141) D removed the scripts table from list_cmd (run.py is its single owner, #5806). TestListCmd in tests/integration/test_coverage_phase4.py patched list_cmd._list_available_scripts/_get_console and is deleted. Each of its seven behaviours already has an exact oracle in tests/unit/commands/test_run_list.py: - test_no_scripts_shows_warning_and_example -> test_run_list_prints_the_0_39_list_output_and_runs_nothing[no-scripts-panel] (exact bytes) + test_no_scripts_panel_gets_the_example_block - test_scripts_shown_via_fallback_no_console -> test_plain_fallback_without_console[start-is-default, no-default] (exact output) - test_start_script_marked_as_default -> test_run_list_prints_the_0_39_list_output_and_runs_nothing[scripts-table] (exact "[>] | start" row) + test_plain_fallback_without_console[start-is-default] - test_scripts_shown_via_rich_console -> test_rich_console_prints_table_then_default_note (console.print call count) + [scripts-table] exact table - test_exception_in_list_scripts_exits_1 -> test_read_error_exits_1_with_the_error (exit 1 + "[x] Error listing scripts: disk error") - test_no_scripts_rich_panel_import_error_fallback -> test_no_scripts_panel_fallback_on_import_or_name_error (exact output, ImportError and NameError) - test_rich_console_exception_falls_back_to_simple -> test_rich_failure_falls_back_to_plain_once (one plain listing, every name, default note) Stale text after the bare apm list switch: the canvas page's "not shown by apm list", and a lifecycle test docstring that said apm list never reads the lock. (troubleshooting/index.md is B's hunk; fixed there to avoid a merge conflict.) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The failed `apm run missing` prints the exact stderr line "Run 'apm run --list' to see each script and its command." The test runs that step, checks that it reaches the scripts table, and checks that it changes no durable state. Docs: the troubleshooting entry and the run reference no longer say what bare `apm list` shows. The entry points to `apm run --list` for scripts, so it stays true before and after the inventory switch. Refs #5756 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
After the switch, bare 'apm list' is the inventory: each row is an item a harness reads and SOURCE names the package that installed it. The entry now says so, shows 'apm list <package>' for one package, keeps the 'apm deps' pointers and 'apm run --list' for scripts. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Merges B's signed head (no rebase) so D merges cleanly after B on main. packages/apm-guide/.apm/skills/apm-usage/commands.md, Scripts table, resolved to exactly two rows after `apm preview SCRIPT`: B's `apm run --list` row as B has it, then D's `apm list [NAME]` inventory row. The stale "`apm list` | List available scripts" row is removed (S141); no other "List available scripts" or apm-list-means-scripts text remains in the tree. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…rime # Conflicts: # tests/quality/known_cell_issue_states.json # tests/quality/known_cell_issues.py
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Dec 3, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> # Conflicts: # tests/quality/harness_conformance.json
5 of 10 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
a8e5aa1d19afbf1a1386c729ec69e03cdc92906e↑ Train head a8e5aa1 = 50b2e27 + merge A 977f548 + merge F' 0fcc972; two conflicts resolved as a pure union (issues 5745 and 5797 OPEN; both known_cells updates kept).
↑ Locally tests/quality plus the harness witness module: 1331 passed, 14 non-required skips, 0 failed; CI-mirror lint clean; L1 verified the mechanical merge with #5801.
↓ One CI check on a8e5aa1 still pending at assessment time.
Description
This PR changes two things in the harness conformance ratchet (
tests/quality/harness_conformance.json). A required cell whose witness is skipped now fails, and so does a required cell whose witness node is not collected. Before,ReceiptWitnessPluginonly checked witnesses that passed, so a skipped witness left its required cell unproven and nothing failed. A cell that genuinely does not apply should leave through the contract (applies()), not through a skip at run time.tests/lifecycle/obligations.py:skipped_witness_failure()and the plugin hook turn a skipped or xfailed witness of a required cell (setup or call phase) into a failure. The failure names every affected cell and the skip reason. Skips of nodes that witness no required cell stay skips, for example theroot-variablevariants oftest_hc_compile_01.tests/lifecycle/harness_ratchet.py:uncollected_witnesses()andcollected_witness_nodes()check that every required witness node is collected, usingpytest --collect-onlyover the witness modules. A renamed or unparametrized witness is refused.tests/quality/test_harness_conformance.pyadds:Required-witness rule (QL amended). A REQUIRED cell's witness outcome is OK only if:
required_known_failingintests/quality/harness_conformance.json; (b) theKnownFailuretracking equals the row's issue; (c) that issue is OPEN (the ledger rows are known cells, so the closed-issue gate and theknown_cell_issue_states.jsonsnapshot cover them); (d) the failure matches theKnownFailurematch (the known plugin fails an off-signature failure).Everything else fails: a strict xfail outside the ledger, a non-strict xfail or
pytest.xfail()(the message carriesxfail:), a skip in any phase, an uncollected node, a strict XPASS. The ledger holds exactly the 8 HC-UNSUP-01 cells citing #5797 and is SHRINK-ONLY against the merge-base (resolve_base_commit()andratchet_at()); a base without the section compares against the frozen 8-cell set (BOOTSTRAP_KNOWN_FAILING).Milestone 0.40.0. This is step 1 of #5796, and it is test-only. Step 2 covers the HC-UNSUP-01 generalization and its product reporter (#5797). A separate step 2 PR finishes the work tracked in #5797 and #5796.
Issue and approved scope
Issue: Refs #5796
Human scope-approval comment: PGM sequencing ruling for #5796 (step 1 test-only, step 2 under the #5797 scope record #5797 (comment)).
Does this PR complete the issue, or what remains? Part (a) of #5796 is done here. Part (b), the HC-UNSUP-01 generalization, lands with #5797.
Type of change
Testing
All commands ran locally through the host guard, sequentially with
-p no:xdist, on base maincafb1bbb:pytest tests/lifecycle/scenarios/test_harness_conformance.py tests/quality/test_promise_obligations.py tests/quality/test_generated_obligations.py: 275 passed, 14 skipped.root-variablevariants oftest_hc_compile_01, which witness no required cell, so the new gate correctly keeps them as skips.pytest tests/quality/test_harness_conformance.py: 29 passed. That includes the new collection check, which found no uncollected required cells on main.1 failed, 1 skipped, and the failure text namesHC-UNSUP-01|t|projectand the skip reason.pytest tests/quality/test_harness_conformance.py tests/quality/test_known_cells_cite_open_issues.py tests/quality/test_promise_obligations.py tests/quality/test_generated_obligations.py: 122 passed. Pytester cases: ledger cell + strict + open issue -> xfailed; same cell outside the ledger -> failed (xfail:); tracking test(harness): a skipped witness on a REQUIRED conformance cell must fail the ratchet; generalize HC-UNSUP-01 #5796 vs ledger [BUG] install silently drops primitive kinds the target does not carry (no HC-UNSUP-01 diagnostic) #5797 -> failed; off-signature and strict XPASS -> failed; non-strict, untracked and run-time xfail -> failed (xfail:); setup-phase skip -> error naming the cell; ledger growth and re-keying -> refused; ledger issue CLOSED -> reported byclosed_cells.pytest tests/lifecycle/scenarios/test_harness_conformance.py tests/quality/test_harness_conformance.py tests/quality/test_known_cells_cite_open_issues.py: 271 passed, 14 skipped, 8 xfailed. The 8 xfails are exactly thetest_hc_unsup_01ledger cells (agent-skills p/u, antigravity p, gemini p/u, hermes p, windsurf p/u), reason "[BUG] install silently drops primitive kinds the target does not carry (no HC-UNSUP-01 diagnostic) #5797 ...".lint-auth-signals.sh,check_complexity_ratchet.py --base-ref cafb1bbb,check_test_assertions.py,check_exact_test_duplicates.py,lint_architecture_boundaries.py --root ., andtests.quality.taxonomy --changed.Changelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.