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
Open
kubestellar-hive[bot] wants to merge 1 commit into
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
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>
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 Hive will automatically remove the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Improvement
Adds
tests/docs-contract.test.mjs, the first test in the repo that reads thedocs/tree. Six assertions over everydocs/**/*.md{,x}:.md/.mdxextension resolution, matching how Docusaurus resolves them)
#fragmenton such a link matches a heading slug in the target documentkey: valuepairsarchitectures,community, persidebars.js) declare atitledocs/tree is non-empty, so the other assertions cannot pass vacuouslyWhy this is not already covered
docusaurus.config.js:33setsonBrokenMarkdownLinks: '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.ymlstill publishesthe page with a dead link.
grep -rln 'docs/' tests/returned nothing before this change.Verification
node --testat rev00b44df: 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-headingfragment, and removing atitlefromdocs/community/awards.mdeach turned the corresponding test red, and the working tree wasrestored clean afterwards.
npx prettier --checkpasses on the new file.Scope / non-overlap
Claims exactly one file,
tests/docs-contract.test.mjs, and one cluster: markdown-link andfrontmatter integrity within
docs/. It deliberately does not assert route or sluguniqueness, navbar wiring or sidebar reachability (#275), the
data/architecturescatalog-to-docs contract (#260),
blog/frontmatter (#270),adr/records (#282), or/imgstatic asset resolution (#289). No production code, no content, no workflow filesare touched.
Note:
docs/skills/*.mdare excluded from thetitle/descriptionassertions on purpose.Four of them carry no frontmatter at all and none is referenced by
sidebars.jsor thenavbar, yet they publish because they live under
docs/. Whether those pages belong on thepublic 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