Skip to content

test: cover the adr/ decision-record contract (tests/adr-contract.test.mjs) - #282

Open
kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-adr-contract
Open

kubestellar-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-adr-contract

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds tests/adr-contract.test.mjs — the first test that reads adr/ at all. It asserts the contract between adr/README.md's index table and the adr/NNNN-*.md records:

  • every indexed row links to a file that exists, and to one named for that row's number
  • index numbers are unique
  • index Status matches each record's - **Status**: header; index Title matches its H1
  • every record declares a parseable - **Date**: and a Status in {Proposed, Accepted, Rejected, Superseded, Deprecated}
  • every record heads itself with its own file number ("ADR 0002:" in 0002-*.md)
  • every relative ./-link between files in adr/ resolves

Header assertions apply to files that head themselves as an ADR or are linked from the index, so supporting drafts filed alongside a record are not held to the ADR header block.

Two assertions are { todo: true }

main already violates them: adr/0001-stakeholder-outreach-draft.md takes the 0001- prefix without being ADR 0001, so two files claim number 0001 and one is absent from the index. each ADR number is claimed by exactly one file and every number-prefixed ADR file is listed in the index are therefore marked todo — the suite stays green, the deviation is recorded in the test file, and the fix is filed as #281 with the exact remediation. Dropping the { todo: true } flags is a one-line-each change once #281 lands; that is a docs rename, outside this lane.

Verification

  • npm run test:unit: 68 tests, 66 pass, 0 fail, 2 todo (was 55 pass / 0 fail).
  • Mutation-checked: flipping an index Status, and repointing an index link at a nonexistent file, each fail the expected assertions (4 failures across the two mutations); adr/README.md restored, git diff --stat clean.
  • npx prettier --check clean.
  • No dependency, no lockfile change, no production code.

Coverage evidence

  • Unit: npm run test:unit -- --experimental-test-coverage, local clone of cncf/endusers at parent revision 00b44df after npm ci, 2026-09-18. Baseline: 55 tests, adr/ read by no test (grep -rn adr tests/ empty). This is a content-contract suite, so it adds no scripts/ line coverage.
  • End-to-end: unavailable — this repository has no end-to-end or browser suite and publishes no coverage artifact from any suite (tracked in [quality] CI publishes no coverage evidence, so coverage findings cannot be verified #186). No claim is made that this path lacks end-to-end coverage.

Disjointness

Claims exactly one new file, tests/adr-contract.test.mjs, and the adr/ content cluster. No other open PR touches adr/ as a test subject: the open data-contract test PRs cover data/milestones.json (#235), data/projects-born.json (#239), data/community-roster.json (#241), data/members.json/awards.json (#253), data/community-people.json (#257), data/architectures (#260), blog/ frontmatter (#270), docusaurus.config.js/sidebars.js (#275) and package.json/CI wiring (#278). #167 edits ADR content (status/prose) but changes no filename and no index structure; the assertions here are parity assertions, which hold across that edit.

Related Issue

Closes #280


Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-opus-5

Adds tests/adr-contract.test.mjs, asserting that adr/README.md's index
table and the adr/NNNN-*.md files agree: indexed links resolve and are
named for their number, index numbers are unique, index Status and Title
match each record's header and heading, every record declares a parseable
Date and an allowed Status, each record heads itself with its own number,
and relative links between ADR files resolve.

Two assertions are marked todo because main already violates them: the
supporting outreach draft takes the 0001- prefix without being ADR 0001,
so two files claim that number and one is absent from the index.

Closes #280

Signed-off-by: kubestellar-hive[bot] <kubestellar-hive@hive.kubestellar.io>
@kubestellar-hive

Copy link
Copy Markdown
Contributor Author

Important

Held for human review by the hive's ACMM level gate.

This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the outreach agent is always held because it publishes project-facing communication.

Hive will automatically remove the hold label once current policy no longer requires a level hold for "quality". If this is an outreach PR, a human must review it and remove the label.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] No test covers the adr/ decision-record contract (adr/README.md index ↔ adr/NNNN-*.md files)

0 participants