Skip to content

[FEAT-2] SDK: client diff support + native applier scaffold (flag-gated)#1

Open
prasad-rently wants to merge 8 commits into
masterfrom
feat/feat-2-bundle-diff
Open

[FEAT-2] SDK: client diff support + native applier scaffold (flag-gated)#1
prasad-rently wants to merge 8 commits into
masterfrom
feat/feat-2-bundle-diff

Conversation

@prasad-rently

Copy link
Copy Markdown
Owner

FEAT-2 — Differential JS Bundle Updates (client/SDK side)

Pairs with the server PR (rently-com/react-native-ota-updater#29). Off by default → classic CodePush behavior unchanged (capability list is empty; native applier not wired in).

✅ Verified in this PR

  • SHARED-S4 client-capabilities.js — advertises client_capabilities on update_check (empty by default). 6 node assertions.
  • SDK-C1 patch patches/code-push+4.2.2.patch — the upstream code-push@4.2.2 acquisition SDK drops unknown response fields; this forwards is_diff/diff_url/source_hash (FEAT-2) and asset_manifest_url (FEAT-1) into remotePackage. Validated: applies clean + node --check OK.
  • T3.1 diff-support.js shouldAttemptDiff() — opt-in client gate (experimental.bundleDiff). 6 node assertions.

⚠️ Scaffold — NOT wired, needs device CI (T3.2 / T3.3)

  • android/.../CodePushDiffPatcher.java (jbsdiff) and ios/CodePush/CodePushDiffPatcher.{h,m} (bspatch wrapper).
  • These are additive and not integrated into the working download path — the classic full-download flow is untouched and safe.
  • They cannot be compiled/device-tested in the authoring environment (no NDK/Xcode/devices). Integration + device verification steps are in FEAT-2-NATIVE-INTEGRATION.md.

Tracked debt

  • The SDK-C1 patch is a stopgap; a scoped in-repo acquisition rewrite is tracked as PENDING (forwards all fields by construction, removes the dependency patch). Consumers (RenterApp) must carry an equivalent patch until then.

Reviewer note

Do not add "bundle-diff" to CLIENT_CAPABILITIES until the native applier is integrated and verified on both platforms — until then the server never offers diffs and everything stays classic.

🤖 Generated with Claude Code

prasad-rently and others added 3 commits June 10, 2026 22:58
Appends `client_capabilities` to update_check requests via our own
request-fetch-adapter.js (no change to the upstream code-push acquisition SDK).
Capability list is EMPTY by default → classic behavior unchanged until a
feature's client side ships. Pure logic, 6 node assertions green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Upstream code-push@4.2.2 queryUpdateWithCurrentPackage drops unknown response
fields. patch-package patch forwards is_diff/diff_url/source_hash (FEAT-2) and
asset_manifest_url (FEAT-1) into remotePackage so they reach CodePush.js + native.
Classic responses unaffected (fields are undefined when not sent).

Interim stopgap — scoped acquisition rewrite tracked as PENDING (ROADMAP §1b).
Patch validated: applies clean + node --check OK.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…s (scaffold)

- T3.1 diff-support.js shouldAttemptDiff() opt-in gate (6 assertions green).
  Diff fields already flow to native via package-mixins + SDK-C1 patch.
- T3.2/T3.3 CodePushDiffPatcher (Android jbsdiff / iOS bspatch wrapper) — ADDITIVE,
  NOT wired into the working download path; classic flow untouched.
  ⚠️ Native is UNVERIFIED (no NDK/Xcode/device here) — see
  FEAT-2-NATIVE-INTEGRATION.md for the integration + device verification steps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@prasad-rently prasad-rently added enhancement New feature or request feat-2 FEAT-2: differential JS bundle updates needs-device-ci Requires native build + on-device verification labels Jun 10, 2026
The scaffolds referenced an unadded gradle dep (jbsdiff) and an unvendored C
symbol (codepush_bspatch) — those would break the Android/iOS builds since the
source globs compile them. Convert to compile-clean placeholders: applyPatch
throws (Android) / returns nil (iOS) so callers fall back to a full download;
real impl + wiring documented inline and in FEAT-2-NATIVE-INTEGRATION.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@prasad-rently

Copy link
Copy Markdown
Owner Author

FEAT-2 pending follow-ups (tracked)

Critical path to diffs working on a device:

Server-side (paired PR rently-com/react-native-ota-updater#29): issues microsoft#30 (Redis lock), microsoft#31 (Postgres/R2 CI).

prasad-rently and others added 4 commits June 11, 2026 11:55
Single common document describing the full FEAT-2 flow across server + client
as one story. Identical copy in both repos.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…d path

When update_check offers a diff (diffUrl/sourceHash/bundleHash), downloadPackage
now tries to reconstruct the new bundle by applying a bsdiff patch to the current
bundle, instead of a full download:
- verify current bundle hash == sourceHash, download patch, apply (jbsdiff),
- copy current package (assets) into the new folder + replace the bundle,
- verify reconstructed hash == bundleHash, write metadata.
ANY failure ⇒ falls through to the normal full HTTP download (classic path intact).

CodePushDiffPatcher: real jbsdiff apply + sha256 (replaces placeholder).
+ io.sigpipe:jbsdiff dependency.

NOTE: device-validation pending (cannot build Android into an app here). Built on
the apply core already validated on iOS simulator + jbsdiff format-verified.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mirrors the Android hook. When update_check offers a diff, CodePushPackage
downloadPackage tries to reconstruct the new bundle via bspatch instead of a full
download: verify current bundle == sourceHash, download patch, copy current
package (assets) + replace bundle via vendored ota_bspatch, verify == bundleHash,
write metadata. ANY failure ⇒ falls through to the normal download (classic intact).

- Vendored public-domain bspatch core (bsdiff/ota_bspatch.c) — recompiled +
  re-validated (exact target hash).
- CodePushDiffPatcher: real applyPatch + sha256 (CommonCrypto).
- Podspec: include subdir + .c; link libbz2.

NOTE: device-validation pending (cannot build iOS into an app here). Core proven
on iOS simulator earlier.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feat-2 FEAT-2: differential JS bundle updates needs-device-ci Requires native build + on-device verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant