Repository navigation
test: pin the .markdown-link-check.json key contract - #1007
Merged
Merged
Conversation
markdown-link-check's CLI copies a fixed list of keys off the parsed config onto its options object and silently drops the rest, so a key that is misspelled, invented, or renamed by a dependency bump is indistinguishable from one that works: the run stays green and the setting simply does not apply. fallbackHttpStatus was such a key. It sat next to retryOn429/retryCount reading as the clause that tolerates a rate-limited host, while liveness is decided solely by aliveStatusCodes. Removing it is behaviour preserving, because nothing ever read it. Add a test that derives the accepted key set from the installed CLI source rather than hard-coding it, so an upstream rename fails here instead of quietly disabling a setting, and shape-check ignorePatterns, aliveStatusCodes, the retryOn429/retryCount pairing and timeout. Signed-off-by: quality <quality@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 was referenced Oct 3, 2026
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/markdown-link-check-config.test.mjsand removes one dead key from.markdown-link-check.json. Nothing in the suite read that file before this.The failure mode being closed
markdown-link-check does not pass the parsed config through to the checker. Its
CLI copies a fixed list of keys onto
optsand drops the rest, with no warningand no non-zero exit (
node_modules/markdown-link-check/markdown-link-check:430-439).A key that is misspelled, invented, or renamed by a devDependency bump is
therefore indistinguishable from one that works:
npm run check:linksstaysgreen and the setting silently does not apply.
fallbackHttpStatus: [200, 206, 429]was such a key — read nowhere inmarkdown-link-checkorlink-check. It sat next toretryOn429/retryCountreading as the clause that tolerates a rate-limited host, while liveness is
decided solely by
aliveStatusCodes([200, 206]), so a host still answering429after the third retry is reported dead. The config documented a guaranteethe tool was not providing.
What the test asserts
.markdown-link-check.jsonis one the installed CLI reads, withthe accepted set derived from the CLI source rather than hard-coded, so an
upstream rename fails here instead of quietly disabling a setting;
is restructured so it no longer reads keys off a
configobject, the test saysso rather than passing vacuously;
acceptedKeys()ignoresconfig.trim()(a method call on the--configargument, not a setting) and bare reads that never reach
opts;ignorePatterns[].patterncompiles as aRegExp;aliveStatusCodesis a non-empty list of integer HTTP status codes;retryOn429: trueis paired withretryCount >= 1, sincelink-checkonlyretries while
attempts < retryCount;timeoutparses as anms()duration;--config .markdown-link-check.json, since aconfig the CLI is not pointed at is inert too.
Deliberately not changed
Whether
429should be tolerated — adding it toaliveStatusCodes, or settingfallbackRetryDelay— is a behaviour change and a maintainer's call. This PR onlydeletes a setting that was never read, so
npm run check:linksbehaves exactly asit did before.
Verification
node --test tests/markdown-link-check-config.test.mjsfails on unmodifiedmainwithdeclares keys markdown-link-check never reads: fallbackHttpStatus,and passes once the key is removed — the test demonstrably catches the defect it
was written for.
npm run test:unit:coverage:checkexits 0 (TZ=UTC, node v26.8.1). The new fileis 100.00% lines / 85.19% regions; the uncovered regions are assertion-message
and early-return arms that only execute on failure. Repository totals stay above
every gate:
src files 100.00 | 100.00,all files 99.37 | 94.98against--check 99 --check-source 100 --check-regions 94 --check-source-regions 99.npx markdown-link-check --config .markdown-link-check.json -q README.mdexits0 with the key removed, confirming the config is still accepted.
npx prettier --checkpasses on both touched files.Scope and overlap
Touches
.markdown-link-check.jsonand one new test file. Disjoint from everyopen hold-gated PR: #989/#991 (
tests/tools/e2e-coverage-report.mjsand itstests), #996 (
tests/tools/coverage-report.mjs,package.json), #998 (adr/),#1000/#1002 (
ci.ymljob guards), #1004 (.prettierignore/.markdownlintignore— ignore-file entries, not link-checker config), #994(
SECURITY.md,.cspell.yml). Branched from a freshorigin/mainat 6ccdaac.Related Issue
Closes #1006
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88