Skip to content

Config service improvements #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Conversation

z4kn4fein
Copy link
Member

@z4kn4fein z4kn4fein commented Jun 3, 2025

Describe the purpose of your pull request

This PR contains the following:

  • When an external cache is configured, the SDK continues to sync with it in offline mode.
  • Introduce new error codes for better error handling on EvaluationDetails and RefreshResults.

Minor breaking changes

Some components (usually not directly referenced by type) were renamed:

  • ConfigCatSnapshot -> ConfigCatClientSnapshot
  • ClientReadyState -> ClientCacheState

Related issues (only if applicable)

Requirement checklist (only if applicable)

  • I have covered the applied changes with automated tests.
  • I have executed the full automated test set against my changes.
  • I have validated my changes against all supported platform versions.
  • I have read and accepted the contribution agreement.

@z4kn4fein z4kn4fein requested a review from a team as a code owner June 3, 2025 15:54
Copy link
Contributor

@adams85 adams85 left a comment

Choose a reason for hiding this comment

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

Could you apply all the config fetching/caching/snapshot-related improvements to the intellisense docs from here?

value: defaultValue,
error: message,
user: user))
errorCode: .settingValueTypeMismatch,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should return the error code settingValueTypeMismatch in this case since this is not a type mismatch between the default and evaluated value type. This is a case where user simply called the evaluation function with an invalid parameter.

Other SDKs throw in this case, but from my understanding the Swift SDK doesn't use exceptions. So I think we should use unexpectedError or probably even introduce a new error code invalidUserInput = -2 or something like that.

@@ -200,7 +200,7 @@ public final class ConfigCatClient: NSObject, ConfigCatClientProtocol {
let evalUser = user ?? defaultUser

if let error = flagEvaluator.validateFlagType(of: Value.self, key: key, defaultValue: defaultValue, user: evalUser) {
completion(TypedEvaluationDetails<Value>.fromError(key: key, value: defaultValue, error: error, user: evalUser))
completion(TypedEvaluationDetails<Value>.fromError(key: key, value: defaultValue, error: error, errorCode: .settingValueTypeMismatch, user: evalUser))
Copy link
Contributor

Choose a reason for hiding this comment

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

Same issue.

key: key,
value: defaultValue,
error: error,
errorCode: .settingValueTypeMismatch,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same issue.

@z4kn4fein
Copy link
Member Author

Could you apply all the improvements to the intellisense docs from here?

Yep, I will, and I'll also work on the coverage and duplication situation.

Copy link

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