Skip to content

fix(web): prevent late file uploads after cancellation - #15

Draft
kvnloo wants to merge 3 commits into
review/958-basefrom
review/958-upload-cancel-guard
Draft

kvnloo wants to merge 3 commits into
review/958-basefrom
review/958-upload-cancel-guard

Conversation

@kvnloo

@kvnloo kvnloo commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Target

Follow-up to original author kuishou68's tester-army/e2e#958, using its exact head d310846848068b2e82a96d192b6a826f5a563447 as this fork draft PR's base. The latest Cubic review identified delayed uploads after cancellation: e2e-inc#958 (comment) and e2e-inc#958 (comment) .

Fix

The outer guard can abandon a filechooser wait when the operation is cancelled or times out. If the chooser event arrives later, the old uploadFiles continuation can still call setFiles. That can mutate the page after the step has ended.

  • Use the existing connectionAbort error mapping and check operation.signal before direct setInputFiles, before triggering the chooser click, and after awaiting the chooser before dispatching setFiles.
  • Regression cases cover an already-aborted direct-input/button path and a late chooser resolving after abort. A separate test executes the production label-control predicate against a fake associated HTMLInputElement, rather than stubbing every label as valid; it protects the direct-file-input path noted by Cubic. No files may be uploaded after cancellation.

Evidence

  • Source and test diff isolated to 2 files (+48/−2), based on fix(web): support upload buttons that open file choosers e2e-inc/e2e#958 head.
  • Reuses project's typed cancellation mapping; does not alter successful upload ordering.
  • Full pnpm check, native Chromium and unit test suite not run in this execution environment (unavailable pnpm dependencies/network). Needs CI before promotion.
  • Check that the final callback still observes the aborted ConnectionBudget.signal from the outer operation in all engines.

Do not promote as a new competing origin PR; review/cherry-pick into e2e-inc#958. Original solution and tests by kuishou68; maintainer okwasniewski rewrote the upload flow; Cubic identified this follow-up race. Credit retained.

Coordination: #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant