Skip to content

The project realignment card counted the whole workspace - #50

Merged
JamesKane merged 1 commit into
mainfrom
fix/project-realign-count
Aug 16, 2026
Merged

The project realignment card counted the whole workspace#50
JamesKane merged 1 commit into
mainfrom
fix/project-realign-count

Conversation

@JamesKane

Copy link
Copy Markdown
Owner

PRJEB1323 was told "35 alignment(s) in this project could be re-mapped to chm13v2.0". Every one of its 88 alignments is already on chm13v2.0.

What the number actually was

The card filtered self.all_alignments, which LoadAllAlignments fills from list_all_alignments() — the whole workspace, never scoped to a project. Queried directly:

PRJEB1323's alignments 88, all chm13v2.0, all with files, none derived → true count 0
Workspace-wide realignable 35 — 29 GRCh38, 4 chm13v2.0_maskedY_rCRS, 1 unknown, 1 GRCh37

35 is exactly what was on screen, and none of those alignments belong to that project.

Why this was the bad way round

The button was always correct. StartProjectRealign asks realignable_in_project, which is properly scoped — so pressing "Realign 35" on this project would have realigned nothing at all.

A count that disagrees with the action beneath it is worse than a slow count: it invites a decision the app then quietly declines to carry out. A comment justified the local filtering as avoiding a query per frame, and the number it produced answered a different question than its label claimed.

The fix

The eligibility rule existed in three places, and the copy that drifted was the one in the UI — which also had the wrong data in scope. This deletes that copy. The card asks the app, so the number shown and the batch the button starts come from one function.

  • Cached per project on the existing regions_attempted lazy-load idiom, so it is asked once rather than per frame, including after a failure.
  • The reply carries its project_id and is discarded if the user has navigated away.
  • Invalidated whenever AllAlignments arrives, so an import in progress cannot leave a stale figure on screen — the report was found mid-import.

Validation

  • 983 tests, 0 failed; clippy clean under -D warnings; cargo fmt clean; locale parity passes.
  • The count for this project was confirmed against the workspace database before and after, which is how the workspace-vs-project scope was identified rather than guessed.

Not covered

Not re-checked in the GUI. The card should now read "Every alignment in this project is already on chm13v2.0, or has been realigned." for PRJEB1323; that follows from the data, but it has not been watched happen.

🤖 Generated with Claude Code

PRJEB1323 was told "35 alignment(s) in this project could be re-mapped to
chm13v2.0". All 88 of its alignments are already on chm13v2.0. The 35 was every
realignable alignment in the *workspace* — 29 GRCh38, 4 masked-CHM13, 1 GRCh37,
1 unknown — none of them in that project.

The card filtered `all_alignments`, which `LoadAllAlignments` fills from
`list_all_alignments()`: the whole workspace, never scoped to a project. A
comment justified counting locally to avoid a query per frame, and the number it
produced was for a different question than the label claimed.

The button was right all along — `StartProjectRealign` asks
`realignable_in_project` — so pressing "Realign 35" on this project would have
realigned nothing. A count that disagrees with the action it sits above is worse
than a slow one: it invites a decision the app then quietly declines.

Root cause is that the rule existed in three places, and the copy that drifted
was the one in the UI, which also had the wrong data in scope. This deletes that
copy. The card now asks the app, so the number shown and the batch the button
starts come from the same function.

Cached per project on the `regions_attempted` idiom so it is asked once, not per
frame; the reply is discarded if the user has moved on; and it is invalidated
whenever `AllAlignments` arrives, so an import in progress does not leave a stale
figure on screen.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@JamesKane
JamesKane merged commit 73480cd into main Aug 16, 2026
3 checks passed
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