Repository navigation
feat(js): add read-only mode to local server provider - #486
Closed
fabriziodemaria wants to merge 2 commits into
Closed
fabriziodemaria wants to merge 2 commits into
fabriziodemaria wants to merge 2 commits into
Conversation
Add a `readOnly` provider option that resolves flag values without sending any data back to Confidence: resolves are forced to apply=false, applyFlag() is a no-op, telemetry (registerResolve) is skipped, and flush()/flushAssigned() still drain the WASM log buffers to bound memory but never POST to clientFlagLogs:write. This enables previewing flag values without recording exposures or generating traffic, leaving experiment metrics unaffected. Co-authored-by: Cursor <cursoragent@cursor.com>
Guards against reintroducing unbounded buffer growth: verifies that flush() still drains the in-WASM resolve-log buffer in read-only mode even though it sends nothing, so events don't accumulate across the process lifetime. Co-authored-by: Cursor <cursoragent@cursor.com>
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
Adds a
readOnlyoption to the JS OpenFeature local server provider (@spotify-confidence/openfeature-server-provider-local) that lets you resolve flag values without sending any data back to Confidence.Previously there was no unified way to turn off apply/telemetry/logs together — only a per-evaluation
_confidence_skip_applycontext key that just suppressed apply for a single evaluation.When
readOnly: true, all three outbound side-effects are suppressed:apply=false, andapplyFlag()becomes a no-op.registerResolve()calls are skipped.flush()/flushAssigned()still drain the WASM log buffers (to bound memory) but neverPOSTto/v1/clientFlagLogs:write.Flag values still resolve normally, so this is a true "read-only" preview mode that leaves experiment metrics unaffected.
Changes
ConfidenceServerProviderLocal.ts: newreadOnly?: booleanoption; gates apply, telemetry, and log sending.ConfidenceServerProviderLocal.read-only.test.ts: new tests asserting zero egress in read-only mode,applyFlagno-op, and a sanity check that logs still send when disabled.README.md/CLAUDE.md(AGENTS.md): documented the option.Test plan
make test(WASM build + install + proto:gen + format:check + typecheck + vitest): 164/164 non-e2e tests pass.flaglogs.test.tsrequires a liveCONFIDENCE_CLIENT_SECRET+ network and is unaffected by this change.Made with Cursor