Repository navigation
test(lifecycle): harness conformance surface witnesses across the registry - #5778
Merged
Merged
Conversation
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Dec 2, 2026
Brings the #5778 surface witnesses (with the F1-F3 oracle fixes) and adds registry-parametrized witnesses for HC-AUDIT-02, HC-POLICY-01, HC-PLUGIN-01.refuse (user), HC-PLUGIN-03 and HC-PLUGIN-03.overlap. 40 of the 41 Pi cells move from baseline to required, each with a passing e2e receipt. HC-POLICY-01|pi|project stays in the baseline: the default unmanaged_files governance directories do not include the Pi root. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Dec 2, 2026
QL ruling on #5778: apm targets resolves the current project and has no -g form, so the promise covers project scope for every target. The restriction is promise-level data (scopes, with a scope_source citing reference/cli/targets.md), not a per-target predicate. The 13 required and 4 baseline HC-TARGETS-01|*|user cells leave the ratchet; nothing else moves. A guard holds a scope restriction uniform across targets and cited, with a negative control that an uncited restriction is refused. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Daniel Meppiel (danielmeppiel)
marked this pull request as ready for review
December 2, 2026 15:25
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
An unconditional Unix-only pty import breaks Windows test collection, while flawed conformance checks and a moving baseline reference can hide regressions or trigger false failures.
5 open issues
What changed in this PR
Extends APM's lifecycle promise engine with registry-driven harness conformance coverage, building on #5775 ahead of Pi support.
Changes:
- Adds real-CLI witnesses across lifecycle operations and scopes.
- Promotes passing cells to required, receipt-backed coverage while retaining baseline gaps.
- Adds contract validation and CI enforcement.
| File | Description |
|---|---|
tests/quality/test_harness_conformance.py |
Validates contract rules, witnesses, and baseline shrinkage. |
tests/quality/promise-catalog.json |
Registers the harness-conformance promise. |
tests/quality/harness_conformance.json |
Records required witnesses and remaining baseline cells. |
tests/lifecycle/scenarios/test_harness_conformance.py |
Adds registry-derived lifecycle witnesses. |
tests/lifecycle/obligations.py |
Loads required harness witnesses into receipt enforcement. |
tests/lifecycle/obligation_space.py |
Includes harness cells in generated obligations. |
tests/lifecycle/harness_ratchet.py |
Loads, validates, and regenerates conformance tracking. |
tests/lifecycle/harness_contract.py |
Defines promises and registry-based applicability. |
.github/workflows/merge-train.yml |
Runs conformance checks in the merge train. |
.github/workflows/ci.yml |
Runs conformance checks in CI. |
Review effort: Balanced
|
|
||
| import json | ||
| import os | ||
| import pty |
Comment on lines
+145
to
+148
| step = _git( | ||
| root, "fetch", "--no-tags", "--depth=1", "origin", f"+refs/heads/{branch}:{_BASE_REF}" | ||
| ) | ||
| resolved = _git(root, "rev-parse", "--verify", _BASE_REF) if step.returncode == 0 else step |
|
|
||
| @pytest.mark.parametrize(("target", "scope"), _hc("HC-ALL-01")) | ||
| def test_hc_all_01(lifecycle_world: World, target, scope) -> None: | ||
| scene = _scene(lifecycle_world, target, scope) |
| and not {"apm_modules", "vendor", "hc-src", ".apm"} & set(p.parts) | ||
| and any( | ||
| m in p.read_text(encoding="utf-8", errors="replace") | ||
| for m in (AGENT_MARKER, HOOK_MARKER) |
Comment on lines
+199
to
+200
| def test_every_required_witness_exists() -> None: | ||
| assert ratchet.witness_problems(ratchet.load_ratchet()) == [] |
…istry Adds one lifecycle witness per HC promise (detect, targets, init picker, --target all, commands, user skills, compile, audit, lock, prune, inventory, target change, unsupported primitives, MCP not-deployed), parametrized by harness_contract.applicable(). Each passing cell emits an e2e check_obligation receipt and moves from baseline to required; cells red on main stay in the baseline. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…racles cover their full promises HC-TARGETS-01: each listed row's deploy_dir equals the registry profile root (apm targets reports the project root for every scope). HC-TARGETCHANGE-01: after narrowing, the lock row's deployed set equals the anchor set and records none of the widened paths. HC-DETECT-01: one flagless install in the detected project deploys only under the target's primitive dirs; the contract oracle text matches. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
HC_DISCOVER=1 widens the conformance witnesses to every applicable cell, so a workflow carrying it would run discovery in place of the ratchet gate. A scan of .github/ refuses it, with a negative control that the scan sees one. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
QL ruling on #5778: apm targets resolves the current project and has no -g form, so the promise covers project scope for every target. The restriction is promise-level data (scopes, with a scope_source citing reference/cli/targets.md), not a per-target predicate. The 13 required and 4 baseline HC-TARGETS-01|*|user cells leave the ratchet; nothing else moves. A guard holds a scope restriction uniform across targets and cited, with a negative control that an uncited restriction is refused. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Daniel Meppiel (danielmeppiel)
force-pushed
the
danielmeppiel-hc-surface
branch
from
December 2, 2026 19:35
a01acef to
3f19cde
Compare
Daniel Meppiel (danielmeppiel)
added a commit
to mohitmishra786/apm
that referenced
this pull request
Dec 2, 2026
…soft#4593) Gemini now carries the agents primitive, so the harness conformance contract generates HC-DEPLOY-01.agents cells for it at project and user scope. Add test_hc_deploy_01_agents on the surface-witness Scene kit (microsoft#5778): install checks the registry path, the lock row, the native frontmatter and body, and emits the OBLIGATION receipt; uninstall emits the absence receipt. List both cells as required in the ratchet. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Dec 2, 2026
Restacked as one commit onto main 4e733b0 (#5775, #5778, #5743 and #5784 landed). This is the net Pi delta of danielmeppiel-pi-target at 0871e7d7 over the stack it carried, applied with no conflicts: - the pi target (registry profile, catalog capability, .pi detection, skills in .agents/skills, commands in .pi/prompts, PI_CODING_AGENT_DIR user root, read verbatim), trust hint, init picker from the registry, unsupported primitive warning once, governance_dirs for unmanaged_files; - project cleanup removes only roots that do not signal their target, and only roots that do are created before a write (materializes_root); an auto_create target's merged hook config is created with its root; - the trust hint also fires for project-only .apm content; - harness conformance: Pi cells all required (zero baseline), HC-PLUGIN-01 .dryrun promoted (26 rows formerly #5781) with an exact-line oracle; main's required cells kept (the carried ratchet had them in baseline), known_failing merged into the promise engine, PI_CODING_AGENT_DIR scrubbed in tests/conftest.py, Pi journey variants, Pi receipts; - real-harness Pi 1.6.0 lane with the cross-spawn and minimatch overrides. apm-spec-waiver: adds the pi target as registry data on the shared target layer; no change to an OpenAPM v0.1 requirement apm-spec-waiver: policy default scan dirs now come from registry data; the existing list is byte-identical and pi adds .pi Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
6 of 10 tasks
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Dec 2, 2026
Restacked as one commit onto main 4e733b0 (#5775, #5778, #5743 and #5784 landed). This is the net Pi delta of danielmeppiel-pi-target at 0871e7d7 over the stack it carried, applied with no conflicts: - the pi target (registry profile, catalog capability, .pi detection, skills in .agents/skills, commands in .pi/prompts, PI_CODING_AGENT_DIR user root, read verbatim), trust hint, init picker from the registry, unsupported primitive warning once, governance_dirs for unmanaged_files; - project cleanup removes only roots that do not signal their target, and only roots that do are created before a write (materializes_root); an auto_create target's merged hook config is created with its root; - the trust hint also fires for project-only .apm content; - harness conformance: Pi cells all required (zero baseline), HC-PLUGIN-01 .dryrun promoted (26 rows formerly #5781) with an exact-line oracle; main's required cells kept (the carried ratchet had them in baseline), known_failing merged into the promise engine, PI_CODING_AGENT_DIR scrubbed in tests/conftest.py, Pi journey variants, Pi receipts; - real-harness Pi 1.6.0 lane with the cross-spawn and minimatch overrides. apm-spec-waiver: adds the pi target as registry data on the shared target layer; no change to an OpenAPM v0.1 requirement apm-spec-waiver: policy default scan dirs now come from registry data; the existing list is byte-identical and pi adds .pi Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Dec 3, 2026
Restacked as one commit onto main 4e733b0 (#5775, #5778, #5743 and #5784 landed). This is the net Pi delta of danielmeppiel-pi-target at 0871e7d7 over the stack it carried, applied with no conflicts: - the pi target (registry profile, catalog capability, .pi detection, skills in .agents/skills, commands in .pi/prompts, PI_CODING_AGENT_DIR user root, read verbatim), trust hint, init picker from the registry, unsupported primitive warning once, governance_dirs for unmanaged_files; - project cleanup removes only roots that do not signal their target, and only roots that do are created before a write (materializes_root); an auto_create target's merged hook config is created with its root; - the trust hint also fires for project-only .apm content; - harness conformance: Pi cells all required (zero baseline), HC-PLUGIN-01 .dryrun promoted (26 rows formerly #5781) with an exact-line oracle; main's required cells kept (the carried ratchet had them in baseline), known_failing merged into the promise engine, PI_CODING_AGENT_DIR scrubbed in tests/conftest.py, Pi journey variants, Pi receipts; - real-harness Pi 1.6.0 lane with the cross-spawn and minimatch overrides. apm-spec-waiver: adds the pi target as registry data on the shared target layer; no change to an OpenAPM v0.1 requirement apm-spec-waiver: policy default scan dirs now come from registry data; the existing list is byte-identical and pi adds .pi Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Mohit Mishra (mohitmishra786)
pushed a commit
to mohitmishra786/apm
that referenced
this pull request
Dec 3, 2026
…soft#4593) Gemini now carries the agents primitive, so the harness conformance contract generates HC-DEPLOY-01.agents cells for it at project and user scope. Add test_hc_deploy_01_agents on the surface-witness Scene kit (microsoft#5778): install checks the registry path, the lock row, the native frontmatter and body, and emits the OBLIGATION receipt; uninstall emits the absence receipt. List both cells as required in the ratchet. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.


Description
Depends on #5775; Milestone 0.40.0. This PR is stacked on #5775 at 1622a4a, so until #5775 lands the diff against main also includes it.
It adds one lifecycle witness per harness-conformance promise in
tests/lifecycle/scenarios/test_harness_conformance.py. Targets come only fromharness_contract.applicable(), with no target literals, and the contract-code guard passes. Each passing cell emits an e2echeck_obligationreceipt.206 cells that pass on main move from
baselinetorequiredintests/quality/harness_conformance.json. Cells that are red on main stay in the baseline, which only shrinks. Pi cells are added torequiredin #5771.Promises covered:
init -ycheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationcheck_obligationNotes:
Issue and approved scope
Issue: Refs #3047, Refs #2908
Human scope-approval comment: harness conformance program for milestone 0.40 (Pi harness lead and QL gate).
Does this PR complete the issue, or what remains? Partial: the remaining baseline rows are tracked under #3047.
Type of change
Testing
Validation evidence (local, sequential):
pytest tests/lifecycle/scenarios/test_harness_conformance.py tests/quality/test_harness_conformance.py: 248 passed, 15 skipped, 1 failed. The failure was the contract-code guard, since fixed.pytest tests/quality/test_harness_conformance.py <module>::test_hc_compile_01gave 38 passed and 15 skipped;-k "hc_all_01 or deploy_01_commands or hc_prune_01"gave 43 passed.HC_DISCOVER=1, every applicable cell, main 62329d6): 86 failed, 230 passed, 28 skipped. Failing cells stay in the baseline.Changelog
Spec conformance (OpenAPM v0.1)
Agent assessment