Skip to content

test(lifecycle): harness conformance surface witnesses across the registry - #5778

Merged
Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
danielmeppiel-hc-surface
Dec 2, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
danielmeppiel-hc-surface

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

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 from harness_contract.applicable(), with no target literals, and the contract-code guard passes. Each passing cell emits an e2e check_obligation receipt.

206 cells that pass on main move from baseline to required in tests/quality/harness_conformance.json. Cells that are red on main stay in the baseline, which only shrinks. Pi cells are added to required in #5771.

Promises covered:

  • HC-DETECT-01, HC-TARGETS-01
  • HC-INIT-01: the pty-driven interactive picker and init -y
  • HC-ALL-01, HC-DEPLOY-01.commands
  • HC-DEPLOY-01.skills (user scope)
  • HC-COMPILE-01: default root and root variable
  • HC-AUDIT-01, HC-LOCK-01, HC-PRUNE-01, HC-INVENTORY-01, HC-TARGETCHANGE-01
  • HC-UNSUP-01, HC-MCP-02
promise scope main (required / still baseline) #5771 head receipt
HC-ALL-01 project 9 green / 0 baseline pi cells land in #5771 e2e check_obligation
HC-ALL-01 user 9 green / 0 baseline pi cells land in #5771 e2e check_obligation
HC-AUDIT-01 project 13 green / 4 baseline (copilot-app, copilot-cowork, grok-cloud, openclaw) pi cells land in #5771 e2e check_obligation
HC-COMPILE-01 project 7 green / 4 baseline (antigravity, claude, copilot, gemini) pi cells land in #5771 e2e check_obligation
HC-COMPILE-01 user 9 green / 2 baseline (claude, copilot) pi cells land in #5771 e2e check_obligation
HC-DEPLOY-01.commands project 6 green / 3 baseline (copilot, copilot-app, kiro) pi cells land in #5771 e2e check_obligation
HC-DEPLOY-01.commands user 6 green / 3 baseline (copilot, copilot-app, kiro) pi cells land in #5771 e2e check_obligation
HC-DEPLOY-01.skills project 0 green / 1 baseline (copilot-cowork) pi cells land in #5771 e2e check_obligation
HC-DEPLOY-01.skills user 13 green / 3 baseline (copilot-cowork, grok-cloud, openclaw) pi cells land in #5771 e2e check_obligation
HC-DETECT-01 project 9 green / 0 baseline pi cells land in #5771 e2e check_obligation
HC-INIT-01 project 7 green / 2 baseline (grok-build, kiro) pi cells land in #5771 e2e check_obligation
HC-INVENTORY-01 project 13 green / 4 baseline (copilot-app, copilot-cowork, grok-cloud, openclaw) pi cells land in #5771 e2e check_obligation
HC-INVENTORY-01 user 13 green / 4 baseline (copilot-app, copilot-cowork, grok-cloud, openclaw) pi cells land in #5771 e2e check_obligation
HC-LOCK-01 project 13 green / 4 baseline (copilot-app, copilot-cowork, grok-cloud, openclaw) pi cells land in #5771 e2e check_obligation
HC-LOCK-01 user 13 green / 4 baseline (copilot-app, copilot-cowork, grok-cloud, openclaw) pi cells land in #5771 e2e check_obligation
HC-MCP-02 project 3 green / 4 baseline (copilot-app, copilot-cowork, grok-cloud, openclaw) pi cells land in #5771 e2e check_obligation
HC-MCP-02 user 3 green / 4 baseline (copilot-app, copilot-cowork, grok-cloud, openclaw) pi cells land in #5771 e2e check_obligation
HC-PRUNE-01 project 13 green / 4 baseline (copilot-app, copilot-cowork, grok-cloud, openclaw) pi cells land in #5771 e2e check_obligation
HC-TARGETCHANGE-01 project 13 green / 4 baseline (copilot-app, copilot-cowork, grok-cloud, openclaw) pi cells land in #5771 e2e check_obligation
HC-TARGETS-01 project 13 green / 4 baseline (copilot-app, copilot-cowork, grok-cloud, openclaw) pi cells land in #5771 e2e check_obligation
HC-TARGETS-01 user 13 green / 4 baseline (copilot-app, copilot-cowork, grok-cloud, openclaw) pi cells land in #5771 e2e check_obligation
HC-UNSUP-01 project 5 green / 12 baseline (claude, codex, copilot, copilot-app, copilot-cowork, cursor, grok-bot, grok-build, grok-cloud, kiro, openclaw, opencode) pi cells land in #5771 e2e check_obligation
HC-UNSUP-01 user 3 green / 14 baseline (antigravity, claude, codex, copilot, copilot-app, copilot-cowork, cursor, grok-bot, grok-build, grok-cloud, hermes, kiro, openclaw, opencode) pi cells land in #5771 e2e check_obligation

Notes:

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

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

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.
  • After the fix: pytest tests/quality/test_harness_conformance.py <module>::test_hc_compile_01 gave 38 passed and 15 skipped; -k "hc_all_01 or deploy_01_commands or hc_prune_01" gave 43 passed.
  • Discovery (HC_DISCOVER=1, every applicable cell, main 62329d6): 86 failed, 230 passed, 28 skipped. Failing cells stay in the baseline.
  • All clean: ruff check and format --check at the uv.lock pin, pylint R0801, lint-auth-signals.sh, the complexity ratchet (--base-ref 1622a4a), the tm006 taxonomy and check_test_assertions.py.

Changelog

  • One fragment per section
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • N/A -- this PR does not change OpenAPM-observable behaviour.

Agent assessment

  • Change confidence: high -- this PR changes only tests and ratchet data. Every moved cell passed locally with a receipt, and the ratchet guards still pass.

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>
@danielmeppiel
Daniel Meppiel (danielmeppiel) marked this pull request as ready for review December 2, 2026 15:25
Copilot AI balanced review requested due to automatic review settings December 2, 2026 15:25

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

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>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit cafb1bb into main Dec 2, 2026
55 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-hc-surface branch December 2, 2026 19:59
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>
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>
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