Repository navigation
Conversation
…ueue
Background
The Failed page says its documents are skipped until you reset them. Reset
and Reset All only deleted the failed_documents entry and the
processing_status row; the document's ocr_queue row stayed `failed`. The
scheduled OCR drain and "Process All Pending" only take `pending` rows, the
Failed page was empty afterwards, and the dashboard "Failed" card (which
counts ocr_queue rows) kept counting the documents. The only way out was the
"Process" button on each OCR queue row.
Changes
- models/document.js: requeueFailedOcrQueueItems(documentIds) sets failed
ocr_queue rows back to pending (processed_at cleared, ocr_text and
wrote_back kept). Password-protected rows stay failed: they would only
fail again until unlocked. resetAllFailedDocuments() does the same for its
documents inside its transaction and returns { count, requeued }.
- routes/queues.js: POST /api/failed/reset/:documentId and
POST /api/failed/reset-all requeue and report `requeued`; the messages say
when OCR will read documents again; the dashboard stats cache is
invalidated when rows were requeued. @Swagger and OPENAPI/openapi.json
updated.
- resetFailedDocument() is deliberately unchanged: the other callers (OCR run
finished, AI analysis after OCR, PDF unlock, manual, ignore) clear the entry
as a result of success and must not touch the OCR queue.
Testing
- tests/test-failed-reset-requeues-ocr.js (new, 5 cases: requeue and kept
text, password-protected/done/pending/processing untouched, invalid IDs,
resetFailedDocument leaves ocr_queue alone, reset-all scope). Without the
model change 4 of 5 fail.
- tests/test-failed-reset-all.js adapted to the new return shape.
- ESLint, Prettier, typecheck clean on the changed files; the offline suite
passes (three tests need Chrome or local sockets and only fail inside a
sandbox; they pass outside it).
Impact
Failed page API only: one extra response field (`requeued`), no schema
change. Databases already in the broken state (empty Failed page, failed
OCR rows) are not repaired by this; they need a "retry failed" action on the
OCR page.
Upstream Status
Not applicable (fork-only).
Fixes admonstrator#445
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
…ueue
Background
The Failed page says its documents are skipped until you reset them. Reset and Reset All only deleted the failed_documents entry and the processing_status row; the document's ocr_queue row stayed
failed. The scheduled OCR drain and "Process All Pending" only takependingrows, the Failed page was empty afterwards, and the dashboard "Failed" card (which counts ocr_queue rows) kept counting the documents. The only way out was the "Process" button on each OCR queue row.Changes
requeued; the messages say when OCR will read documents again; the dashboard stats cache is invalidated when rows were requeued. @Swagger and OPENAPI/openapi.json updated.Testing
Impact
Failed page API only: one extra response field (
requeued), no schema change. Databases already in the broken state (empty Failed page, failed OCR rows) are not repaired by this; they need a "retry failed" action on the OCR page.Upstream Status
Not applicable (fork-only).
Fixes #445