Skip to content

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

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

luismeyer wants to merge 3 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).

The client currently exposes little detail about why it serves cached definitions, refreshes, or changes connection state. Set DEBUG=@vercel/flags-core to emit detailed console.debug diagnostics using the existing debug namespace.

The controller, cache, and network sources import one shared debug() function. It checks the environment variable on each call and computes details lazily. Events cover mode/state transitions, initialization and shutdown, read and snapshot results, cache versions/age and acceptance, header freshness and fallback, background/blocking/shared refreshes, stale-if-error expiry and recovery, HTTP status, polling, stream pings/timeouts, and reconnect delays.

Logging is off by default. The new logs omit credentials, raw headers, definitions, evaluation entities, and raw error messages; a throwing console cannot interrupt client operations. Includes usage documentation and a patch changeset. Event names and fields remain internal diagnostics.

Validation: existing flags-core regression suites, TypeScript, and Biome passed for the logger implementation (live-service integration suite excluded). The logger-specific test file was subsequently removed; the deletion was reviewed and git diff --check passed. Tests were not rerun for the deletion. Review found no substantive issues.

@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 Sep 23, 2026 1:46pm UTC
flags-sdk-dev Ready Ready Preview, v0 Sep 23, 2026 1:46pm UTC
flags-sdk-snippets Ready Ready Preview, v0 Sep 23, 2026 1:46pm UTC
flags-sdk-sveltekit-snippets Ready Ready Preview, v0 Sep 23, 2026 1:46pm UTC
shirt-shop Ready Ready Preview, v0 Sep 23, 2026 1:46pm UTC
shirt-shop-api Ready Ready Preview, v0 Sep 23, 2026 1:46pm UTC

This branch was successfully deployed

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