docs: thin client proposal for edge resolution - #499
Open
andreas-karlsson wants to merge 3 commits into
Open
Conversation
andreas-karlsson
marked this pull request as ready for review
August 4, 2026 08:31
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.
./remote— a thin Confidence client for remote resolutionAdds a new entry point,
@spotify-confidence/openfeature-server-provider-local/remote,exporting a stateless
ConfidenceClientthat resolves against a remote resolverover any fetch-compatible function — a Confidence resolver Cloudflare Worker via
service binding, or
resolver.confidence.devover HTTP. It ships neither WASM norOpenFeature (~9 kB gzipped) while reusing the existing protos and
flag-bundle.ts.Why. A common deployment runs resolution in a separate process from the
application (app Worker → resolver Worker). This supports resolve server-side,
apply client-side: an exposure is recorded only when a flag actually affects what
a user sees. The resolver side landed in
498dd2a6; this is the application-sideSDK that sends the applies. The existing online SDK is the wrong tool — it is built
around a long-lived stateful client, which fights a per-request execution model and
has no story for carrying a resolve token from a server-side resolve to a
client-side apply.
API.
resolve(flagNames, context, { apply })([]resolves all flags;applydefaults to
true, so naive usage never silently loses exposure data),apply(resolveToken, flagNames), andevaluate(bundle, flagKey, defaultValue)— apure function over a JSON-forwarded bundle, so a browser evaluates with no network
and no secrets. No lifecycle: no
initialize, noclose, no timers.Errors. Neither
resolvenorevaluatethrows. Transport, HTTP or decodingfailures make
resolvereturn an errored bundle, whichevaluateturns into thedefault value with an
ERRORreason. The errored bundle is still plain JSON, so thefailure forwards to the browser correctly labelled — a caller catching a rejection
would have to invent a fallback bundle, and the obvious inventions (
null, an emptybundle) mislabel it as
FLAG_NOT_FOUND.applystill rejects.Tested over a mocked transport and e2e against the live
resolver.confidence.dev.plans/thin-js-client.mdrecords the design (with a TanStack Start on Cloudflareexample) and two follow-ups: a dedicated SDK id for thin-client resolve telemetry,
and token-only applies.