Skip to content

Handle undefined optional protocol fields - #838

Merged
tiagocandido merged 1 commit into
mainfrom
uc-protocol-optional-fields
Sep 29, 2026
Merged

tiagocandido merged 1 commit into
mainfrom
uc-protocol-optional-fields

Conversation

@tiagocandido

@tiagocandido tiagocandido commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What changes are you making?

Treat optional undefined protocol fields as absent, matching JSON semantics when browser postMessage uses structured clone. Previously a checkout containing order: undefined could lose its entire start/update event. Required undefined fields, nulls where disallowed by the schema, and malformed nested objects remain invalid; the decoder preserves legacy fulfillment normalization.

Include the failing field path in safe decode diagnostics, keep the published TypeScript declarations aligned, and cover the shared codec through Web and React Native consumers.

How to test

From the repository root, with dependencies installed:

pnpm --dir protocol test
pnpm --dir protocol lint
pnpm --dir platforms/web lint
pnpm --dir platforms/web test
pnpm --dir platforms/web build
pnpm --dir platforms/web verify
pnpm --dir platforms/web sample:build

The full stack passes 88 protocol tests, 440 Web tests, Web lint/typechecks, package verification and sample build. The React Native protocol suite also passes all 19 tests. The structured-clone regression asserts that optional keys disappear from the delivered snapshot while invalid present orders are rejected.

@github-actions github-actions Bot added the #gsd:50662 Rebase Checkout Kit on UCP label Sep 28, 2026
@tiagocandido
tiagocandido added this pull request to stack #845 September 28, 2026 15:20
@tiagocandido
tiagocandido marked this pull request as ready for review September 28, 2026 15:23
@tiagocandido
tiagocandido requested a review from a team as a code owner September 28, 2026 15:23
@github-actions

Copy link
Copy Markdown

Protocol — Coverage Report

Lines Statements Branches Functions
Coverage: 94%
93.49% (158/169) 89.16% (107/120) 90.9% (30/33)

@github-actions

Copy link
Copy Markdown

Web — Coverage Report

Lines Statements Branches Functions
Coverage: 96%
95.17% (375/394) 84.32% (199/236) 97.08% (100/103)

@github-actions

Copy link
Copy Markdown

React Native — Coverage Report

Lines Statements Branches Functions
Coverage: 91%
90.97% (363/399) 87.29% (213/244) 100% (92/92)

@github-actions

Copy link
Copy Markdown

Package Size

Platform Artifact Base Head Delta
Web npm tarball 90.0 KiB 90.9 KiB +902 B
React Native npm tarball 119.0 KiB 119.6 KiB +584 B
Web file breakdown
File Base Head Delta
dist/index.js.map 247.2 KiB 249.3 KiB +2.2 KiB
dist/custom-elements.json 48.0 KiB 48.0 KiB 0 B
dist/index.d.ts 47.7 KiB 47.7 KiB 0 B
dist/index.js 41.2 KiB 41.8 KiB +559 B
README.md 20.1 KiB 20.1 KiB 0 B
package.json 2.9 KiB 2.9 KiB 0 B
LICENSE 1.1 KiB 1.1 KiB 0 B
React Native file breakdown
File Base Head Delta
node_modules/@shopify/checkout-kit-protocol/src/generated/Models.ts 108.7 KiB 108.7 KiB 0 B
node_modules/@shopify/checkout-kit-protocol/src/generated/Models.d.ts 73.1 KiB 73.1 KiB 0 B
android/src/main/java/com/shopify/reactnative/checkoutkit/ShopifyCheckoutKitModule.java 16.2 KiB 16.2 KiB 0 B
ios/ShopifyCheckoutKit.swift 16.1 KiB 16.1 KiB 0 B
ios/AcceleratedCheckoutButtons.swift 14.1 KiB 14.1 KiB 0 B
src/components/AcceleratedCheckoutButtons.tsx 13.0 KiB 13.0 KiB 0 B
src/index.ts 12.7 KiB 12.7 KiB 0 B
lib/commonjs/index.js 12.4 KiB 12.4 KiB 0 B
lib/commonjs/components/AcceleratedCheckoutButtons.js 11.4 KiB 11.4 KiB 0 B
src/index.d.ts 11.3 KiB 11.3 KiB 0 B
lib/commonjs/components/AcceleratedCheckoutButtons.js.map 10.4 KiB 10.4 KiB 0 B
lib/module/index.js 10.4 KiB 10.4 KiB 0 B
lib/module/components/AcceleratedCheckoutButtons.js 10.2 KiB 10.2 KiB 0 B
node_modules/@shopify/checkout-kit-protocol/src/generated/ProtocolNotifications.ts 9.5 KiB 9.5 KiB 0 B
lib/module/components/AcceleratedCheckoutButtons.js.map 9.1 KiB 9.1 KiB 0 B
lib/module/index.js.map 8.1 KiB 8.1 KiB 0 B
src/present-dispatcher.ts 8.0 KiB 8.0 KiB 0 B
lib/commonjs/index.js.map 7.9 KiB 7.9 KiB 0 B
node_modules/@shopify/checkout-kit-protocol/src/generated/ProtocolRenameMap.ts 7.8 KiB 7.8 KiB 0 B
node_modules/@shopify/checkout-kit-protocol/src/generated/ProtocolNotifications.d.ts 7.6 KiB 7.6 KiB 0 B
…and 117 smaller files

Measured from the PR base SHA and PR head SHA. The file breakdown shows uncompressed sizes within each package artifact, so individual files do not sum to the compressed artifact total. This comment reports package artifact sizes only; it is not a final app binary-size report.

@bitrise

bitrise Bot commented Sep 28, 2026

Copy link
Copy Markdown

Install this build

Open Tophat, select your target device, then click Install. Links open on the Mac running Tophat.

SDK Install
React Native Install with Tophat

Checkout Kit E2E results

Status Tags Target Platform OS version tag Device
✅ launch, checkout-presentation, checkout-completion, buyer-identity react-native ios latest iPhone 15
iOS 27 Beta
✅ launch, checkout-presentation, checkout-completion, buyer-identity react-native android latest Google Pixel 9
Android 17.0

@tiagocandido
tiagocandido merged commit 53f1891 into main Sep 29, 2026
53 checks passed
@tiagocandido
tiagocandido deleted the uc-protocol-optional-fields branch September 29, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

#gsd:50662 Rebase Checkout Kit on UCP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants