[sub-spm-optional-products] LCFeatureControl review fixes: JWT log leak, platforms, request coalescing #13
Reference in New Issue
Block a user
No description provided.
Delete Branch "feature/spm/lcfeaturecontrol"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up fixes on top of the LCECryptoKit/LCFeatureControl sub-SPM commit, from a code review of
2ba487a.Changes
api.request(...)call sites inFeatureControlManager/FeatureControlNotificationsClientnow passdebug: false. TheAPIdefault isdebug: truewith no#if DEBUGgate, soAuthorization: Bearer <jwt>was printing on every request, including in release builds.Package.swift—LCEssentials.API(used byLCFeatureControl) is iOS/watchOS-only, and the vendoredLCECryptoKit.xcframeworkhas no macOS/tvOS slice.evaluate()calls on a cold cache now share a single in-flight request per cache key instead of firing one per caller.200response carrying{"error": true}is now treated as a failure inevaluate/evaluateOrThrowandlist, instead of being cached/returned as success.list(status:limit:cursor:)now threads a cursor through so the already-decodednextCursorcan actually be used to page.payloaddecoded through a full evaluate response, date-decode failures). 45 → 54 tests inLCFeatureControlTests. Removed the 7 remaining force-unwraps in test scaffolding.Documentation/FeatureControl.md, cross-linked fromREADME.mdandExtensions.md.Test plan
xcodebuild test -scheme LCEssentials-Package -destination 'platform=iOS Simulator,...'— 84/84 passing (30LCEssentialsTests+ 54LCFeatureControlTests), 0 failures.swift build --product LCEssentials— clean.- FeatureControlManager/NotificationsClient: pass debug: false at every api.request(...) call site — the API default (debug: true) was printing Authorization: Bearer <jwt> on every request, release builds included. - Package.swift: drop macOS/tvOS from platforms — LCEssentials.API (used by LCFeatureControl) is iOS/watchOS-only and the vendored xcframework has no macOS/tvOS slice. - FeatureControlManager: coalesce concurrent evaluate() calls on a cold cache into a single in-flight request per key instead of firing one per caller. - FeatureControlManager/NotificationsClient: treat a 200 response carrying {"error": true} as a failure instead of caching/returning it as success. - FeatureControlNotificationsClient: thread a cursor param through list() so the already-decoded nextCursor can actually be used to page. - Tests: 9 new tests (coalescing, envelope-error-on-200, cursor param, a real object payload decoded through a full evaluate response, date-decode failures) and removed the 7 remaining force-unwraps in test scaffolding. - Documentation/FeatureControl.md: new guide for the LCFeatureControl product, cross-linked from README.md and Extensions.md.