Skip to content

refactor!: rename native host APIs to bundle preparation - #649

Merged
sunnylqm merged 6 commits into
masterfrom
refactor/native-host-prepare-bundle
Sep 28, 2026
Merged

sunnylqm merged 6 commits into
masterfrom
refactor/native-host-prepare-bundle

Conversation

@sunnylqm

@sunnylqm sunnylqm commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary / 改动

Rename the bridge-free native-host entry points consistently across Android, iOS/Swift, and HarmonyOS, using bundle-preparation terminology rather than checkAndUpdate.

Before After
Android PushyNativeUpdate.checkAndUpdate(context, callback) PushyRuntime.prepareBundle(context, callback)
Objective-C checkAndUpdateWithCompletion: prepareBundleWithCompletion:
Swift checkAndUpdate(completion:) prepareBundle(completion:)
Harmony PushyFileJSBundleProvider.checkAndUpdate() PushyFileJSBundleProvider.prepareBundle()
Android/Harmony NativeUpdateResult BundlePreparationResult
Harmony NativeUpdateConfig PushyConfiguration
iOS RCTPushyNativeUpdateCompletion RCTPushyBundlePreparationCompletion
  • Rename corresponding source files, imports, callback types, internal call sites, and Harmony package exports.
  • Retain no deprecated native-host aliases.
  • Add four cross-platform naming regression tests and migrate existing configuration/orchestration/round tests.
  • Add bilingual native-host migration documentation and README references.

Compatibility / 兼容性边界

This is a source-breaking native-host API rename, not a behavior change. configure retains its name. Preparation still starts, joins, or reuses the existing native round after real launch bundle resolution; it does not reload the running React Native instance. Activation still selects a bundle for the next launch.

The public JavaScript SDK, TurboModule/legacy bridge contract (src/NativePushy.ts), server HTTP paths, configuration values, result fields/status strings (including noUpdate), and persisted keys are unchanged. Package identity, version, and dependencies are unchanged. This PR does not remove every occurrence of update from the package or binary.

原生宿主需要同步修改调用方法、导入及类型,并重新构建/分发原生安装包;不能仅靠 JS 热更新完成原生接口重命名。Apple 平台按正常升级流程重新运行 pod install,Harmony 使用重新构建的匹配 HAR。不得为了调用 prepareBundle 再次解析启动 bundle。

Validation / 验证

Completed on the renamed source in validation run:

  • bun install --frozen-lockfile — passed.
  • bun test src/__tests__ — 320 passed, 0 failed, across 20 files.
  • Biome and tsc --noEmit — passed.
  • Native bridge parity — 18 spec methods present on Android old/new architecture, iOS, and Harmony.
  • Harmony SDK type checking — skipped, because that runner had no DevEco/OpenHarmony SDK; not claimed as passed.

Actual native compilation/E2E results are tracked separately by the existing PR checks. The temporary branch-scoped refactor workflow has been removed; the final diff does not alter CI workflows or test selection. No merge or release is included.


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

Summary by CodeRabbit

  • Documentation
    • Added English and Chinese guidance for native host APIs, including the prepareBundle entry points, startup sequence, migration steps, and rebuild requirements.
  • Breaking Changes
    • Renamed native host API methods, configuration and result types across Android, Apple, and Harmony platforms. Existing native integrations must migrate to the new names and rebuild; no deprecated aliases are provided.
    • Bundle selection, update results, and JavaScript bridge behavior remain unchanged.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: d002528e-3893-44e0-b218-c982d8453b06

📥 Commits

Reviewing files that changed from the base of the PR and between fd411ff and bb306a4.

📒 Files selected for processing (13)
  • NATIVE_HOST_API_MIGRATION.md
  • android/src/main/java/cn/reactnative/modules/update/UpdateContext.java
  • harmony/pushy/src/main/ets/BundlePreparationResult.ts
  • harmony/pushy/src/main/ets/NativeCheckOrchestrator.ts
  • harmony/pushy/src/main/ets/PushyConfiguration.ts
  • harmony/pushy/src/main/ets/UpdateContext.ts
  • ios/RCTPushy/RCTPushy.h
  • ios/RCTPushy/RCTPushy.mm
  • ios/RCTPushy/RCTPushyConfiguration.h
  • ios/RCTPushy/RCTPushyConfiguration.mm
  • src/__tests__/bundlePreparationRound.test.ts
  • src/__tests__/nativeHostApi.test.ts
  • src/__tests__/nativeHostApiNaming.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • harmony/pushy/src/main/ets/PushyConfiguration.ts

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


📝 Walkthrough

Walkthrough

The native host API is renamed to bundle-preparation terminology across Android, Harmony, and iOS. Result and configuration types are renamed without changing their described values or validation. Migration documentation and tests are updated.

Changes

Native Host API Rename

Layer / File(s) Summary
Android bundle preparation API
android/src/main/java/cn/reactnative/modules/update/*
Renames Android result and configuration types, runtime and orchestration methods. Existing orchestration checks and result outcomes remain in place.
Harmony bundle preparation API
harmony/pushy/index.ets, harmony/pushy/src/main/ets/*, src/__tests__/nativeConfiguration.test.ts, src/__tests__/nativeHostApi.test.ts, src/__tests__/bundlePreparationRound.test.ts
Renames Harmony result, round, and configuration types and provider and orchestration entry points. Updates package exports and tests to use the renamed APIs.
iOS and Swift API rename
ios/RCTPushy/*
Renames public completion types, configuration normalizer, and preparation entry points. The asynchronous persistence and completion flow remains in place.
Migration guidance and naming checks
NATIVE_HOST_API_MIGRATION.md, README.md, README-CN.md, src/__tests__/nativeHostApiNaming.test.ts
Adds English and Chinese migration guidance and README entry points. Adds tests for renamed platform APIs and absence of superseded identifiers.

Priority: ➖ Normal

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

Change: Refactor

Merge Risk: ⚪ Minimal · up to bb306

The native API rename appears ready to merge after normal checks. Native hosts must update their calls and rebuild as documented.

Security Architecture Review

Security architecture risk: 🔵 Low · up to bb306

The native API rename requires host applications to migrate, but the reviewed preparation paths retain their existing checks and state ownership. No newly exposed security path was identified. External caller coverage remains incomplete.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The effective contract change reaches applications that call the Android, iOS, or Harmony native-host APIs; the reviewed paths do not show a new network-facing or JavaScript-bridge entry point.

Trust Boundaries and Controls

  • observed — Android's public method still delegates preparation to the existing orchestrator and delivers its outcome through the main-thread callback; the orchestrator retains configuration and generation gates.
  • observed — The renamed iOS selector remains a completion-only native-host facade method delegating to the same orchestrator path; the target-branch comparison found no added input or changed caller authority.

Resilience and Maintainability Implications

  • observed — Harmony's single shared promise and generation-based cancellation remain in place through the rename. Reuse of a terminal failure or rejection is existing round behavior, not an introduced recovery path.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 16 files. (3 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 primary change: renaming native host APIs to bundle preparation terminology. The ! correctly signals a breaking change.
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 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 30 functions across 16 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

…ter 10.56.0

- iOS: RCTPushyNativeConfigurationCompletion -> RCTPushyConfigurationCompletion,
  RCTPushyNormalizeNativeConfig -> RCTPushyNormalizeConfiguration,
  RCTPushyNativeConfig.{h,mm} -> RCTPushyConfiguration.{h,mm}
- Harmony: NativeUpdateRound -> BundlePreparationRound,
  PersistedNativeUpdateConfig -> PersistedPushyConfiguration
- Android/Harmony: "configure native update" error text -> "persist configuration"
- Naming test now scans every shipped native source for old host names and
  "native update" wording (JNI-bound NativeUpdateCore/Flow excepted)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sunnylqm
sunnylqm merged commit 8bd05f1 into master Sep 28, 2026
13 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