Add explicit title override to document ingest#54
Merged
Conversation
Add explicit title override to document ingest
Accept an optional "title" on ingest (multipart form field or JSON body).
When set it seeds the document row AND is threaded through the ingest
Payload so persistTree keeps it — the parsed title never clobbers it.
Motivation: some PDFs have unreliable title text the parser latches onto
— rotated arXiv margin stamps extracted in reverse ("3202 guA" for
"Aug 2023"), repeated ORCID iD markers ("iD iD iD iD"), letter-spaced
cover pages. The existing mojibake guard only catches doubled-glyph
watermarks. An explicit title lets callers (and curated corpora like the
playground demo set) show a clean display name regardless. Empty = keep
auto-discovery.
@
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds support for an optional, caller-supplied document title override in the ingest handler and pipeline. The handler captures a title from multipart form or JSON payload, propagates it through the ingest Payload, and persistTree now honors this sticky override instead of always writing the parsed title. ChangesSticky document title override
Estimated code review effort: 2 (Simple) | ~12 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant HandleIngestDocument
participant Pipeline
participant persistTree
Client->>HandleIngestDocument: submit document with optional title
HandleIngestDocument->>HandleIngestDocument: trim title into titleOverride
HandleIngestDocument->>Pipeline: enqueue Payload{Title: titleOverride}
Pipeline->>persistTree: persistTree(titleOverride)
alt titleOverride non-empty
persistTree->>persistTree: skip SetDocumentTitle
else titleOverride empty
persistTree->>persistTree: set title if parsed title passes mojibake check
end
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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
Accept an optional
titleon ingest — a multipart form field or a JSON body field. When present it seeds the document row and is threaded through the ingestPayloadsopersistTreekeeps it: the parsed title never overwrites an explicit one. Empty preserves existing auto-discovery.Why
Some PDFs have unreliable title text the font-heuristic latches onto:
3202 guA(=“Aug 2023”),]LC.sc[(=“[cs.CL]”)iDmarkers —iD iD iD iDThe existing
isLikelyMojibakeTitleguard only catches doubled-glyph watermarks, so these slip through and become the display title. An explicit override lets callers — and curated corpora like the Playground demo set — show a clean name regardless.Tests
TestPersistTree_TitleOverrideIsSticky: override is never clobbered by the parsed title; a blank override still lets a usable parsed title through.go build ./...+go test ./...green.@
Summary by CodeRabbit
New Features
Bug Fixes