fix(scanner): enforce total byte cap during metadata scans - #17
Open
JohnXu22786 wants to merge 3 commits into
Open
JohnXu22786 wants to merge 3 commits into
JohnXu22786 wants to merge 3 commits into
Conversation
JohnXu22786
marked this pull request as ready for review
September 12, 2026 05:47
Increment metadata scan totals from file sizes so refreshes stop at maxTotalBytes and surface a truncated index.
Do not infer deletions from a partial metadata scan, and clear stale truncation status when a refresh completes within its limits.
JohnXu22786
force-pushed
the
bug/scanner-metadata-total-cap
branch
from
September 12, 2026 05:49
9fc26e0 to
f511ad5
Compare
Recompute UTF-8 byte usage after metadata-only scans decode changed files so malformed input cannot exceed maxTotalBytes without reporting truncation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Before this PR:
Metadata-only (
readContent: false) scans skippedmaxTotalBytes. Incremental refreshes could process files past the configured total-size cap, decode malformed UTF-8 into content larger than the metadata size without reporting truncation, delete indexed files beyond a partial scan prefix, and retain stale truncation status after a later complete refresh.After this PR:
Metadata scans count file sizes and stop at
maxTotalBytes. Refreshes recompute decoded UTF-8 byte usage for changed files, preserve the prior indexed file when decoded content exceeds the cap, propagate current truncation state, skip deletion reconciliation for partial inventories, and clear stale truncation after complete scans. Focused scanner and incremental regression tests cover these paths.Type of change
Bug fix