Skip to content

core(tdr): add Contract Test Hygiene section#19

Merged
cms-pm merged 1 commit into
mainfrom
tdr/contract-test-hygiene
May 5, 2026
Merged

core(tdr): add Contract Test Hygiene section#19
cms-pm merged 1 commit into
mainfrom
tdr/contract-test-hygiene

Conversation

@cms-pm
Copy link
Copy Markdown
Owner

@cms-pm cms-pm commented May 5, 2026

Summary

Adds a normative Contract Test Hygiene section to core/AI_ASSISTED_TDR_METHODOLOGY.md:

  • Ratified scenarios MUST NOT be gated by skipUnless / --gtest_filter / equivalents
  • Pending-implementation scenarios MUST use the runner's explicit expected-fail surface (expectedFailure, DISABLED_, xfail)
  • Removing an expected-fail marker MUST be a reviewable diff event, decoupled from unrelated implementation
  • Source-shape proxies MAY detect implementation arrival but MUST NOT gate assertions

Motivation

Path A tombstone scenarios in consumer projects (cms-pm/cockpit Phase 8) were using @unittest.skipUnless(_proxy_function(), reason) to silently skip tests until implementation lands. This produces three failure modes that are invisible in CI:

  1. A wrong-symbol implementation causes the proxy to keep returning False, so the test stays skipped — drift goes undetected.
  2. The proxy regex itself is fragile (e.g. literal-only patterns silently miss macro forms).
  3. "Skipped because the implementation hasn't landed" is indistinguishable from "skipped because the environment isn't available" in standard runners.

expectedFailure makes "not yet implemented" an explicit CI state. Removing the decorator becomes a deliberate, diff-reviewable act when implementation arrives, and a wrong-symbol implementation goes red loudly.

This pattern is the Python analog of GoogleTest's DISABLED_ prefix and pytest's xfail, which the Avoid Fragile Tests paper cites as the right tool for tracked-but-not-yet-passing scenarios.

Pilot consumers (cms-pm/cockpit, chunk-8.0t)

The pilot artifacts are already landed in cms-pm/cockpit on chunk-8.0t-status-additive-and-behavioral:

  • Amendment package: docs/governance/amendments/2026-05-04-test-hygiene-tdr-amendment-package.md
  • Shared scaffold: tests/_contract_support.py
  • Predicate pilot: docs/validation/phase-8/predicates/scn-8.0t.json
  • Reauthored contract test: tests/test_phase8_0t_sideband_fast_queue_backpressure_contract.py

The 8.0t contract suite (6/6 green) was the first chunk authored under this rule — SCN-8.0t-03 and SCN-8.0t-05/-06 run unconditionally and produce real pass/fail.

Stacked PRs (one item per commit, one item per PR)

This is PR 1 of 4 in the test-hygiene amendment package:

# Branch Status
1 tdr/contract-test-hygiene this PR
2 evidence/scenario-status-vocabulary draft, depends on #1
3 adapters/hil-sil-predicate-router draft, depends on #1, #2
4 astaire/scenario-ledger-collection draft, depends on #2

Test plan

  • Confirm the new section renders correctly in the TDR doc
  • Confirm wording is consistent with core/EVIDENCE_CONTRACT.md once PR ADG-BOOTSTRAP-01: graphify consumer scripts resolve the wrong root #2 lands
  • Adapter consumers (Claude, Codex) require no change — the rule is tool-agnostic
  • No schema or contract file changes; no test artifacts to run against this repo

🤖 Generated with Claude Code

Ratified acceptance scenarios must not be silently skipped via
skipUnless / --gtest_filter / equivalents. Pending-implementation
scenarios use the runner's explicit expected-fail surface; source-shape
proxies may detect implementation arrival but must not gate assertions.

Drives the Path A tombstone pattern toward an explicit CI state
distinguishable from skipped/passing/failing — removing an
expected-fail marker becomes a reviewable diff event rather than a
silent decorator drop coupled to unrelated work.

Source amendment package and pilot consumers (cms-pm/cockpit
chunk-8.0t):
- docs/governance/amendments/2026-05-04-test-hygiene-tdr-amendment-package.md
- tests/_contract_support.py
- docs/validation/phase-8/predicates/scn-8.0t.json

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@cms-pm cms-pm merged commit ebf79b9 into main May 5, 2026
1 of 2 checks passed
cms-pm added a commit that referenced this pull request May 6, 2026
New optional tooling adapter for projects with substantial HiL or SiL
evidence capture. Routes deterministic capture-and-compare work off
the architect-tier agent onto a worker-tier agent driven by a pinned
predicate.json.

Routing contract:
- architect (Opus or equivalent) authors predicate.json at chunk-plan
  time; worker (Haiku or equivalent) runs CLI, diffs against predicate,
  emits {scn, status, evidence_uri, predicate_hash} JSONL
- worker MUST NOT load architecture context or mutate predicate
- architect re-engages only on non-empty diff or unexpected status

Compatible with the contract test hygiene rule (PR #19) and the
scenario status vocabulary (PR #20). Compounds with the RTK tooling
adapter on shell-visible runner invocations.

Pilot consumer: cms-pm/cockpit Phase 8
- docs/validation/phase-8/predicates/scn-8.0t.json
- scripts/validation/run_phase8_0t_fast_queue_backpressure.py

Predicate schema is project-local at 0.1.0-pilot; will be promoted
to a ratified contract under contracts/ after a second project adopts.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.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.

1 participant