Skip to content

fix(messaging): serialize array data values as JSON - #9253

Merged
mikehardy merged 1 commit into
invertase:mainfrom
OskarEichler:codex/messaging-data-array-serialization
Sep 1, 2026
Merged

fix(messaging): serialize array data values as JSON#9253
mikehardy merged 1 commit into
invertase:mainfrom
OskarEichler:codex/messaging-data-array-serialization

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

What changed

  • Serialize array-valued outgoing RemoteMessage.data entries with JSON, consistently with other object values.
  • Add a focused regression test with nested objects.

Observable behavior correction

  • Arrays now retain their JSON structure. For example, [{ id: 1 }] becomes [{"id":1}] instead of [object Object].
  • This changes only the malformed wire value produced for array data. String, primitive, plain-object, and null serialization retain their existing behavior; there is no public API or type change.

Why

The public RemoteMessage.data value type accepts objects, and the serializer already JSON-encodes objects. Its explicit array exclusion routed arrays through JavaScript string coercion instead, losing quoting and nested object data before Android's native RemoteMessage.Builder received it.

Verification

  • Exact baseline regression: expected [{"id":1},{"id":2}], received [object Object],[object Object].
  • Focused Messaging Jest: 33 passing.
  • Full Jest: 103 suites, 1,480 tests, 31 snapshots.
  • Android App + Messaging E2E: 86 passing, 6 pending.
  • Android unit and post-E2E coverage processing pass.
  • lerna:prepare, JS lint, dependency-cruiser, both TypeScript compiles, API-reference generation, type-parity comparison, and git diff --check pass.

@mikehardy mikehardy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @OskarEichler 👋

Thanks for the PR - this looks like a real problem to me. I ran local Jest/unit plus the android/ios/macos e2e suite against it here and it came out clean. Pending CI, then I'll merge.

Cheers

@mikehardy mikehardy added the Workflow: Pending Merge Waiting on CI or similar label Aug 31, 2026
@mikehardy
mikehardy force-pushed the codex/messaging-data-array-serialization branch from a491eda to 3dcd282 Compare September 1, 2026 11:27
@mikehardy
mikehardy merged commit 9f27842 into invertase:main Sep 1, 2026
18 of 21 checks passed
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.20%. Comparing base (0470b71) to head (3dcd282).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@              Coverage Diff              @@
##               main    #9253       +/-   ##
=============================================
+ Coverage     47.23%   68.20%   +20.98%     
- Complexity        0     2096     +2096     
=============================================
  Files           248      441      +193     
  Lines         11603    25163    +13560     
  Branches       2494     4256     +1762     
=============================================
+ Hits           5479    17161    +11682     
- Misses         5303     6612     +1309     
- Partials        821     1390      +569     
Flag Coverage Δ
android-native 65.06% <ø> (?)
e2e-ts-android 54.09% <100.00%> (?)
e2e-ts-macos 49.88% <0.00%> (?)
jest 47.34% <0.00%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Workflow: Pending Merge Waiting on CI or similar

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants