Skip to content

bug: scope configuration file per sdk key (#84) - #85

Draft
leoromanovsky wants to merge 1 commit into
mainfrom
lr/configuration-cache-env-fix
Draft

bug: scope configuration file per sdk key (#84)#85
leoromanovsky wants to merge 1 commit into
mainfrom
lr/configuration-cache-env-fix

Conversation

@leoromanovsky

Copy link
Copy Markdown
Member

🎟️ Fixes issue
📜 Design Doc: link if applicable

Motivation and Context

Fixes #83 - Configuration cache not respecting environment boundaries when switching SDK keys.

Customer Issue:

When customers switch between environments (production, staging, development) by initializing the SDK with different SDK keys, the ConfigurationStore was sharing a single cache file across all environments. This caused configuration from one environment to persist and be loaded in another environment, leading to incorrect feature flag behavior.

Description

ConfigurationStore.swift:

  • Modified constructor to accept optional sdkKey parameter
  • Updated findCacheFileURL() to generate SDK-key-specific cache filenames
  • Uses deterministic hash of SDK key: eppo-configuration-{abs(sdkKeyHash)}.json
  • Maintains backward compatibility when sdkKey is nil (uses original filename)
  • Updated clearPersistentCache() to accept optional SDK key parameter

EppoClient.swift:

  • Updated ConfigurationStore initialization to pass SDK key
  • Enhanced offline initialization to handle SDK key changes properly
  • Ensures each SDK key gets its own configuration cache instance

How has this been documented?

How has this been tested?

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.

Bug: The Eppo Assignment cache should not be hitting across environments.

1 participant