Skip to content

feat(flags-core): add opt-in client state debug logging - #518

Open
luismeyer wants to merge 5 commits into
codex/flags-header-sourcefrom
codex/flags-client-debug
Open

luismeyer wants to merge 5 commits into
codex/flags-header-sourcefrom
codex/flags-client-debug

Conversation

@luismeyer

@luismeyer luismeyer commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Stacked on #511 (codex/flags-header-source), including its unified project-aware reads and immediate stream fallback fixes.

Set DEBUG=@vercel/flags-core to follow the controller, shared cache, and network sources through one global console.debug logger. Every event includes the configured clientName, so concurrent clients can be distinguished.

State transitions include their previous state, next state, and reason. Evaluation and getDatafile() events show the project, revision, age, freshness assessment, and failure allowance. Refresh events distinguish background, blocking, and shared work; HTTP response receipt is separate from cache application. Stream-confirmed cancellation is distinguished from shutdown, and ordinary freshness confirmations do not look like outage recovery. Polling/stream startup logs expose timeout and freshness thresholds; HTTP retries and stream reconnects include attempt counts, delays, and reasons. getDatafile() logs use its API name because it now performs active resolution.

Logging remains off by default, checks the namespace on each call, and computes details lazily. Diagnostics omit credentials, raw headers, definitions, evaluation entities, and raw error messages; a throwing console cannot interrupt client operations. The README includes an example trace and an event guide. Event names and fields are internal diagnostics.

Validation after rebasing: 995 core unit tests across 23 suites pass on both Node 22 and Node 24. TypeScript, the core build, changed-file Biome, and git diff --check pass. A built-package smoke check verifies client names across four concurrent clients, header refreshes, polling, quiet stream timeout/reconnect, and shutdown. The adapter discovery fixture now covers lazy stream initialization; its 13 tests pass on Node 22 and Node 24 (one existing test remains skipped). All 26 definition-preparation tests also pass. Live-service integration tests were excluded.

@vercel

vercel Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
flags-playground Ready Ready Preview, v0 Oct 1, 2026 12:26pm UTC
flags-sdk-dev Ready Ready Preview, v0 Oct 1, 2026 12:26pm UTC
flags-sdk-snippets Ready Ready Preview, v0 Oct 1, 2026 12:26pm UTC
flags-sdk-sveltekit-snippets Ready Ready Preview, v0 Oct 1, 2026 12:26pm UTC
shirt-shop Ready Ready Preview, v0 Oct 1, 2026 12:26pm UTC
shirt-shop-api Ready Ready Preview, v0 Oct 1, 2026 12:26pm UTC

@luismeyer
luismeyer added this pull request to stack #512 September 23, 2026 13:34
@luismeyer
luismeyer force-pushed the codex/flags-client-debug branch from 09a8e94 to f50ca9f Compare September 30, 2026 14:56
@luismeyer
luismeyer force-pushed the codex/flags-client-debug branch from f50ca9f to 0768d43 Compare October 1, 2026 10:30
@luismeyer
luismeyer force-pushed the codex/flags-client-debug branch from 2dac318 to 76e3975 Compare October 1, 2026 10:54
@luismeyer
luismeyer force-pushed the codex/flags-client-debug branch from 76e3975 to 7abefe2 Compare October 1, 2026 11:00
@luismeyer
luismeyer force-pushed the codex/flags-client-debug branch from 7abefe2 to 4925dc8 Compare October 1, 2026 11:49

This branch was successfully deployed

6 active deployments
Preview – flags-sdk-dev — f3c5257f Deployed Oct 1, 2026 by vercel[bot]
Preview – flags-playground — f3c5257f Deployed Oct 1, 2026 by vercel[bot]
Preview – flags-sdk-sveltekit-snippets — f3c5257f Deployed Oct 1, 2026 by vercel[bot]
Preview – flags-sdk-snippets — f3c5257f Deployed Oct 1, 2026 by vercel[bot]
Preview – shirt-shop-api — f3c5257f Deployed Oct 1, 2026 by vercel[bot]
Preview – shirt-shop — f3c5257f Deployed Oct 1, 2026 by vercel[bot]
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