fix(workspaces): resolve text-less PDFs to an empty projection#667
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix(workspaces): resolve text-less PDFs to an empty projection#667posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
Extraction previously threw "Extraction did not produce usable page Markdown." whenever every page came back empty, which happens naturally for scanned or image-only PDFs with no text layer (LiteParse trims each page's Markdown, so whitespace-only pages collapse to empty strings). Distinguish "the provider gave us no pages at all" (still a genuine failure) from "the PDF has pages but no extractable text" (a valid outcome). The latter now resolves into a valid projection with blank pages and a `hasExtractableText: false` marker recorded on the manifest and file projection metadata, so the file is marked done-with-no-text instead of failed. Generated-By: PostHog Code Task-Id: 97353e21-4b24-4afc-9a1f-2846a17dda22
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
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.
Summary
Uploading a scanned or image-only PDF (one with no text layer) failed hard with "Extraction did not produce usable page Markdown." instead of finishing gracefully. LiteParse trims each page's Markdown, so whitespace-only pages collapse to empty strings, tripping the
usablePageCount === 0guard and rejecting the whole extraction.This change distinguishes two cases:
"Extraction did not produce any pages.").hasExtractableText: falsemarker on the manifest and file-projection metadata, so the file is marked done-with-no-text rather than failed.Why
Users uploading text-less/scanned PDFs hit a hard extraction failure instead of a graceful "no extractable text" result — a small but real UX gap on the PDF extraction path.
Testing
pnpm check(format + lint + types) — passpnpm test src/features/workspaces/extraction— 19 tests pass, including new cases for all-empty pages resolving to an empty projection and page-less extractions still being rejected.Created with PostHog Code from this inbox report.
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.