Skip to content

docs: thin client proposal for edge resolution - #499

Open
andreas-karlsson wants to merge 3 commits into
mainfrom
andreask/thin-client
Open

docs: thin client proposal for edge resolution#499
andreas-karlsson wants to merge 3 commits into
mainfrom
andreask/thin-client

Conversation

@andreas-karlsson

@andreas-karlsson andreas-karlsson commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

./remote — a thin Confidence client for remote resolution

Adds a new entry point, @spotify-confidence/openfeature-server-provider-local/remote,
exporting a stateless ConfidenceClient that resolves against a remote resolver
over any fetch-compatible function — a Confidence resolver Cloudflare Worker via
service binding, or resolver.confidence.dev over HTTP. It ships neither WASM nor
OpenFeature (~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-side
SDK 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; apply
defaults to true, so naive usage never silently loses exposure data),
apply(resolveToken, flagNames), and evaluate(bundle, flagKey, defaultValue) — a
pure function over a JSON-forwarded bundle, so a browser evaluates with no network
and no secrets. No lifecycle: no initialize, no close, no timers.

Errors. Neither resolve nor evaluate throws. Transport, HTTP or decoding
failures make resolve return an errored bundle, which evaluate turns into the
default value with an ERROR reason. The errored bundle is still plain JSON, so the
failure forwards to the browser correctly labelled — a caller catching a rejection
would have to invent a fallback bundle, and the obvious inventions (null, an empty
bundle) mislabel it as FLAG_NOT_FOUND. apply still rejects.

Tested over a mocked transport and e2e against the live resolver.confidence.dev.
plans/thin-js-client.md records the design (with a TanStack Start on Cloudflare
example) and two follow-ups: a dedicated SDK id for thin-client resolve telemetry,
and token-only applies.

Comment thread openfeature-provider/js/src/ConfidenceClient.ts Dismissed
@andreas-karlsson
andreas-karlsson marked this pull request as ready for review August 4, 2026 08:31
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.

2 participants