Skip to content

Changelog

compare changes

  • @xtandard/kit is now a dependency. The storage drivers, drizzle table factories, auth and authorization providers, the hooks runner, the validation core, the panel and API plumbing, the framework adapters, the CLI plumbing, the admin shell, the React embed, the build configs and the docs-site tooling come from @xtandard/kit. Every subpath and exported name of @xtandard/flags is unchanged (the API-surface diff has no removals); users never install or configure the kit.
  • Every SQL, document, Redis, memory and file adapter now has compareAndSwap (memory, file, Redis/RedisJSON, Postgres, Drizzle on pg/MySQL/SQLite, MongoDB, SQLite, libSQL). Only unstorage and Cloudflare KV lack it. Comparisons are structural (object key order is ignored).
  • Values are written as canonical JSON (sorted object keys) by every adapter. Data written by earlier releases reads, lists and swaps as before; no migration.
  • unstorage writes string values JSON-encoded ("hello" is stored as "\"hello\""). An older release still reads them, and strings stored by earlier releases read back as before.
  • New Postgres tables get key text COLLATE "C" (bytewise, index-usable prefixes). Existing tables are untouched and keep working; the optional ALTER is in the kit’s storage guide. pgFlagsTable keeps the plain text key (no drizzle-kit diff for existing schemas).
  • mysqlFlagsTable takes keyCollation (utf8mb4_bin default; utf8mb4_0900_bin on MySQL 8.0+ or utf8mb4_nopad_bin on MariaDB for new tables). See “MySQL PAD SPACE” under Fixed.
  • createFetchHandler: sourceStorage is optional when a prebuilt core is given (one of the two is required, checked at construction). The result, and every adapter helper (flagsPanel for Bun, Hono, Express and Elysia), gains close(), which stops the OFREP SSE poller.
  • Every panel answers GET {basePath}/healthcheck with { "ok": true }, and serves the SPA’s index.html with cache-control: no-cache (an upgrade no longer serves a stale page that points at deleted hashed assets). The standalone server and serve keep their { status, title } healthcheck at /healthcheck and {basePath}/healthcheck.
  • A non-GET request outside the API gets 405 with an Allow: GET, HEAD header.
  • The OpenAPI document’s info.version is the package version (it was a hard-coded 0.1.0).
  • CLI:
    • AUTH_ROLE sets the basic-auth user’s role (admin by default, as before).
    • SOURCE_SQLITE_TABLE / RUNTIME_SQLITE_TABLE set the SQLite table (default xtandard_flags, as before).
    • UI_DIR overrides the bundled UI directory (the standalone image already honoured it).
    • bun src/cli.ts <command> runs the CLI directly (a self-run guard); importing the module never runs it.
  • The standalone app delegates to the CLI’s serve, with its own defaults unchanged (memory storage, ./data/{source,runtime} and ./data/{source,runtime}.sqlite).
  • Optional-peer error messages read @xtandard/flags/storage/redis requires the optional peer "redis". Install it with: bun add redis (or npm install redis).
  • Validation: ValidationError and ValidationResult (@xtandard/flags) are now type aliases of the kit’s ValidationIssue / ValidationResult, with the same shape.
  • Admin UI: the header is the kit’s shell. The unpublished-changes badge and the Discard and Publish buttons sit before the read-only badge; an embedded dashboard whose /config request fails (and that has no server bootstrap) shows a “Could not load the panel configuration” message instead of an empty shell.
  • React embed: @xtandard/flags/react also exports the FetchLike type.
  • New exports (additions only): MemoryFlagsStorage (./storage/memory); FileFlagsStorage, FileLegacyMode and migrateFileStorage (./storage/file); KeyCollisionError (./storage/drizzle); the FetchLike type (./react).
  • Docs site, CI and release run on the kit’s tooling and reusable workflows (@v0.1). CI now uses redis:8, so the RedisJSON conformance cases run. The Docker image is smoke-tested before it is pushed, and docker.yml has a refresh-kit dispatch input. Release notes come from the tag’s CHANGELOG section.

Inherited from @xtandard/kit (inventory §3; each has a permanent regression test in the kit).

  • Node 20.0–20.15 served the “UI not built” page instead of the admin SPA (process.getBuiltinModule is missing there); the UI directory now resolves on every Node 20 that engines allows (kit 0.1.1).
  • A throwing auth provider is a 500, not a 401. A broken identity provider no longer looks like bad credentials (flags lacked wh 543e1fa).
  • The panel requires sourceStorage or a prebuilt core and says so at construction, instead of failing on the first request (wh 5b151c1).
  • Domain errors are mapped by name (ReadonlyError, NotFoundError, SnapshotProtectedError, the validation errors), so a class copy from another bundle no longer turns into a 500.
  • A malformed % escape in a path is a 404, not a 500 (URIError).
  • Key-shaped path parameters are re-validated before they reach storage (MySQL PAD SPACE, inventory §5). Flag, segment and snapshot keys must match [a-zA-Z0-9._-]+; project and environment keys (path and the OFREP projectKey/environmentKey query) may not be empty, ./.., contain /, or have leading/trailing whitespace. Example: DELETE …/snapshots/v1%20 passed the “active snapshot is protected” check ("v1 " !== "v1") and then deleted the v1 row on MySQL; it is now a 404.
  • The panel title is HTML-escaped in the served page, and so are the <base href> and the bootstrap JSON (<, >, U+2028/U+2029); $ sequences in the config are kept.
  • Express keeps every Set-Cookie header and multi-value request headers, re-serialises pre-parsed bodies (JSON, string, bytes, urlencoded) without a stale content-length, and streams responses with backpressure, so the OFREP SSE stream now works under Express (it was buffered).
  • The CLI’s Node server (npx … serve) keeps every Set-Cookie, streams every response (not only SSE) and cancels the body when the client disconnects.
  • Elysia: PATCH and DELETE bodies reach the panel (only POST/PUT were rebuilt), a stale content-length is dropped, and two mounts with different prefixes are no longer deduplicated by the plugin name.
  • The OpenAPI info.version is the package version, not 0.1.0.
  • Negative numbers and a bare - are values (--value -5, --reason -), not new flags (kit 0.1.1 parseArgs).
  • bun src/cli.ts runs the CLI even when its path can’t be resolved as written (kit 0.1.1 isMainModule).
  • An unknown SOURCE_STORAGE_DRIVER / RUNTIME_STORAGE_DRIVER fails instead of silently using the file driver.
  • An empty environment variable counts as unset (TITLE= in a .env file kept an empty title).
  • (Unknown AUTH_MODE already fails since v0.2.1’s hotfix; the kit now enforces it.)
  • file legacy: "read-through" (the flags default) could delete another key’s file. The raw legacy path of x/a%25/k is the encoded path of x/a%/k, so writing or removing x/a%25/k deleted x/a%/k, and reading a missing x/a%25/k returned x/a%/k’s value (same for ^ escapes). Present in every earlier flags release; fixed in the kit (#18), and the conformance suite now runs in read-through mode.
  • file: a write is atomic (temporary file + rename), so a crash never leaves a half-written value; watch reports a rename as remove only when the file is gone (writes were reported as removals); empty key segments are distinct (a//b ≠ a/b); on a case-insensitive file system a read-through never opens a legacy Acme/ for acme (realpath check).
  • Redis: getKeys de-duplicates SCAN results (SCAN may return a key twice); watch escapes glob characters in the watched prefix (PSUBSCRIBE), so it no longer misses or over-matches events.
  • unstorage: keys ending in $ are no longer hidden (unstorage treats them as meta keys), empty key segments are kept, and a stored string that looks like JSON reads back as that string ("123" came back as the number 123). Older spellings still read.
  • MySQL (drizzle): getKeys no longer skips keys containing supplementary characters (emoji): an indexed LIKE 'p%' on utf8mb4_bin misses them on MySQL 8.4; it is now a range scan plus an exact startsWith.
  • MySQL PAD SPACE: utf8mb4_bin ignores trailing spaces, so setItem("flags/a ") overwrote "flags/a", and reads, removes and swaps acted on the other spelling. Reads, removes and swaps now match keys byte-exactly, and a colliding write throws KeyCollisionError instead of overwriting. New tables can opt into a NO PAD collation (keyCollation).
  • Postgres / Drizzle: a stored JSON string that looks like JSON ("123") reads back as the string (it was parsed twice); a failed connect or table creation is retried on the next call instead of being cached (Postgres, libSQL).
  • SQLite / libSQL: prefix listing uses GLOB (case-sensitive, index-usable); MongoDB re-checks prefixes with startsWith, so a case-insensitive collection collation never leaks keys from another prefix.
  • @xtandard/flags/storage/sqlite can be imported under Node (bun:sqlite loads on first use; opening a database still needs Bun). The SQLite table is created on first use.
  • withWatch results survive an object spread ({ ...withWatch(s, sub) } kept no methods).
  • JSON values must be finite: a json variant (or condition value) containing NaN or Infinity is rejected; it was stored as null.
  • A root-level validation issue carries the base path (flag) without a trailing dot (flag.).
  • The embed’s routing: "memory" keeps the query string, so the ?project= / ?env= scope survives navigation.
  • The theme host watcher works without MutationObserver (theme="inherit" in environments without it fell over).
  • CI runs the RedisJSON conformance cases (redis:8); with redis:7 they never ran.
  • The deprecated TransactionalFlagsStorage / isTransactional stay exported for compatibility; no adapter implements them (they never did).

None. The API-surface diff (xtandard-kit api-surface) shows no removals, stored data written by earlier releases reads unchanged, and no persisted or HTTP-contract default changed (table xtandard_flags, Mongo xtandard_flags/flags_kv, pg channel xtandard_flags, CLI tables xtandard_flags_{source,runtime}, Redis prefixes xtandard:flags:{source,runtime}, file dirs ./.flags/… (CLI) and ./data/… (image), readonly status 403, realm xtandard-flags, __FLAGS_CONFIG__, xtandard-flags:theme, .xtandard-flags).

Optional, for MySQL users on utf8mb4_bin tables who want trailing-space keys kept distinct:

ALTER TABLE flags_kv MODIFY `key` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_bin NOT NULL;
-- MariaDB: COLLATE utf8mb4_nopad_bin

compare changes

Security fix for the standalone server, the CLI and the Docker image: a mistyped AUTH_MODE no longer serves an open panel. Library APIs, storage and the HTTP API are unchanged.

  • auth: reject unknown AUTH_MODE instead of serving an open panel (#23). Any value other than none or basic (a typo, wrong case) used to fall through to none, leaving the admin panel and API unauthenticated. The server now exits with Unknown AUTH_MODE "x" (expected none or basic) before it listens. An empty or unset AUTH_MODE still means none, and now prints the same unauthenticated-panel warning as an explicit none.

None if AUTH_MODE is none, basic or unset. If a deployment fails to start after upgrading, its AUTH_MODE was invalid and the panel was open: set it to basic (with credentials) or none explicitly.

compare changes

  • MySQL (Drizzle storage): run a one-off ALTER TABLE. The key column is now varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin. MySQL’s default collation (utf8mb4_0900_ai_ci) folds case and accents, so flags/Acme/… and flags/acme/… were the same row. New tables get the binary collation from the schema; tables created before 0.2.0 need (adjust the length if you set keyLength):

    ALTER TABLE flags_kv
    MODIFY `key` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL;

    If two keys already collided, the table holds only the last write; the ALTER doesn’t bring the other back. getKeys also used ESCAPE '\', a MySQL syntax error, so listing failed on every MySQL call before this release.

  • File storage: keys with uppercase letters get a new file name. Each key segment is now encoded so it stays distinct on case-insensitive file systems (macOS and Windows defaults): an uppercase letter becomes ^ + the lowercase letter (Acme → ^acme), and characters outside [a-z0-9._~!@,=+-] become %XX. All-lowercase keys (flags/default/production/…) keep their file names, so most trees need nothing. Files written before 0.2.0 are still read and listed, and are replaced by the encoded name on the next write. On a case-insensitive file system such a legacy file can still answer for its lowercase twin until it is rewritten, so if your tree has keys with uppercase letters, re-save them once (read and write back each key from getKeys("flags/")).

  • unstorage storage: keys containing %, ?, \ or : are stored under an escaped name (%25, %3F, %5C, %3A), because unstorage cut keys at ? and turned \ and : into separators. Keys without those characters are unchanged. A key with one of them written before 0.2.0 is not found under its new name (with ?, \ or : it was stored mangled anyway); write it again.

  • storage: Exact keys and literal prefixes on every backend: getKeys on SQLite, libSQL, Postgres and Drizzle keeps only exact startsWith matches (SQLite’s LIKE folds ASCII case); Redis escapes glob characters in SCAN MATCH; unstorage lists by plain string prefix. The storage conformance suite now covers case/accent-distinct keys, ? \ : round-trips and % _ ! * [ ] ? \ : %25 in prefixes, and runs live against MySQL, Redis and MongoDB in CI (c9d27ae)
  • site: Serve og:url, og:image and sitemap URLs over https (2ada92e)
  • brand: Vector brand kit in the xtandard family system: symbol, horizontal and stacked lockups for light and dark, monochrome, favicon set and social card, generated by scripts/brand-assets.sh and documented in docs/BRAND.md (276a822, f4cf88c, 3b7a255, f1b90e7)
  • ui: The admin UI and the React embed show the theme-aware symbol next to the title (a host logoUrl still replaces it), and the standalone UI ships the new favicon set. The old PNG logos (logo.png, logo-128.png, logo-256.png, favicon.png) are gone from docs/assets/; the README uses the SVG lockups
  • Pre-commit formatting skips .mdx and tolerates commits touching only fmt-ignored files (d4c9ed3)

compare changes

compare changes

  • react: Embedded dashboard resolves to one theme; theme=“inherit” follows the host (de6600e)
  • release: Npm trusted publishing (OIDC) + manual re-publish of a tag (63f8530)

compare changes

  • elysia: Elysia 2 support via @xtandard/flags/elysia2 (b5405ef)

compare changes

  • react: Scope the embed stylesheet so it can’t leak into the host app. @xtandard/flags/react/styles.css was a full, unscoped Tailwind v4 build — its preflight resets (*, button, h1, a, tables) and generic utilities (.flex, .border, …) restyled the entire host page, not just <FlagsDashboard/>. Every rule is now scoped under the embed’s .xtandard-flags wrapper (preflight and utilities included), with the design tokens re-homed onto the wrapper and a build guardrail that fails if any rule escapes the scope. Base UI portals (Select/Combobox popups, Dialogs) now render inside the wrapper too, so they stay styled under the scoped stylesheet. The standalone SPA bundle (dist/ui) is unchanged.

compare changes

  • snapshots: Guarded deletion + configurable retention (count and/or age) — deleteSnapshot in core/API/UI/CLI (never the active or latest version; the delete stays on the audit record), plus a retention policy ({ snapshots/audit: { keepLast?, maxAge? } }, union-of-keeps) applied after each publish with SNAPSHOT_/AUDIT_KEEP_LAST/_MAX_AGE env support. The removed payloads are surfaced to after hooks (snapshot.deleted, audit.pruned) for offloading. (d2977c5)
  • storage: createRedisJSONStorage — native RedisJSON documents (JSON.SET/JSON.GET) on the same storage/redis subpath, making stored snapshots/drafts JSONPath-queryable and RediSearch-indexable (server needs the JSON module: Redis 8 / Redis Stack; zero new client deps). (9fa002f)
  • react: initialProjectKey/initialEnvironmentKey on <FlagsDashboard/> — embed hosts can pre-select where the dashboard opens (URL ?project=/?env= still wins). (6de66ce)
  • demo: The seeded demo (bun run demo) showcases snapshot deletion — several deletable versions, a pre-deleted v2 in the audit, protected active/latest. (b455ace)
  • examples: One-command runner for the react-embed example (bun run examples:react-embed). (9df10dd)

compare changes

  • storage: Make the Drizzle exports compatible with [email protected] beta — widen the peer range (>=0.44.0 || >=1.0.0-0) and return the portable DrizzleKvTable from the *FlagsTable factories so their .d.ts no longer freezes the 0.45 PgColumn brand (fixes TS2883/TS2322 for consumers on 1.0.0-beta.x). Verified against both 1.0.0-beta.22 and 0.45.x. (8397b69)

compare changes

  • hooks: Control-plane before/after hooks on the admin core (throw to deny; best-effort side effects) (e40d149)
  • hooks: Map before-hook denials to HTTP status via HookDeniedError (8bf47ef)
  • hooks: Bundled hooks/webhook (HMAC + retry) and hooks/log reference adapters (4ae1dba)
  • hooks: Pinned flag tests that gate publishing (hooks/test-gate + Flag.tests) (b117e8b)
  • eval: onEvaluation runtime-plane observer for usage/exposure (in-process provider + OFREP) (70ea275)
  • embed: Cross-origin support for the embedded dashboard (credentials/fetch props + panel cors) (cc6a15c)
  • storage: Drizzle adapter (storage/drizzle) + drizzle/{pg,mysql,sqlite} table factories (1649545)
  • storage: Composable withWatch + pgListenNotify — add watch to any storage from any change source (17dab87)
  • hooks: Map HookDeniedError from separate bundles by name, not instanceof (723121c)
  • examples: Map @xtandard/flags/hooks/* to source in examples tsconfig (20760de)
  • hooks: Add docs/HOOKS.md + runnable examples/hooks (all hook flavors incl. onEvaluation) (3839a16)
  • embed: Document CORS ownership — mount vs plugin, no double-up (b0c12d6)
  • storage: Make watch coverage explicit (which adapters self-notify) + withWatch override behavior (e9b3325)

compare changes

  • cli: Complete --help (all env vars/drivers, options, examples) + add --version (08b9bc6)
  • Complete env/driver reference (incl. sqlite) + clarify the xtandard-flags binary vs @xtandard/flags package (9274cba)

compare changes

  • ofrep: Full OpenFeature compliance — ETag/304, flag metadata, opt-in SSE (4efae2e)
  • examples: One-command runner for the polyglot OFREP clients (f0b8ad8)
  • ci: Exclude cli.ts from coverage; add pre-commit + pre-push hooks (8bdb873)
  • examples: OFREP client example + polyglot Python/Go/plain-TS clients (d22157b, a90ad9b)
  • examples: Auth + authorization flexibility demo (cd5bc54)
  • readme: Frame the two evaluation paths — in-process (recommended) vs OFREP (53a2d47)

compare changes

  • cli: Print resolved storage location on serve startup (19cc902)
  • ci: Exclude changelogen’s CHANGELOG.md from the format check (8810808)
  • release: Publish the GitHub Release even when changelogen pre-created a draft (b85c7a5)

compare changes

  • Align npm keywords with the GitHub topics (094e0a7)
  • release: Create a GitHub Release on tag push (80ce518)