Skip to content

fix: prevent subscription model encode and notification races#1692

Open
nan-li wants to merge 1 commit into
mainfrom
nan/sdk-4899-subscription-encode-race
Open

fix: prevent subscription model encode and notification races#1692
nan-li wants to merge 1 commit into
mainfrom
nan/sdk-4899-subscription-encode-race

Conversation

@nan-li

@nan-li nan-li commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Lands Domus's #1685 on current main (cherry-picked cleanly; no conflict with SDK-4874 executor changes).
  • Makes OSSubscriptionModel mutations and archival race-safe: lock-protected value-type State, atomic snapshot() for encode, mutationLock so each setter updates state and fires delta/observer notifications in order.
  • Closes production crashes SDK-4899 / #1588; may also address #1587 (verify after ship).

Test plan

  • UserConcurrencyTests on iPhone 17 Pro (Full test plan, -parallel-testing-enabled NO) — 10/10 passed, including:
    • testEncodingSubscriptionModel_withConcurrentMutation_usesConsistentSnapshot
    • testConcurrentSubscriptionChangesNotifyInMutationOrder
  • Confirm Reduced plan still skips UserConcurrencyTests (pre-existing); consider running Full in CI for this PR or a follow-up.
  • After merge, ask Domus to verify SDK-4899 on a patch build.

Credit: @chunhuidu-dev / Domus for the original fix in #1685.

Made with Cursor

@nan-li

nan-li commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Supersedes fork PR #1685 (same commit, rebased onto current main).

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