fix(docs): make check:docs work in native PowerShell on Windows#91609
fix(docs): make check:docs work in native PowerShell on Windows#91609aniruddhaadak80 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the docs formatting workflow to be more robust during CHECK runs by formatting within a temporary workspace and improving file comparison stability.
Changes:
- Chunk
oxfmtinvocations and allow overridingcwdso formatting can run inside a temp docs copy - Copy
.oxfmtrc.jsoncinto the temp directory and normalize CRLF/LF when comparing formatted output - Ignore
CLAUDE.mdfiles in markdownlint configuration
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/format-docs.mjs | Runs oxfmt in chunks and supports temp-root formatting with normalized comparisons. |
| config/markdownlint-cli2.jsonc | Adds an ignore rule for CLAUDE.md. |
| if (result.status !== 0 || result.error) { | ||
| console.error("spawnSync result:", result); | ||
| const stderr = result.stderr?.trim() ?? ""; | ||
| throw new Error(`oxfmt failed${stderr ? `:\n${stderr}` : ""}`); | ||
| } |
| }, | ||
| ); | ||
| function runOxfmt(files, cwd = ROOT) { | ||
| const chunkSize = 50; |
|
Codex review: needs real behavior proof before merge. Reviewed July 5, 2026, 9:20 PM ET / 01:20 UTC. Summary PR surface: Other 0. Total 0 across 2 files. Reproducibility: yes. source-level: the PR test demonstrates CRLF input being accepted after the formatter writes LF, while current Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep LF enforcement visible in check mode, handle Windows command-budget or smoke coverage through the focused companion path, and require real native PowerShell Do we have a high-confidence way to reproduce the issue? Yes, source-level: the PR test demonstrates CRLF input being accepted after the formatter writes LF, while current Is this the best way to solve the issue? No. Normalizing both sides hides a formatting difference the repo explicitly enforces, and the native Windows command-limit blocker remains in the formatter path before the changed comparison runs. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against eda9b9fb1858. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Other 0. Total 0 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (2 earlier review cycles)
|
e848cdb to
46a0cb4
Compare
|
Rebased onto main, resolved merge conflict in format-docs.mjs by taking main's refactored structure and preserving the CRLF normalization fix. Ready for re-review. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Closing as superseded by #93512, which landed the PowerShell-safe docs formatter fix in |
Closes #41513
What Problem This Solves
Currently, the docs formatting check (
pnpm check:docs) fails natively on Windows due to CRLF/LF line ending mismatches. Whenformat-docs.mjscompares the repository files with the formatted temporary files, git checkout on Windows may produce CRLF endings whileoxfmtwrites LF endings. This causes valid files to be incorrectly reported as misformatted. Additionally, theCLAUDE.mdfile was recently moved todocs/reference/templates/CLAUDE.mdbut not excluded inmarkdownlint-cli2.jsonc, causing lint failures.Why This Change Was Made
To allow Windows users to run docs checks natively without spurious failures, we normalize all line endings to LF before comparing the raw and formatted files in
format-docs.mjs. This aligns with the existing practice of normalizing line endings incheck-docs-format.mjs. Furthermore,**/CLAUDE.mdis added to themarkdownlint-cli2.jsoncignores list so it's not subject to standard Markdown checks that expect different formatting.User Impact
Allows Windows developers to run native PowerShell docs checks successfully without false-positive failures related to line endings or
CLAUDE.mdlinting.Evidence
format-docs.mjsto use.replace(/\r\n/g, '\n')when reading both the raw and formatted files.**/CLAUDE.mdtoconfig/markdownlint-cli2.jsoncignores.test/scripts/format-docs.test.tsto verify that CRLF is properly normalized to LF before comparing files in check mode, addressing the missing coverage identified by ClawSweeper.pnpm test:scripts test/scripts/format-docs.test.tsand verified the new test passes.