Skip to content

docs(corpus): add test-contract template - #1540

Merged
tucktuck101 merged 1 commit into
launchpadfrom
task/1349-corpus-template-test-contract
Aug 28, 2026
Merged

docs(corpus): add test-contract template#1540
tucktuck101 merged 1 commit into
launchpadfrom
task/1349-corpus-template-test-contract

Conversation

@serina-mcfall

Copy link
Copy Markdown

Summary

Adds launchpad/docs/corpus/templates/test-contract.md, the corpus template for a node type that documents one testable obligation plus the specific test(s) that verify it. Verified that Pact (the obvious industry candidate) does not fit this repo's architecture, and grounded the template instead in two real, already-built precedents already in this codebase: docs/multi-tenant-conformance.md/conformance_multitenant.rs and crates/buzz-conformance/TRACE_SCHEMA.md.

Related issue

Closes #1349

Issue type

Task


Agent provenance

Field Value
Harness / provider Claude Code
Model claude-sonnet-5
Session reference N/A - harness does not expose a run id/URL for this session
Initiating human @serina-mcfall

Objective

Create launchpad/docs/corpus/templates/test-contract.md as the canonical template a real test-contract corpus node (a node type carrying type: verification) is built from.

Impacted components

  • launchpad/docs/corpus/templates/test-contract.md

Approach and rejected alternatives

The issue's own DoD text is stale boilerplate copied from the standards-track issues (MUST/SHOULD/enforcement/policy checklist) — every one of #1326-#1351 carries it verbatim. This PR builds against parent Feature #605's real acceptance criterion instead: "every template states its purpose, required sections, evidence expectations and the industry model/standard it adapts." The template's own "Note on this document's structure" section states this mismatch explicitly, following the precedent set by #1528 (architecture-context).

Rejected alternative: using Pact (docs.pact.io) as the adapted industry model, which is the obvious candidate the batch brief flagged for verification. Read TESTING.md and crates/buzz-test-client/'s actual test structure first, then fetched Pact's own docs. Pact's mechanism is consumer-driven contract testing: a consumer's own tests generate a contract file, and a separately deployed provider is verified against it independently, usually via a Pact Broker. Buzz doesn't have that shape — one relay binary tested end-to-end against CLI/desktop/mobile clients built from the same source tree, same commit, same CI run (confirmed via TESTING.md and AGENTS.md's "Nostr-first HTTP surface" section). Forcing Pact's consumer/provider/broker vocabulary onto that would misdescribe it, so it was rejected as the primary model rather than cited anyway for the sake of having a named standard.

What the template adapts instead, found while investigating: this repository already has two home-grown "test contract" precedents. docs/multi-tenant-conformance.md is a prose obligation table mirrored one row per module in crates/buzz-test-client/tests/conformance_multitenant.rs, which calls itself, in its own doc-comment, "the executable form of the conformance contract" — not-yet-landed obligations are #[ignore]d and stubbed with a pending_lane(...) helper that panics via todo!(), so an empty test body can never pass as done. Separately, crates/buzz-conformance/TRACE_SCHEMA.md opens by calling itself, verbatim, "the contract between the relay's emitter and the independent replay checker," and its sibling LIMITS.md states plainly what a green run does and does not prove. Both are real, checked-in, and directly on point — a stronger primary source than an external standard that doesn't structurally fit.

Verification

Command run:

cd /home/serina/Launchpad/buzz/__worktrees/task-1349-corpus-template-test-contract
python3 -m unittest discover -s launchpad/docs/corpus/schema/tests -p "test_*.py" -v

Raw output:

test_duplicate_audiences_rejected (test_schema.InvalidFixtureTest.test_duplicate_audiences_rejected) ... ok
test_fact_with_forbidden_fields_rejected (test_schema.InvalidFixtureTest.test_fact_with_forbidden_fields_rejected) ... ok
test_inference_missing_confidence_rejected (test_schema.InvalidFixtureTest.test_inference_missing_confidence_rejected) ... ok
test_malformed_id_rejected (test_schema.InvalidFixtureTest.test_malformed_id_rejected) ... ok
test_missing_audiences_rejected (test_schema.InvalidFixtureTest.test_missing_audiences_rejected) ... ok
test_missing_evidence_field_rejected (test_schema.InvalidFixtureTest.test_missing_evidence_field_rejected) ... ok
test_missing_evidence_for_fact_rejected (test_schema.InvalidFixtureTest.test_missing_evidence_for_fact_rejected) ... ok
test_missing_evidence_for_inference_rejected (test_schema.InvalidFixtureTest.test_missing_evidence_for_inference_rejected) ... ok
test_missing_identity_rejected (test_schema.InvalidFixtureTest.test_missing_identity_rejected) ... ok
test_missing_origin_rejected (test_schema.InvalidFixtureTest.test_missing_origin_rejected) ... ok
test_missing_status_rejected (test_schema.InvalidFixtureTest.test_missing_status_rejected) ... ok
test_missing_type_rejected (test_schema.InvalidFixtureTest.test_missing_type_rejected) ... ok
test_team_knowledge_missing_provided_by_rejected (test_schema.InvalidFixtureTest.test_team_knowledge_missing_provided_by_rejected) ... ok
test_unknown_audience_value_rejected (test_schema.InvalidFixtureTest.test_unknown_audience_value_rejected) ... ok
test_unknown_origin_rejected (test_schema.InvalidFixtureTest.test_unknown_origin_rejected) ... ok
test_unknown_relationship_type_rejected (test_schema.InvalidFixtureTest.test_unknown_relationship_type_rejected) ... ok
test_unknown_status_rejected (test_schema.InvalidFixtureTest.test_unknown_status_rejected) ... ok
test_unknown_type_rejected (test_schema.InvalidFixtureTest.test_unknown_type_rejected) ... ok
test_unrecognized_field_rejected (test_schema.InvalidFixtureTest.test_unrecognized_field_rejected) ... ok
test_wrong_direction_relationship_rejected (test_schema.InvalidFixtureTest.test_wrong_direction_relationship_rejected) ... ok
test_every_enum_member_has_metadata (test_schema.RelationshipEnumMetadataTest.test_every_enum_member_has_metadata) ... ok
test_every_metadata_entry_has_directionality_and_inverse (test_schema.RelationshipEnumMetadataTest.test_every_metadata_entry_has_directionality_and_inverse) ... ok
test_relationship_enum_matches_node_schemas_inlined_copy (test_schema.RelationshipEnumMetadataTest.test_relationship_enum_matches_node_schemas_inlined_copy) ... ok
test_node_schema_is_valid_json_schema (test_schema.SchemaMetaValidityTest.test_node_schema_is_valid_json_schema) ... ok
test_relationships_schema_is_valid_json_schema (test_schema.SchemaMetaValidityTest.test_relationships_schema_is_valid_json_schema) ... ok
test_full_fixture_passes (test_schema.ValidFixtureTest.test_full_fixture_passes) ... ok
test_minimal_fixture_passes (test_schema.ValidFixtureTest.test_minimal_fixture_passes) ... ok

----------------------------------------------------------------------
Ran 27 tests in 0.034s

OK

Command run:

python3 launchpad/project-intelligence/corpus/validate.py; echo "EXIT: $?"

Raw output:

UNVERIFIED  corpus-agents: evidence entry 1, citation 1: is a commit reference, which names no openable file
UNVERIFIED  corpus-agents: evidence entry 20, citation 1: is a graph-edge or tool-result citation, which names no openable file
UNVERIFIED  corpus-readme: evidence entry 1, citation 1: is a commit reference, which names no openable file
UNVERIFIED  corpus-standard-confidence: evidence entry 1, citation 1: is a commit reference, which names no openable file
UNVERIFIED  corpus-standard-decision-references: evidence entry 1, citation 1: is a commit reference, which names no openable file
UNVERIFIED  corpus-template-test-contract: evidence entry 1, citation 1: is a commit reference, which names no openable file
UNVERIFIED  corpus-template-test-contract: evidence entry 6, citation 1: is a graph-edge or tool-result citation, which names no openable file
UNVERIFIED  corpus-template-test-contract: evidence entry 14, citation 1: is an external URL this validator can neither pin nor open
UNVERIFIED  corpus-template-test-contract: evidence entry 14, citation 2: is an external URL this validator can neither pin nor open
UNVERIFIED  corpus-template-test-contract: evidence entry 16, citation 1: is an external URL this validator can neither pin nor open
PASS  corpus validation found no errors; 10 item(s) reported unverified
EXIT: 0
  • Tests or checks were run and the raw output is pasted above
  • The diff is confined to the scope of the linked issue
  • No secrets, keys, tokens or hostnames were added to tracked files

Not verified

Codex is currently down (#1467), so this PR has same-model (Claude) adversarial self-review rather than a genuine cross-model review pass — a real cross-model review has not happened. No real test-contract node has been built from this template yet, so whether the required-sections list actually holds up in practice is untested. Pact's Pact Broker workflow and its newer bi-directional contract-testing mode were not researched in depth, since the consumer/provider mismatch already ruled Pact out as the primary model before those details would matter. crates/buzz-conformance's property tests (tests/proptest_checker.rs) and fixture-replay tests (tests/replay_fixtures.rs) were read for structure but not executed. These gaps are also recorded in the node's own "Expected but not verified" section.

Security implications

None. This is a documentation-only change adding one Markdown file under launchpad/docs/corpus/templates/; it changes no runtime code, no CI configuration beyond what already validates the corpus tree, and introduces no new secrets or external calls.

Escalations

None. No blocking or non-blocking findings surfaced while researching or drafting this node that warranted a separate issue.

…o's own conformance precedent

Defines launchpad/docs/corpus/templates/test-contract.md per #605's real
acceptance criterion (purpose, required sections, evidence expectations,
industry model adapted). Verified Pact's consumer-driven model against
docs.pact.io and found it does not fit Buzz's single-repo, single-deployment
relay-plus-in-repo-clients architecture; the template instead adapts two
real, already-verified precedents already in this repository:
docs/multi-tenant-conformance.md paired with
crates/buzz-test-client/tests/conformance_multitenant.rs, and
crates/buzz-conformance/TRACE_SCHEMA.md, which calls itself "the contract
between the relay's emitter and the independent replay checker."

Closes #1349

Signed-off-by: Serina Mcfall <serina.mcfall@gmail.com>
@serina-mcfall serina-mcfall added type:task Bounded work with no children of its own. The default type. area:docs The MkDocs knowledge layer and its content by:agent Filed or authored by an AI agent, not a human labels Aug 27, 2026
@serina-mcfall
serina-mcfall marked this pull request as ready for review August 27, 2026 04:34
@tucktuck101 tucktuck101 self-assigned this Aug 27, 2026

@tucktuck101 tucktuck101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review — test-contract template

Accurate and well-sourced — the Pact, ISTQB and Google SWE citations hold, and the required
sections (named verifying test plus a runnable command) are the right ones for this node kind.
One finding, and it is one bullet.

Medium — the boundary against the invariant template is unnamed, and the two overlap

test-contract.md:132 defines the covered subject as "a single testable statement about
behaviour (an invariant, an isolation guarantee, a compatibility promise) plus the concrete
test(s) that currently exercise it" — naming invariant as a covered obligation kind.

Sibling PR #1549's invariant.md:255-291 requires an instance to carry "Invariant statement",
"Scope", "Enforcement today" (whose five tiers include "test-enforced (a test would fail)") and
"Consequence of violation".

I read both Boundary sections in full. test-contract.md:202-217 excludes test-suite docs,
#1325's citation standard, conformance tables, and ADRs/PRDs — it never mentions
#1343/invariant. invariant.md:229-253 excludes #1320, #1344 and #1342 — it never mentions
#1349/test-contract, which is also absent from its "It does not cover" table at :436-445.

So an author holding a test-backed invariant — e.g. "kind 40002 replies must bump reply_count
on the thread root", which is invariant.md's own flagship example — is pointed at both
templates by both templates, and neither yields.

The distinguishing axis exists but is unstated: test-contract requires a named verifying
test and a runnable command and fixes instances at type: verification; invariant makes a
test one of five acceptable enforcement tiers and lets instances pick type by subject matter.
My ruling: test-contract owns obligation-plus-named-test; invariant owns
always-holds-property-plus-enforcement-tier.

One bullet in each Boundary section naming the other template and that axis. Both PRs are in
this wave and can be fixed together — this is the only finding I have on this PR, and I would
have approved it otherwise.

What is correct

  • Pact docs and Pact Specification v4 attributions verified; ISTQB and Google SWE ch11
    quotations hold.
  • The type: governance reasoning for the template node, and the correct disjunctive statement
    about AGENTS.md being type: agent, are both right — sibling #1550 gets that second point
    wrong and this PR gets it right.
  • The frontmatter skeleton is complete and schema-valid, so an author can copy it directly.
  • Required sections 3-4 (named test, runnable command) make the node's central claim checkable
    rather than aspirational.
  • CI green at head (latest run per check); node validates clean.

Reviewed by tucktuck101's review lane. Every failing claim reported above was reproduced by me against this PR head before posting.

@tucktuck101 tucktuck101 removed their assignment Aug 27, 2026
@tucktuck101
tucktuck101 merged commit 53b8853 into launchpad Aug 28, 2026
38 checks passed
@serina-mcfall
serina-mcfall deleted the task/1349-corpus-template-test-contract branch August 31, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs The MkDocs knowledge layer and its content by:agent Filed or authored by an AI agent, not a human type:task Bounded work with no children of its own. The default type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

task: define the test contract corpus template

2 participants