Skip to content

bug: when switching sdk keys; do not use the assignment cache (#83) - #84

Draft
leoromanovsky wants to merge 2 commits into
mainfrom
lr/assignment-cache-env
Draft

bug: when switching sdk keys; do not use the assignment cache (#83)#84
leoromanovsky wants to merge 2 commits into
mainfrom
lr/assignment-cache-env

Conversation

@leoromanovsky

@leoromanovsky leoromanovsky commented Nov 20, 2025

Copy link
Copy Markdown
Member

🎟️ Fixes issue
📜 Design Doc: link if applicable

#83

Motivation and Context

Description

How has this been documented?

How has this been tested?

@typotter typotter left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looks good to my non-swift-trained eyes

} else {
// Different SDK key, reset the shared instance to create a new one
// This ensures the assignment cache is cleared when switching environments
sharedInstance = nil

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What happens to existing instances? Do they lose any ability to properly function? Would keying the assignment cache on the sdk token be a viable solution here (if more work)?

// This should pass - no additional logging since we're using the same SDK key
XCTAssertEqual(loggerSpy.logCount, 1, "Same assignment with same SDK key should not be logged again due to cache (consistent offline/online behavior)")
}
} No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

newline nit

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.

2 participants