fix(native-worker): keep batches and retries intact across seam races

- Verification challenge no longer abandons the batch: batch mates the
  worker cancel would mark skipped are requeued and fenced from later
  snapshot applications, and the adoption loop restarts the queue for
  requeued items when the run ends
- Pause vs cancel race: a cancelled result with no pause flag set waits
  up to 1.5s for the pause intent to land on the main looper before
  being classified as a permanent skip
- Stale Go cancel flag: new ResetDownloadCancel export (wired through
  Android and iOS bridges) drops a pre-registered cancel with no active
  download; retryItem/retryAllFailed call it so the first retry of a
  cancelled-before-start item no longer aborts instantly
- Reconcile-loop errors now cancel the native worker and clear the run
  id before marking items failed, instead of leaving the service
  downloading a batch the UI already wrote off
This commit is contained in:
zarzet
2026-07-10 10:18:03 +07:00
parent d819878ec7
commit 9b7f1631f0
8 changed files with 151 additions and 1 deletions
+6
View File
@@ -541,6 +541,12 @@ class PlatformBridge {
await _channel.invokeMethod('cancelDownload', {'item_id': itemId});
}
/// Drops a stale pre-registered cancel flag for an item with no active
/// download, so a user-initiated retry does not abort instantly.
static Future<void> resetDownloadCancel(String itemId) async {
await _channel.invokeMethod('resetDownloadCancel', {'item_id': itemId});
}
static Future<void> setDownloadDirectory(String path) async {
await _channel.invokeMethod('setDownloadDirectory', {'path': path});
}