Repository navigation
fix(docs): the link check reports in path order, not the filesystem's #943 - #947
Merged
Merged
Conversation
…943 checkDocs walked the docs tree in readdirSync order, which differs between machines, so a test comparing its problems as an array failed on one CI runner and passed on another. It now sorts the files before reading them, which also makes the winner deterministic when a.mdx and a/index.mdx name the same route, and returns problems sorted by file, then line. A test runs the checker over reversed and shuffled directory listings. Signed-off-by: Nik Cubrilovic <[email protected]>
|
Reviewed the diff of
The fix looks correct. Sorting before the route map is built makes the |
Contributor
Author
|
Triage: both nits noted. Neither needs a change: the two sorts agree by UTF-16 code unit and are locale-independent, and the reversed listing plus the seeded shuffles cover the order dependence this fixes. |
This was referenced Oct 20, 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.
Closes #943.
checkDocs(docs/scripts/check-links.ts) walked the docs tree inreaddirSyncorder, and that order is the filesystem's. A test comparing its problems as an array, "checks a nested section named scripts, and matches redirect patterns", failed on some CI runners: on #942's PR, and once on main at 88b6520. It passed on others.Fix
checkDocssorts the file list before reading it. This also makes deterministic which page wins when two files name one route (a.mdxanda/index.mdx); before, that depended on the listing order.listDirparameter (defaultreaddirSync) lets a test feed the walker its own listing order.Acceptance criteria
checkDocsreports problems in a deterministic order, files sorted by path and then by line, whatever order the filesystem lists them in.a.mdx/a/index.mdxpair, and expects the same array each time. The one cross-file assertion in the file now expects path order. Every other multi-problem assertion is within one page, where order follows the page and does not depend on the filesystem.docs:checkon the real docs passes, and its output is unchanged apart from ordering. It reports no problems either way: tangly--strictpasses and check-links prints "all good".The updated test fails against the old checker on macOS (APFS lists
index.mdxbeforeguides/), the opposite of the runner that failed, which shows the old output depended on the listing order.bun test scripts/check-links.test.ts: 19 pass on bun 1.4.0.No CHANGELOG entry: this is a docs build-script fix, not a user-visible change.
squirrel skill impact
None.