Skip to content

feat: let a release history entry set its own minimumBackgroundDuration - #199

Merged
floyd-soomgo merged 9 commits into
masterfrom
feature/release-history-minimum-background-duration
Sep 17, 2026
Merged

floyd-soomgo merged 9 commits into
masterfrom
feature/release-history-minimum-background-duration

Conversation

@floyd-soomgo

@floyd-soomgo floyd-soomgo commented Sep 16, 2026

Copy link
Copy Markdown
Member

Summary

Apps using this fork hardcode the wait in CodePush.sync({ installMode: ON_NEXT_RESUME, minimumBackgroundDuration: 3600 }), so every update waits the same hour. This lets each release decide for itself.

  • A release history entry (ReleaseInfo) can carry minimumBackgroundDuration (seconds). When present it takes precedence over the sync option; when absent the sync option applies as before. 0 is a valid value and means "on the next resume", so the value is resolved with ?? and typeof === 'number' checks rather than truthiness.
  • The value travels the existing path: release history → UpdateCheckResponse.minimum_background_durationRemotePackage.minimumBackgroundDurationlocalPackage.install(installMode, minimumBackgroundDuration). The deprecated updateChecker path goes through the same mapper, so it works there too. Native code is untouched.
  • CLI: release and update-history gain --minimum-background-duration <seconds> (whole number, 0 or greater). update-history is how a team lowers the wait to 0 after a release has gone out.
  • update-history used to exit with "No options specified" when --rollout was the only option. Now --rollout and the new option both count. Since --rollout can reach the write path on its own, the command validates it the same way release does, plus a finiteness check so --rollout abc cannot write null into the history.
  • Docs: root README.md, docs/api-js.md, and the CLI reference in cli/README.md / cli/README.ko.md.

Verification

  • npx jest --watchman=false src/CodePush.test.js: 32 tests, including three that assert the value the native bridge receives for a history value, no history value, and a history value of 0
  • npm run --workspace cli test: 12 suites, 116 tests
  • npm run typecheck and ESLint on changed files
  • E2E (npm run e2e -- --app RN0840 --platform both, iPhone 17 simulator + Galaxy S23 over USB): all phases pass on both platforms, first try. Two new phase-4 scenarios cover the feature end to end: 05 releases with --minimum-background-duration 0 while the app's sync asks for 20 seconds and the update is applied on the first resume; 06 releases with 20 while sync asks for no wait, and the update is not applied after a 2 second background but is after 20 seconds. The runner also asserts the served history entry carries the value.

Follow-up

release --rollout abc still passes NaN through its range check (pre-existing). Aligning it with the update-history check is a one-line change, left out of this PR.

A release can now carry `minimumBackgroundDuration`, which wins over the one
the `sync` call passes, so a single release can be applied sooner or later
than the app asks for by default.
`release --minimum-background-duration <seconds>` writes the value on the
release history entry it creates, so the release decides its own background
wait instead of taking the one the `sync` call passes. Without the option the
entry says nothing about it, exactly as before.
…unt --rollout as an option

`update-history --minimum-background-duration <seconds>` edits the background
wait of a release that is already out, which is how a team lowers it to 0 once
the release has been running for a while.

The "no options specified" guard only looked at --mandatory and --enable, so
`update-history --rollout 50` exited instead of saving the percentage. It now
counts every option that changes the entry.
The release and update-history commands can now set a background wait on a
single release, and the runtime prefers it over the minimumBackgroundDuration
the sync call passes, so the CLI option list and the JS API reference say so.
@floyd-soomgo
floyd-soomgo marked this pull request as ready for review September 17, 2026 07:56
@floyd-soomgo
floyd-soomgo merged commit 58f514b into master Sep 17, 2026
1 check passed
@floyd-soomgo
floyd-soomgo deleted the feature/release-history-minimum-background-duration branch September 17, 2026 07:58
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