Repository navigation
feat: improve developer ergonomics - #23
Merged
Merged
Conversation
- Add public ReflagEvaluationErrorCodes constants and use them internally. - Ship XML documentation and document the main client and option members. - Accept anonymous-object contexts in GetFlag, GetFlag<T>, GetFlags and GetFlagsForBootstrap, matching BindClient. - Default the logger to the host ILoggerFactory when registered with AddReflag. - Rate-limit the not-initialized error and say how to fix it. - Log evaluation diagnostics with the flag key and readable messages. - Explain how to provide a missing or invalid secret key. - Shorten the testing docs, note failed evaluations, and say remote config is not supported.
Port the regression test from #18. Current main already keeps a pre-initialization check from suppressing the matching check after initialization, because the dedupe key includes evalErrors and flagStateVersion.
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
Developer-ergonomics fixes from an SDK review, covering discoverability, logging, error messages, and docs.
ReflagEvaluationErrorCodesconstants (MISSING_CONTEXT_FIELD,UNSUPPORTED_ARRAY_OPERATOR,INVALID_COMPARISON,INVALID_FLAG_DEFINITION,CLIENT_NOT_INITIALIZED) so callers don't copy magic strings. The evaluator now uses them.CS1591suppressed for members that are still undocumented) and documentReflagClient,ReflagBoundClient, and everyReflagClientOptionsproperty.GetFlag,GetFlag<T>,GetFlags, andGetFlagsForBootstrapaccept anonymous-object/dictionary contexts, matchingBindClient. The basic README example now passes one directly.AddReflag(...)defaultsLoggerto the hostILoggerFactory(categoryReflag), so DI users no longer wire it by hand.InitializeAsync().{FlagKey}and the joined error messages instead of a dictionary that most sinks render as its type name. Messages still omit context values.SecretKey,REFLAG_SECRET_KEY, andOffline = true. A short key says it is invalid rather than "invalid options.SecretKey specified".AddReflagsnippet andLoggeroption docs, and drop the "currently"/"at the moment" wording.Compatibility
ArgumentExceptioninstead ofArgumentNullException. Callers catchingArgumentExceptionare unaffected.objectoverloads, passing a literalnullcontext to the flag read methods is a compile-time ambiguity. Previously it threw at runtime.flag "<key>": targeting rules could not be fully evaluated: ...).Validation
AddReflaglogger default, the rate-limited initialization error, loose-context overloads, the missing-key message, and check telemetry across initialization (from fix: preserve check telemetry across initialization #18).dotnet build -warnaserror(Release) anddotnet format --verify-no-changespass.dotnet packincludesReflag.xmlfornet10.0andnetstandard2.0.Supersedes #18. Its fix (adding initialization state to the check-event dedupe key) is already covered on current
main, because the dedupe key includesevalErrorsandflagStateVersion. This PR ports its regression test, adapted to protocol v2. Removing both keys makes the test fail.