Classify: submitted alerts leave the queue but don't show up in Done

Open
#424 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript
Domain
backend, frontend

Research direction

Start by tracing the GET /sequences/classify-queue and GET /sequences/classify-done handlers and the ClassifyAlertPage submit flow described in the issue. Check how alerts with unannotated or legacy-stage lanes are handled, then reproduce the queue/Done mismatch and add coverage for the case. Done means every alert leaving the queue after submission is either visible in Done or submission is blocked with a clear explanation.

Written by the indexing model from the issue text.

Description

P1-high type: bug

What happens

In Classify, when I classify an alert and click Submit:

  • the alert leaves the queue and the queue total goes down, as expected;
  • but the Done list / Done count does not go up accordingly. After classifying many alerts, Done only listed 4 alerts, then 5, without a clear reason.

So some submitted alerts end up in neither the queue nor Done.

Steps to reproduce

  1. Log in as an annotator, open Classify (no filter).
  2. Note the queue total and the Done total.
  3. Classify and submit N alerts.
  4. Queue total = previous − N. Done total ≠ previous + N (it barely moves).

Observed on 2026-10-23 on the production instance.

Why this looks like a bug (code at main, 40ddd18)

The two lists don't use complementary rules:

  • Queue (GET /sequences/classify-queue): alert has at least one lane in ready_to_annotate.
  • Done (GET /sequences/classify-done): every lane of the alert has an annotation in seq_annotation_done or annotated (HAVING count() == sum(lane_done), outer join, so a lane without annotation counts as not done).

Any alert where the submitted lanes are done but at least one other lane is neither ready_to_annotate nor done falls between the two lists. Candidates:

  • a lane with no SequenceAnnotation row: ClassifyAlertPage shows it locked ("not yet imported") and leaves it out of the submit payload (isLaneLocked), yet submit is allowed. Afterwards the alert has no ready lane (out of the queue) and is not fully done (out of Done);
  • a lane in the legacy imported stage;
  • a lane removed or added while the alert was open (concurrent import).

This is a lead, not a confirmed cause.

Diagnostic query

SELECT s.source_api, s.platform_alert_id,
       count(*)     AS lanes,
       count(sa.id) AS with_annotation,
       sum(CASE WHEN sa.processing_stage IN ('seq_annotation_done','annotated') THEN 1 ELSE 0 END) AS done,
       sum(CASE WHEN sa.processing_stage = 'ready_to_annotate' THEN 1 ELSE 0 END)                 AS ready,
       array_agg(DISTINCT sa.processing_stage)                                                     AS stages
FROM sequences s
LEFT JOIN sequences_annotations sa ON sa.sequence_id = s.id
GROUP BY 1, 2
HAVING sum(CASE WHEN sa.processing_stage IN ('seq_annotation_done','annotated') THEN 1 ELSE 0 END) > 0
   AND sum(CASE WHEN sa.processing_stage = 'ready_to_annotate' THEN 1 ELSE 0 END) = 0
   AND sum(CASE WHEN sa.processing_stage IN ('seq_annotation_done','annotated') THEN 1 ELSE 0 END) < count(*);

Every row is an alert visible in neither list. with_annotation < lanes points to the missing-annotation lead, and stages shows any other stray stage.

Expected

  • An alert that leaves the classify queue after a submit appears in Done: queue decrease = Done increase.
  • No alert can be in neither list. Either the submit is blocked while a lane can't be classified, or Done/queue membership covers that case.

Side notes (not the bug, but they make it harder to see)

  • Done is sorted by alert date (recorded_at), not by classification date, so a freshly classified alert is not necessarily on page 1.
  • Done filters are saved in the browser (filters-classify-done) and shared across users on the same machine.
Dominant language
TypeScript
Stars
0
Forks
1
Avg merge
2d 22h
Merged PRs (30d)
3

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pyronear/pyro-annotator

All issues in pyronear/pyro-annotator

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.