Skip to content

feat: bound CLI input size for large files - #47

Merged
tappe9 merged 3 commits into
mainfrom
agent/issue-37-large-file-guard
Aug 19, 2026
Merged

tappe9 merged 3 commits into
mainfrom
agent/issue-37-large-file-guard

Conversation

@tappe9

@tappe9 tappe9 commented Aug 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

Implement Issue #37 as the first staged large-file hardening step.

  • add a default 256 MiB CLI encoded-input limit;
  • add --max-input-bytes <BYTES> as an explicit override;
  • reject over-limit files with structured CliError::InputTooLarge before parsing;
  • use file metadata for early rejection and cap the actual read at one byte beyond the limit to catch files that grow while being read;
  • keep inspect(&[u8]) and inspect_with_limits() unchanged;
  • document current in-memory behavior and the separation between input-byte limits and metadata-count limits.

Design

This intentionally does not add inspect_reader or a streaming/event API. Streaming/file-backed inspection remains a later library design, consistent with ADR 0003. Parsing stays entirely in the zstdscope library; the CLI only owns file-reading/resource policy and presentation.

Validation

TDD was used for the boundary behavior:

  • RED: CI run #131 failed the four new large-file boundary tests before implementation while existing tests remained green.
  • GREEN: the implementation made the boundary tests pass.
  • Final CI run #133 passes format, clippy, workspace tests, rustdoc, core default-feature tests, package listing, publish dry-run, MSRV Rust 1.85.0, and Linux/macOS/Windows test jobs.

Closes #37

@tappe9
tappe9 marked this pull request as ready for review August 19, 2026 04:54
@tappe9
tappe9 merged commit c319d29 into main Aug 19, 2026
5 checks passed
@tappe9
tappe9 deleted the agent/issue-37-large-file-guard branch August 19, 2026 04:54
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.

Design a bounded/streaming inspection path for large files

1 participant