Skip to content

test(frontend): cover aborting a dataset upload and its conflict retry - #7416

Merged
aglinxinyuan merged 1 commit into
apache:mainfrom
aglinxinyuan:test-dataset-abort-upload
Aug 8, 2026
Merged

test(frontend): cover aborting a dataset upload and its conflict retry#7416
aglinxinyuan merged 1 commit into
apache:mainfrom
aglinxinyuan:test-dataset-abort-upload

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

onClickAbortUploadProgress was the largest uncovered block in DatasetDetailComponent and 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:

Response Behaviour
success notify, report the abort
404 already gone — report the abort, no error
409, attempt < ABORT_RETRY_MAX_ATTEMPTS retry after ABORT_RETRY_BACKOFF_BASE_MS * (attempt + 1)
409 at the limit, or any other status give up, but still report the abort

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, and cancelExistingUpload delegating 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):

Mutation Result
never retry on conflict red
make the retry unbounded red
use a constant backoff instead of a growing one red
skip the unsubscribe red
leave the task unmarked red
send the abort flag as false red
drop the onUploadComplete() that frees the slot red
remove the 404 early return survived
remove the doneCalled idempotence guard survived

The two survivors are reported rather than papered over, because they are informative:

  • The 404 early return is behaviourally redundant. Without it a 404 falls past the 409 check to the same 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.
  • The doneCalled guard is not reachable. Exactly one of the next/404/fallback paths fires per response, and each retry replaces the subscription, so done() 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?

npx ng test --watch=false --include="**/dataset-detail.component.spec.ts"
 Test Files  1 passed (1)
      Tests  104 passed (104)

9 new on top of the existing 95. yarn format:ci passes.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5)

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.
Copilot AI lite review requested due to automatic review settings August 8, 2026 02:06
@github-actions github-actions Bot added the frontend Changes related to the frontend GUI label Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @xuang7
    You can notify them by mentioning @xuang7 in a comment.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.87%. Comparing base (2c57707) to head (8b2db16).

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     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø) Carriedforward from 2c57707
agent-service 85.50% <ø> (ø) Carriedforward from 2c57707
amber 80.82% <ø> (ø) Carriedforward from 2c57707
computing-unit-managing-service 50.72% <ø> (ø) Carriedforward from 2c57707
config-service 65.97% <ø> (ø) Carriedforward from 2c57707
file-service 69.05% <ø> (ø) Carriedforward from 2c57707
frontend 86.87% <ø> (+0.13%) ⬆️
notebook-migration-service 78.89% <ø> (ø) Carriedforward from 2c57707
pyamber 97.55% <ø> (ø) Carriedforward from 2c57707
workflow-compiling-service 26.31% <ø> (ø) Carriedforward from 2c57707

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mengw15 mengw15 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Aug 8, 2026
Merged via the queue into apache:main with commit 802a388 Aug 8, 2026
25 checks passed
@aglinxinyuan
aglinxinyuan deleted the test-dataset-abort-upload branch August 8, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cover aborting a dataset upload and its conflict retry

4 participants