Skip to content

[codex] fix client rollout current-hash updates#580

Merged
sunnylqm merged 1 commit into
masterfrom
codex/fix-client-rollout-current-hash
Jun 13, 2026
Merged

[codex] fix client rollout current-hash updates#580
sunnylqm merged 1 commit into
masterfrom
codex/fix-client-rollout-current-hash

Conversation

@sunnylqm

@sunnylqm sunnylqm commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Added a client-side resolveCheckResult step for choosing the effective update candidate from the server response.
  • Stopped merging expVersion over the root response, so rollout candidates no longer inherit root diff, pdiff, full, or unrelated update fields.
  • Treat rollout targets that already match currentVersion as upToDate, and stop before falling through to the root full-release candidate.
  • Added a downloadUpdate guard that skips downloads when the requested update hash equals the current hash.
  • Added tests for rollout same-hash handling, artifact isolation, rollout miss fallback, root same-hash handling, and direct download same-hash guarding.

Why

The server currently returns a candidate set: a root full-release candidate plus an optional rollout candidate. react-native-update@10.37.5 and current master merged expVersion with the root response. When a rollout device had already installed the rollout hash, the rollout candidate could inherit update: true and root artifacts, causing the client to attempt downloading the same version or mismatched artifacts.

Keeping the decision client-side preserves the existing server protocol and cache behavior while making the client resolve the effective candidate correctly.

Validation

  • bun test src/__tests__
  • bun run lint

Summary by CodeRabbit

  • Bug Fixes

    • Skip redundant downloads when the current version already matches the target update hash.
  • Tests

    • Added comprehensive test coverage for update resolution and client download logic, including rollout handling and no-op update scenarios.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bb8f3b8a-fb3b-4427-ac5a-fa32fafb3749

📥 Commits

Reviewing files that changed from the base of the PR and between 767841c and 6e46022.

📒 Files selected for processing (5)
  • src/__tests__/client.test.ts
  • src/__tests__/provider.test.ts
  • src/client.ts
  • src/provider.tsx
  • src/resolveCheckResult.ts

📝 Walkthrough

Walkthrough

This PR refactors update result resolution by extracting rollout and version-comparison logic into a new resolveCheckResult utility, integrating it into the provider's update flow, and adding a client-side download guard for already-current hashes. Test coverage validates the new utility and enhanced mocking capabilities.

Changes

Update Resolution and Integration

Layer / File(s) Summary
resolveCheckResult utility and test coverage
src/resolveCheckResult.ts, src/__tests__/provider.test.ts
New resolveCheckResult function normalizes CheckResult by reading rollout percentages, checking eligibility, merging experimental versions, and returning appropriate metadata. Tests verify rollout inclusion, artifact isolation, fallback to root, and hash-based "already current" detection.
Provider checkUpdate refactoring
src/provider.tsx
Refactors checkUpdate() to use resolveCheckResult instead of inline rollout filtering. Removes isInRollout dependency, centralizes version comparison, and delegates expired vs. active update handling to strategy-dependent handlers.
Client download guard and test mocks
src/client.ts, src/__tests__/client.test.ts
Client's downloadUpdate short-circuits when hash matches current version. Test mocks enhanced to inject downloadPatchFromPpk, downloadPatchFromPackage, and downloadFullUpdate; new test verifies no downloads or logs for no-op updates.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A rollout resolved in one place,
No loops or filters to trace,
One utility true,
Makes updates feel new,
While short-circuits keep pace! 🚀

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-client-rollout-current-hash

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sunnylqm sunnylqm marked this pull request as ready for review June 13, 2026 00:41
@sunnylqm sunnylqm merged commit a939db7 into master Jun 13, 2026
3 of 7 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.

1 participant