Skip to content

docs: deduplicate callKey KDoc across the context promotion chain#126

Merged
OmarAlJarrah merged 1 commit into
mainfrom
docs/context-callkey-kdoc-dedup
Jun 16, 2026
Merged

docs: deduplicate callKey KDoc across the context promotion chain#126
OmarAlJarrah merged 1 commit into
mainfrom
docs/context-callkey-kdoc-dedup

Conversation

@OmarAlJarrah

Copy link
Copy Markdown
Member

Problem

The minted, call-unique default callKey is documented in full on DispatchContext: why the bare traceId:spanId pair is not a safe ContextStore key (the no-op context shares constant ids, an inbound W3C trace shares a trace id across spans, a tracer may reuse a span id across sibling calls) and why a process-unique counter is appended.

RequestContext and ExchangeContext each restated that same rationale verbatim in their own KDoc. The explanation now lives in three places and will drift independently as it is edited.

Change

Trim the two downstream types to document only what is local to them — that the default key is minted via DispatchContext.mintCallKey, and the resulting equality caveat (two default-constructed instances are not structurally equal; pin an explicit callKey if you need equality) — and defer the underlying "why trace/span alone is not collision-safe" reasoning to DispatchContext as the single canonical source.

KDoc only: no behavior, no signature, and no public-API change. compileKotlin and ktlint pass.

RequestContext and ExchangeContext each restated, verbatim, the rationale for
why the minted default callKey is collision-safe — the same explanation already
documented in full on DispatchContext. Three copies of the same prose drift
independently over time.

Trim the two downstream types to state only what is local to them (the default
is minted via DispatchContext.mintCallKey, and the resulting equality caveat)
and defer the "why trace/span alone is not a safe key" reasoning to
DispatchContext, the single canonical source.

KDoc only; no behavior or API change.
@OmarAlJarrah OmarAlJarrah merged commit 109d78a into main Jun 16, 2026
1 check passed
@OmarAlJarrah OmarAlJarrah deleted the docs/context-callkey-kdoc-dedup branch June 16, 2026 22:51
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.

1 participant