The GitHub Actions job "Required Checks" on texera.git/main has succeeded.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
802a388d28befb53becb764aee1e0af5fff01117 / Xinyuan Lin <[email protected]>
test(frontend): cover aborting a dataset upload and its conflict retry (#7416)

### 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)

Report URL: https://github.com/apache/texera/actions/runs/31241281125

With regards,
GitHub Actions via GitBox

Reply via email to