Catalogue 0.5.0: Retry PDF text extraction and open PDFs in the browser
Catalogue 0.5.0 lets admins restart PDF text extraction that failed or got stuck, and adds a link that opens a PDF in the browser’s own viewer when the embedded viewer can’t load.
Retrying PDF text extraction
The PDF library now has a retry button on each row, and a PDF page whose extraction failed has a Retry button on its error message. Retry stuck in the library header queues again every PDF that is still waiting, and those whose extraction has been running for more than 15 minutes. It reports how many were queued, how many already had a job and how many could not be queued, and shows a warning instead of success when some were refused. A PDF that was already read is not reset by accident. Each retry is recorded in the activity log.
Extraction jobs are no longer duplicated: a PDF that already has a job waiting or running is skipped. This works on sites whose Oban database migration is older than the Oban library. Two workers on the same PDF can no longer turn a finished extraction back into a failed or running one.
Open in the browser
A PDF’s page has an Open link to the stored file, so the document can be read in the browser’s own PDF viewer when the embedded one doesn’t load.
Other changes
- The PDF library keeps its active or trashed filter in the address with
?filter=. - The bulk action bars on a catalogue’s page use PhoenixKit’s shared bar.
- Deleting a PDF for good can no longer leave a dangling reference when the same file is uploaded at the same moment.
Upgrading
No migration and no change in requirements. Update the dependency.
Full release notes: Catalogue 0.5.0
0.5.0 · 1 June 2026
Added
- PDF viewer fallback (#31) — a persistent “Open” link on the PDF detail page points at the always-present signed
/file/route, so the document is reachable in the browser’s native viewer even when the embedded/_pdfjsframe can’t load. Pairs with a core router-served/_pdfjsfallback, but the catalogue side works independently. - PDF extraction self-heal (#31) —
Catalogue.requeue_stuck_extractions/1re-drives everypendingextraction plusextractingrows orphaned past:stale_after_seconds(default 900), andCatalogue.retry_extraction/2resets a single row topendingand re-enqueues so a terminalfailedrow runs again. Surfaced in the UI as a per-row Retry button, a detail-page Retry on the failed alert, and a “Retry stuck” header action. Newpdf.extraction_retriedactivity action. Both functions re-exported fromCatalogueviadefdelegate.
Changed
- App-level Oban enqueue dedup (#31) instead of Oban’s built-in
unique:— satisfying theuniquecompile check forces listing:suspended, anoban_job_stateenum value absent on hosts that upgraded the Oban lib ahead of its migration (querying it raises22P02and kills every enqueue). The app guard skips the insert when a non-terminalPdfExtractorjob already exists for thefile_uuid, querying only the four always-present states (available/scheduled/executing/retryable) and proceeding on any query error. The worker name is derived viainspect/1so a rename is a compile error, not a silently-broken query. - Guarded, atomic extraction status transitions (#31) —
mark_failed/2andmark_extracting/1only advance from a non-terminal state (UPDATE … WHERE status IN ('pending','extracting')), so a concurrent worker can no longer clobber a success terminal (extracted/scanned_no_text) back tofailed— silent data loss that broke search — nor pull a finished extraction back toextracting. Success markers stay last-writer-wins. - Honest, batched
requeue_stuck_extractions/1— returns%{requeued, skipped, failed}(capped at 1000 rows/call) whereskippedis rows a live job already covers, so “Re-queued N” never takes credit for no-ops; the “Retry stuck” flash is a warning (not “success”) when enqueues were refused — the exact queue-missing case the button targets. The whole selection is de-duped against live jobs in one query and enqueued with oneOban.insert_all/1rather than ~2k per-row round-trips at the cap. retry_extraction/2refuses a success-terminal row with{:error, :already_extracted}unlessforce: trueis passed, so a stray programmatic caller can’t reset a good extraction topendingand drop the PDF out of search mid-re-extract.- Bulk-action bars folded onto core
<.bulk_actions_bar>(#31) on the catalogue detail page (categories + deleted-items lists) — removes ~50 lines of duplicate component markup while keeping the sticky styling andclear_selectionbehaviour. PdfLibraryLiveloads its list inhandle_params/3(notmount, which runs twice) and now honours a?filter=active|trasheddeep-link; the extraction-status badge is a HEEx component with auto-escaping instead of hand-builtPhoenix.HTML.rawmarkup.
Fixed
- The
permanently_delete_pdf/2refcount-then-handoff sequence runs inside aRepo.transaction(_, isolation: :serializable)so a concurrent upload of the same content can’t orphan a reference between the count andStorage.trash_file/1.
Notes
- No new core requirement — still
phoenix_kit ~> 1.7 and >= 1.7.125. The PDFoban_jobsdedup filters onargs ->> 'file_uuid', which has no index; since this module ships no migrations andoban_jobsis core/host-owned, a partial expression index belongs in a future core migration once the job table grows large (tracked inAGENTS.mdand onPdfLibrary.extraction_job_pending?/1). - Verification:
mix precommitclean (compile + format + credo –strict + dialyzer). The Web/context test suites that exercise the new guards are DB-gated and run against a host whose schema is at core V111+.
Catalogue 0.5.0. Install or update: {:phoenix_kit_catalogue, "~> 0.5"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.