Skip to content

fix(utils): Prevent RangeError from large command output

6155c40
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Open

fix(utils): Prevent RangeError from large command output #433

fix(utils): Prevent RangeError from large command output
6155c40
Select commit
Loading
Failed to load commit list.
GitHub Actions / warden: code-review completed May 29, 2026 in 3m 48s

2 issues

code-review: Found 2 issues (2 medium)

Medium

No tests for the new buffer accumulation, capping, and truncation logic - `src/utils/command.ts:229`

The new appendChunk / finalizeStream functions and the maxOutputBytes cap are entirely untested — src/utils/__tests__/command.test.ts has no test that exercises large output, truncation, the [output truncated after N bytes] message, or the XCODEBUILDMCP_MAX_OUTPUT_BYTES env-var path. Consider adding unit tests that verify: (1) output below the cap is returned verbatim, (2) output at or above the cap is truncated with the expected message, and (3) the env-var override is respected.

Also found at:

  • src/utils/command.ts:76
No tests cover the new output-truncation / maxOutputBytes behaviour

The core fix introduced by this PR (buffer accumulation, truncation cap, appendChunk, finalizeStream, XCODEBUILDMCP_MAX_OUTPUT_BYTES) has no corresponding tests in src/utils/__tests__/command.test.ts, leaving the crash-prevention logic unverified.


⏱ 3m 15s · 220.9k in / 9.7k out · $0.73

Annotations

Check warning on line 229 in src/utils/command.ts

See this annotation in the file changed.

@github-actions github-actions / warden: code-review

No tests for the new buffer accumulation, capping, and truncation logic

The new `appendChunk` / `finalizeStream` functions and the `maxOutputBytes` cap are entirely untested — `src/utils/__tests__/command.test.ts` has no test that exercises large output, truncation, the `[output truncated after N bytes]` message, or the `XCODEBUILDMCP_MAX_OUTPUT_BYTES` env-var path. Consider adding unit tests that verify: (1) output below the cap is returned verbatim, (2) output at or above the cap is truncated with the expected message, and (3) the env-var override is respected.

Check warning on line 76 in src/utils/command.ts

See this annotation in the file changed.

@github-actions github-actions / warden: code-review

[UJ6-YUH] No tests for the new buffer accumulation, capping, and truncation logic (additional location)

The new `appendChunk` / `finalizeStream` functions and the `maxOutputBytes` cap are entirely untested — `src/utils/__tests__/command.test.ts` has no test that exercises large output, truncation, the `[output truncated after N bytes]` message, or the `XCODEBUILDMCP_MAX_OUTPUT_BYTES` env-var path. Consider adding unit tests that verify: (1) output below the cap is returned verbatim, (2) output at or above the cap is truncated with the expected message, and (3) the env-var override is respected.