fix(docs): match locale notice routes with POSIX separators - #206
Open
dajiaohuang wants to merge 1 commit into
Open
fix(docs): match locale notice routes with POSIX separators#206dajiaohuang wants to merge 1 commit into
dajiaohuang wants to merge 1 commit into
Conversation
`path.relative` separates with backslashes on Windows, so the notice route built from a nested page became `/spec/01-product\00-overview` and never matched the POSIX route the Chinese mirror actually links. Every nested page was reported as an invalid source notice, and `pnpm docs:check` exited 1 on Windows while passing on the Linux runner. The three pages directly under `docs/spec` were unaffected because their relative path has no separator. Normalize the separators when assembling the route, and split the check into `noticeRoute`/`verifyLocalePairs` so both the route and the pair scan can be covered instead of only by running the script. Refs vastsa#201
|
@dajiaohuang is attempting to deploy a commit to the vastsa's projects Team on Vercel. A member of the Team first needs to authorize it. |
dajiaohuang
force-pushed
the
fix/docs-locale-check-windows-paths
branch
from
September 11, 2026 10:52
d551ac1 to
5f3561a
Compare
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.
Fixes #201.
Summary
pnpm docs:checkfails on Windows and passes on the Linux CI runner. The check builds the required source-notice route from apath.relativeresult, which separates with backslashes on Windows, so it looks for/spec/01-product\00-overviewwhile the Chinese mirror links/spec/01-product/00-overview.Cause
On Windows
relativePathis01-product\00-overview.md. The mirror contains the POSIX route:> **翻译说明:** 本页是与 [英文源规格](/spec/01-product/00-overview) 一一对应的机器辅助翻译。so
source.includes(...)never matches and every nested page is reported invalid. The three pages directly underdocs/spec(00-baseline.md,NAV.md,README.md) have no separator and pass; the reported list contains exactly the other 74 files, which is the signature of the bug.Reproduction
Windows, on
mainat6e6d710e:With this change:
Changes
docs/scripts/check-locales.mjs: normalize separators when assembling the notice route; split the check intonoticeRouteandverifyLocalePairs, with the CLI body behind amain()guard so importing the module no longer runs the scan. Messages and exit codes are unchanged.docs/scripts/check-locales.test.mjs: covers the route normalization and the pair scan.docs/package.json: adds"test": "node --test".Validation
node docs/scripts/check-locales.mjs— exit 1 before, exit 0 after (77 pairs verified).node --testindocs/— 2 tests pass. Against the unfixed script the suite fails, so it is bound to the fix.node scripts/check-release-docs.mjs— unaffected by this change (verified separately).git diff --check— clean;git ls-files --eolreportsw/lffor the spec pages, so this is not a line-ending problem.Notes for the maintainer
testscript uses Node's built-in runner, so it adds no dependency.ci.ymlalready runspnpm -r --if-present test, which will now include thedocspackage; if you would rather keep the docs workspace out of that job, drop the script and keep the test file. No workflow file is modified.path.sep === '/') the normalization is a no-op and the test passed before the fix as well. The assertion that fails on every platform is the import ofnoticeRoute, since the unfixed script does not export it.ci.ymlignoresdocs/**, so only thedocs-checkworkflow covers this path, and that workflow runs solely onubuntu-latest— which is why a Windows-only failure can stay invisible. I have not changed any workflow.🤖 Generated with Claude Code