Fix detection completion % calculation in bulk import task#1532
Open
JasonWildMe wants to merge 13 commits into
Open
Fix detection completion % calculation in bulk import task#1532JasonWildMe wants to merge 13 commits into
JasonWildMe wants to merge 13 commits into
Conversation
…nator The bulk import task page (/react/bulk-import-task) could show detection < 100% even when all MediaAssets had completed detection and annotations. Three bugs in ImportTask.iaSummaryJson(): 1. Numerator counted ANY asset with detectionStatus complete/pending, including non-IA-eligible assets (videos, corrupt images). These incremented numDetectionComplete but not numAllowedIA, so the completion check (numDetectionComplete == numAllowedIA) could never pass, or the percentage could exceed 100%. 2. Assets that acquired annotations through non-IA paths (manual annotation, data import, migration) were not counted as detection- complete because the check only looked at detectionStatus, not whether annotations actually existed. 3. The progress denominator used numAssets (total) while the completion check used numAllowedIA (IA-eligible), so even when the equality check passed, in-progress percentages were diluted by ineligible assets. Fix: use a single isEligible flag per asset that gates both the numAllowedIA and numDetectionComplete counters. An eligible asset counts as detection-complete if it has detectionStatus complete/pending OR has non-trivial annotations (i.e. not just the whole-image placeholder bounding box). Both legacy and non-legacy paths now use numAllowedIA as denominator for the completion check, progress fraction, and divide guard. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The re-identification button on the bulk import task page was gated on task.status === "complete", but ImportTask.status is never transitioned from "processing-detection" to "complete" after IA detection finishes. The only code paths that set it to "complete" are when detection is skipped or via the legacy StandardImport pathway. Since task.iaSummary.detectionStatus already accurately reflects whether detection has completed (and is checked on the same line), the ImportTask.status check is both redundant and broken. Remove it so the button is enabled once detection is genuinely complete. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This reverts commit 88756d1.
This reverts commit af1939c.
This reverts commit 75d536a.
This reverts commit a9ad1cd.
This reverts commit e8a0919.
This reverts commit 04083cc.
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.
Summary
Fixes the bulk import task page (
/react/bulk-import-task) showing detection completion < 100% even when all MediaAssets have completed detection and have annotations.Root cause
Three bugs in
ImportTask.iaSummaryJson():Numerator/denominator population mismatch: The numerator (
numDetectionComplete) counted any asset withdetectionStatuscomplete/pending — including non-IA-eligible assets (videos, corrupt images). These incremented the numerator but not the denominator (numAllowedIA), sonumDetectionComplete == numAllowedIAcould never pass, or the in-progress percentage could exceed 100%.Only checked
detectionStatus, not actual annotations: Assets that acquired annotations through non-IA paths (manual annotation via the API, data import, migration) were never counted as detection-complete because the code only inspecteddetectionStatus, not whether non-trivial annotations actually existed on the asset.Inconsistent denominators between completion check and progress fraction: The completion equality check used
numAllowedIA(IA-eligible assets) but the progress percentage divided bynumAssets(total assets). This meant in-progress percentages were diluted by ineligible assets that could never complete detection.Changes
MediaAsset.java— AddedhasNonTrivialAnnotations(): returns true if the asset has any annotation whereisTrivial()is false (i.e., not just the whole-image placeholder bounding box created during import).ImportTask.java— Reworked theiaSummaryJson()per-asset loop:isEligibleflag per asset gates bothnumAllowedIAandnumDetectionCompletecounters — ensures numerator and denominator draw from the same populationdetectionStatusis "complete" or "pending", OR the asset has non-trivial annotationsnumAllowedIAas the denominator for the completion equality check, progress fraction, and divide-by-zero guardTest plan
🤖 Generated with Claude Code