Skip to content

test: cover the docs/ markdown link and frontmatter contract (tests/docs-contract.test.mjs) - #296

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

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

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds tests/docs-contract.test.mjs, the first test in the repo that reads the
docs/ tree. Six assertions over every docs/**/*.md{,x}:

  • every relative doc-to-doc markdown link resolves to a file on disk (with .md/.mdx
    extension resolution, matching how Docusaurus resolves them)
  • every #fragment on such a link matches a heading slug in the target document
  • every frontmatter fence that opens is terminated
  • top-level frontmatter lines are parseable key: value pairs
  • docs under an autogenerated sidebar directory (architectures, community, per
    sidebars.js) declare a title
  • the docs/ tree is non-empty, so the other assertions cannot pass vacuously

Why this is not already covered

docusaurus.config.js:33 sets onBrokenMarkdownLinks: 'warn'. onBrokenLinks: 'throw'
on line 32 covers resolved route links, not relative markdown paths between files — so a
rename or a deleted heading only emits a warning and deploy-gh-pages.yml still publishes
the page with a dead link. grep -rln 'docs/' tests/ returned nothing before this change.

Verification

node --test at rev 00b44df: 61 tests pass, 0 fail (55 existing + 6 new).
Each new assertion was mutation-checked to confirm it actually bites — pointing a link at a
missing file, adding a #no-such-heading fragment, and removing a title from
docs/community/awards.md each turned the corresponding test red, and the working tree was
restored clean afterwards. npx prettier --check passes on the new file.

Scope / non-overlap

Claims exactly one file, tests/docs-contract.test.mjs, and one cluster: markdown-link and
frontmatter integrity within docs/. It deliberately does not assert route or slug
uniqueness, navbar wiring or sidebar reachability (#275), the data/architectures
catalog-to-docs contract (#260), blog/ frontmatter (#270), adr/ records (#282), or
/img static asset resolution (#289). No production code, no content, no workflow files
are touched.

Note: docs/skills/*.md are excluded from the title/description assertions on purpose.
Four of them carry no frontmatter at all and none is referenced by sidebars.js or the
navbar, yet they publish because they live under docs/. Whether those pages belong on the
public site is a content decision for a maintainer, recorded in #294 rather than forced by
a test.

Related Issue

Closes #294


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

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

Nothing in tests/ reads the docs/ tree, and docusaurus.config.js sets
onBrokenMarkdownLinks to 'warn', so a relative doc-to-doc link that stops
resolving only warns and the site still deploys with a dead link.

Add tests/docs-contract.test.mjs asserting that relative doc-to-doc links
resolve on disk, that link #fragments match a heading in the target doc,
that any frontmatter fence that opens is terminated and parses as key:
value pairs, and that docs under an autogenerated sidebar declare a title.

Closes #294

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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] docs/ relative markdown links and frontmatter have no test gate (onBrokenMarkdownLinks is 'warn')

0 participants