Skip to content

Conversation

@rachelmcr
Copy link
Contributor

@rachelmcr rachelmcr commented May 30, 2023

Closes: #9836, #7842

Description

This PR increases the app's resilience when Order fields have unexpected types:

  • When a Order shipping line's tax ID is a String instead of an Int.
  • When Order line item's SKU is a number (Int or Decimal) instead of a String.

It uses failsafe decoding to handle those alternative types, and adds a unit test for parsing alternative types in an Order. (These are known decoding errors that users have experienced.)

Testing instructions

We don't know the exact plugins that can cause this behavior, but you can test using a tool like Charles Proxy or Proxyman to intercept and modify the response:

  1. Set a breakpoint in your tool of choice for requests to the /wc/v3/orders endpoint.
  2. Build and run the app.
  3. Open the Orders tab.
  4. Modify the response so a shipping line tax ID is a string (e.g. "shipping_lines": [{ [...], "taxes": [{ "id": "1"}] }] or see the order-alternative-types.json mock for an example).
  5. Modify the response so a line item SKU is a number (e.g. "line_items": [{ [...] "sku": 123 }]).
  6. Execute the response and confirm the app loads the order list.

Screenshots

Before After
Simulator Screen Shot - iPhone 14 Pro - 2023-05-30 at 12 25 23 Simulator Screen Shot - iPhone 14 Pro - 2023-05-30 at 12 27 53

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@rachelmcr rachelmcr added feature: order list Related to the order list. category: reliability Related to app’s reliability, accuracy, and perceived waiting time labels May 30, 2023
@rachelmcr rachelmcr added this to the 13.9 milestone May 30, 2023
@rachelmcr rachelmcr requested review from Ecarrion and ThomazFB May 30, 2023 11:36
@rachelmcr rachelmcr marked this pull request as ready for review May 30, 2023 11:36
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented May 30, 2023

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr9844-4c849a5 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@rachelmcr rachelmcr force-pushed the issue/9836-order-decoding-fallbacks branch from e89b580 to 9c239b0 Compare May 30, 2023 13:26
@Ecarrion Ecarrion self-assigned this May 31, 2023
@rachelmcr rachelmcr enabled auto-merge May 31, 2023 14:20
@rachelmcr rachelmcr merged commit aadb52f into trunk May 31, 2023
@rachelmcr rachelmcr deleted the issue/9836-order-decoding-fallbacks branch May 31, 2023 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: reliability Related to app’s reliability, accuracy, and perceived waiting time feature: order list Related to the order list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Reliability] Add fallbacks for known Order decoding errors

4 participants