Skip to content

test: pin the broken-markdown-link policy docs-contract.test.mjs depends on - #1337

Merged
mrbobbytables merged 1 commit into
mainfrom
quality/test-broken-markdown-link-policy
Oct 12, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
quality/test-broken-markdown-link-policy

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds tests/site-config-broken-markdown-links.test.mjs, pinning the policy
the site build applies to broken relative links between markdown files.

tests/site-config.test.mjs:193 pins onBrokenLinks: 'throw', which is the
route checker — it fires for a link whose resolved URL is not a page the
site builds. Markdown-to-markdown links are a different checker with a
separate setting, and nothing in the suite reads it.

tests/docs-contract.test.mjs:67 already states the dependency in prose —
"relative links in docs/ must point at files that exist; onBrokenMarkdownLinks
is 'warn', so the site build will not catch these"
— and asserts the docs/
half of the rule, which is the right call. The missing half is that nothing
fails when the setting that comment describes changes underneath it.
Editing
docusaurus.config.js:146 from 'warn' to 'ignore' is a one-token change
that stops the build reporting broken relative markdown links altogether while
every check stays green; check:links (_check:links-md) only walks
root-level *.md, so it does not cover docs/ or blog/ either.

What it asserts

Resolution, not the literal. Docusaurus 3.10.2 accepts the setting under two
spellings and rewrites one into the other
(@docusaurus/core/lib/server/configValidation.js:456-462), so reading the
file would pin a spelling rather than a policy and would go quiet the moment
the config migrated. The tests run the real config through the installed
validateConfig() instead:

  1. the build reports broken markdown links rather than silencing them — the effective level is warn or throw, never ignore
  2. the setting is declared under exactly one spelling — a half-landed migration would leave the deprecated key silently winning over the one a reader sees
  3. the deprecated root spelling still reaches the build — non-vacuity, and the fact that stops holding at v4
  4. the deprecated-spelling baseline retires itself — DEPRECATED_ROOT_SPELLING follows the retiring-baseline convention of KNOWN_UNBOUNDED_JOBS in tests/ci-supply-chain.test.mjs

No production code changes. The new file is a tests/*.test.mjs, so it is
neither a src nor a harness file for tests/tools/coverage-report.mjs and
does not move either coverage gate.

Verification

Run at main (fb75c1a):

  • npm run test:unit:coverage:check — exits 0
  • npx prettier --check on the new file — clean
  • non-vacuity, both directions: with docusaurus.config.js set to 'ignore', assertion 1 goes red; with it migrated to markdown.hooks.onBrokenMarkdownLinks, assertions 2–4 go red exactly as the baseline is designed to

Scope

Disjoint from the open hold-gated PRs: #1334 (scripts/lib/mdx-active-content.mjs, CONTENT-SECURITY.md), #1330 (tests/e2e/** DirectoryFreshness fixtures), #1332 (tests/ci-playwright-trace-evidence.test.mjs). This PR adds one new file and edits none.

Related Issue

Closes #1336

The companion finding — docusaurus.config.js declaring the root
onBrokenMarkdownLinks that Docusaurus v4 removes, while future: { v4: true }
is already set — is recorded on #1307 with the exact replacement text. It is a
production-config edit, so this lane cannot land it; when it does land, test 4
here goes red by design and its failure message says exactly what to delete.


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

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

tests/site-config.test.mjs pins onBrokenLinks: 'throw', which is the route
checker. Relative links between markdown files are a different checker with a
separate setting, and nothing in the suite reads it.

tests/docs-contract.test.mjs states the dependency in prose -- "relative links
in docs/ must point at files that exist; onBrokenMarkdownLinks is 'warn', so
the site build will not catch these" -- and asserts the docs/ half of the
rule. Nothing fails when the setting that comment describes changes underneath
it: editing docusaurus.config.js from 'warn' to 'ignore' stops the build
reporting broken relative markdown links while every check stays green, and
check:links only walks root-level *.md.

Resolution is pinned rather than the literal, because Docusaurus 3.10.2 accepts
the setting under two spellings and rewrites one into the other. Running the
real config through the installed validateConfig() pins what the build does and
keeps doing so across the migration tracked on #1307, which this lane cannot
land: DEPRECATED_ROOT_SPELLING is a retiring baseline in the style of
KNOWN_UNBOUNDED_JOBS, and its staleness test fails once the config migrates.

Verified non-vacuously at fb75c1a: with the config set to 'ignore' the policy
guard goes red; with it migrated to markdown.hooks.onBrokenMarkdownLinks the
baseline tests go red as designed. npm run test:unit:coverage:check exits 0.

Closes #1336

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-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 keep the hold label until a human removes it. Operators can make a deliberate one-off release during an ACMM level change with release_level_holds=true, but level changes never release this hold automatically.

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] Nothing pins the broken-markdown-link policy that docs-contract.test.mjs depends on

1 participant