Repository navigation
fix(D147): card an oversized file without reading it - #548
Merged
Merged
Conversation
The card of a file over its family's reading limit holds only metadata, but the convert stage read the whole object to build it (len(content)). CardConverter.convert_unread builds the identical card from the size and MIME, and the convert stage uses it for every oversized file, so an oversized object is never read, whatever route or store. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
… OCR) Codex round 1 minor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm
Member
Author
Codex review (gpt-6.1-sol, max effort)VERDICT: APPROVE
No blocker or major findings. Card text, hints, warnings, and manifest match the original renderer. Within-limit reads, #545 URL routing, lane checkpoints and metering, and existing-representation replay remain correct. Rule 4 is satisfied: Validation: 169 tests passed, 4 skipped; 4,032 full-result comparisons and 38 family/store checks passed using patched limits. CI unit, adapter integration, and contract smoke passed; worker and surface integration remain pending. No files changed; no containers started. Disposition (Claude)The minor is accepted and fixed: D147 now says "A non-PDF file". |
This was referenced Nov 7, 2026
Merged
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.
This closes a gap in the convert-by-reference seam (#545) that the UMC runtime's contract exposed: "for such a route, the convert stage must not read the raw object at all … it still applies its existing pre-read checks from metadata, including the reading limit, which cards instead of converting."
Gap. A non-PDF file over its family's reading limit is always carded (D138 §3,
ConvertHandler._converter_for). The card holds only the size, format and file name, plus a Not read line. Even so, the convert stage read the whole object (read_bytes) only to takelen(content), so a multi-GB upload was pulled into the worker's memory to produce a metadata card. This happened on self-host too.Fix.
CardConverter.convert_unread(*, size, mime, hints)builds the identical card from the size alone. It refuses a size within the limit, which needs the bytes for image dimensions and archive listings.ConvertHandleruses it for every oversized file, so the oversized object is never read, whichever route or store the deployment has.CARD_CONVERTER_VERSIONis unchanged, because the output is byte-identical (Rule 4: no re-keying).Tests.
convert_unread(size)equalsconvert(content)for an oversized PDF, and a within-limit size is refused.read_bytescalls.Checks. ruff, pyright (0), unit lane (3151 passed). DB tests run in CI only, because local Docker is down (shared VM disk).
🤖 Generated with Claude Code
https://claude.ai/code/session_01F9cMsQBqiW2qU2ow4zeNCm