Skip to content

feat: report CodePush download size by version - #216

Merged
floyd-soomgo merged 3 commits into
masterfrom
feat/download-size-telemetry
Oct 22, 2026
Merged

floyd-soomgo merged 3 commits into
masterfrom
feat/download-size-telemetry

Conversation

@floydkim

@floydkim floydkim commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Purpose

Allow apps to record CodePush download file sizes by version without tracking download progress themselves.

onDownloadSuccess(targetVersion, { baseVersion, downloadBytes }) now provides the version running before the update and the size of the final downloaded file used for the update. When running the embedded bundle, the base version is the native app version.

  • A successful patch reports the patch file size. A fallback to a full download reports only the final full file size, excluding earlier failed attempts.
  • Measurement works without a progress callback. Existing callbacks that accept only the target version remain compatible.
  • Download size reporting requires rebuilding the native app. Older native code returns null for downloadBytes.
  • Apps that call remotePackage.download() directly can read the same size from localPackage.downloadBytes. It is not saved with the update, so getCurrentPackage() and getUpdateMetadata() do not return it.

Validation

  • Passed 83 JavaScript tests and source type checking against the latest master at the time of the update.
  • Passed Android native tests against that master, including comparisons with actual file sizes for full downloads, patches, fallbacks, and responses without Content-Length. These cover the sizes the update manager reports, not the native module's callback wiring, because the module cannot be constructed in JVM tests. The iOS tests cover that wiring by calling the module entry point.
  • Passed 67 iOS native tests before moving the changes onto the latest master, including comparisons between native method return values and actual file sizes.
  • Confirmed that deliberately incorrect measurements cause the five new Android tests and three new iOS tests to fail.
  • App E2E tests and actual telemetry delivery were not exercised.

The implementation and JavaScript tests, native test coverage, and documentation are split into separate commits.

@floyd-soomgo
floyd-soomgo marked this pull request as ready for review October 21, 2026 10:00
@floyd-soomgo
floyd-soomgo force-pushed the feat/download-size-telemetry branch from d11c06b to 4cb5e6d Compare October 22, 2026 08:23
The embedded bundle has no OTA label, so baseVersion falls back to the
native app version. Native code built before this change returns no
size, so downloadBytes is null rather than 0 to keep it distinguishable
from a measured value.
The Android tests cover what the update manager reports, not the native
module's callback wiring: the module cannot be constructed without a
React context and native maps. The iOS tests call the module entry point
directly.
@floyd-soomgo
floyd-soomgo force-pushed the feat/download-size-telemetry branch from 4cb5e6d to f82cb36 Compare October 22, 2026 08:46
@floyd-soomgo
floyd-soomgo force-pushed the feat/download-size-telemetry branch from f82cb36 to b9a3f06 Compare October 22, 2026 08:53
@floyd-soomgo
floyd-soomgo merged commit 83594f9 into master Oct 22, 2026
1 check passed
@floyd-soomgo
floyd-soomgo deleted the feat/download-size-telemetry branch October 22, 2026 08:58
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.

2 participants