The project realignment card counted the whole workspace - #50
Merged
Conversation
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>
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.
PRJEB1323was told "35 alignment(s) in this project could be re-mapped to chm13v2.0". Every one of its 88 alignments is already onchm13v2.0.What the number actually was
The card filtered
self.all_alignments, whichLoadAllAlignmentsfills fromlist_all_alignments()— the whole workspace, never scoped to a project. Queried directly:chm13v2.0, all with files, none derived → true count 0chm13v2.0_maskedY_rCRS, 1unknown, 1 GRCh3735 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.
StartProjectRealignasksrealignable_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.
regions_attemptedlazy-load idiom, so it is asked once rather than per frame, including after a failure.project_idand is discarded if the user has navigated away.AllAlignmentsarrives, so an import in progress cannot leave a stale figure on screen — the report was found mid-import.Validation
-D warnings;cargo fmtclean; locale parity passes.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