tomd: kimi review follow-ups#19
Merged
Merged
Conversation
Addresses the deferred items from PR cppalliance#18's "Not in this PR" section, sourced from the Apr 15 kimi-k2.5 review. - Promote _compute_bbox from extract.py to types.py as public compute_bbox. No silent empty-list guard: callers already enforce non-empty input, and a ValueError on empty is the correct contract (crash loudly, don't degrade). Replace the inline min/max duplicate in cleanup.py._join_cross_page with a call to the shared helper. - Cap the reply-to continuation loop in wg21.py at REPLY_TO_CONTINUATION_CAP (5) blocks. On a malformed PDF where page 0 body text contains email addresses, the unbounded loop could sweep arbitrary content into metadata["reply-to"].
df16e13 to
f65ad96
Compare
jlchilders11
requested changes
Apr 16, 2026
Contributor
jlchilders11
left a comment
There was a problem hiding this comment.
One change to make the pull request description accurate
jlchilders11
approved these changes
Apr 16, 2026
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.
Follow-up to #18, addressing two items from the "Not in this PR" section (sourced from the Apr 15 kimi-k2.5 review). The other suggestions outlined there were dropped.
Stuff we did
compute_bboxdedupextract.pytotypes.pyas a public helpercleanup.py.ValueErroron empty lists to avoid silent degradation from a future mistake.Reply-to continuation cap
wg21.pynow stops after 5 blocks, preventing malformed PDFs from sweeping body text into metadata.Stuff we didn't do
The remaining five items from the review were evaluated and dropped:
classify_monospacerename): it's a triple-signal classification algorithm, not a simple predicate. The name fits._word_similarityand_jaccard_similarityuse different denominators for different purposes. Not worth unifying.except Exceptionnarrowing): a good general best practice, but here we already log withexc_info=True, and unfortunately, MuPDF doesn't appear to have a clean exception hierarchy to narrow to anyway.