修复非 ASCII 路径下构建失败等 Windows 问题,并补上 CI - #1
Open
Tianbuyu-wwx wants to merge 2 commits into
Open
Tianbuyu-wwx wants to merge 2 commits into
Tianbuyu-wwx wants to merge 2 commits into
Conversation
Six shipped guards and the release build fail on a Windows checkout, and nothing in the repository says so because no workflow runs them. A Linux-only job cannot see any of these, which is how they reached a release. Path portability - Add `.gitattributes` pinning `* text=auto eol=lf`. Git for Windows defaults to `core.autocrlf=true`, so a clean clone checked every text file out as CRLF and the byte-comparison guards failed on it: LICENSE is pinned by length (11558 vs 11357 — one byte per line) and by SHA-256, NOTICE's copyright line carried a trailing `\r`, and public/_headers, vercel.json, the index.html CSP meta and docs/ARCHITECTURE.md are all compared as text. Ten tests across five files failed on a fresh clone for this reason alone. `licenses/**` is excluded: those files are copied verbatim from the shipped packages and several upstream LICENSE files are CRLF, so normalising them would make the committed copies differ from what `npm run legal:licenses` produces. - `legal-pages-core`: `writeAll` is async and copies `licenses/` with `fs/promises.cp`. The SYNCHRONOUS recursive copy aborts the process (0xC0000409) whenever the SOURCE path holds any non-ASCII character, so `npm run build` could not complete from a checkout under a path like `E:\项目\…` — it exited 127 with an EMPTY `dist/licenses`, dropping all 185 third-party licence files the legal pages link to, and it killed the build-pages worker outright. `build-legal-pages.mts` awaits it; the tests do too. - `generate-headers`: guard the ESA deployment doc on `docs/internal/` existing. The public snapshot does not carry that tree, so `--check` reported permanent drift and `npm run legal:headers:check` failed on every clone. - `operation-purity` exempted three macro bindings by POSIX suffix while building paths with `path.join`, so on Windows the exemption never applied and the three intended files were reported as offenders. Offender paths are reported POSIX-normalised as well. Diagnostics - `vite.config`: drop `dropConsole`. Oxc's transform is all-or-nothing and cannot tell a library's log from a failure report, so it also removed the editor's own error reports and the console banner `console-banner.ts` prints on purpose. Measured on a production build, a session of boot → draw → generate → 3D → open export emits two console messages and both are the app's own; the library call sites that remain in the bundle do not fire in use. Guards that failed for reasons of their own - `compression-compat` asserted a native stream rejects concatenated gzip members. Browsers do; Node's zlib-backed stream does not, and RFC 1952 allows a gzip file to be a sequence of members. It now pins the invariant that holds either way — the output cap — and documents the divergence rather than assuming one runtime's behaviour. - `root-docs` asserted the changelog was still STAGED (`## [Unreleased]`, no released heading) while the repository has published to v1.1.15. It now pins what holds in both states: at most one staged heading, and every released heading well formed. - Budgets the suite's own comments already called tight are now stated rather than inherited: `object-remove-cost` (sprite construction in jsdom), `build-pages` (a real 185-file licence copy, which these tests never reached before because the crash came first), `generate-operation` (21 full generations, several as a determinism pair), `agent/skills`-adjacent Help chunk in `windows.test.tsx`, and the lazy Help chunk's dialog. - `windows.test.tsx`, `chrome/tour-overlay` and `agent/setup-readiness` read an async surface in a single turn: the menu's rows, a sampler's second endpoint, and a panel handover driven by a fixed number of settle turns. Each now waits for what it asserts. CI - `.github/workflows/ci.yml` runs type-check, tests, build and the drift guards on ubuntu and windows, with actions pinned by SHA and the Node floor read from `.node-version`. Windows is in the matrix on purpose: it is the only place the first two fixes above are observable. Verified on the committing machine (Windows, checkout under `E:\项目\PetitMaker`): `npm run lint` clean; `npm run test:run` 8760 passed, no failures, no crashed workers — the same suite reported 17 failures plus a worker crash before; `npm run build` exits 0 with all 185 licences copied into `dist/licenses`, where the identical command exited 127 with an empty `dist/licenses` before; `stamp:check`, `docs:check`, `legal:licenses:check`, `legal:headers:check` and `legal:validate` all pass. Signed-off-by: 天不语 <2364309541@qq.com>
Owner
|
感谢!好夸张的行动力 (゚∀。)。已经完成了这次改动的review。我的结论是换行符、Windows 路径,以及公共仓库中的校验脚本问题,都值得修复。 这次 PR 同时涉及兼容性修复、生产日志和测试行为调整,范围比较大。建议先保留 Windows 和公共仓库兼容性相关改动,将生产日志调整单独讨论。中文路径的问题,方便的话能否补一个 Windows + Node 24 下的测试,确认复制操作正常完成且文件完整?压缩测试希望明确区分不同运行环境的预期结果,并保留内容完整性和输出大小限制的检查。几处等待时间的调整,也请补充原来的耗时或失败现象,方便判断是否需要延长。 另说明一下贡献的接收方式:公共仓库的 main 由发布流程统一更新。审核通过的改动会先整合到开发版本,完成验证后随版本发布,因此这里不会直接使用 Squash 或Rebase 合并。我们会在本 PR 中说明最终采纳的内容,并链接对应的公开发布记录。 目前贡献指南对这个流程说明得还不够清楚,我们会补充。再次感谢🙏! |
Author
Scope is now the Windows and public-repository compatibility fixes only. The production logging change to vite.config.ts is out of this PR. The non-ASCII path has a test that reproduces the abort: the license copy is driven from a working directory holding non-ASCII characters, and the assertions are about the COMPLETE result — same tree, same bytes — rather than that the call returned. Before the fix it kills the worker with exit code 3221226505; after it passes in 40ms. The existing copy test now compares all 185 files byte for byte instead of asserting the directory is non-empty. The concatenated-member case pins an answer per environment instead of accepting either one: Node's platform stream reads the sequence of members RFC 1952 defines and returns both (measured: 2x the payload), so that is asserted with byte-for-byte content, while the no-platform fallback is driven with the streams stubbed and must refuse rather than hand back a partial buffer. The output cap is checked on its own, with a payload that trips it. Every wait budget now states what was measured and what was seen to fail: 117/823/396ms for object-remove-cost with timeouts under a parallel run, 584-1246ms per generation case in generate-operation, ~1.4s for the full license-tree comparison, 8450ms for a neighbouring case in windows.test, and ~2.3s for the setup handover. No assertion was loosened. Signed-off-by: 天不语 <2364309541@qq.com>
Owner
|
谢谢!相关建议我同步到反馈频道上了(https://pd.qq.com/g/pd76247629, 欢迎加入),为方便追踪,可以给它们单开一些issue(我就不代劳啦,毕竟是你的contribution~),针对其中几点,我可以提一些我的想法
|
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.


修复非 ASCII 路径下构建失败等 Windows 问题,并补上 CI
感谢 review(以及"好夸张的行动力"😂)。以下按您提出的四点逐条回应。改动已收窄:生产日志调整(
vite.config.ts)已从本 PR 移除。1. 范围收窄
现在只包含 Windows 与公共仓库兼容性两类改动:
.gitattributes、writeAll改异步递归拷贝、generate-headers的守卫、4 个受影响测试docs/internal/、CHANGELOG 已发布小节,脚本与测试不再把内部形态当作唯一真相.github/workflows/ci.yml(ubuntu + windows,Node 24)已移除:
vite.config.ts的dropConsole改动。若您有兴趣,我可以单独开一个 PR,并附上实测数据(一次生产构建会话的 console 消息计数与调用点数量)。2. 中文路径:补了一条能复现该崩溃的测试
新增
copies licenses/ completely when the checkout path is not ASCII:把工作目录切到一个含非 ASCII 字符的临时路径再触发许可拷贝,断言的是结果的完整性(目录树逐文件一致、逐字节相同),而不是"没有抛错"。修复前后实测(同一台机器、同一条用例):
fs.cpSync递归)Worker exited unexpectedly with exit code 3221226505(即 0xC0000409,进程级中止)fs/promises.cp)同时把原有的
copies licenses/ through升级为copies licenses/ through, in full:对licenses/全部 185 个文件做树结构与逐字节比对(实测 ~1.4s),不再只断言"目录非空"。CI 的
windows-latest(Node 24)会运行这两条。3. 压缩测试:按运行环境分别钉预期,并保留完整性与大小限制检查
inflate优先使用平台的DecompressionStream。拼接 gzip 成员的行为按运行时不同而不同——RFC 1952 允许一个 gzip 文件由多个成员组成:原测试对两者都断言
rejects,这就是它在 Node 下失败的原因。现在按环境分别钉死:vi.stubGlobal复现)decompress的绝对上限仍报safety limit4. 几处等待时间:附上实测与失败现象
canvas/object-remove-costkit/generate-operationlegal/build-pagesui/shell/windowsui/agent/setup-readinesssettle()是固定轮数而非等条件成立;该用例实测 ~2.3s这几处没有放宽任何断言,只是把等待预算写明并给出依据(60s / 20s 都是仓库里已有的值)。另有一处
tour-overlay的采样竞态是补await frames(2)让采样器看到第二个端点,不是超时。关于合并方式
已了解:公共仓库
main由发布流程统一更新,审核通过的改动先进入开发版本、验证后随版本发布,不直接 Squash / Rebase。如需我调整提交形态(拆分、合并,或改用补丁文件),请告知。验证
npm run lint(即tsc --noEmit):0 错误dist/licenses185 个文件ubuntu-latest与windows-latest,Node 24