feat(W-23159740): per-user persistent feature flags (iOS)#4086
Open
wmathurin wants to merge 8 commits into
Open
feat(W-23159740): per-user persistent feature flags (iOS)#4086wmathurin wants to merge 8 commits into
wmathurin wants to merge 8 commits into
Conversation
Implements per-user feature flag storage and hydration so each user account's active features are accurately reflected in the User-Agent string across app restarts. - SFSDKAppFeatureMarkers: +registerAppFeature:forUser:, +unregisterAppFeature:forUser:, +appFeaturesForUser: (union of global + per-user), +loadPersistedFeatures:forUser: - SFUserAccount: persistedFeatureFlags property (NSSet<NSString*>), serialized via NSKeyedArchiver into UserAccount.plist - SalesforceSDKManager: userAgentString:qualifier:forUser: unions global + per-user flags; hydratePerUserFeatureFlags called from sharedManager dispatch_once - SFUserAccountManager: finalizeAuthCompletion promotes BW/WD/QR transient global flags to per-user after login completes - SFSmartStore: SU flag now registered per-user - SFMobileSyncSyncManager: MS flag now registered per-user - SFSDKAppFeatureMarkersTests: 6 new tests covering isolation, union, nil-user fallback, per-user unregister, hydration, and persistence
Clang Static Analysis Issues
Generated by 🚫 Danger |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #4086 +/- ##
==========================================
- Coverage 70.69% 65.70% -5.00%
==========================================
Files 246 246
Lines 21501 21580 +79
==========================================
- Hits 15201 14179 -1022
- Misses 6300 7401 +1101
🚀 New features to boost your workflow:
|
|
||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
|
||||||||||||||||||
|
||||||||||||||||||||||||||
bbirman
reviewed
Jun 25, 2026
bbirman
reviewed
Jun 25, 2026
- Replace custom SFSDKUserKey() with SFKeyForUserAndScope(user, SFUserAccountScopeUser) to reuse the existing codebase convention for user-scoped keys - Capture per-user flag snapshot inside dispatch_sync block before assigning to user.persistedFeatureFlags, eliminating the map read outside the queue's protection
|
||||||||||||||||||
bbirman
approved these changes
Jun 25, 2026
…tion to UI tests - UserCredentialsView: add "SDK" section with User Agent row and JSON export - AuthFlowTesterMainPageObject: add getUserAgent() via JSON export - BaseAuthFlowTester: add validateUserAgent(), loginOtherUser(), isMultiUser param - MultiUserLoginTests: add testAdvancedAuthUser_HasBWFlag_RegularAuthUser_DoesNot - SFUserAccountManager: fix BW/WD global flag bleed by clearing global flags after promoting to per-user in finalizeAuthCompletion (matches existing QR pattern)
|
||||||||||||||
…Agent into public/private overloads validateUserAgent(loginHost:...) now fetches the UA once and delegates to a private overload that takes ua: String. validate() calls the private overload using credentials already loaded, eliminating a second export-button round-trip.
…ode paths - SFSDKAppFeatureMarkersTests: appFeaturesForUser:nil equivalence, unregister updates persistedFeatureFlags - SFUserAccountManagerTests: persistedFeatureFlags NSKeyedArchiver encode/decode roundtrip - SalesforceSDKManagerTests: userAgentString:forUser: with per-user flag, nil-user fallback, hydratePerUserFeatureFlags - Expose hydratePerUserFeatureFlags in SalesforceSDKManager+Internal.h for testability
…e-deriving from credentials.domain By auth completion, handleCustomDomainUpdateWithLoginHint:myDomain: has replaced credentials.domain with the resolved org domain, which no longer contains '/discovery'. Re-evaluating isDiscoveryDomain at that point always returns false, so the WD flag was never promoted to per-user. Use the transient global flag (already set by SFOAuthCoordinator at auth start) as the source of truth, matching the QR flag pattern.
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.
Summary
SFUserAccountviapersistedFeatureFlags(NSSet, serialized with NSKeyedArchiver into UserAccount.plist)SFSDKAppFeatureMarkersgains per-user register/unregister/query methods;+appFeaturesForUser:returns global ∪ per-user union;+loadPersistedFeatures:forUser:hydrates in-memory state without writebackSalesforceSDKManager.userAgentString:qualifier:forUser:resolves per-user flags for UA construction;hydratePerUserFeatureFlagspopulates in-memory state at SDK initSFUserAccountManager.finalizeAuthCompletion:promotes BW/WD/QR transient global flags to per-user after authentication completesSFSDKAppFeatureMarkersTestsGUS Stories
Test plan
SFSDKAppFeatureMarkersTests— 9 tests, 0 failuresSalesforceSDKManagerTests— all existing tests passxcodebuild build -scheme SalesforceSDKCore -sdk iphonesimulator