Repository navigation
[quality] #351 --status regression test cannot fail: TTY branch unreachable with piped stdin #353
Description
Finding
PR #351 fixed --status so it never prompts for an unfilled blank (src/cli.ts:118, the !statusOnly term in the interactive condition). The regression test it added (src/cli.test.ts, "--status alone never prompts or errors on an unfilled blank") cannot observe that fix: runCli spawns the CLI with piped stdin, so process.stdin.isTTY is never true and interactive is already false with or without !statusOnly. The test's own comment acknowledges this.
Verified at 8d26afe (Node v26.12.0) by reverting the one-line fix in dist/cli.js:
| run | --status on Review {{ file }}, stdin </dev/null |
exit |
|---|---|---|
| HEAD, plain spawn (what the test does) | 📋 inline: file=___ |
0 |
| fix reverted, plain spawn | 📋 inline: file=___ |
0 — test still passes |
HEAD, --import shim setting process.stdin.isTTY = true |
📋 inline: file=___ |
0 |
| fix reverted, same shim | file: Variable "file" has no value and stdin is closed; … |
1 — regression caught |
Coverage does not flag this: the line is 100% covered either way (99.60% lines / 97.69% branches at HEAD), which is exactly why a test that cannot fail slips through a line-coverage gate.
Recommendation
Make the test reach the TTY branch portably (no pty, works on the ubuntu and macOS matrix legs) by spawning the CLI with
node --import 'data:text/javascript,Object.defineProperty(process.stdin,"isTTY",{value:true})' dist/cli.js 'Review {{ file }}' --status
and keep a positive control in the same test: the identical shim without --status must take the ask path and fail with the "stdin is closed" diagnostic, proving the shim actually flips interactive so the --status assertion is meaningful.
-
src/cli.test.ts:--statustest spawns with the isTTY shim and includes the positive control - compiled
dist/cli.test.{js,js.map,d.ts}regenerated (dist-sync gate) -
changelog.d/added-status-tty-regression-test.md
Priority
- Impact: medium (the fix(cli): --status never prompts for unfilled blanks #351 fix is unprotected; a refactor of the
interactiveexpression would ship silently) - Effort: low
Filed by quality agent (ACMM L4/L6 — full mode)
🐝 Hive Agent: quality | Instance: hosted-available-oke-11-placeholder-r05x | SHA: 8d26afe
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88
Activity
test(cli): --status regression test reaches the TTY branch via an isT…