Skip to content

fix: [SDK-5181] accept a create-subscription success with no subscription object - #1748

Merged
nan-li merged 2 commits into
mainfrom
nan/sdk-5181
Sep 18, 2026
Merged

nan-li merged 2 commits into
mainfrom
nan/sdk-5181

Conversation

@nan-li

@nan-li nan-li commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Description

One Line Summary

Stop logging an error when the server answers a create-subscription request with a success that has no subscription object.

Details

Motivation

The server answers this way when the email or SMS being added already belongs to the user. The SDK logged it as an error on every occurrence even though nothing went wrong.

Scope

  • A success response without a subscription object is logged at INFO and the request is finished, not retried. The local model is left unchanged.
  • The ryw_token and ryw_delay fields are read from the top level of the response, where the server puts them, instead of from inside the subscription object where they never were.
  • Nothing sent to the server changes.

Testing

Unit testing

Two tests in SubscriptionCreateResponseTests: a success without a subscription object completes once without changing the model, and a success with one sets the subscription id and records the token and delay.

Manual testing

Both tests plus SubscriptionUpdateRaceTests run locally on an iPhone 17 Pro simulator.

Ran on device and added an existing email and got a 200 response and the SDK logged "INFO: Create Email subscription response has no subscription object to hydrate"

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

🤖 Generated with Claude Code

…tion object

- Hydrate the model only when the response carries a subscription object. A 2xx without one is the server's no-op for a subscription that already exists on this user, so it is logged at INFO instead of ERROR
- Read ryw_token and ryw_delay from the top level of the response, where the server sends them, instead of from inside the subscription object
- Add SubscriptionCreateResponseTests covering both cases
@nan-li
nan-li requested a review from a team September 18, 2026 16:00

@abdulraqeeb33 abdulraqeeb33 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approve with nits.

  1. The no-subscription test still passes if the executor hunk is reverted. Assert RYW record/resolve so revert goes red.
  2. INFO is right for a missing subscription key. Same line also fires when the value is present but not a dict, and default remote logging will not export INFO.

…reverted

- Register a never-met waiter on the IAM fetch condition in the no-op test and assert the executor's resolve releases it, which the old early return never did
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