Skip to content

refactor(test): reuse process-death waits in PTY tests - #174221

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/test-audit-pty-waits-20261016
Oct 16, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/test-audit-pty-waits-20261016

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

The PTY tests duplicate the shared process-death wait instead of using its existing cancellation and cleanup contract.

User Impact

No user-visible change. Both PTY suites and every assertion remain; production code is unchanged.

Why This Change Was Made

Replace two identical local wait loops with waitForDead, retaining the test-owned abort signal and explicit descendant-death assertions. PTY exit reports the shell's lifetime, so the separate adopted-descendant check still matters.

The shared helper observes death once more before rejecting an abort and polls every 5 ms instead of 10 ms. It adds no deadline or retry budget. Existing helper tests cover abort diagnostics, real process death, zombie detection, and timer/listener settlement.

This removes 26 net test lines across two files, with no cases, assertions, platform gates, or production lines removed.

Evidence

  • Independent scoped review: no actionable findings.
  • AST comparison against c4f6442eed0f12bdfb4d9844726eebcd362dee28: every retained statement, test case, and assertion is equivalent after the wait-call rename.
  • Formatting and git diff --check: passed.
  • Scoped type-aware lint on both changed files: no warnings or errors.
  • Isolated Blacksmith Testbox proof run: Node 24.19.0, Linux x64, observed 4 CPUs and 16 GB RAM.
  • node scripts/run-vitest.mjs src/process/terminal-pty.test.ts src/process/terminal-pty-bun.test.ts test/helpers/process-wait.test.ts --maxWorkers=1: 27 passed / 14 platform-runtime skips on Node; 35 passed / 6 platform-runtime skips on the checksum-pinned OpenClaw Bun fork. All eight native Bun PTY cases ran and passed, including the slave-holding descendant case.

The signed commit 11aa707ef5ecf89209db3271af956d8206132df1 has the exact tested tree 0a15ce8752f2e935053b48f388ce1b3efecfff7e. The test payload passed; the delegated Actions run was cancelled during lease cleanup. An initial cleanup settlement read failed, then the same native lease-stop route reconciled successfully without rerunning tests.

The remaining skips cover Windows-only cases and the stock-Bun fallback route, neither changed here. Required exact-head CI owns broader compiler and platform proof.

@vincentkoc vincentkoc self-assigned this Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@vincentkoc
vincentkoc marked this pull request as ready for review October 16, 2026 12:52
@vincentkoc
vincentkoc enabled auto-merge (squash) October 16, 2026 12:59
@vincentkoc
vincentkoc merged commit a50e0a2 into main Oct 16, 2026
171 checks passed
@vincentkoc
vincentkoc deleted the refactor/test-audit-pty-waits-20261016 branch October 16, 2026 13:05
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash auto-merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant