Skip to content

[Documentation] Convention: behavioural claims in contract docs cite the test that pins them #16

Description

@charles-fineman

Context:
Identified during work on #11 (see its follow-up comment) and in the architectural review of #12.

Description:

internal/docscheck (added in #12) gates claims that are mechanically false — a link that does not resolve, a path that does not exist, an undated changelog section. It explicitly does not, and cannot, reach a different and more dangerous class: prose in a versioned contract that describes behaviour nothing verifies.

The motivating case, from #11's follow-up comment: docs/schema-threat-model.md stated that the rendered companion "anchors every entity in one namespace", and used that claim to justify the document-wide identifier uniqueness rule. Seven of thirteen collections were not anchored. The same claim was echoed in CHANGELOG.md and two comments in internal/threats/validate.go, so a reader had four mutually consistent statements of something the template did not do. A link checker would have passed all four.

Two more of the same kind: the control-character guarantee the docs promised for ~60 unchecked fields, and the escaping rules in docs/config.md.

What actually caught the anchoring claim was a reviewer reading the template. What now pins it is TestEveryDeclaredEntityIsAnchored, which enumerates the fixture's own collections so a collection added later fails the test the day the fixture declares one.

The gap: that fix exists as one good instance, not as a repository convention. Nothing makes the link from a prose claim to its verifying test discoverable to the next reviewer working under the same time pressure that let the original claim drift.

Proposal:

Add a convention to AGENTS.md, beside the "Documentation checks" section #12 introduced: every behavioural claim in a versioned contract document (docs/schema*.md, docs/config.md, docs/cli.md) cites the test that pins it — the same way CHANGELOG.md already cites issue numbers.

This is a documentation change, not a checker. Do not build a linter for it: deciding from text whether a claim is "verified" versus merely unreferenced is not mechanically decidable, and #12's whole design premise is that a check which cries wolf gets switched off.

If the convention proves its worth, a narrow follow-on check becomes plausible later — assert that a backticked TestXxx name cited in docs/*.md actually exists in the Go source, symmetric to CheckNamedPaths but for identifiers. That is speculative and should not be built ahead of the convention it would enforce.

Rationale:

Deferred from #12, which correctly scoped itself to mechanically-false claims and said so in its package comment rather than pretending to cover this. The architectural review of #12 recommended codifying the convention as a companion change.

Reference:

Acceptance Criteria:

  • AGENTS.md states the convention and shows one worked example
  • The anchoring, control-character, and docs/config.md escaping claims each cite their pinning test
  • A contract document with no behavioural claims is not forced to invent citations
  • No linter is added for this

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions