Skip to content

fix: resume revived paused tasks and guard unknown download sizes - #52

Merged
fivecar merged 2 commits into
mainfrom
fix/pr51-review-comments
Jul 24, 2026
Merged

fix: resume revived paused tasks and guard unknown download sizes#52
fivecar merged 2 commits into
mainfrom
fix/pr51-review-comments

Conversation

@fivecar

@fivecar fivecar commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

Addresses the three review-bot comments on #51, all verified as real issues:

  • Resume revived PAUSED tasks when active. feat(deps)!: migrate to @fivecar/react-native-background-downloader #51 removed ensureDownloadsAreRunning(), which previously force-resumed paused tasks on init. Without it, a task the OS paused while backgrounded stayed paused forever — the spec-start loop skips anything already in existingTasks. reviveTask() now resumes a PAUSED task when the queue is active, keeping the pause-if-inactive branch.
  • Guard unknown bytesTotal in progress. The downloader reports bytesTotal: -1 when the server omits Content-Length (Android ProgressReporter.kt documents this; iOS passes countOfBytesExpectedToReceive). fractionWritten is now 0 when bytesTotal <= 0 instead of negative/NaN; raw byte counts still pass through.
  • README install docs now point to @fivecar/react-native-background-downloader (the actual peer dependency since feat(deps)!: migrate to @fivecar/react-native-background-downloader #51) instead of the old @kesha-antonov package, with the iOS AppDelegate link fixed to the fork's Installation section.

Test plan

  • New/updated tests cover: PAUSED revival resumed when active, left paused when startActive: false, and fraction 0 on bytesTotal: -1 (each confirmed failing before the fix).
  • Full suite: 85/85 passing with the repo's 100% coverage threshold met; tsc --noEmit and ESLint clean.

🤖 Generated with Claude Code

Address review comments from #51:

- Resume revived PAUSED tasks when the queue is active. The old
  ensureDownloadsAreRunning() workaround force-resumed them, but #51
  removed it without a replacement, so tasks paused by the OS while
  backgrounded stayed paused forever after relaunch.
- Guard progress fraction against bytesTotal <= 0. The downloader
  reports -1 when the server omits Content-Length, which produced
  negative fractionWritten values; report 0 instead while still
  passing raw byte counts through.
- Update README install instructions to reference
  @fivecar/react-native-background-downloader instead of the old
  @kesha-antonov package.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 68493f45ab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/index.ts
When init() is called with activeNetworkTypes (e.g. wifi-only) while on a
forbidden network (e.g. cellular), the revived-PAUSED resume ran before init
evaluated the initial network state, so a download could briefly run on metered
data before onNetInfoChanged() paused it. Move the network-gating block ahead of
the revive/start sections so pauseAllInternal() flips this.active off first;
revivals then won't resume PAUSED tasks, revived DOWNLOADING tasks get paused,
and fresh starts get paused in begin().

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cursor

cursor Bot commented Jul 24, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_7e2fcf7a-2e23-4d00-817a-3d5dd89f9fc8)

@fivecar

fivecar commented Jul 24, 2026

Copy link
Copy Markdown
Owner Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit d843765. Configure here.

@fivecar
fivecar merged commit 5c4a91e into main Jul 24, 2026
3 checks passed
@fivecar
fivecar deleted the fix/pr51-review-comments branch July 24, 2026 01:25
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 6.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant