Skip to content

build: register every encoded native text once and generate its copies - #686

Merged
sunnylqm merged 1 commit into
masterfrom
claude/native-texts
Oct 16, 2026
Merged

sunnylqm merged 1 commit into
masterfrom
claude/native-texts

Conversation

@sunnylqm

@sunnylqm sunnylqm commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #683: the encoded native texts get the same single-source treatment as the constants.

What changes

  • scripts/contract.ts registers each encoded text once in nativeTexts. A platform that names the same thing differently gets its own value, e.g. the package patch suffix .ipa.patch / .apk.patch / .app.patch. The JS service presets are registered there too, as servicePresets.
  • The generator emits these files:
    • cpp/patch_core/native_texts.h, shared by the C++ cores and iOS
    • the Texts.java and Texts.ts constants
    • the client's SERVER_PRESETS
  • Every call site reads from those generated files, and RCTPushyRevealText is removed. Harmony's APP_DELTA_SUFFIX is renamed to PACKAGE_DELTA_SUFFIX.
  • nativeTextEncoding.test.ts takes its plain texts from the registry. It now fails on any encoded literal outside a generated region, so the registry cannot fall out of date.
  • librnpushy.so is rebuilt because the JNI side reads the texts differently now.

Verification

  • bun lint passes: 40 generated regions are up to date.
  • bun test passes: 461 tests.
  • The native purge-restore harness now includes native_texts.h.

🤖 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

  • Chores
    • Standardized update-related settings and text across supported platforms. Existing update behavior and service endpoints remain unchanged.
    • Aligned package patch file naming across platforms; downloaded files continue to use the same names.
    • No user-facing changes to installation, permissions, or update workflows.

Encoded strings (update wording, service addresses) were hex literals
scattered over 40 call sites in four languages, the same text encoded up to
four times (noUpdate, crashRescue, index.bundlejs.patch, .ppk.patch...),
with the JS client's service presets a separate plain copy.

scripts/contract.ts now registers each text once (nativeTexts, with
per-platform values where a platform names the same thing differently, like
the package patch suffix) plus the service presets, and the generator emits
cpp/patch_core/native_texts.h (shared by the C++ cores and iOS), the
Texts.java and Texts.ts constants and the client's SERVER_PRESETS. Every
call site reads those; RCTPushyRevealText is gone.

nativeTextEncoding.test.ts takes its plain texts from the registry and now
fails on any encoded literal outside a generated region, so the registry
stays complete. librnpushy.so is rebuilt for the JNI side's new reads.

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: a2d22a4e-bb38-4c7d-9510-b25868d7dd9a
📥 Commits

Reviewing files that changed from the base of the PR and between 8e490df and 0ba7205.

⛔ Files ignored due to path filters: 4
  • android/lib/arm64-v8a/librnpushy.so is excluded by !**/*.so
  • android/lib/armeabi-v7a/librnpushy.so is excluded by !**/*.so
  • android/lib/x86/librnpushy.so is excluded by !**/*.so
  • android/lib/x86_64/librnpushy.so is excluded by !**/*.so
📒 Files selected for processing: 29
  • android/src/main/java/cn/reactnative/modules/update/ApkInstaller.java
  • android/src/main/java/cn/reactnative/modules/update/DownloadTask.java
  • android/src/main/java/cn/reactnative/modules/update/NativeCore.java
  • android/src/main/java/cn/reactnative/modules/update/ReactReloadManager.java
  • android/src/main/java/cn/reactnative/modules/update/SyncCoordinator.java
  • android/src/main/java/cn/reactnative/modules/update/Texts.java
  • android/src/main/java/cn/reactnative/modules/update/UpdateContext.java
  • android/src/main/java/cn/reactnative/modules/update/UpdateModule.java
  • cpp/android_jni/jni_log.h
  • cpp/android_jni/update_core_android.cpp
  • cpp/patch_core/archive_patch_core.cpp
  • cpp/patch_core/native_texts.h
  • cpp/update_flow_core/native_config.cpp
  • cpp/update_flow_core/native_round.cpp
  • cpp/update_flow_core/round_engine.cpp
  • cpp/update_flow_core/update_flow_core.cpp
  • harmony/pushy/src/main/ets/Texts.ts
  • harmony/pushy/src/main/ets/UpdateContext.ts
  • ios/RCTPushy/RCTPushyCommon.h
  • ios/RCTPushy/RCTPushyConfiguration.mm
  • ios/RCTPushy/RCTPushyInstaller.mm
  • ios/RCTPushy/RCTPushyOrchestrator.mm
  • ios/RCTPushy/RCTPushyState.mm
  • scripts/contract.ts
  • scripts/generate-contract.ts
  • scripts/tests/ios-purge-restore/extract.py
  • scripts/tests/ios-purge-restore/purge_restore_test.mm
  • src/__tests__/nativeTextEncoding.test.ts
  • src/client.ts
💤 Files with no reviewable changes: 2
  • ios/RCTPushy/RCTPushyCommon.h
  • ios/RCTPushy/RCTPushyConfiguration.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 PR adds a shared registry for native text values and service presets, generates platform constants from that registry, and updates Android, C++, iOS, and Harmony code to use the generated values. Tests check generated text inputs and scan native sources for encoded literals.

Changes: Shared native text contract

Layer / File(s) Summary
Define and generate shared text values
scripts/contract.ts, scripts/generate-contract.ts, cpp/patch_core/native_texts.h, android/.../Texts.java, harmony/.../Texts.ts, src/client.ts, src/__tests__/nativeTextEncoding.test.ts
The contract defines native text entries and Pushy and Cresc service presets. The generator emits encoded text constants for C++, Java, and ArkTS, plus service preset regions. Tests derive text inputs from the contract and scan native sources for encoded literals outside generated regions.
Update Android and Harmony call sites
android/.../ApkInstaller.java, android/.../DownloadTask.java, android/.../NativeCore.java, android/.../ReactReloadManager.java, android/.../SyncCoordinator.java, android/.../UpdateContext.java, android/.../UpdateModule.java, harmony/.../Texts.ts, harmony/.../UpdateContext.ts
Android call sites use named Texts constants instead of revealing embedded strings. Harmony renames APP_DELTA_SUFFIX to PACKAGE_DELTA_SUFFIX and uses it for package-delta filenames.
Use shared values in C++
cpp/android_jni/*, cpp/patch_core/archive_patch_core.cpp, cpp/patch_core/native_texts.h, cpp/update_flow_core/*
C++ logging, JNI, archive, and update-flow code uses values from pushy::texts. Local string-reveal helpers and definitions are removed from update-flow files.
Use shared values in iOS
ios/RCTPushy/*, scripts/tests/ios-purge-restore/*
iOS getters use values from pushy::texts. The RCTPushyRevealText declaration and implementation are removed. The purge-restore test includes native_texts.h and adjusts helper ordering.

Priority: ➖ Normal

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

Change: Refactor

Merge Risk: ⚪ Minimal · up to 0ba72

This change moves native text values into a generated shared registry without altering the intended runtime values. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 23 files. (4 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 summarizes the main change: registering encoded native text once and generating its platform-specific copies.
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 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 23 files. (4 skipped: 4 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • 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
  • 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 c22800a into master Oct 16, 2026
16 checks passed
@sunnylqm
sunnylqm deleted the claude/native-texts branch October 16, 2026 10:00
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