Skip to content

[NEW-SPEC-8] Require spec and README code/CLI examples to be executable in CI (doctest / round-trip harness) #146

Closed

Description

@SoundMatt

Problem. THEME-J documents dead/broken doc references across the ecosystem, and REL-SPEC-10
(filed separately in this batch) documents at least two ports whose documented CLI quickstart cannot
actually be followed as written. Nothing today prevents either the spec document or a port's README
from shipping a stale example, because no example is ever actually executed.

Proposal. Add a new §20.7, plus a requirement under §13's README guidance: every fenced code/CLI
example marked normative in the spec, and every implementation's README quickstart, MUST be
machine-extractable and executed in CI (doctest-style extraction, or a round-trip harness) — a failing
example MUST fail the build. This extends REL-SPEC-10 from "one documented demo must work" to "every
normative example must be continuously proven to work," and applies the same discipline to the spec
repo itself so the document can't ship a stale snippet (as its own §12.1/§12.2 examples currently do —
see NEW-SPEC-6).


Filed from the 2026-07-29 ecosystem audit register; independently re-verified against current HEAD before filing.

Activity

  1. added a commit that references this issue on Aug 21, 2026
    6aefd24
  2. SoundMatt commented on Aug 21, 2026

    @SoundMatt
    OwnerAuthor

    Implemented and merged in #187 (v2.8 → v2.9, MINOR).

    What shipped

    • New §20.7 "Continuous example verification" and new §17 Requirement 19.
    • <!-- doctest:KIND --> marker convention, applied to all 7 of this document's existing normative JSON examples (§12.1, §12.2 ×2, §12.3, §15.8, §17.2, §20.6). KIND selects the validator — the same one relay conform applies to a real binary's output, not a separate check invented for the doctest.
    • README extension: every literal, executable command in a README's ## RELAY conformance section must be machine-extracted and executed in CI. Network-fetching commands (go get/go install) and commands needing a published container image are explicitly exempt.
    • Reference implementation: extractDoctestExamples (cmd/relay/doctest.go), TestSpecDoctestExamplesValidate (cmd/relay/doctest_test.go). New REQ-RELAY-102.

    Real bugs found and fixed while building this

    • Three of this document's own examples used truncated placeholder hex ("816b402d...") instead of a real 64-char SHA-256. Replaced with genuine values — two are the actual hashes of the referenced golden vectors.
    • RELAY's own JSON Schema validator never implemented the pattern keyword at all — silently ignored per its own documented keyword list. Every schema constraining a SHA-256 field with "^[0-9a-f]{64}$" was unenforced: relay conform would have accepted a malformed hash in any capabilities/manifest/attestation/vectors-manifest document without a single finding. Found because the truncated placeholders above initially validated cleanly — a false pass this mechanism exists to prevent. Fixed with a regexp-based pattern check; new TestSchemaPattern; mutation-tested.
    • README.md's own "Current" version line was six MINOR releases stale (v2.0 while spec/version.json was at v2.8) — the exact class of drift §19.5 already guards against, just not in README.md. Fixed, and TestReadmeVersionMatchesVersionJSON extends the §19.5 mechanism so it can't silently recur.

    Verification

    Local, pre-merge: go build/vet/test clean, gofmt -l . clean, golangci-lint run 0 issues, coverage 90.4% (≥90% gate), gofusa check 0 errors/PASS, gofusa trace -req-coverage 100 100%/100%.

    Post-merge, independently re-verified from a fresh clone at 6aefd24: build/vet/gofmt/test clean (coverage 90.4% confirmed), gofusa check 0 errors/PASS, gofusa trace 100%/100% (102/102 requirements traced), and end-to-end — relay conform --manifest reports 19 total requirements with Requirement 19 correctly NOT_OBSERVABLE/implementation's own CI, and README's version line confirmed matching spec/version.json.

    CI green on the main merge commit (DCO, Lint, Docker build, CodeQL, Security, Test, Self-conformance, go-FuSa full safety lifecycle — all pass).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions