Repository navigation
fix: avoid Foundation's back-deployed Date comparison operators - #575
Merged
Merged
Conversation
The Xcode 27.2 SDKs declare Foundation's `Date <=` and `Date >=` as back-deployed. Early iOS 27.2 beta builds shipped a Foundation that did not export those symbols, so any app built with that SDK crashed on a null call when the SDK compared two Dates while deciding whether to record debug events for a flag evaluation. Compare the dates' time intervals directly instead. This is the same expression Apple's new operator uses, so behavior is unchanged, and the SDK no longer references the back-deployed symbol at all.
There was a problem hiding this comment.
Risk: low.
Automated risk review (dry run): Low
This PR would be automatically approved.
Why: The change is a one-function workaround in FeatureFlag.swift that compares timeIntervalSinceReferenceDate instead of using Foundation’s back-deployed Date <= operator, with existing FeatureFlagSpec coverage and no unresolved Bugbot findings.
If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.
Sent by Cursor Approval Agent: Dry-Run PR Approver
abelonogov-ld
approved these changes
Nov 23, 2026
tanderson-ld
pushed a commit
that referenced
this pull request
Nov 23, 2026
🤖 I have created a release *beep* *boop* --- ## [11.8.1](11.8.0...11.8.1) (2026-11-23) ### Bug Fixes * avoid Foundation's back-deployed Date comparison operators ([#575](#575)) ([1e18137](1e18137)) * Record no variation and a WRONG_TYPE reason in events when a typed evaluation has the wrong type ([#554](#554)) ([d76e12e](d76e12e)) * Start the primary environment first, then secondary environments by name ([#572](#572)) ([30856c4](30856c4)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Release 11.8.1** bumps the SDK version from `11.8.0` to `11.8.1` across packaging and metadata (Release Please manifest, `LaunchDarkly.podspec`, Xcode `MARKETING_VERSION` / dylib versions, `ReportingConsts.sdkVersion`, and README SPM pin). > > The changelog for this patch documents three **bug fixes** shipped in the release: > > **Debug events on newer Apple SDKs:** `FeatureFlag.shouldCreateDebugEvents` no longer compares `Date` values with `<=` / `>=`. It uses `timeIntervalSinceReferenceDate` instead, avoiding crashes when Foundation’s back-deployed Date operators are missing on some iOS 27.2 beta builds. > > **Typed evaluation analytics:** When a flag value cannot be decoded to the requested type, evaluations now emit **`WRONG_TYPE`** with **no variation index** in both the returned detail and recorded flag events (via `withEvaluationResult(variation: nil, …)`). > > **Multi-environment startup order:** `LDClient.start` initializes the **primary** environment first, then **secondary** environments in **stable alphabetical order by name**, so client creation and plugin registration are deterministic across launches. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 4ad6acb. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: LaunchDarklyReleaseBot <[email protected]>
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
Replaces the one
Date <= Datecomparison in the SDK (FeatureFlag.shouldCreateDebugEvents) with a comparison of the two dates'timeIntervalSinceReferenceDatevalues. Behavior is unchanged. The SDK no longer references Foundation's back-deployedDate <=operator, which crashes on some iOS 27.2 beta builds.Reported through customer support: an App Store app built with Xcode 27.2 crashed on 183 devices in two weeks with a jump to address
0x0insidestatic Date.<= infix, called fromFeatureFlag.shouldCreateDebugEventsviaLDClient.stringVariation.Root cause (Apple, not the SDK)
Date <=andDate >=as@backDeployed(before: iOS 27.2). Apple added the operators to fix NaN handling: swift-foundation #2223, back-deployed on the release branch in swift-foundation #2230.This comparison has been in the SDK unchanged since 2022 and is the only
<=or>=between two Dates in the codebase.Why this is equivalent
Apple's new operator is implemented as
lhs.timeIntervalSinceReferenceDate <= rhs.timeIntervalSinceReferenceDate(Date.swift at the shipped commit, line 202), andtimeIntervalSinceReferenceDateis a direct read of the stored Double. The pre-27.2 behavior was the standard library's Comparable default,!(rhs < lhs), over the same Double. The two differ only for NaN, which no date in this SDK can be. This change matches both.Testing
Done:
swift buildpasses.FeatureFlagSpecon an iPhone 16 simulator (iOS 18.6): 17 tests, 0 failures, includingtestShouldCreateDebugEvents.In progress, will be posted here when complete:
v11without this change, then show it passes with this change.nm -mon the built framework: the weak import of$s10Foundation4DateV2leoiySbAC_ACtFZis present before this change and absent after it.Note
Overview
Fixes crashes on some iOS 27.2 beta devices when apps are built with Xcode 27.2:
FeatureFlag.shouldCreateDebugEventsno longer calls Foundation’s back-deployedDate <=operator (which can resolve to a null symbol and jump to0x0on certain 27.2 betas).The method now compares
timeIntervalSinceReferenceDateon the two dates instead, preserving the same debug-event gating logic used fromstringVariation/ event reporting. Inline comments document that this is a platform/SDK linkage workaround, not a behavioral SDK change.Reviewed by Cursor Bugbot for commit 0ce78ac. Bugbot is set up for automated code reviews on this repo. Configure here.