Skip to content

chore: dedupe config/util/serde defaults and rename callKey "mint" to "generate"#185

Merged
OmarAlJarrah merged 1 commit into
mainfrom
chore/dedupe-config-util-serde-helpers
Jun 25, 2026
Merged

chore: dedupe config/util/serde defaults and rename callKey "mint" to "generate"#185
OmarAlJarrah merged 1 commit into
mainfrom
chore/dedupe-config-util-serde-helpers

Conversation

@OmarAlJarrah

Copy link
Copy Markdown
Member

Summary

A cluster of small, 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. All changes preserve inputs/outputs and stay within the usual sdk-core constraints (Java 8 bytecode, explicit-API strict, ktlint 120-col, allWarningsAsErrors).

Cleanups

config/Configuration.kt (+ ConfigurationBuilder.kt)

  • Hoist the default env/property lookup seams to two shared top-level internal vals so the Configuration constructor 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.
  • 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.kt

  • Route the system-property branch of fromConfiguration through the existing private buildOptions helper rather than re-implementing the same construct-and-warn logic the env-var branch already shares. Same IllegalArgumentException handling and same proxy.config.invalid warning fields.
  • Extract the repeated bypass-all ("*") classification in resolveNonProxyHosts into a local function, expressed once. Sysprop-over-env precedence is untouched.

serde/Tristate.kt

  • Drop the no-op @JvmName("nullValue") that merely re-asserts the default JVM name (the factory is already named nullValue), matching its absent() sibling.

http/context/DispatchContext.kt

  • Inline the single-use private deriveCallKey helper into its only caller. The counter is still incremented exactly once per key, so the produced traceId:spanId:n keys are identical.

Terminology rename

Rename mintCallKey/mintCounter to generateCallKey/generateCounter and replace "mint" with "generate" across the SDK's KDoc, comments, tests, and docs (http/context, instrumentation, the auth steps, IdempotencyKeyStep, sdk-example, and docs/). The renamed symbols are internal/private, so the rename does not touch the public API.

API / Build

No public-API change — the .api snapshot is unaffected (apiCheck passes). The getBoolean and nullValue signatures are unchanged.

Verification

./gradlew :sdk-core:compileKotlin :sdk-core:compileTestKotlin :sdk-core:ktlintMainSourceSetCheck :sdk-core:ktlintTestSourceSetCheck :sdk-core:apiCheck pass, plus the affected config, ProxyOptions, Tristate, http.context, and bearer-auth test suites.

Closes #179

… "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
@OmarAlJarrah OmarAlJarrah merged commit 984cf07 into main Jun 25, 2026
1 check passed
@OmarAlJarrah OmarAlJarrah deleted the chore/dedupe-config-util-serde-helpers branch June 25, 2026 22:00
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.

config/util/serde: dedupe defaults, fold single-use helpers, drop a no-op @JvmName

1 participant