Skip to content

fix(import): running async jobs cannot be cancelled on local SQLite #2824

Description

@yinlianghui

Summary

A running asynchronous CSV import could not be cancelled in the local SQLite showcase environment.

This was found during the UI follow-up for #2678, using framework baseline 98874656ffc50ce1531af52346228ffcdda73fba and the pinned ObjectUI build 80901aad44ff3beeaf7882ec3367da934325b2f2. It is not claimed as a regression introduced by #2680.

Reproduction

  1. Start the showcase backend and pinned ObjectUI console.
  2. Import a CSV containing 50,000 valid rows.
  3. While the import is running and the Cancel control is visible, click Cancel.
  4. Wait for the job to finish and inspect import history/backend state.
  5. Repeat from a clean run.

Observed in 2/2 runs:

  • The UI accepted the cancel action.
  • The import history/backend job eventually reported succeeded.
  • All 50,000 rows were imported.

Expected

The running job stops at a cancellation checkpoint, retains only the already committed partial progress, and ends with a terminal cancelled state.

Actual

The job completes successfully and imports all rows.

Technical boundary

The current implementation stores cancellation requests in the process-local cancelledImportJobs set and checks it from the worker through shouldCancel. The import runner checks at progress intervals (200 rows), but the synchronous SQLite workload may prevent the cancel HTTP request from being handled in time. Exact event-loop timing should be confirmed with focused instrumentation before choosing a fix.

Existing integration coverage verifies unknown/already-finished cancellation, but does not exercise cancelling a live running job over HTTP with SQLite.

Suggested regression coverage

Add a real HTTP + SQLite integration test that:

  • starts a sufficiently long asynchronous import;
  • waits until the job is running;
  • sends the cancel request;
  • verifies the request is observed before completion;
  • verifies the final state is cancelled;
  • verifies imported rows match the last committed partial progress and do not reach the full input count.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions