feat(fs): read archives through the one read path - #21
Conversation
Zip, tar, and gzipped tar are recognized by their magic bytes — never their extensions — and render as an entry listing like a directory read. Passing `entry` extracts one member instead, rendered as hashline text like any file. Everything is bounded: the listing caps its entry count with the true total reported, and extraction caps its bytes while streaming, so a small archive that inflates enormously stops at the cap instead of filling memory — zip bombs stay in the bottle. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KoSjfcJPjXpkVLTS2Vxwwr
|
Warning Review limit reached
Next review available in: 32 minutes Limit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The last light decoder in the
readseries (files → directories → URLs → SQLite → now archives).read_fileon a zip, tar, or gzipped tar — recognized by magic bytes (PKheaders, gzip's1f 8b,ustarat offset 257), never extension — renders an entry listing like a directory read: names, sizes, directories with trailing slashes. Passingentryextracts one member instead, rendered as ordinary hashline text.Bounded on purpose:
as and asserts the read stops exactly at the cap with a clipped marker.A missing entry is an
InvalidInputpointing back at the listing, not a guess. Misleading extensions go both ways in the tests: a zip named.txtreads as an archive, a text file named.zipreads as text.Deps:
zip(default-features off, deflate only),tar,flate2— all pure Rust.Validation: unit tests for detection, listings, extraction, caps, and misses on all three formats, plus an integration test through
read_file(listing → entry as hashline). Full gates green ×2 — fmt, clippy-D warnings, workspace tests (200 tests).🤖 Generated with Claude Code
https://claude.ai/code/session_01KoSjfcJPjXpkVLTS2Vxwwr
Generated by Claude Code