chore: dedupe config/util/serde defaults and rename callKey "mint" to "generate"#185
Merged
Merged
Conversation
… "generate"
A cluster of behavior-preserving cleanups across sdk-core's config, util,
serde, and http/context packages, plus a terminology rename of the call-key
factory from "mint" to "generate" throughout the SDK.
config:
- Hoist the default env/property lookup seams to shared top-level vals so the
Configuration constructor defaults and the ConfigurationBuilder field
initializers reference a single source of truth instead of duplicating the
lambdas.
- Collapse getBoolean onto String.toBooleanStrictOrNull(), matching the
single-expression form of its getInt/getDuration siblings. Identical strict
semantics: only "true"/"false" (case-insensitive) are recognized; anything
else falls through to the default.
util/ProxyOptions:
- Route the system-property branch of fromConfiguration through the existing
buildOptions helper rather than re-implementing the same construct-and-warn
logic the env-var branch already shares.
- Extract the repeated bypass-all ("*") classification in resolveNonProxyHosts
into a local function, expressed once.
serde/Tristate:
- Drop the no-op @JvmName("nullValue") that merely re-asserts the default JVM
name, matching its absent() sibling.
http/context:
- Inline the single-use deriveCallKey helper into its only caller.
- Rename mintCallKey/mintCounter to generateCallKey/generateCounter and replace
"mint" with "generate" across the SDK's KDoc, comments, tests, and docs.
No public-API change; apiCheck snapshot is unaffected.
Closes #179
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
A cluster of small, behavior-preserving cleanups across
sdk-core'sconfig,util,serde, andhttp/contextpackages, plus a terminology rename of the call-key factory from mint to generate throughout the SDK. All changes preserve inputs/outputs and stay within the usualsdk-coreconstraints (Java 8 bytecode, explicit-API strict, ktlint 120-col,allWarningsAsErrors).Cleanups
config/Configuration.kt(+ConfigurationBuilder.kt)internal vals so theConfigurationconstructor defaults and the builder field initializers reference one source of truth instead of duplicating the lambdas. Kept at file scope (not the companion) so they don't depend on companion init order.getBooleanontoString.toBooleanStrictOrNull(), matching the single-expression form of itsgetInt/getDurationsiblings. Identical strict semantics — only"true"/"false"(case-insensitive) are recognized; anything else falls through to the default.util/ProxyOptions.ktfromConfigurationthrough the existing privatebuildOptionshelper rather than re-implementing the same construct-and-warn logic the env-var branch already shares. SameIllegalArgumentExceptionhandling and sameproxy.config.invalidwarning fields."*") classification inresolveNonProxyHostsinto a local function, expressed once. Sysprop-over-env precedence is untouched.serde/Tristate.kt@JvmName("nullValue")that merely re-asserts the default JVM name (the factory is already namednullValue), matching itsabsent()sibling.http/context/DispatchContext.ktderiveCallKeyhelper into its only caller. The counter is still incremented exactly once per key, so the producedtraceId:spanId:nkeys are identical.Terminology rename
Rename
mintCallKey/mintCountertogenerateCallKey/generateCounterand replace "mint" with "generate" across the SDK's KDoc, comments, tests, and docs (http/context,instrumentation, the auth steps,IdempotencyKeyStep,sdk-example, anddocs/). The renamed symbols areinternal/private, so the rename does not touch the public API.API / Build
No public-API change — the
.apisnapshot is unaffected (apiCheckpasses). ThegetBooleanandnullValuesignatures are unchanged.Verification
./gradlew :sdk-core:compileKotlin :sdk-core:compileTestKotlin :sdk-core:ktlintMainSourceSetCheck :sdk-core:ktlintTestSourceSetCheck :sdk-core:apiCheckpass, plus the affectedconfig,ProxyOptions,Tristate,http.context, and bearer-auth test suites.Closes #179