Make CheckoutKit configuration configure-only#85
Open
kieran-osgood-shopify wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced May 13, 2026
f957cbd to
82606f0
Compare
0453ef5 to
3aaa3db
Compare
82606f0 to
cd2ef3a
Compare
0955280 to
c7e8091
Compare
cd2ef3a to
e5d6371
Compare
945d4b6 to
fe87622
Compare
1d19f91 to
87179cb
Compare
fe87622 to
2fccbc2
Compare
2fccbc2 to
63e7604
Compare
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
Swift 6 is stricter about global/shared mutable state. In Swift 6 language mode, a mutable global like this becomes a concurrency-safety problem:
The compiler treats this as non-isolated shared mutable state: any caller in the process can read or write it, and Swift has no guarantee that those accesses are serialized.
The kind of error we are working toward eliminating is:
This matters for ShopifyCheckoutKit.configuration because it is public process-wide configuration, and it currently also drives side effects like updating OSLogger.shared.logLevel.
Options considered
I considered both making configuration
@MainActoror wrapping the configuration inside anactorBoth of these result in suboptimal results,
actorwould make all reads async/await,@MainActorwould result in all reads needing to be MainActor isolated event for background tasks.This is not ideal for our library code, because reading log levels or constructing user agents, which should be sync and should not cross to the main actor, all then rely on tasks and async/await, it would complicate library code significantly with workarounds for sync to async
What
The "synchronous synchronization" option is an NSLock or Semaphore
Its a bit manual and can result in deadlocks, but essentially we wrap up reading/writing to this value behind an explicit lock.
For this binary single access mutual exclusion
NSLock/DispatchSemaphoreperform the same, butNSLockships with a helperwithLockto guarantee release around a closure (easy enough to add to semaphore, but no actual benefit).Before you merge
Important
platforms/swift/README.mdand/orplatforms/android/README.md)Releasing a new Swift version?
platforms/swift/ShopifyCheckoutKit.podspecplatforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swiftplatforms/swift/CHANGELOG.mdplatforms/swift/README.md(major version only)Releasing a new Android version?
versionNameinplatforms/android/lib/build.gradleplatforms/android/CHANGELOG.mdplatforms/android/README.mdTip
See the Contributing documentation for the full release process per platform.