Commit Graph
3 Commits
Author SHA1 Message Date
yetone 9a0414637e scripts: the opencode2 and proc tests pass on Windows
unisong reported in #1206 that tests under scripts/ fail on Windows on
main. Reproduced on the Windows box at origin/main (bun test scripts):
23 pass, 8 fail.

- opencode2.test.mjs took the packages folder from a file URL's
  pathname, "/C:/…", and join made it "\C:\…", so seven imports
  failed ("Cannot find module"). It is fileURLToPath now.
- scripts/sync-proc.mjs had the same pathname root. proc.test.mjs
  imports it, so the whole file failed to load (the eighth red).
- With it loading, proc.test.mjs showed five more on Windows: its fake
  readFile matched "/fake-proc/123/stat" while proc.mjs joins with the
  system's separator, and the kill(pid, 0) walk's skip list (written
  with "/") skipped nothing, so it walked test folders and passed its
  5s bound. The fake now matches join()'s path, and the walk compares
  "/" paths. proc.mjs itself is unchanged: it reads /proc on Linux only.

Only scripts/ changes; no package's files, so no version.

Run:
- win-run (Windows 11) bun test scripts: 39 pass, 0 fail
  (origin/main: 23 pass, 8 fail).
- mica-run (macOS) bun test scripts: 39 pass; node scripts/sync-proc.mjs
  ok, and on Windows too.

Not tried: Linux (CI runs it).
2026-11-16 15:09:02 +08:00
yetone 1823ff3a13 proc: deepzora and gumloop ask the shared proc.mjs whether a lock's owner lives (#1164)
#1198 (yetihan) moved 15 packages' liveness checks onto scripts/proc.mjs,
so a Linux zombie no longer holds a lock. Two were left on a bare
kill(pid, 0), which answers for a zombie as for a live process:

- deepzora's bridge lock (bridge.mjs lock(), the same code as
  reasonix-desktop's, which #1198 fixed): a zombie owner left "Another
  bridge operation is running" until the zombie was reaped.
- gumloop's ledger lock peers (gumloop.mjs isAlive): a zombie peer was
  counted live, so its ticket was waited on.

Both now import a synced proc.mjs (scripts/sync-proc.mjs lists 17
copies; both package.json files ship it). gumloop's crash-window test
writes its instrumented copy into a temp dir, so proc.mjs is copied
beside it. A new guard in scripts/proc.test.mjs fails when any package
file outside tests and proc.mjs calls kill(pid, 0).

deepzora 0.2.1, gumloop 0.1.2.

Run (mote, HOME=$(mktemp -d)):
- bun test scripts/proc.test.mjs packages/deepzora packages/gumloop:
  111 pass, 0 fail. node --test scripts/proc.test.mjs: 9 pass.
- deepzora node --test deepzora.test.mjs: 13 pass.
- node scripts/sync-proc.mjs --check: ok. bun scripts/check.mjs: ok.

Broken by hand: main's bridge.mjs and gumloop.mjs with the new tests:
the guard names both files, and the copies test fails on deepzora.

Not tried: a real zombie owner for these two (#1198's fork-based
zombie check covers proc.mjs itself); a real Gumloop or DeepZora
account. gumloop under node --test fails 3 of 3 on bun:test imports,
the same on origin/main.
2026-11-16 12:31:01 +08:00
zhou.han 9e86a2c7b7 proc: a Linux zombie no longer holds a lock (#1198)
yetihan (#1198): a lock whose owner is a Linux zombie was held for
good. process.kill(pid, 0) succeeds on a zombie, so 15 packages' lock
and liveness checks counted an exited, unreaped owner as alive.

- scripts/proc.mjs: processStatus(pid) is dead on ESRCH, and on Linux
  also when /proc/<pid>/stat says Z or X; EPERM is "permission", any
  other error "unknown". processAlive / processExists keep each
  caller's old EPERM and unknown-error meaning.
- scripts/sync-proc.mjs copies it into each package (--check in the
  tests); every package's own check keeps its old semantics, now with
  zombies dead. agent-console's daemon bundle and window-warmup's dist
  are rebuilt.
- 15 packages bumped.

Review run at 28ef6622 (mote, HOME=$(mktemp -d)):
- node scripts/sync-proc.mjs --check: ok.
- bun test (whole repo): 8934 pass, 0 fail.
- bun scripts/check.mjs: every package ok.
- window-warmup's build reproduces its dist/plugin.js byte for byte.
  agent-console's bundle diff read line by line: the proc module plus
  esbuild's renumbered imports, nothing else (esbuild isn't installed
  on mote, so it wasn't rebuilt there).
- Real zombie on Linux (WSL, magpie-desktop): a bash child left
  unreaped by an exec'd sleep, /proc stat "Z": the old kill(0) check
  says alive, processStatus says dead; the running process says alive.

Not tried: each package's lock contention end to end.
2026-11-16 12:19:09 +08:00