test(frontend): cover aborting a dataset upload and its conflict retry - #7416
Conversation
onClickAbortUploadProgress was the largest uncovered block in the component and the one with the most ways to go wrong: the abort call is retried on 409 while the backend finishes finalizing a previous attempt, bounded by ABORT_RETRY_MAX_ATTEMPTS with a backoff that grows per attempt. Adds 9 tests: the abort request and its abort flag, the task moving to aborted, the progress stream being unsubscribed so a late event cannot resurrect it, the concurrency slot being released so a queued upload starts, retry-then-success, the growing backoff, giving up at the attempt limit while still reporting the abort, an uncovered error status still reporting it, a 404 not surfacing as an error, and cancelExistingUpload delegating for an upload still in flight. No production file is touched.
Automated Reviewer SuggestionsBased on the
|
There was a problem hiding this comment.
Pull request overview
This PR expands frontend unit test coverage for DatasetDetailComponent’s upload-abort flow, specifically validating the retry/backoff behavior on 409 conflicts and ensuring abort-related bookkeeping (status, subscriptions, queue slot release, delegation via cancelExistingUpload) behaves correctly.
Changes:
- Adds a focused test suite covering abort outcomes for success, 404, 409 with bounded retries + increasing backoff, and non-retryable errors.
- Verifies abort side-effects: marking the task as
aborted, unsubscribing from progress updates, and releasing the concurrency slot so queued uploads can proceed. - Asserts behavior against exported constants (
ABORT_RETRY_BACKOFF_BASE_MS,ABORT_RETRY_MAX_ATTEMPTS) to avoid hard-coded timing/limit assumptions.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7416 +/- ##
============================================
+ Coverage 84.81% 84.87% +0.05%
Complexity 4149 4149
============================================
Files 1169 1169
Lines 46740 46740
Branches 5202 5202
============================================
+ Hits 39643 39671 +28
+ Misses 5384 5353 -31
- Partials 1713 1716 +3
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What changes were proposed in this PR?
onClickAbortUploadProgresswas the largest uncovered block inDatasetDetailComponentand the one with the most ways to go wrong. Aborting an in-flight upload has to survive the backend still finalizing a previous attempt, so the abort is retried on 409:ABORT_RETRY_MAX_ATTEMPTSABORT_RETRY_BACKOFF_BASE_MS * (attempt + 1)Adds 9 tests over that ladder plus the surrounding bookkeeping: the abort flag on the request, the task moving to
aborted, the progress subscription being dropped so a late event cannot resurrect it, the concurrency slot being released so a queued upload starts, andcancelExistingUploaddelegating here for an upload still running. Both constants are exported, so the backoff growth and the attempt bound are asserted rather than hard-coded.Verified by mutation, all reverted (production diff empty):
onUploadComplete()that frees the slotdoneCalledidempotence guardThe two survivors are reported rather than papered over, because they are informative:
done()at the bottom, so no input distinguishes the two. The test still earns its place — it fails if 404 is ever turned into an error path — but it does not pin the branch itself.doneCalledguard is not reachable. Exactly one of thenext/404/fallback paths fires per response, and each retry replaces the subscription, sodone()is never invoked twice. It is defensive code with no observable behaviour at this level.The slot-release mutation survived my first pass too; unlike the other two that was a genuine gap, so I added the test that covers it.
No production file is touched.
Any related issues, documentation, discussions?
Closes #7413
How was this PR tested?
9 new on top of the existing 95.
yarn format:cipasses.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 5)