fix(utils): Prevent RangeError from large command output #433
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
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
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.