Skip to content

[Bug] pnpm docs:check fails on Windows: notice routes are built with backslashes #201

Description

@dajiaohuang

What happened?

docs/scripts/check-locales.mjs builds the required source-notice route from a path.relative result, which separates with backslashes on Windows. The route it looks for therefore becomes /spec/01-product\00-overview while the Chinese mirror links /spec/01-product/00-overview, so every nested page is reported as an invalid source notice and pnpm docs:check exits 1.

The check passes on the Linux CI runner only because path.relative returns forward slashes there, which is why the Docs check workflow stays green.

Steps to reproduce

On Windows:

git clone https://github.com/vastsa/PI-Desktop && cd PI-Desktop
pnpm install --frozen-lockfile
pnpm docs:check

Expected behavior

Verified 77 English/Chinese specification pairs.

Exit code 0 — the same result the Linux runner produces.

Actual behavior

Invalid Chinese source notices:
01-product\00-overview.md
01-product\01-product-scope.md
... (74 entries)
08-meta\open-questions.md

Exit code 1.

Root cause

In docs/scripts/check-locales.mjs, markdownFiles() returns path.relative(...) values and the check builds the expected link from one directly:

const englishRoute = `/spec/${relativePath.replace(/\.md$/, '')}`

On Windows relativePath is 01-product\00-overview.md, so englishRoute is /spec/01-product\00-overview. source.includes(...) then never matches the POSIX route the mirror actually contains:

> **翻译说明:** 本页是与 [英文源规格](/spec/01-product/00-overview) 一一对应的机器辅助翻译。

The signature confirms the diagnosis: the three pages directly under docs/spec (00-baseline.md, NAV.md, README.md) have no separator in their relative path and pass, while all 74 nested pages fail — the reported list contains exactly those 74 files.

Impact

pnpm docs:check is the package script the Docs check workflow runs, and it is the documented way to verify the English/Chinese mirror pairs locally (release-runbook, AGENTS.md, and docs/spec/06-delivery/03-ai-development-workflow.md). Windows is a shipped target platform, so contributors on Windows see a red check on a clean main and cannot distinguish a real documentation gap from this false positive.

App version

0.14.6

Operating system

Windows

Extra environment

Reproduced on main at 6e6d710e517b567d82dc28f8b01e19f7f81eaf64. git ls-files --eol reports w/lf for the pages, so this is not a line-ending problem.

Proposed fix

Normalize the separators when assembling the route, and split the check into noticeRoute/verifyLocalePairs so the route and the pair scan can be covered by tests. A pull request follows.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: platformOperating-system and environment-specific behaviorbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions