Commit Graph

60 Commits

Author SHA1 Message Date
Luis Meyer 4a190b1bd4 Merge branch 'main' into flags-version-header 2026-09-17 09:38:07 +02:00
Luis Meyer 2e03f56280 op 2026-09-16 13:19:47 +02:00
Luis Meyer b167598b77 fix(flags-core): use plural flags config version headers 2026-09-16 12:04:24 +02:00
Damien Simonin Feugas 4848877ca6 [@vercel/flags-core] Add custom waitUntil option (#497) 2026-09-16 09:58:56 +00:00
Luis Meyer 3c12c2c04d revert(flags-core): remove source debug logging 2026-09-16 11:44:50 +02:00
Luis Meyer 25154ede50 fix(flags-core): use singular flags config version headers 2026-09-16 11:18:23 +02:00
Luis Meyer 48afe11165 feat(flags-core): add bundled source debug diagnostics 2026-09-15 12:21:50 +02:00
Luis Meyer 0fd2f412e9 debug 2026-09-15 11:38:43 +02:00
Luis Meyer 004baf818f fix 2026-09-15 10:25:46 +02:00
Luis Meyer da0b044c2f fix(flags-core): handle cancelled header refreshes and add changeset 2026-09-15 10:13:50 +02:00
Luis Meyer 923ea09467 stuff 2026-09-15 10:03:39 +02:00
Luis Meyer 7332270a2a [vercel-flags-core] add vercel client mode 2026-09-14 18:30:25 +02:00
Luis Meyer a3fc275ed3 docs(flags-core): clarify request-time initialization with OIDC (#496) 2026-09-10 16:36:37 +02:00
Luis Meyer e0eebe6fbc fix(flags-core): request identity on the stream so Bun receives the first datafile (#494)
* fix(flags-core): request gzip on the stream so Bun receives the first datafile

* test(flags-core): expect Accept-Encoding on stream requests in black-box tests

* fix(flags-core): send Accept-Encoding: identity on the stream only when running on Bun
2026-09-09 11:16:11 +02:00
Dominik Ferber c9d28116eb Experiments (#486)
* step 1

* single experiment

* reuse variants

* single experiment

* exposures

* undo exposureLogging boolean

* Attach experiment metadata to all evaluated flag outcomes

* version

* hybrid and override exposure reporting

* Initialize adapters before reporting flag overrides

* Update package versions for experiment replacement

* versions

* fix test

* Rename exposure reporting APIs as experimental

* Add APIs for reporting flag exposures and overrides

* Update changeset for exposure reporting APIs

* Remove default exposure reporting

* Defer exposure reporting with waitUntil

* Fix override reporting without a reporter

* Handle optional override reporting in Vercel adapter

* Update override reporting to accept parameter objects

* patch
2026-09-04 12:21:17 +00:00
Luis Meyer cc8c26648c feat(flags-core): add metrics environment option (#453)
* feat(flags-core): support explicit environment

Co-Authored-By: Claude <noreply@anthropic.com>

Co-Authored-By: Luis Meyer <luis.meyer@vercel.com>

* fix(flags-core): scope environment to metrics ingest

Co-Authored-By: Claude <noreply@anthropic.com>

Co-Authored-By: Luis Meyer <luis.meyer@vercel.com>

* fix(flags-core): clarify metrics environment

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(flags-core): restrict metric environment values

* docs(flags-core): clarify metrics environment fallback

---------

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-08-26 12:28:13 +02:00
Luis Meyer 58e1f5bcdf Rename Edge Config packages to Global Config (#452)
* Rename edge config packages

* Rename Global Config APIs

* Fix Global Config environment setup

* Rename Global Config endpoints

* Update Global Config documentation links

* Undo lockfile changes

* Update lockfile

* Undo lockfile changes

* Update lockfile

* Fall back to EDGE_CONFIG

---------

Co-authored-by: Andy Bitz <artzbitz@gmail.com>
2026-08-04 12:36:41 +02:00
Dominik Ferber ceb15198f7 [@vercel/flags-core] strip g and y regex flags (#450) 2026-07-27 13:50:24 +00:00
Dominik Ferber 1f000784e5 upgrade vite & vitest (#445) 2026-07-26 08:25:37 -04:00
Dominik Ferber 50b1aa4f96 Align rollouts assignments with split assignments (#427)
* [@vercel/flags-core] align rollotus and splits

* avoid extra array

* 100k

* full range

* fix comments

* rename

* shorten comments

* add changeset

* add stderr test
2026-07-09 22:48:48 +03:00
Luis Meyer 9dff590bd5 Add FLAGS_EVALUATION metric (#401)
* Add FLAGS_EVALUATION metric

* Track variant IDs in evaluation results

* report null instead of fallback

* bucket to the previous minute

* replace variant null with undefined

* invert

* use option instead of env var

* Add track option to black-box flag tests

* Add evaluation metrics controls and flush reasons

* increase max_count

* defaul track:true

* increase batch

* Bound ingest POSTs to 2000 events per request

Flushes can overshoot the scheduler's MAX_COUNT because the map read
happens in a microtask, so a single POST could exceed the server-side
maxItems cap and be rejected with a 400. Chunk sendIngestEvents so each
POST carries at most MAX_EVENTS_PER_REQUEST events.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Remove count-based flushing from the scheduler

Flushing is now purely time-based (idle window, max window, shutdown).
Batches are only cut down to size when the ingest events are sent, via
the 2000-event chunking in sendIngestEvents, which keeps every POST
below the server-side maxItems cap.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* cleanup

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 14:09:45 +02:00
Dominik Ferber f60c99d707 [vercel-flags-core] fix datafile serialization (#416) 2026-06-26 17:40:11 +03:00
Luis Meyer c35f38dfb9 Support createClient options-first overload (#406) 2026-06-23 14:32:06 +02:00
Luc Leray b0150af9c8 [@vercel/flags-core] quiet noisy stream reconnect logs (#395)
* [@vercel/flags-core] quiet noisy stream reconnect logs

* [@vercel/flags-core] test exhaustion log + guard undefined reason
2026-06-16 14:43:25 +00:00
Dominik Ferber 201f9d5988 Add bulk evaluation (#385)
* [flags] avoid re-imports

Avoid re-importing next/headers since it adds unnecessary microtask queue overhead

* [flags] avoid iife microtask queue overhead

* [flags] skip awaits where possible

* [flags] allow bulk eval

* wip

* add bulk mode to playground

* first try of bulk eval

* add bulk evaluation to adapters

* reuse

* simplify

* versions

* rm outdated changeset

* rm outdated changeset

* revert playground

* revert playground flags

* rm logs

* reuse cache of resolved flags for bulk

* simplify

* changesets

* support bulk([]) and bulk({})

* flagKey → key

* allow any type in expectPermutations

* avoid unnecessary mapping

* fix changeset

* validate package.json fields

* update package.json fields

* keep covariant

* adjust adapter types

* Merge bulk into evaluate (#392)

* merge bulk into evaluate

* add pages router compatibility

* better types

* add array test

* add test

* changesets

* use type import

* fix import

* extract readOverrides

* fix import of reportValue

* tracing

* skip bulkDecide for overwritten flags

* update changesets

* [changesets] onlyUpdatePeerDependentsWhenOutOfRange

* add type guard

* adjust changeset
2026-06-05 08:14:29 +00:00
Luis Meyer 7b5ea9a808 Reapply OIDC (#390)
* Reapply "Add oidc support (#374)" (#389)

This reverts commit 357ca676c6.

* bump oidc package

* review

* comments
2026-06-04 16:37:03 +02:00
Luis Meyer 357ca676c6 Revert "Add oidc support (#374)" (#389)
This reverts commit 72d36511d0.
2026-05-28 10:16:43 +03:00
Luis Meyer 72d36511d0 Add oidc support (#374)
* Add oidc support

* changeset

* update tests

* update def script

* fix provider data

* update changeset

* fix createVercelAdapter

* comments

* error
2026-05-28 08:59:00 +02:00
Dominik Ferber 4d90e912a4 [flags-core] perf improvements (#382)
* [flags-core] perf improvements

* add changeset
2026-05-18 13:20:13 +03:00
Vincent Derks bd4d01a9b2 vercel-flags-core: jitter ingest retries and batch-wait window (#371)
Replace the deterministic 100/200ms retry schedule with full-jitter exponential
backoff, jitter MAX_BATCH_WAIT_MS by ±20% to desynchronize concurrent flushes,
and log when a flush exhausts all retries.

Helpers extracted to utils/backoff.ts so they can be reused.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-06 15:57:15 +02:00
Dominik Ferber 80dcdada34 [vercel flags] add progressive rollouts to sdk (#360)
* [vercel flags] add progressive rollouts

* fix slots

* add changeset
2026-04-14 16:55:57 +03:00
Dominik Ferber 9142790975 only build publishable packages during release process (#348)
* clean up

* fix release process
2026-03-21 21:17:04 +02:00
Swarnava Sengupta b755ffecdf fix: SDK key detection to avoid false positives with third-party identifiers (#345)
The SDK key validation now uses a regex (/^vf_(?:server|client)_/) to require
the format vf_server_* or vf_client_* instead of accepting any string starting
with vf_. This prevents false positives with third-party service identifiers
that happen to start with vf_ (e.g., Stripe identity flow IDs like
vf_1PyHgVLpWuMxVFx...).

Adds isValidSdkKey() helper function and updates parseSdkKeyFromFlagsConnectionString()
to use the stricter validation. Updates all tests to use valid SDK key formats.
2026-03-21 17:39:00 +00:00
Dominik Ferber 44460570d4 [vercel/flags-core] allow json flags (#335)
* rm unused import

* [vercel-flags] allow json flags

* add flags-playground

* wip

* clean up type

* reword changeset

* rm examples/flags-playground
2026-03-20 14:03:53 +02:00
Dominik Ferber b81963dc14 fix (#339) 2026-03-19 16:18:59 +02:00
Dominik Ferber 64619d7c66 @vercel/flags-core: allow specifying entities type when creating clients (#334)
* changeset

* adapt
2026-03-13 11:09:21 +02:00
Dominik Ferber 4a5f56a8c7 skip sending config reads (#330)
* skip sending config read for dev and custom envs

* add changeset

* clean up

* wip
2026-03-13 08:16:47 +01:00
nadav dd1396e461 Guard missing Vercel Flags runtime helpers (#326)
* Guard request-context flag reporting

* Preserve request-context hook binding

* Guard core request-context reporting

* Guard missing bundled flag definitions

---------

Co-authored-by: Dominik Ferber <dominik.ferber@gmail.com>
2026-03-12 16:38:18 +02:00
Dominik Ferber e8539cd52a make version dynamic in tests (#304) 2026-03-06 12:02:03 +00:00
Dominik Ferber b70c2ea466 Control (#278)
* refactor

* remove retries

* simplify

* simplify options

* before

* rename DataSource to Controller

* refactor and better tests

* avoid double polling

* rename

* fix

* simplify test setup

* wip

* unify

* wip

* only track 1 read per build

* make BundledSource lazy

* clean up fallback behavior

* add mode

* mutually exclusive streaming & polling

* rely more on black box testing

* simplify

* Update CLAUDE.md

* various fixes

* add tests

* more fixes

* Update CLAUDE.md

* more fixes

* resolve more issues

* unite black box tests

* tests

* progress

* adjust

* don't report on 401s; use Response.json

* enforce min polling interval

* progress

* types

* capture all logs

* throw with prefix

* added a minimum gap of `BASE_DELAY_MS` (1 second) between connection
 attempts

* step

* progress

* use request context in tests

* add separate tests depending on context

* tests

* rm unused option

* add state machine chart

* rm sources

* use fake timers for more tests

* swap remaining tests from msw to mocked fetch

* update comments

* Update CLAUDE.md

* update comment

* fix comment

* fix types

* rm peek

* adds ping checks and sending x-revision header  (#282)

* abort on missed pings

* use revision from bundled definitions

* tests

* simplify

* send x-revsion on reconnects too

* simplify StreamSource

* rename

* rename in test

* wait for stream

* replace startBackgroundUpdates with explicit call

* Update CLAUDE.md

* restore stronger tests

* Update CLAUDE.md

* convert

* simplify tests

* fix test

* fixes

* rm state machine

* await first poll before resoliving init

* rm outdated comment

* avoid leaking _origin

* changeset

* avoid log on reconnect due to missed pings

* don't warn on missed pings

* Update event reporting for control rewrite (#289)

* Update event reporting for control rewrite

* Log ingest response

* Use string for revision

* Add retries when ingesting events

* adapt changeset

* adjust test

---------

Co-authored-by: Luis Meyer <luis.meyer@vercel.com>
Co-authored-by: Andy <AndyBitz@users.noreply.github.com>
Co-authored-by: Andy Bitz <artzbitz@gmail.com>
2026-03-06 10:05:01 +02:00
Vincent Derks 722b0d054e Added new comparators: (not_)contains and case-insensitive versions (#288)
* Added new comparators: (not_)contains and case-insensitive versions

* Switched to "ci" option instead of creating new condition for every ci-case

* Cleanup

* More cleanup

* Some more cleanup & finetuning

Made-with: Cursor

* Changeset

* Switch options key to just "i" and also allow for passing "i" as string instead of options object

* Apply suggestions from code review

* Update packages/vercel-flags-core/src/evaluate.ts

Co-authored-by: Dominik Ferber <dominik.ferber@gmail.com>

* naming

* Renaming

---------

Co-authored-by: Dominik Ferber <dominik.ferber@gmail.com>
2026-03-06 07:52:32 +02:00
Vincent Derks a924044282 Fixed bug with inverted NOT_ONE_OF segment comparator (#296)
* Fixed bug with inverted NOT_ONE_OF segment comparator

* Feedback

* Changeset

* Updated unit-test
2026-03-05 10:52:50 +01:00
Dominik Ferber 7d7719a255 [@vercel/flags-core] deduplicate concurrent initialize() calls (#274)
* add shop

* wip

* fix parallel init initialize

* avoid double polling

* add tests

* rm shirt-shop-vercel

* ignore

* refactor

* rm unnecessary fix

* minimal

* changeset

* fix tests
2026-02-13 14:34:46 +02:00
Hayden Bleasel cf9ccd0076 Open Source Docs (#272)
* Scaffold Geistdocs instance

* Update biome.json

* Replace content

* Re-path docs

* Update docs package name

* Misc fixes

* Update geistdocs.tsx

* Move content to correct folder

* Start migrating custom components

* Finish migrating custom components

* Migrate existing redirects

* Remove #next suffixes from code blocks

* Migrate homepage and flags

* Remove duplicate lockfiles

* Start fixing homepage

* Replace Geist components

* Fix colors

* Improve layout

* Fix code blocks

* Fix hero

* Fix illustrations

* Fix redirect

* Fix nav links

* Patch in FrameworkSwitcher

* Bump Next.js in docs

* Delete turbo.json

* Misc fixes

* More logo fixes
2026-02-13 09:06:03 +02:00
Dominik Ferber 2bfaada64c Revert "add primed stream message support (#263)" (#270)
This reverts commit 8ae9101ba9.
2026-02-11 15:40:45 +02:00
Dominik Ferber f14aea8e73 respect hashed keys (#267)
* respect hashed keys

* use cache for pending promises

* refactor

* add try/catch

* typo
2026-02-11 15:22:07 +02:00
Luis Meyer 8ae9101ba9 add primed stream message support (#263)
* add primed stream message support

Implements client-side support for version-based caching. When the client
already has the current datafile (indicated by revision), the server can
send a lightweight primed message instead of the full datafile, reducing
bandwidth. Tracks revision from datafile and sends X-Revision header on
reconnections.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* use getRevision getter for single source of truth and fix type errors

Refactors StreamConfig.revision to a getRevision getter function so
connectStream always reads the latest revision from client state instead
of tracking a separate copy. Fixes CI type-check errors in tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-11 12:51:54 +01:00
Andy 84714c3b91 [vercel-flags-core] Forward configUpdatedAt timestamp correctly (#266) 2026-02-11 12:50:07 +01:00
Luis Meyer 5e2d095863 Suppress stream abort error on intentional shutdown (#264)
When shutdown() is called on a client using FlagNetworkDataSource, the stream abort error is expected and should not be logged. The break statement still exits the loop properly.

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-11 12:45:42 +01:00
Dominik Ferber d44a9229e3 pass default openfeature client (#261) 2026-02-11 12:52:29 +02:00