Skip to content

test(android): replay the round engine vectors through the sync adapter - #680

Merged
sunnylqm merged 2 commits into
masterfrom
claude/lucid-wilson-bdf3d4
Oct 16, 2026
Merged

sunnylqm merged 2 commits into
masterfrom
claude/lucid-wilson-bdf3d4

Conversation

@sunnylqm

@sunnylqm sunnylqm commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • SyncCoordinator.runOnce drives the shared round engine through a RoundHost (engine step, monotonic clock, kv store, the IO the engine's commands ask for). DeviceRound is the device implementation (JNI FlowBridge.stepRound, UpdateContext, OkHttp) — behaviour unchanged.
  • New SyncRoundReplayTest (same idea as Harmony's harmonySyncRound.test.ts): each trace in cpp/update_flow_core/tests/round-engine-vectors.json plays the engine; IO outcomes come from the trace's next event. It checks every event the adapter answers with (type/text/installed/ok/code/timedOut/reason/error/now), the arguments each command ran with (http url/body/timeouts, download strategy/url/hash/originHash/deadline, commit generation/hash/hashInfo/activate/cache), the start facts (config, generations, deadline), the sticky crash-hold flag, cancellation of a timed-out attempt, the finish → BundlePreparationResult mapping and unactivatedHash, and that the breadcrumb never survives.
  • 28 of the vectors replay, including crash hold, round deadline and timed-out downloads (the fake clock reads each event's now). Skipped: the tvOS-only forceActivate/activated trace, the code-less download failure (Android always reports a code), and the protocol-error traces.
  • Negative control: reporting reset instead of config_changed on a lost commit fails the config-change trace.

Test plan

  • ./gradlew :react-native-update:testReleaseUnitTest via Example/e2etest (JVM unit tests are not run by CI): 79 tests, 0 failures
  • CI (e2e-android exercises DeviceRound)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Refactor
    • Streamlined Android update-round processing while preserving existing download selection and commit behavior.
  • Tests
    • Added replay coverage for Android update scenarios, checking expected results, cancellation, and incomplete-round cleanup.
  • Documentation
    • Updated the native update design overview to list the additional Android and iOS replay-test coverage.

SyncCoordinator.runOnce now drives the engine through a RoundHost (the
engine step, the clock, the kv store and the IO its commands ask for);
DeviceRound is the device's. SyncRoundReplayTest plays each trace of
round-engine-vectors.json as a scripted engine, fakes the IO from the
trace's next event and checks every event the adapter answers with, the
arguments each command ran with, the start facts, the crash-hold flag
and the finish's result mapping.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fe357b9c-3c00-4461-9b34-ce6d7db6a83f
📥 Commits

Reviewing files that changed from the base of the PR and between 25515b1 and a10f139.

📒 Files selected for processing: 1
  • docs/NATIVE_CHECKUPDATE_DESIGN.md
🚧 Files skipped from review as they are similar to previous changes: 1
  • docs/NATIVE_CHECKUPDATE_DESIGN.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

📝 Walkthrough

Android round execution now uses a RoundHost abstraction for timing, engine steps, device operations, and downloads. A new JVM test replays shared round vectors through a scripted host and checks emitted events, IO, and round results.

Changes: Android round engine

Layer / File(s) Summary
Round host and device adapter
android/src/main/java/cn/reactnative/modules/update/SyncCoordinator.java
RoundHost defines the operations used by a round. DeviceRound delegates those operations to Android services, and runClaimedRound passes the adapter to runOnce.
Host-driven round execution
android/src/main/java/cn/reactnative/modules/update/SyncCoordinator.java
Round execution, command handling, commits, and download deadline waiting use host-provided operations and clock values.
Round vector replay checks
android/src/main/java/cn/reactnative/modules/update/SyncCoordinator.java, android/src/test/java/cn/reactnative/modules/update/SyncRoundReplayTest.java, docs/NATIVE_CHECKUPDATE_DESIGN.md
The test replays shared vectors through a scripted host and checks events, IO, deadline handling, and finish results. The design document lists the test.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to a10f1

No actionable merge-blocking issue was established; the change is ready for normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 65 functions across 2 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: replaying round-engine vectors through the Android sync adapter. It matches the added replay test and related adapter refactoring.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 65 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sunnylqm
sunnylqm merged commit f434aa7 into master Oct 16, 2026
10 checks passed
@sunnylqm
sunnylqm deleted the claude/lucid-wilson-bdf3d4 branch October 16, 2026 04:09
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