Repository navigation
test(lifecycle): harness conformance contract and ratchet in the promise engine - #5775
Merged
Daniel Meppiel (danielmeppiel) merged 2 commits intoDec 2, 2026
Merged
Conversation
…ise engine Add the harness conformance contract (#3616) as registry-driven data inside the existing promise engine, with no parallel framework: - tests/lifecycle/harness_contract.py: the promises every harness target is measured against, each with a predicate that declares the registry fields it reads; applies(promise, profile, scope) returns APPLIES, NOT_APPLICABLE (naming the field) or UNKNOWN; project and user scope are evaluated separately; promise status is live, pending-witness or retired. - obligation_space.harness_obligations(): one "<promise>|<target>|<scope>" obligation per APPLIES cell of a live promise, fed into the generated space; obligations.load_generated() reads their required witnesses. - tests/quality/harness_conformance.json: shrink-only ratchet generated at base 62329d6 (15 required, 675 baseline). Required cells name lifecycle witnesses whose OBLIGATION receipts ReceiptWitnessPlugin enforces; unit and static witnesses do not count. HC-DOCTOR-01 is a feature gap owned by #3297. - tests/lifecycle/scenarios/test_harness_conformance.py: the first witness, HC-DEPLOY-01.skills at project scope, parametrized only from applicable(). - tests/quality/test_harness_conformance.py: field-coverage guard (fields are irrelevant only for display or identity), harness-literal guard over the contract code, UNKNOWN or missing predicate fails, exemption rule (feature gap allowed, single-harness gap refused), baseline only shrinks, no committed artifact carries cells of a pending-witness promise, and two mutation proofs: deleting a witness turns its cell red, and a target added to KNOWN_TARGETS without cells fails. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ot base_sha The shrink-only check now resolves its comparison base from the branch the change applies to, never from the ratchet's own editable base_sha: - In CI it fetches the pull request base branch tip explicitly (GITHUB_BASE_REF), or the first parent of HEAD for merge queue and push commits; an unreachable base fails instead of skipping. - Outside CI it uses the merge base with origin/main. - The only skip is a base commit without the ratchet file (the change that adds it) or a local clone without origin/main. - New cells: growth stays refused when base_sha is re-pointed, and an unreachable base raises under CI. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Witness validation ignores parameter suffixes, allowing nonexistent pytest cases to satisfy required cells without receipt enforcement.
6 open issues
Validate complete parameterized witness IDs · New Use effective pack prefixes to identify packable targets · New Use scope-aware native route predicates · New Reject exemptions for closed or unrecorded issues · New Use the workflow’s immutable comparison SHA · New Compare predicate debt against the actual baseline · New
What changed in this PR
Adds registry-driven harness conformance checks to the existing lifecycle promise engine, supporting #3616 and preparing for the Pi target.
Changes:
- Defines harness promises and generates target/scope obligations.
- Adds a shrink-only baseline and receipt-backed skill deployment witnesses.
- Integrates conformance checks into CI and merge-train gates.
| File | Description |
|---|---|
tests/quality/test_harness_conformance.py |
Adds contract validation and mutation checks. |
tests/quality/promise-catalog.json |
Registers the conformance promise. |
tests/quality/harness_conformance.json |
Records required witnesses and baseline gaps. |
tests/lifecycle/scenarios/test_harness_conformance.py |
Adds parametrized skill deployment witnesses. |
tests/lifecycle/obligations.py |
Loads required harness witnesses. |
tests/lifecycle/obligation_space.py |
Includes generated harness obligations. |
tests/lifecycle/harness_ratchet.py |
Implements ratchet validation and regeneration. |
tests/lifecycle/harness_contract.py |
Defines promises and registry-based applicability. |
.github/workflows/merge-train.yml |
Runs conformance checks on merge trains. |
.github/workflows/ci.yml |
Runs conformance checks in CI. |
Review effort: Balanced
| names: dict[str, frozenset[str]] = {} | ||
| for key, node in sorted(ratchet.required.items()): | ||
| path, _, test = node.partition("::") | ||
| function = test.split("[", 1)[0] |
| def packs(profile: Any, scope: str) -> Result: | ||
| if scope != PROJECT: | ||
| return _na("pack is project-scope") | ||
| return _OK if profile.pack_prefixes else _na("pack_prefixes is empty") |
|
|
||
| @predicate(REGISTRY_NATIVE_PLUGIN_HARNESS) | ||
| def native_plugin_harness(profile: Any, scope: str) -> Result: | ||
| return _OK if _native_plugin_harness(profile) else _na("not a native plugin harness") |
Comment on lines
+77
to
+78
| elif not harness_contract.exemption_allowed(promise_id, ratchet.baseline, cells): | ||
| problems.append(f"{promise_id}: exempt only when every applicable cell is baseline") |
Comment on lines
+150
to
+154
| # A merge queue or push commit: its first parent is the base. | ||
| head = _git(root, "rev-parse", "HEAD").stdout.strip() | ||
| step = _git(root, "fetch", "--no-tags", "--depth=2", "origin", head) if head else None | ||
| resolved = ( | ||
| _git(root, "rev-parse", "--verify", "HEAD^1") if step and step.returncode == 0 else step |
|
|
||
| def test_predicate_pending_fields_only_shrink() -> None: | ||
| # Pinned: a field leaves this set when a predicate reads it; none may join. | ||
| assert set(contract.PREDICATE_PENDING_FIELDS) <= { |
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Dec 2, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This was referenced Dec 2, 2026
Merged
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-harness-conformance
branch
December 2, 2026 19:28
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 (microsoft#5775) generates HC-DEPLOY-01.agents cells for it at project and user scope. Add the lifecycle witness that installs a local agent package per required cell, checks the native path, frontmatter and lock row, and emits the OBLIGATION 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>
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>
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
This PR adds the harness conformance contract as registry-driven data inside the existing lifecycle promise engine (
obligation_space.py,ReceiptWitnessPlugin, generated obligations). It adds no parallel framework. The contract states the promises every harness target owes. Whether a promise applies to a target is a pure function of registry data, so adding or removing a target inKNOWN_TARGETSadds or removes its cells through data alone.Milestone 0.40.0. This is a precursor to the Pi target (#5771): Pi lands its column at zero baseline on top of this PR.
tests/lifecycle/harness_contract.pyapplies(promise, profile, scope)returns APPLIES, NOT_APPLICABLE (naming the field it read) or UNKNOWN.obligation_space.harness_obligations()<promise>|<target>|<scope>obligation for each APPLIES cell of a live promise.obligations.load_generated()reads their required witnesses.tests/quality/harness_conformance.json62329d60: 690 cells, of which 15 are required and 675 are baseline.ReceiptWitnessPluginenforces. Unit and static witnesses do not count.tests/lifecycle/scenarios/test_harness_conformance.pyapplicable().tests/quality/test_harness_conformance.pychecks that:ci.ymlandmerge-train.yml.P-COMPAT-harness-conformanceis added.Issue and approved scope
Issue: Refs #3616
Human scope-approval comment: routed through the PGM Pi lead under the 2026-12-02 harness decision; a scope comment on #3616 is pending with the lead.
Does this PR complete the issue, or what remains? It does not complete #3616. What remains:
Type of change
Testing
Commands run locally, sequentially, with no xdist:
pytest tests/lifecycle/scenarios/test_harness_conformance.py tests/quality/test_generated_obligations.py: 40 passed. Receipts were enforced byReceiptWitnessPlugin.pytest tests/quality/test_harness_conformance.py "tests/quality/test_ci_topology.py::test_test_architecture_ratchets_are_required_in_every_context": 19 passed, 1 skipped. The skip is the shrink-only check, which needs a committed ratchet on main.test_ci_topology.py,test_quality_baselines.py,test_promise_obligations.py,test_test_taxonomy.pyandtest_known_cells_cite_open_issues.pyreturned 874 passed and 5 failed.test_known_cells_cite_open_issues.pyand both topology checks afterwards, and they pass.check_obligationcall removed, the[claude]witness fails with "is the witness of 1 required obligation(s) that no oracle receipt covered".test_deleting_a_witness_turns_its_cell_redpasses. Removing the witness function makes its required cell report as unwitnessed.test_a_target_added_without_cells_fails_the_ratchetpasses. A clonedKNOWN_TARGETSentry with no ratchet rows is refused.ruff checkandruff format --checkCI mirror at 0.15.12, pylint R0801,lint-auth-signals.sh,check_complexity_ratchet.py --base-ref origin/main,check_test_assertions.py,check_exact_test_duplicates.pyandpython -m tests.quality.taxonomy --changedare all clean.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.
Agent assessment