Skip to content

test: stub stdin ref/unref in cli premature-exit regression test - #2337

Merged
jatmn merged 1 commit into
mainfrom
test/cli-fake-stdin-ref
Oct 22, 2026
Merged

jatmn merged 1 commit into
mainfrom
test/cli-fake-stdin-ref

Conversation

@jatmn

@jatmn jatmn commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • The fake TTY stdin in the Node 24 premature-exit regression test (cli.test.ts) now stubs ref and unref next to setRawMode.
  • Why: Ink's App calls stdin.ref() before attaching its input listener. Without the stub it throws, Ink unmounts the app and logs [Ink:uncaught] TypeError: stdin.ref is not a function, so the test passed against an unmounted UI instead of the interactive startup it is meant to cover.

Impact

  • user-facing impact: none (test-only).
  • developer/maintainer impact: the regression test exercises a mounted Ink app again, and the misleading error is gone from test output.

Testing

  • I ran the required local preflight.
  • exact commands and results: bun run build ok, bun run typecheck ok, bun run check ok (0 failures in every shard).
  • focused tests: bun test src/entrypoints/cli.test.ts 5/5 pass, 0 runs log the Ink error (on main: 20/20 pass, 20/20 log it).
  • documented skipped checks, platform limitations, or verified pre-existing failures: verified on Node 22; the error did not make the test fail or hide assertion failures (an inverted assertion still fails), it only skipped the interactive path.

Notes

  • provider/model path tested: n/a
  • screenshots attached (if UI changed): n/a
  • follow-up work or known limitations: none.

Summary by CodeRabbit

  • Tests
    • Updated a CLI regression test to account for Node 24 stdin behavior during interactive sessions.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between c823efe and 04f9c1d.

📒 Files selected for processing: 1
  • src/entrypoints/cli.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.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 18
  • GitHub Check: unit-tests (8)
  • GitHub Check: typecheck
  • GitHub Check: unit-tests (2)
  • GitHub Check: unit-tests (3)
  • GitHub Check: launcher-compatibility (24.11.x)
  • GitHub Check: unit-tests (5)
  • GitHub Check: unit-tests (6)
  • GitHub Check: unit-tests (4)
  • GitHub Check: unit-tests (7)
  • GitHub Check: unit-tests (1)
  • GitHub Check: dedicated-tests
  • GitHub Check: launcher-compatibility (22)
  • GitHub Check: launcher-node-floor
  • GitHub Check: smoke-and-tests
  • GitHub Check: CodeQL (javascript-typescript)
  • GitHub Check: pr-intent-scan
  • GitHub Check: CodeQL (actions)
  • GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions: 3
Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions.

⚙️ CodeRabbit configuration file

Files:

  • src/entrypoints/cli.test.ts
Review install, launcher, build, packaging, startup, and entrypoint changes for cross-platform compatibility, tracked-source rewrites, env/config precedence, and release safety.

⚙️ CodeRabbit configuration file

Files:

  • src/entrypoints/cli.test.ts
Apply the OpenClaude maintainer review rubric from AGENTS.md.

⚙️ CodeRabbit configuration file

Files:

  • src/entrypoints/cli.test.ts
🔇 Additional comments: 1
src/entrypoints/cli.test.ts: 1

1131-1132: LGTM!

📝 Walkthrough

The Node 24 premature-exit regression test now stubs process.stdin.ref() and process.stdin.unref() to return process.stdin.

Changes: CLI regression test

Layer / File(s) Summary
stdin test setup
src/entrypoints/cli.test.ts
The child-process test setup stubs process.stdin.ref() and process.stdin.unref() to return process.stdin.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~2 minutes

Change: Other

Suggested reviewers: chioarub

Merge Risk: ⚪ Minimal · up to 04f9c

This test-only change is mergeable with no remaining actionable risk.

Pre-merge checks: Passed 7
Check name Status Explanation
Title check Passed The title is concise, scoped, and accurately describes the stdin ref/unref stubs added to the CLI regression test.
Description check Passed The description covers the change, rationale, impact, validation results, and notes. It follows the required template and reports focused test results.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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.
Risk Surface Disclosed Passed The diff changes only the fake stdin setup in src/entrypoints/cli.test.ts; it does not change CLI startup code. The test targets interactive startup, and the PR description identifies the change as …
No Hidden Policy Change Passed The PR changes only src/entrypoints/cli.test.ts. The diff adds process.stdin.ref and process.stdin.unref stubs in the existing child-process test setup. It does not change product behavior or pr…
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

Full details: Risk Surface Disclosed

Explanation

The diff changes only the fake stdin setup in src/entrypoints/cli.test.ts; it does not change CLI startup code. The test targets interactive startup, and the PR description identifies the change as test-only with no user-facing impact. The current review reports zero actionable findings, so no blocker is identified.

Full details: No Hidden Policy Change

Explanation

The PR changes only src/entrypoints/cli.test.ts. The diff adds process.stdin.ref and process.stdin.unref stubs in the existing child-process test setup. It does not change product behavior or product, trust-model, routing-default, telemetry/network, or permission policy. No explicit maintainer alignment is needed.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@jatmn jatmn self-assigned this Oct 22, 2026

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

— jatmn's PR Review agent

I found no actionable code defects in the three-dot diff. Details below.

Merge readiness

  • Draft PR: GitHub reports mergeable_state: blocked because the pull request is still a draft. Mark it ready for review when you want merge-queue / required-review gating to apply beyond CI.
  • CI (head 04f9c1d908e4e87c467e5b272a2dd792450cf87a): All required PR checks on the head commit completed success (eight unit-tests shards, smoke-and-tests, typecheck, dedicated-tests, launcher-compatibility for Node 22 and 24.11.x, launcher-node-floor, pr-intent-scan, CodeQL family). web skipped (no web diff). Combined commit status success; CodeRabbit success.
  • Node 24 vs local verification: The regression describe block targets Node 24 / #1678, but CI unit-tests runs Bun shards on Node 22 and the subprocess uses whatever node is on PATH (also 22 in that job). launcher-compatibility exercises Node 24.11.x for openclaude --version only—not this integration test. That matrix gap predates this PR; your Node 22 verification still matches what CI exercises for cli.test.ts. Not a merge blocker for this two-line harness fix.
  • Scope: Single file, test-only, no dependency on other open PRs.

🟢 Thanks for the contribution. I do not see any actionable issues from my review.

@jatmn
jatmn marked this pull request as ready for review October 22, 2026 15:59
@jatmn
jatmn merged commit 5c9b3c9 into main Oct 22, 2026
22 checks passed
@jatmn
jatmn deleted the test/cli-fake-stdin-ref branch October 22, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant