Skip to content

[FSSDK-13302] fix: forward options in async fetchQualifiedSegments - #667

Merged
Muzahidul Islam (muzahidul-opti) merged 1 commit into
masterfrom
muzahid/fix-async-segment-options
Oct 19, 2026
Merged

Muzahidul Islam (muzahidul-opti) merged 1 commit into
masterfrom
muzahid/fix-async-segment-options

Conversation

@muzahidul-opti

@muzahidul-opti Muzahidul Islam (muzahidul-opti) commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The async overload of fetchQualifiedSegments(options:) dropped options when delegating to the completion-handler form, so .ignoreCache / .resetCache were silently ignored. The sync overload already forwards them.

 public func fetchQualifiedSegments(options: [OptimizelySegmentOption] = []) async throws {
     return try await withCheckedThrowingContinuation { continuation in
-        fetchQualifiedSegments { error in
+        fetchQualifiedSegments(options: options) { error in

Found while verifying the Swift SDK 6.0.0 docs (optimizely/feature-experimentation-docs#33), which now carry a warning about this until the fix ships.

Evidence

New test OptimizelyUserContextTests_ODP_Aync_Await.testFetchQualifiedSegments_optionsForwarded:

await user.fetchQualifiedSegments(options: [.ignoreCache, .resetCache])
assert odpManager.options == [.ignoreCache, .resetCache]
  • Before: XCTAssertEqual failed: ("Optional([..., ...])") is not equal to ("Optional([])") — 6 tests, 1 failure
    After: Executed 6 tests, with 0 failures (OptimizelyTests-APIs-iOS, iPhone 17 Pro simulator)

Merge Danger

Door: two-way — one-line revert.
Blast Radius: Only callers of the async overload that pass non-empty options. They will now get the cache behavior they asked for (e.g. .ignoreCache triggers a network fetch instead of a cache hit). Calls without options are unchanged.

Issues

  • FSSDK-13302

🤖 Generated with Claude Code

The async overload called the completion-handler form without passing
`options`, so .ignoreCache and .resetCache were silently ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 93.929%. remained the same — muzahid/fix-async-segment-options into master

@muzahidul-opti Muzahidul Islam (muzahidul-opti) changed the title [FSSDK-13227] fix: forward options in async fetchQualifiedSegments [FSSDK-13302] fix: forward options in async fetchQualifiedSegments Oct 16, 2026
@muzahidul-opti

Copy link
Copy Markdown
Contributor Author

The ticket reference in the title (FSSDK-13227) pointed at an unrelated, already-closed docs ticket. Created FSSDK-13302 for this bug and updated the PR title accordingly.

@Mat001 Matjaz Pirnovar (Mat001) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes a real bug — the async fetchQualifiedSegments(options:) was dropping options, so .ignoreCache / .resetCache were silently ignored. One-line fix forwards them.
Complete, not partial — I checked every other async overload (decideAsync, decideAllAsync); they all already forward options correctly, so this was the only broken one.
Matches the existing sync overload, removing a genuine asymmetry.
Has a real regression test that drives the actual fixed path and would have failed before the change.
Low risk — tightly scoped, two-way door (one-line revert), no behavior change for callers who pass no options.

@muzahidul-opti
Muzahidul Islam (muzahidul-opti) merged commit b3230ed into master Oct 19, 2026
13 of 16 checks passed
@muzahidul-opti
Muzahidul Islam (muzahidul-opti) deleted the muzahid/fix-async-segment-options branch October 19, 2026 12:38
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.

3 participants