Skip to content

fix(scanner): enforce total byte cap during metadata scans - #17

Open
JohnXu22786 wants to merge 3 commits into
mainfrom
bug/scanner-metadata-total-cap
Open

JohnXu22786 wants to merge 3 commits into
mainfrom
bug/scanner-metadata-total-cap

Conversation

@JohnXu22786

@JohnXu22786 JohnXu22786 commented Sep 12, 2026

Copy link
Copy Markdown
Owner

What this PR does

Before this PR:

Metadata-only (readContent: false) scans skipped maxTotalBytes. 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

@JohnXu22786
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
JohnXu22786 force-pushed the bug/scanner-metadata-total-cap branch from 9fc26e0 to f511ad5 Compare September 12, 2026 05:49
Recompute UTF-8 byte usage after metadata-only scans decode changed files so malformed input cannot exceed maxTotalBytes without reporting truncation.
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.

1 participant