Skip to content

test: stop spawning POSIX binaries in two cases that run on Windows - #8713

Merged
lidge-jun merged 1 commit into
devfrom
fix/dev-red7-windows-posix-spawns
Nov 13, 2026
Merged

lidge-jun merged 1 commit into
devfrom
fix/dev-red7-windows-posix-spawns

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

Two Windows failures from dev batch 43496185962. Both test files were added in #8416 and spawn POSIX binaries that do not exist on Windows (uv_spawn ... ENOENT).

windows 5/14, tests/lib/process-control-graceful.test.ts "stopProxyGracefully > a refused mayTerminate keeps the forced-stop fallback from signalling the process" started its throwaway target with /bin/sleep 30. The behaviour it guards is platform-independent: on Windows the forced fallback is taskkill /T /F behind the same mayTerminate check (killProxy in src/lib/process-control.ts). The idle child is now the runtime's own binary (process.execPath -e "setTimeout(...)"), as the file's other helper already does, so the case runs on Windows too. Letting mayTerminate allow the stop makes it fail.

windows 4/14, tests/service/service-scheduler-restart-respawn-refusal.test.ts (9 cases, 11 results). This file models a Windows scheduler restart on a POSIX process model by design. The Windows host is a fixture: repairService({ platform: "win32" }), and the proxy child pins process.platform to win32 for its own branch selection. The process lifecycle under that is POSIX on purpose. The proxy is launched through /bin/sh -c '... &' so init reaps it (a zombie child would still answer kill(0) while stopProxy blocks the event loop in Atomics.wait). A symlink named ocx supplies the command line that verifyPidIdentity reads through ps. On a real Windows host there is no /bin/sh, and the stop runs the real Windows path (CIM command-line identity, taskkill), which makes it a different test that cannot be validated before a Windows batch. Its cases now run off Windows only (posixHostTest = test.skipIf(process.platform === "win32")). The reason is written in the file, together with the tests that cover the same decisions on Windows:

  • tests/service/service-scheduler-restart-cleanup.test.ts: repairService on a respawnable_service refusal and the restart receipt, hermetic, every platform. 27 cases passed on windows 3/14 of the same run.
  • tests/windows/windows-stop-callers.test.ts: the Windows /api/stop route and the checked service stop. 32 cases passed on windows 12/14 of the same run.

These cover the same decisions through seams and are partial coverage, not an end-to-end replacement: Windows CI no longer has this file's integrated proof that the real management route accepts a matching receipt, rejects a foreign one, and settles restart recovery against a live proxy. A native Windows integration test (direct child, Windows identity and taskkill paths) is a worthwhile follow-up. On Linux and macOS the file still runs every case.

Verification

  • bun test tests/lib/process-control-graceful.test.ts: 33 pass / 0 fail. With mayTerminate: () => true the guarded case fails.
  • bun test tests/service/service-scheduler-restart-respawn-refusal.test.ts: 11 pass / 0 fail on macOS.
  • bun run typecheck: exit 0.
  • NOT RUN: a native Windows runner (the next manual dev batch), and the full suite locally.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Summary by CodeRabbit

  • Tests
    • Improved cross-platform test compatibility by avoiding assumptions about platform-specific utilities and skipping POSIX-only scheduler test fixtures on Windows.
    • Updated coverage for graceful process shutdown and scheduler restart, refusal, receipt, recovery, and locking scenarios; existing test assertions remain unchanged.

dev batch 43496185962 windows 5/14: process-control-graceful started its idle
target with /bin/sleep, which does not exist on Windows (uv_spawn ENOENT). The
runtime's own binary is the idle child now, as the same file's other helper
already does; the case keeps guarding the forced-stop fallback, which on Windows
is taskkill behind the same mayTerminate check. Letting mayTerminate allow the
stop makes the case fail.

windows 4/14: service-scheduler-restart-respawn-refusal (added in #8416) models
the Windows host on a POSIX process model: the proxy is launched through /bin/sh
so init reaps it, and a symlink named ocx supplies the command line ps reports.
On Windows none of that exists and the stop path is the real Windows one, which
is another test. Its cases now run off Windows only, with the reason and the
Windows coverage of the same decisions (service-scheduler-restart-cleanup and
windows-stop-callers, both green on that run's Windows shards) in the file.
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner November 13, 2026 20:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T20:43:56.909541Z af6485a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Nov 13, 2026
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The test changes use process.execPath for the graceful-stop child and skip POSIX-hosted scheduler tests on Windows. The scheduler test bodies and assertions remain unchanged.

Changes: Test platform coverage

Layer / File(s) Summary
Graceful-stop child process
tests/lib/process-control-graceful.test.ts:49-52
The regression test launches an idle child through process.execPath instead of /bin/sleep. Comments describe the platform coverage and forced-stop fallback.
Scheduler test platform guard
tests/service/service-scheduler-restart-respawn-refusal.test.ts:36-52, 127, 192, 247, 289, 342, 364, 407, 430, 476
The file defines posixHostTest to skip tests on Windows. Ten affected restart, refusal, receipt, recovery, and lock tests use the wrapper, including both parameterized suites.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: luvs01

Merge Risk: Minimal · up to af648

This change only adjusts tests so they no longer depend on POSIX binaries on Windows. It does not affect runtime behavior and is ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title says the PR stops spawning POSIX binaries in two test cases that run on Windows. The raw summary and objectives confirm both changes: the idle child in process-control-graceful.test.ts switc…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title says the PR stops spawning POSIX binaries in two test cases that run on Windows. The raw summary and objectives confirm both changes: the idle child in process-control-graceful.test.ts switches from /bin/sleep to process.execPath, and the scheduler restart respawn refusal tests are skipped on Windows via posixHostTest. The title is specific, concise, and matches the main change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 0d3b1fa and af6485a.

Files selected for processing: 2

  • tests/lib/process-control-graceful.test.ts
  • tests/service/service-scheduler-restart-respawn-refusal.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@lidge-jun

Copy link
Copy Markdown
Owner Author

Maintainer judgment: integrating into dev under the MAINTAINERS.md maintainer-integration exception, without a second maintainer approval. This is maintainer integration, not a self-approval.

Exact head af6485a:

  • PR CI: all 27 checks on this head passed or were skipped by policy.
  • Fresh final review (gpt-6.1-terra, high) on this exact head: PASS, no blocking findings. The portable idle child keeps the mayTerminate guard meaningful (checked before both Windows taskkill and POSIX signals). The Windows gate on service-scheduler-restart-respawn-refusal is justified: the fixture depends on POSIX reparenting and ps. The cited Windows tests are partial coverage; the missing native Windows integration test (route receipt acceptance/rejection and restart settlement against a live proxy) is recorded in the PR description as a follow-up. Reviewer run: 71 pass / 0 fail across the three files; typecheck passed.
  • Author checks: with mayTerminate () => true the guarded case fails; 33 pass / 0 fail and 11 pass / 0 fail on macOS.
  • NOT RUN: native Windows execution; the next manual dev batch covers it.

Test-only change; no outstanding maintainer change requests and no security-boundary surface.

@lidge-jun
lidge-jun merged commit a713532 into dev Nov 13, 2026
39 checks passed
@lidge-jun
lidge-jun deleted the fix/dev-red7-windows-posix-spawns branch November 13, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant