Repository navigation
test(e2e): windows-compatible hermetic registry e2e + real npm -g install test - #1880
Conversation
…tall test
The hermetic registry e2e (local verdaccio, PR-gated) and the release
canary ran ubuntu-only, so the entire Windows install/update surface —
npm -g shims, NTFS junctions, USERPROFILE-mirrored npm config — had zero
CI coverage.
This PR ports the registry e2e suite to real Windows and adds a new
end-to-end test that exercises the real npm client:
- tests/e2e/crossplat.ts (new): shared cross-platform helpers.
- npmCliPath() runs npm via node npm-cli.js (no shell, no ENOENT on
npm.cmd); npmRunSync() falls back to shell+quoting.
- windowsSystemEnv() forwards SystemRoot/ComSpec/etc — a bare env
without SystemRoot breaks node child processes on Windows.
- npmHomeEnv() mirrors HOME to USERPROFILE/APPDATA (npm userconfig
reads USERPROFILE, not HOME, on win32).
- fakeVersionBin() writes a cross-platform fake CLI (.cmd on win32);
the product's detectOpencodeMajor already shells out for .cmd/.bat.
- registry-fixture.ts + both e2e suites use the helpers; hermetic env
isolation (HOME + XDG_* + win mirrors) now holds on both platforms
(paths.ts reads XDG_* on all platforms).
- New test "hermetic npm -g install e2e": the real npm client installs
billion-context@OLD --global into an isolated prefix (asserts the
platform-correct layout: <prefix>/node_modules + bili.cmd on win32,
lib/node_modules + bin/bili on POSIX), then `bili update` flips it in
place over the real chain, and the shim npm laid down reports the new
version. Fixture tarballs are published with dependencies stripped for
this test — the hermetic registry has no uplinks and dependency
resolution would 404; the flip mechanics under test don't involve it.
- ci-registry.yml: matrix ubuntu-latest + windows-latest (bash shell on
both; artifacts collected with an os suffix).
Validated on a real win10 VM (not just GH runners): junction unit tests
11/11 (from #1872 follow-up), hermetic registry e2e 10/10 including the
new npm -g test — self-update flip, advisory rollback, real npm -g
install + shim + in-place flip all behave on real Windows. Product code
is unchanged; every failure found on the VM was in test infrastructure.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1878-pr.1880.16e1886This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1880.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Review of #1880: when npmCliPath() misses, the fallback branch built execFile(file="npm", args=[joined command], {shell:true}) — Node prepends the file to the shell command line, so this executed `npm npm pack …`. Pass the whole command as the file string with empty argv instead, and quote whitespace-bearing args on all platforms (POSIX quoting was win32-only in npmRunSync). Dead path on CI runners (npm-cli.js sits next to node); only reachable on local dev machines.
… contract Review of #1880: pre-existing strict-tsc mismatch (tests are excluded from tsconfig.build.json, so CI never saw it) — runNpm resolves {stdout,stderr} but RegistryFixture.publish declares Promise<void>. Discard the result at the boundary instead of leaking it into the declared type.
[bot] 🏷 PR #1880 review — 已拉取分支逐文件审完(5 files, +213/−77,单提交),并核对了产品代码侧的每个承重点。结论先行:方向正确、无回归、可合并;review 中顺手修了 2 个小问题(见下),已作为独立标注 commit 推到 查重:无重复。#1872(已合)是 Windows 自更新功能本体,本 PR 是其后的 CI 覆盖补齐,范围不重叠。 ① 是什么问题:hermetic registry e2e 与 release canary 只有 ubuntu leg,Windows 安装/更新面(npm -g shim、NTFS junction、USERPROFILE 隔离)CI 覆盖为零;且现有 suite 全是手工 tar 展开路径,真实 npm 客户端的 ② 什么原因导致的:原 suite 按 POSIX 假设写成—— ③ 怎么修复的(机制层核对,均已逐一验证):
④ 是否有回归问题:逐项过完,无。
⑤ 是否破坏缓存:不涉及——未触碰缓存/重试/增量游标/去重键任何逻辑。 ⑥ 是否改了设计方向:不涉及——纯测试/CI 基建,两种压缩模式、wire、配置面均未动。 ⑦ 是否引入新配置:不涉及——无新 env/config/默认值;用到的 Review 顺手修的小问题(小问题直接修,独立 commit 已推分支):
验证证据:编辑后树本地跑 CI 状态:原 head 非阻塞备注:分支名 判定:可合并(待 |
[bot] 🏷 CI 全绿确认:新 head 我此前给出的合并条件已满足,PR 可合并(合并操作归人)。review 结论见上一条评论(结构化七问 + 两个修复 commit 说明)。 |
test(e2e): windows-compatible hermetic registry e2e + real npm -g install test
The hermetic registry e2e (local verdaccio, PR-gated) and the release
canary ran ubuntu-only, so the entire Windows install/update surface —
npm -g shims, NTFS junctions, USERPROFILE-mirrored npm config — had zero
CI coverage.
This PR ports the registry e2e suite to real Windows and adds a new
end-to-end test that exercises the real npm client:
npm.cmd); npmRunSync() falls back to shell+quoting.
without SystemRoot breaks node child processes on Windows.
reads USERPROFILE, not HOME, on win32).
the product's detectOpencodeMajor already shells out for .cmd/.bat.
isolation (HOME + XDG_* + win mirrors) now holds on both platforms
(paths.ts reads XDG_* on all platforms).
billion-context@OLD --global into an isolated prefix (asserts the
platform-correct layout: /node_modules + bili.cmd on win32,
lib/node_modules + bin/bili on POSIX), then
bili updateflips it inplace over the real chain, and the shim npm laid down reports the new
version. Fixture tarballs are published with dependencies stripped for
this test — the hermetic registry has no uplinks and dependency
resolution would 404; the flip mechanics under test don't involve it.
both; artifacts collected with an os suffix).
Validated on a real win10 VM (not just GH runners): junction unit tests
11/11 (from #1872 follow-up), hermetic registry e2e 10/10 including the
new npm -g test — self-update flip, advisory rollback, real npm -g
install + shim + in-place flip all behave on real Windows. Product code
is unchanged; every failure found on the VM was in test infrastructure.