cli: make --elide-lines a no-op in non-terminal environments#28977
cli: make --elide-lines a no-op in non-terminal environments#28977
Conversation
- Revert BUN_CONFIG_ELIDE_LINES additions (separate PR) - Revert unrelated scripts/build/flags.ts change - Remove the warning entirely instead of erroring; the flag is already a no-op when pretty_output is false (redraw() returns early before reading elide_count), so neither error nor warning is needed - Add cross-platform regression test for non-TTY + --elide-lines Fixes #16286
|
Updated 9:06 PM PT - Apr 7th, 2026
❌ Your commit
🧪 To try this PR locally: bunx bun-pr 28977That installs a local version of the PR into your bun-28977 --bun |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughRemoved the runtime error that blocked use of Changes
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
LGTM — simple removal of a spurious error that was already a no-op.
Extended reasoning...
Overview
Removes 6 lines from src/cli/filter_run.zig that exited with an error when --elide-lines was passed in a non-TTY context. The elision logic only runs inside the pretty_output TTY redraw path, so the error was serving no purpose. Test updates reflect the new correct behavior: no error, exit code 0, and all output visible.
Security risks
None. This is a pure behavioral change removing an unnecessary early-exit guard. No auth, crypto, or permissions code is touched.
Level of scrutiny
Low. The diff is minimal — a 6-line deletion and corresponding test cleanup. The logic is easy to verify by reading the readChunk and redraw functions: the if (\!this.pretty_output) return; guard in redraw() means elision is already skipped in non-TTY mode regardless of elide_count.
Other factors
The one bug flagged (inline comment) is a test quality nit — the new non-TTY test uses --elide-lines 0, which is a universal no-op, rather than a positive value that would more strongly validate non-TTY elision bypass. This does not affect implementation correctness.
|
@robobun adopt |
|
🔴 Build #44361 test-bun shards on alpine/debian/ubuntu (x64, aarch64, baseline, asan) and darwin are failing — but the exact same set of shards is also red on unrelated PR #28979 (build #44365) which only touches The only annotated tests in my build are:
Neither touches |
There was a problem hiding this comment.
LGTM — my previous feedback on was addressed; the two remaining nits are in test code only and don't affect production correctness.
Extended reasoning...
Overview
The PR removes 6 lines from src/cli/filter_run.zig: the runtime guard that rejected --elide-lines with exit code 1 when stdout is not a terminal. The Zig change is a clean, mechanical deletion. The test changes update the Windows branch of runElideLinesTest (removing the now-obsolete error expectation) and add a new explicit test for the non-TTY no-op behavior.
Security risks
None. This is a CLI UX fix with no auth, crypto, or permission surface.
Level of scrutiny
Low. The implementation change is a single block removal with no logic added — only the error path is deleted, and the flag was already functionally a no-op in non-TTY mode (the elision code only runs inside redraw(), which returns early when pretty_output is false). The correctness of the no-op behavior is unchanged.
Other factors
My prior review flagged the use of --elide-lines 0 (a universal no-op) in the new test; the author addressed this by bumping to --elide-lines 5. The two remaining bug reports from the automated system are nit-level test quality issues (Windows branch not checking the antipattern array, and a vacuously-true stderr assertion that should target stdout). Neither affects production behavior — elision text is never written to stderr, and Windows piped output cannot trigger elision regardless. The inline comments on those nits are sufficient.
There was a problem hiding this comment.
LGTM — all prior review feedback addressed, straightforward no-op promotion.
Extended reasoning...
Overview
The PR removes a 6-line validation block in src/cli/filter_run.zig that errored when --elide-lines was used outside a terminal, and updates test/cli/run/filter-workspace.test.ts to reflect the new no-op behavior.
Security risks
None. This is a pure UX fix: removing an error guard for a display-only flag. No auth, crypto, permissions, or data-exposure surfaces are touched.
Level of scrutiny
Low. The Zig change is a deletion-only diff with no new logic. The test changes are additive and address coverage gaps identified in prior reviews.
Other factors
All three issues I raised in previous review rounds were resolved: (1) the new test now uses --elide-lines 5 instead of 0 to catch future non-TTY elision regressions; (2) the not.toMatch(/lines elided/) assertion correctly targets stdout where flushDrawBuf writes; (3) the Windows branch now iterates the antipattern parameter. No outstanding comments remain.
Split out from #18111 by @martinamps.
--elide-linescurrently exits with an error when stdout is not a terminal, which breaks scripts that pass the flag and run in both interactive and CI/hook contexts. The flag is already a no-op in this case (the elision code only runs in the TTY redraw path), so the error serves no purpose. This removes it.Fixes #16286