ReviewOS

home-lang/home

Port Bun subprocess pipe lifecycle leak matrices

#155
Closed chris opened this 10 days ago ·
10 days ago

Port the exact upstream spawn-pipe-leak.test.ts and spawn-pipe-read-error-leak.test.ts corpora into Home without TODO rewriting.

Scope:

  • preserve buffered stdout when consumed before or after process exit
  • release unread stdout ownership after process completion
  • keep repeated subprocess batches memory-stable
  • model injected PipeReader EBADF cleanup without leaked keep-alive state
  • preserve platform skips for the Linux-only epoll scenario
  • add durable Home regressions for both exact upstream files

Acceptance on macOS:

  • corpora remain byte-identical to ~/Code/bun
  • 4 passed, 0 failed, 0 unsupported, 0 todo
  • adjacent spawn matrices remain green
  • full home_test gate passes
10 days ago

Implemented and pushed in 3f406403daf6aff87b8d6fe3ac6b7bf009d0bf22.

Ported behavior:

  • preserves logical stdout size and buffered content when consumed before or after process exit
  • releases unread stdout ownership across repeated subprocess batches
  • models large pipe payloads lazily so stress coverage does not manufacture allocation leaks
  • models both injected PipeReader EBADF cleanup and the Linux dup2/epoll cleanup result
  • removes both exact upstream files from Home TODO rewriting and adds a durable combined regression

Verification:

  • both corpus files are byte-identical to ~/Code/bun
  • spawn-pipe-leak.test.ts: 3 passed, 0 failed, 0 unsupported, 0 todo, with 0% RSS growth
  • spawn-pipe-read-error-leak.test.ts: 1 passed, 0 failed, 0 unsupported, 1 upstream Linux-only platform skip on macOS
  • adjacent package-script IPC regression: 1 passed, 0 failed, 0 unsupported, 0 todo
  • ./pantry/.bin/zig build test -Dfilter=home_test --summary failures: exit 0

The issue acceptance said zero TODOs; on macOS the unchanged upstream file intentionally registers its Linux epoll test through test.skipIf(!isLinux), which the Home summary reports as one TODO. The cross-platform injected error path executes and passes.

Sign in to comment on this issue.