fix(google): fall back to token for blank horizon order ids - #278
Conversation
The Horizon billing-compatibility Purchase.orderId is a non-null String and arrives blank on device, so the converter's null-only `orderId ?: token` fallback never fired and produced purchases with an empty id and transactionId. The strict cross-SDK purchase decoders introduced in #276 correctly reject an empty id, which failed the whole available-purchases batch on a Quest 3 with two real store purchases: getAvailablePurchases result: purchaseCount=2 NitroPurchase has invalid required field: id PurchaseError: billing-response-json-parse-error Blank-aware fallbacks now cover toPurchase (id, transactionId) and toActiveSubscription (transactionId), pinned by regression tests that build the Meta Purchase with a blank and a present orderId, and the payload-parity audit's pinned source expression for the Horizon transactionId is updated to the new canonical form. Verified on the same Quest 3: the batch decodes as 4 available purchases and 2 active subscriptions with no decode errors. Also enable the commented-out HORIZON_APP_ID meta-data in the React Native example manifest. Without it the Horizon platform SDK cannot initialize, so initConnection failed before any store call and the example was not runnable on the device at all. The meta-data is inert on Play and FireOS builds. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe example app enables Horizon application metadata. Horizon purchase and active subscription conversion now use the purchase token when ChangesHorizon purchase identity handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. 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. Comment |
Found by running the Horizon device row that #276 reported as blocked — and it
is exactly the class of bug #276's strict decoders exist to catch.
The bug
The Horizon billing-compatibility
Purchase.orderIdis a non-null String(confirmed from the class file) and arrives blank on device, so the
converter's null-only
orderId ?: tokenfallback never fired. Every Horizonpurchase reached the SDKs with an empty
id/transactionId, and the strictpurchase decoders correctly rejected the whole batch:
Under the pre-#276 lossy decoders this would have silently dropped or shipped
malformed purchases; now it failed loudly and pointed at the defective bridge.
The fix
Blank-aware fallbacks in the Horizon converters —
toPurchase(id,transactionId) andtoActiveSubscription(transactionId) — pinned byregression tests that build the Meta
Purchasewith a blank and a presentorderId. The payload-parity audit's pinned source expression for the HorizontransactionIdis updated to the new canonical form (it rejected the firstdraft of this change, which is that audit working as intended).
Also enables the commented-out
HORIZON_APP_IDmeta-data in the React Nativeexample manifest: without it the Horizon platform SDK cannot initialize, so
initConnectionfailed before any store call and the example was not runnableon the device at all. The meta-data is inert on Play and FireOS builds.
Device verification (Quest 3, real Horizon store data)
initConnectiontruegetAvailablePurchasesgetActiveSubscriptionsWith this, every store in the matrix has now decoded real payloads through the
strict pipeline on hardware: Play, App Store, Amazon, Vega runtime, and
Horizon.
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests