Repository navigation
feat: per-file preview limits and viewer load more - #125
Merged
Merged
Conversation
…d more Replace the fixed 16 MiB raw budget split equally across scopes with per-file (1 MiB patch, 1 MiB contents per side) and 1000-file limits, plus a total measured on encoded JSON to fit the 64 MiB request limit. Capture all patches before full contents; share the remaining budget between scopes in rounds so unused shares move to scopes that need them. Viewer loads previews in file order 16 MiB at a time with Load more.
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.
Behavior owner and resulting change:
collectorowns the preview policy (newinternal/collector/previews.go). The fixed 16 MiB raw budget, split 1/N across scopes (~3.2 MiB for a branch's Combined view), is replaced by:MaxRequestBytesminus the encoded request skeleton minus 1 MiB headroom), so</>HTML escaping can't push a request past 64 MiB.Patches for every scope are captured before any full contents, so full-file views degrade before files lose their patch. Each pass shares the remaining budget between scopes in rounds, in file order, skipping files that don't fit. No scope can consume another's share, and a share a scope doesn't need goes to the others. Piped patches use the same preview limits; piped input validation stays at 2 MiB per file and 16 MiB total. In the viewer (
use-diff.ts,DiffWorkspace.tsx), previews load in file-tree order 16 MiB at a time, and a "Load more" notice action continues the next window, replacing the old hard "Preview budget exceeded" stop.Contracts/invariants affected; local/remote implications: no wire or schema change. Both compositions use the same collector policy. Content identity stays independent of preview truncation. Unchanged checkouts keep reusing their earlier, more truncated snapshot until the content changes or the snapshot expires.
Validation results; remaining risks:
mise run checkpasses after rebasing onmain.Intentional architecture/design changes and rationale:
docs/system.mddescribes the new policy. A total cap stays because an observation is one ingestion request and one transaction.UI evidence: neutral
Noticewith anoutline-mutedsmallButton, following the "View latest" pattern; covered by the Playwright test "previews load in file order 16 MiB at a time". Pierre geometry is preserved by reusing one status item per file and message.