Skip to content

Releases: register new releases at 0% rollout - #89

Merged
adamshiervani merged 2 commits into
devfrom
feat/default-rollout-zero
Sep 21, 2026
Merged

adamshiervani merged 2 commits into
devfrom
feat/default-rollout-zero

Conversation

@adamshiervani

@adamshiervani adamshiervani commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

A newly registered release went to 10% of devices at once. It now starts at 0%: registered, visible in the table, served to nobody until an operator raises it. A 0% row is also ignored when picking the latest release, so registering one does not interrupt a rollout in progress.

 sync (tick, POST /releases/sync, interactive script default)
   new stable version in R2
-    → Release row @10%     # 10% of devices update on their next check
+    → Release row @0%      # no device updates until the rollout is raised
 Retrieve(deviceId, sku)
-  latest   = newest version
+  latest   = newest version with percentage > 0
   fallback = newest version at 100%
   bucket < latest.percentage → latest, else fallback
0.5.3 @100   0.5.4 @50   0.5.5 @0 (just registered)

              before        after
bucket 8      0.5.3         0.5.4      ← 0.5.5 shadowed the running rollout
bucket 95     0.5.3         0.5.3

Version-constrained requests, which skip rollout, still see 0% rows.

 src/release-sync.ts        DEFAULT_ROLLOUT_PERCENTAGE 10 → 0
 src/releases.ts            getLatestRelease filters rolloutPercentage > 0
 scripts/sync-releases.ts   prompt default follows the constant
 test/                      expectations 10 → 0; one test for the shadowing case

Code only, no migration. The schema default stays at 10; every insert sets the value.


Note

Medium Risk
Changes default OTA behavior for newly registered releases and how devices pick the “latest” rollout target; incorrect rollout selection could affect firmware delivery until an operator raises percentages.

Overview
Newly synced releases start at 0% rollout instead of 10%, so registering a version no longer pushes it to any devices until an operator raises the percentage.

Retrieve (background OTA checks) now treats “latest” as the newest release with rolloutPercentage > 0, so a 0% row stays visible in the DB but does not replace an older release that is still rolling out. Version-pinned requests are unchanged and can still resolve 0% rows.

Tests expect 0% on sync-created rows and add coverage for the case where a newer 0% release must not shadow an in-progress rollout.

Reviewed by Cursor Bugbot for commit 2c64c11. Bugbot is set up for automated code reviews on this repo. Configure here.

A newly registered release went to 10% of devices at once. It now
starts at 0%: registered, but served to no device until an operator
raises it. Existing rows keep their percentage.
@adamshiervani
adamshiervani force-pushed the feat/default-rollout-zero branch from f19c527 to 2235e01 Compare September 21, 2026 07:45
@adamshiervani
adamshiervani marked this pull request as ready for review September 21, 2026 08:51
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-21T13:35:30.280521Z 2c64c11 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 2235e014d5

ℹ️ 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/release-sync.ts

export const DEFAULT_ROLLOUT_PERCENTAGE = 10;
/** A new release is registered but served to no device until an operator raises it. */
export const DEFAULT_ROLLOUT_PERCENTAGE = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep zero-percent releases from shadowing active rollouts

When an older release is still rolling out (for example, v2 at 50%), syncing v3 with this new 0% default makes v3 the result of getLatestRelease; Retrieve rejects it for every device and getDefaultRelease only considers 100% rows, so v2 immediately stops being offered and clients fall back to v1. Registering an inactive release therefore interrupts any in-progress rollout; release selection should ignore 0% releases or retain the previous staged candidate until the new release is raised.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 2c64c11: getLatestRelease ignores rows at 0%, so a registered but unreleased version does not displace an older release mid-rollout. Test added: 2.0.0 @100, 2.1.0 @50, 2.2.0 @0; bucket 8 still gets 2.1.0, bucket 95 gets 2.0.0.

Selection took the single newest release as the rollout candidate, so
registering the next version at 0% pushed every device off an older
release still mid-rollout and onto the last 100% one. The latest lookup
now ignores rows at 0%. Version-constrained requests, which skip
rollout, still see them.
@adamshiervani

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 2c64c11f7d

ℹ️ 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".

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The behavior matches the stated rollout policy and has focused regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Registers new releases at 0% rollout so they remain inactive until explicitly promoted.

Changes:

  • Default new releases to 0%.
  • Exclude 0% releases from latest-rollout selection.
  • Add focused regression coverage.
File Description
test/​sync-releases.test.ts Updates synchronization expectations to 0%.
test/​releases.test.ts Tests that 0% releases do not shadow active rollouts.
src/​releases.ts Filters inactive releases from latest selection.
src/​release-sync.ts Changes the default rollout percentage to 0%.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@adamshiervani
adamshiervani merged commit 90fcf63 into dev Sep 21, 2026
3 checks passed
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.

2 participants