Repository navigation
fix(update): probe pi-stable in resolvePiBinary + e2e no-op assertion - #1883
Conversation
resolvePiBinary probed only `pi`(.cmd), but a stock `npm install -g pi-stable` lays down just `pi-stable`(.cmd) — the npm package's declared bin name. Every stock npm install missed the probe and fell back to a bare "pi" spawn that ENOENTs. Probe both names, `pi` first (canonical UX name wins when both exist). Also extend the hermetic npm -g e2e with the no-op branch: after the flip, a second `update` run must exit 0 with "(up to date)", never "Restart to finish", and must not touch package.json. Validated end to end on a real Windows 10 VM against a real `npm i -g pi-stable` agent tree: the pi-managed copy's own `update` run takes the #991 managed branch, drives `pi-stable update --extension npm:billion-context`, and the copy converges 0.1.100 → 0.1.179 with the settings entry untouched.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.1883-pr.1883.71b6c8aThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr1883.tgz
npm install -g packageInstall instructions are refreshed on each push. |
The 'canonical pi wins' sub-case called resolvePiBinary({PATH: binDir}, 'linux', fs.existsSync, ...) where binDir was a real mkdtemp path. On a Windows host that path carries a drive-letter colon (C:/Users/...); the 'linux' branch splits PATH on ':' and shreds the single directory into two non-matching fragments, so the resolver returned bare 'pi' and the assert failed. Red on both windows-latest jobs; ubuntu has no drive colons so it stayed green.
Rewritten with a synthetic colon-free dir plus a stubbed existsImpl reporting both names present - pins the pi-before-pi-stable probe order without depending on host path shape. Production code unchanged.
[bot] 🏷 ## Review — #1883 (pi-stable probe + e2e no-op) Reviewed direction, diff, log-string soundness, and full CI. Found and fixed one blocking issue: the PR's own new unit test was red on both What I verified
The blocking issue (now fixed)CI on the original head: 12 checks green, Root cause (test defect, not a production regression): the "canonical Fix: rewrote that one sub-case to be host-independent — synthetic colon-free dir ( 结构化七问
判定:可合 —— 待 |
[bot] 🏷 ## CI confirmation — #1883 now fully green ✅ Re-ran check on the fixed head
So the host-independent test rewrite resolved the Windows drive-colon failure with no regression anywhere else. Verdict unchanged: ready to merge — the only outstanding item was those two Windows jobs, now green. Merge stays human-only; go ahead when you're ready: #1883 |
Three follow-ups out of the Windows update/install audit (#1880), validated on a real Windows 10 VM.
1.
resolvePiBinary: also probepi-stable(fallback for renamed installs)The canonical npm package is
pi(npm i -g pilays downpi), and the existing probe already covers it. But pi is also distributed under renamed package names (e.g. this project's test envs usepi-stable), whose stock npm install lays down onlypi-stable(.cmd) with nopialias — on such machines the probe missed, fell back to a bare"pi"spawn → ENOENT, andrefreshPiNpmCopynever converged.Fix: probe both names,
pifirst (canonical name wins when both exist; zero behavior change for stock installs).2. e2e no-op assertion
The hermetic npm -g e2e only covered the flip branch. Now, after the flip, a second
updaterun must:(up to date)and neverRestart to finishpackage.jsonmtime untouched3. Real-Windows validation (not in CI, reported here)
refreshDshDesktopCopy(flat literal path) → junction displaced, real dir at 0.1.179, store untouched at 0.1.100, no backup leftovers — on real NTFS.bili update: Node ESM realpaths past the junction → generic in-place flip writes through into the store dir (the dsh 渠道把桌面应用独占的 profiles/desktop 当普通 profile 驱动 —— 第二写者冲突 #1575-accepted in-place overwrite); junction survives. Both flows behave as designed.npm i -g pi-stable+pi-stable install npm:billion-context, staged copy/lock/hidden-lock consistently to 0.1.100 (production-stale shape), ran the copy's ownupdate→ native模式下自动更新问题需要解决 #991 managed branch →pi npm copy is stale … refreshing→ spawn foundpi-stable.cmd(fix fix: keep system prompt byte-stable for prefix cache #1) → copy converged to 0.1.179, settings entry untouched.Local: typecheck clean,
update-pi-self-refresh12/12, hermetic registry e2e 5/5 (Linux).