Skip to content

fix: emit queue-updated events and expose verification status after deferred check#197

Merged
javi11 merged 1 commit intomainfrom
fix/deferer-check
Apr 6, 2026
Merged

fix: emit queue-updated events and expose verification status after deferred check#197
javi11 merged 1 commit intomainfrom
fix/deferer-check

Conversation

@javi11
Copy link
Copy Markdown
Owner

@javi11 javi11 commented Apr 5, 2026

Summary

  • Missing VerificationStatus in frontend data: backend.QueueItem was not including the verification_status field, so the frontend never knew whether a completed item was pending_verification, verified, or verification_failed.
  • No event on upload completion: Neither the normal completion path nor the deferred check path emitted a queue-updated event, leaving the queue list stale after an upload finished.
  • No event from PostCheckRetryWorker: When the background worker resolved deferred articles and updated the status to verified or verification_failed, the frontend received no notification.

Changes

File Change
internal/backend/queue.go Add VerificationStatus *string to QueueItem struct and populate in conversion
internal/processor/processor.go Add OnJobComplete func() callback; call on both normal and deferred completion paths
internal/processor/postcheck_retry_worker.go Add onStatusChanged func() callback; call after successful UpdateCompletedItemVerificationStatus
internal/backend/processor.go Wire both callbacks to emit queue-updated (Wails + web mode)
internal/processor/postcheck_retry_worker_test.go 5 new tests for the onStatusChanged callback behaviour

Test plan

  • go test ./internal/processor/... — all 14 TestProcessRetries subtests pass
  • Upload a file → queue list refreshes immediately when upload completes
  • Upload a file with articles that trigger deferred check → item shows pending_verification badge
  • After PostCheckRetryWorker resolves articles → item updates to verified or verification_failed without manual refresh

🤖 Generated with Claude Code

…eferred check

When uploads complete with deferred article verification (DeferredCheckError),
the UI had no feedback because:
- `VerificationStatus` was missing from the backend `QueueItem` struct sent to
  the frontend, so pending/verified/failed states were invisible.
- No `queue-updated` event was emitted on job completion (normal or deferred
  path), leaving the queue list stale until a user action triggered a refresh.
- The `PostCheckRetryWorker` also emitted no event after resolving deferred
  articles, so `verified`/`verification_failed` transitions were silent.

Fix:
- Add `VerificationStatus` to `backend.QueueItem` and populate it in conversion.
- Add `OnJobComplete` callback to `Processor`; call it on both completion paths
  in `processNextItem`; wire it to emit `queue-updated` in the backend.
- Add `onStatusChanged` callback to `PostCheckRetryWorker`; call it after a
  successful `UpdateCompletedItemVerificationStatus`; wire it to emit
  `queue-updated` in the backend.
- Add 5 targeted tests for the new callback behaviour in
  `postcheck_retry_worker_test.go`.
@javi11 javi11 merged commit 422f625 into main Apr 6, 2026
3 checks passed
@javi11 javi11 deleted the fix/deferer-check branch April 6, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant