Skip to content

refactor(ios): drive the native round through the shared round engine - #675

Merged
sunnylqm merged 1 commit into
masterfrom
claude/round-engine-ios
Oct 15, 2026
Merged

sunnylqm merged 1 commit into
masterfrom
claude/round-engine-ios

Conversation

@sunnylqm

@sunnylqm sunnylqm commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RoundEngine 系列的第 3 步:让 iOS 接入 #673 合入的共享轮次引擎。Android 还要等 #669 合入,所以先做 iOS。

改了什么

  • RCTPushyOrchestrator.mm 原先手写的几段轮次逻辑都删掉了,包括 runConfiguredRound、runQueryRequest、performAttempts 和 PushyQueryRequestTimeout,以及结果映射。
  • runOnce 改为循环调用 flowcore::StepRound,逐条执行引擎返回的命令。命令包括面包屑、collectEnv、http、checkInstalled、download、commit、finish。
  • 三个执行器各管一类命令:perform: 负责环境和 HTTP,download: 负责下载,commit: 负责提交。
  • 平台专属的部分原样保留:
    • tvOS purge-restore 窗口
    • crash hold
    • 提交锁、锁内的代数复核和 PushyVerifyActivation 摘要门
    • 留给 crash hold 激活的未激活版本记录
    • HTTP 客户端本身
  • 宿主等待后的取消判定改用 flowcore::HostCancellation。
  • 净删 81 行(+170 / −251)。

行为对齐(NATIVE_CHECKUPDATE_DESIGN §12.4)

  • 请求整次上限改用引擎给的 callTimeoutMs:15s,并按轮次预算钳制。以前是空闲超时再加 5s,可能比预算多等 5s。
  • 提交如果败给配置变更,现在报 cancelled/config_changed。适配器通过比较配置代数判断是哪一种,以前一律报 reset。
  • 其余行为与原先手写循环一致,由 tests/round-engine-vectors.json 锁定。

验证

  • 用 Example/e2etest 的 Pods 头文件对 RCTPushyOrchestrator.mm、RCTPushyInstaller.mm 做 -fsyntax-only(模拟器 SDK,C++20),通过。
  • scripts/test-ios-purge-restore.sh 12 项全部通过。restorePurgedLaunch 和 commitRoundWithGeneration 的签名没有变。
  • scripts/test-update-flow-core.sh 通过。
  • 轮次驱动本身靠 CI 的 e2e-ios (native) 把关。

🤖 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

  • Improvements
    • Native update checks now handle environment checks, downloads, and installation steps through a coordinated flow.
    • Cancelling a wait for an update now responds to configuration or reset changes.
  • Bug Fixes
    • Installation attempts affected by a configuration change are now reported as configuration-changed failures.

RCTPushyOrchestrator's hand-written round (runConfiguredRound, the endpoint
query loop, the two-budget download loop and the result mapping) is replaced
by a loop over flowcore::StepRound that runs the commands it returns: the
breadcrumb, the launch env, HTTP, the installed check, downloads and the
commit. Platform-specific parts stay here: the tvOS purge-restore window,
crash hold, the commit lock and its activation gate, unactivated-version
bookkeeping for crash hold, and the HTTP client.

Behaviour aligned with the engine (NATIVE_CHECKUPDATE_DESIGN §12.4): the
request's whole-call bound is the engine's callTimeoutMs (15s, capped by the
round deadline) instead of the idle timeout + 5s; a commit lost to a config
change finishes as cancelled/config_changed; the host's post-wait check is
HostCancellation.

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

coderabbitai Bot commented Oct 15, 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: 51cfffb3-16f3-4fd0-8b0a-d66f3d7552d4
📥 Commits

Reviewing files that changed from the base of the PR and between bcfac79 and d278fda.

📒 Files selected for processing: 2
  • docs/NATIVE_CHECKUPDATE_DESIGN.md
  • ios/RCTPushy/RCTPushyOrchestrator.mm

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

📝 Walkthrough

The iOS orchestrator now drives update rounds through flowcore::StepRound. It handles engine commands for environment collection, HTTP requests, version checks, downloads, commits, cancellation, and round completion.

Changes: iOS Round Engine

Layer / File(s) Summary
Engine-driven round control
ios/RCTPushy/RCTPushyOrchestrator.mm, docs/NATIVE_CHECKUPDATE_DESIGN.md
runOnce now supplies round state to StepRound and dispatches its commands. The orchestrator manages the incomplete-round breadcrumb. The design progress note records the iOS integration.
HTTP, download, and commit adapters
ios/RCTPushy/RCTPushyOrchestrator.mm
The HTTP adapter now takes separate idle and whole-call timeouts. Download and commit handlers return results to the engine, including timeout, verification, and configuration-change outcomes.
Cancellation and round results
ios/RCTPushy/RCTPushyOrchestrator.mm
HostCancellation now evaluates configuration and reset generations. Round completion uses the engine-provided status, reason, hash, and activation values.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant RCTPushyOrchestrator
  participant StepRound
  participant Installer
  RCTPushyOrchestrator->>StepRound: StepRound with round input
  StepRound-->>RCTPushyOrchestrator: command
  RCTPushyOrchestrator->>RCTPushyOrchestrator: perform command
  RCTPushyOrchestrator->>Installer: download or commit
  Installer-->>RCTPushyOrchestrator: operation result
  RCTPushyOrchestrator-->>StepRound: command event
  StepRound-->>RCTPushyOrchestrator: finish event
Loading
Merge Risk: ⚪ Minimal · up to d278f

No actionable regression was established in the iOS round-engine integration; it is ready for normal merge checks.

Pre-merge checks: Passed 5
Passed Passed checks: 5 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: iOS now drives native rounds through the shared round engine.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
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.
✨ 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.

@sunnylqm
sunnylqm merged commit 6637538 into master Oct 15, 2026
10 checks passed
@sunnylqm
sunnylqm deleted the claude/round-engine-ios branch October 15, 2026 03:36
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