Product requirements

Benchdog: plan

Benchdog is a feature flag library for the front end and the back end.

Status
Building
Owner
Joe Gaudet
Created
Updated
One-pager
None
Related
None

Summary

Benchdog is a feature flag library for the front end and the back end. It has first-class Ember support, and backends for TypeScript (Node, Express, Fastify, Hono, NestJS, Next.js, Remix), Rails and Django. It has the standard gates (boolean, actors, groups, percentage of actors, percentage of time, expressions), variants and JSON values, segments, environments, scheduled changes, approvals, an audit log and a control dashboard.

A bench dog is a peg that you raise or drop into a hole in the workbench. When it is up, it holds the work. When it is down, the bench is clear. That is a feature flag.

  • Repo: joegaudet/benchdog (new), in ~/dev/benchdog. One polyglot monorepo.
  • Site: https://joegaudet.com/benchdog/. Guide: https://joegaudet.com/benchdog/guide/.
  • npm scope: @benchdog-ts/* (as @switchyard-ts, @jig-ts, @harnessed-ts). The packages benchdog, @benchdog/core and @benchdog-ts/core are free on npm (checked 2026-12-01). The scope itself is not confirmed free; see Risks.
  • RubyGems: benchdog, benchdog-rails (free, checked 2026-12-01).
  • PyPI: benchdog, benchdog-django, benchdog-fastapi, benchdog-celery (free, checked 2026-12-01). django-benchdog is also free.
  • Baselines (proposed, Joe approves in Phase 0): Node 22.12+, Ember 6+ with Embroider + Vite and .gts, Ruby 3.3+ and Rails 7.1+, Python 3.11+ and Django 4.2 LTS+.

Glossary

Not recorded in the original plan.

Problem and context

Not recorded in the original plan.

Goals and non-goals

Not recorded in the original plan.

Customers

Not recorded in the original plan.

Internal stakeholders

Not recorded in the original plan.

Users and scenarios

Not recorded in the original plan.

Landscape and constraints

Examples that this plan follows

Example Where What Benchdog takes from it
Flipper github.com/flippercloud/flipper The gate model, the adapter and cache layers, the UI mounted by the host, the HTTP API shape, and the CRC32 bucket function. Ideas only.
django-waffle github.com/django-waffle/django-waffle Flags, switches and samples, template tags, and test overrides on the Django side.
OpenFeature openfeature.dev Value types (boolean, string, number, object), evaluation context, evaluation details and reasons, the provider interface.
Unleash, LaunchDarkly their public docs Environments, segments, prerequisites, scheduled changes, approvals, streaming, stale-flag reports.
Switchyard ~/dev/switchyard The repo template (pnpm workspace, changesets, ci.yml, pages.yml, release.yml, docs/site, docs-app, packages/skills).
Jig ~/dev/jig, JIG_PLAN.md The plan shape, and the Jig panel API for the Benchdog panel.
Formwright, Joinery ~/dev/sy-formwright, ~/dev/sy-joinery Site layout and type. Joinery builds the dashboard shell. Formwright builds the dashboard forms.
harnessed ~/dev/harnessed Harnesses for the dashboard and the Ember components, so tests read the same in QUnit, Playwright and Jig.
Workbench site ~/dev/wt-site-workbench The tool card, the fit diagram, _tests/tools.mjs and the release gates (links, Lighthouse, screenshots).

Proposed design

Design notes

Bucket function (Flipper compatible)

Flipper buckets an actor with Zlib.crc32("#{feature_name}#{actor_id}") % 100_000 < percentage * 1_000 (lib/flipper/gates/percentage_of_actors.rb, read 2026-12-01). For more than one actor, it sorts the ids and joins them. Benchdog uses this exact function for the percentage-of-actors gate. Thus a 25% Flipper rollout gives the flag to the same actors after a move to Benchdog.

  • CRC32 is in the Ruby and Python standard libraries. The TS core has a small CRC32 function.
  • Variants use the same function with a different salt: "#{flag_key}:variant#{actor_id}". Segment rollouts use "#{flag_key}:#{rule_id}#{actor_id}".
  • The vectors include Flipper's own results, so a change to the function fails CI in each language.
  • Unleash and LaunchDarkly use other hashes (Unleash uses MurmurHash3). An import from them moves actors to different buckets. The importer shows a warning and the count of actors that change.

Capability matrix

Foreign backends cannot store all of the Benchdog model. For example, Flipper has no variants or JSON values, and LaunchDarkly keeps its own audit log and approvals. Thus each backend declares a set of capabilities:

boolean, actors, groups, percentageOfActors, percentageOfTime, expressions, variants, jsonValues, segments, environments, schedules, approvals, prerequisites, nativeAudit, write.

  • The admin API serves GET /capabilities. The dashboard hides the controls that the backend cannot support.
  • A write that needs a missing capability fails with a typed error. It does not fail silently.
  • When the backend has no audit log, Benchdog writes its own log to a side store. It marks the changes that it did not see (made outside Benchdog) as "external".

Three Flipper features are separate. Do not mix them:

Feature What it does Package
Flipper backend Benchdog reads and writes Flipper's tables or Flipper Cloud. benchdog-flipper (gem), TS
Flipper importer A one-time copy of Flipper data into the Benchdog store. benchdog CLI
Flipper API compat Benchdog serves the Flipper HTTP API, so Flipper clients can connect. admin API, each host

Conformance (three suites)

  1. Evaluation vectors (spec/vectors/eval/): flag data + context in, value + reason out. Every core runs them: TS, Ruby, Python.
  2. Admin API contract (spec/openapi.yaml, spec/vectors/admin-api/): an HTTP test suite that runs against each host. These are the Express, Fastify, Hono and Nest middlewares, the Next and Remix handlers, the Rails engine, the Django app, the FastAPI and Flask apps, and the server. The dashboard works only on hosts that pass it.
  3. Audit chain vectors (spec/vectors/audit/): each entry hash is SHA-256 over the RFC 8785 canonical JSON of the entry plus the previous hash. All languages must make the same hashes. If not, benchdog audit verify fails on a log written by a different stack.

The stores also have a shared adapter suite in each language: the same tests for every store.

Workers for scheduled changes

Scheduled changes, ramps and approval expiry need a worker in each host:

  • Rails: ActiveJob (any queue), with a Sidekiq option.
  • Django: a management command for cron, with a Celery beat option.
  • Node: an in-process scheduler for long-running servers.
  • Serverless: an HTTP route that a cron calls (Vercel cron, Cloudflare Cron Triggers).

The evaluator also checks schedules at read time. Thus a late worker cannot leave a flag in the wrong state. The worker only writes the change and its audit entry.

Front-end payload

The host evaluates all client-visible flags for the actor. It puts the result in the page (a <script type="application/json"> tag) or serves it at GET /benchdog/client. A flag is visible to clients only when it has the client tag. The vanilla client reads the payload and can listen for SSE updates. The Ember, React, Vue and Svelte packages use the vanilla client.

Target layout

benchdog/
  spec/                      SPEC.md, schema/*.json, openapi.yaml, vectors/{eval,bucket,audit,admin-api}
  packages/                  TypeScript (pnpm workspace, @benchdog-ts/*)
    core                     evaluator, client API, store/cache/sync interfaces, memory store, CRC32
    admin-api                framework-neutral admin + client HTTP handlers, roles, audit writer
    store-prisma             Prisma schema fragment + adapter (Postgres, MySQL, SQLite)
    store-drizzle            Drizzle tables + adapter (also Neon, PlanetScale, Turso HTTP drivers)
    store-mongo, store-dynamo
    store-upstash, store-cloudflare (KV + D1), store-vercel (Global Config)
    cache-redis              ioredis / node-redis / Valkey, pub/sub sync
    cache-memcached
    sync-pg                  Postgres LISTEN/NOTIFY
    sync-sse                 snapshot + SSE client and server
    express, fastify, hono, nestjs, next, remix
    backend-flipper, backend-unleash, backend-launchdarkly, ...
    openfeature              server provider + web provider
    client                   vanilla browser client
    ember, react, vue, svelte
    dashboard                Ember app (Joinery, Formwright, Switchyard), built to a static bundle
    harnessed                harnesses for the dashboard and the Ember components
    jig                      Jig panel
    cli                      import, export, code references, audit verify, scheduler run
    server                   standalone server (Hono on Node, Docker image), OIDC, API tokens
    skills                   Claude skills, as in the siblings
  ruby/                      gems: benchdog, benchdog-rails, benchdog-sidekiq, benchdog-redis,
                             benchdog-flipper
  python/                    packages: benchdog, benchdog-django, benchdog-fastapi, benchdog-flask,
                             benchdog-celery, benchdog-redis, benchdog-waffle
  docs/site/                 marketing site (static, as the siblings)
  docs-app/                  the guide (Ember), with a live dashboard on an in-browser memory store
  test-apps/                 ember, rails, django, express, next, ... (each runs the contract suite)

The gem and the Python packages include the built dashboard bundle. A build step copies it from packages/dashboard/dist.

Rest of the ecosystem

  • Each sibling docs/site: add Benchdog to the sibling links.
  • harnessed: @benchdog-ts/harnessed ships harnesses. A flag can be set inside a harnessed test.
  • Jig: the Benchdog panel lets a story author switch flags while they look at a story.
  • Switchyard: the approval flow and the dashboard state are Switchyard machines.
  • real-enums: environment names and roles are real-enums in the TS packages.

User interface and prior art

Marketing site and guide

  • Site (docs/site, sibling layout and type): a hero with a live dashboard demo, sections with code for Ember, Rails, Django and Node, a "from Flipper" page, a comparison table (Flipper, waffle, Unleash, LaunchDarkly), sibling links, logo, favicon, social card.
  • Guide (docs-app, at /benchdog/guide/): quick starts for each stack, concepts (gates, rules, bucket function, environments), each store and cache mode, the dashboard and roles, audit, testing, migration from Flipper and waffle, API reference, llms-full.txt.
  • The guide embeds the real dashboard on an in-browser memory store, so readers can change flags.

Done in docs/joe/guide-app (2026-12-01):

  • The guide is the docs-app Ember app with Kolay, the same structure as the Formwright and Marquetry guides: one markdown page for each topic in app/templates/<section>/, a meta.json for the order, Shiki for code, the sibling header, sidebar and footer.
  • The sections: Getting Started, Concepts, Servers, Front Ends, Operations, More.
  • pnpm guide:build writes docs/site/guide/ and docs/site/404.html (not in git), and pnpm site:build puts them in _site/ with the demo. pnpm typecheck and pnpm test:ember include docs-app.
  • The Evaluation page runs the real evaluate from @benchdog-ts/core in the page. The guide links the dashboard demo; it does not embed it yet.
  • The landing page has the sibling nav and the footer with the sibling links.
  • Gates: link checker, Lighthouse (95 or more for performance and accessibility), screenshots.

Workbench site (~/dev/wt-site-workbench)

  • _tests/tools.mjs: add benchdog with status bench and anywhere: true (it also runs in Rails and Django). Change it to shipped with links only at release.
  • ember-workbench/index.html: the meta description (line 9), the JSON-LD tool list (about line 132), the logo nav (about line 195), a new tool card, and both fit-diagram SVGs (desktop about line 292, phone about line 334).
  • New files: images/logos/benchdog.svg, images/tools/benchdog.webp. Run ember-workbench/_src/render-cards.sh after the change.
  • Update sitemap.xml. Run npm test, npm run links, npm run lighthouse and npm run screenshots in _tests/.
  • Diagram placement (decided 2026-12-01): a horizontal band under "your Ember app" named "your backend", with Benchdog across both the app and the backend. Add --benchdog: #15803d (dark #4ade80) to site.css.

Requirements

Not recorded in the original plan.

Data model and API changes

Not recorded in the original plan.

Security and permissions

Not recorded in the original plan.

Observability and success metrics

Not recorded in the original plan.

Rollout and migration

Not recorded in the original plan.

Work items

Phases (one PR each; main stays green; test first)

The full matrix is large. Phases 1 to 7 make a thin vertical slice: spec, TS core, one store, one cache, one host, Ember, dashboard and site. Each later phase adds one area and must pass the conformance suites.

Phase 0: Scaffold and decisions

  • Copy the Switchyard repo template. Add ruby/ and python/ with their own lint, type and test tools (RuboCop, Sorbet or Steep, RSpec; Ruff, mypy, pytest).
  • CI matrix: Node, Ruby, Python, and Postgres, MySQL, SQLite and Redis services.
  • Decided 2026-12-01:
    • Baselines: as in the header (Node 22.12+, Ember 6+, Ruby 3.3+ / Rails 7.1+, Python 3.11+ / Django 4.2 LTS+).
    • Accent: green #15803d, dark-mode tint #4ade80, with the family amber. No sibling uses green. (Brass #b45309 is the Joinery tint.)
    • Logo: a bench top in section with one round peg raised out of its hole. It must read at 16px.
    • Workbench diagram: a new "your backend" band under "your Ember app". Benchdog crosses both.
  • setup-benchdog.sh (in ~/dev) claims the npm org and the GitHub repo.

Phase 1: Spec and vectors

  • SPEC.md: flag model, gates, rule order, variants, segments, environments, prerequisites, schedules, evaluation reasons (OpenFeature names).
  • JSON schema for flag data and for the client payload.
  • Vectors: bucket function (with Flipper's own results), evaluation, audit chain.
  • openapi.yaml for the admin and client API.

Done in feature/joe/spec-vectors (2026-12-01):

  • Expressions use the Flipper expression JSON format, with one Benchdog extension (Segment). A writer refuses an empty All or Any, as Flipper 1.5 does.
  • Percentage gates use Flipper's float comparison (bucket < pct * 1000) with no rounding.
  • spec/tools/flipper-oracle.rb checks the Flipper-compatible vectors against Flipper 1.5.1. All 55 such cases agree. spec/tools/audit-vectors.py makes the audit vectors.
  • The spec version is 1.

Phase 2: TypeScript core

  • Evaluator that passes all vectors. Memory store. Store, cache and sync interfaces.
  • Typed flag declarations (defineFlags) so enabled('nme') is a type error.
  • Shared store-adapter test suite.

Done in feature/joe/ts-core (2026-12-01):

  • evaluate, the expression functions, bucket and the audit chain pass all vectors.
  • createBenchdog keeps a snapshot of one environment and evaluates without I/O. A ChangeFeed or a poll interval loads it again.
  • FlagStore.write applies a change and appends its audit entry in one step.
  • A flag that serves a variation that it does not have gives INVALID_FLAG (spec change, same spec version, because version 1 is not released).

Phase 3: Prisma store and cache

  • Prisma adapter, tested on Postgres, MySQL and SQLite.
  • Memory cache and Redis cache, with Redis pub/sub invalidation.

Done in feature/joe/prisma-redis (2026-12-01):

  • packages/store-tests is the shared store contract (9 tests). MemoryStore, PrismaStore (SQLite, PostgreSQL, MySQL) and cachedStore (ioredis, node-redis) pass it.
  • PrismaStore ships its models as Prisma schema files that an app copies into its schema folder. The audit primary key (environment, seq) serializes writers; the loser tries again.
  • cachedStore keeps the flag set in Redis with a random token for each write, so a slow reader or two writes out of order cannot make other processes use an old set.
  • pnpm test needs no database. pnpm test:databases and the CI databases job run the contract on real PostgreSQL, MySQL and Redis.
  • Prisma 7 refuses db push --accept-data-loss from an AI agent. The tests do not use that flag: each run makes its tables in an empty database.

Phase 4: Admin API and Express

  • admin-api handlers, roles from a host hook, the audit writer (with the hash chain).
  • Express middleware. The contract suite runs against it.

Done in feature/joe/admin-api (2026-12-01):

  • packages/api-tests is the HTTP contract (23 tests) with a fixed fixture of users, roles and environments. It uses only fetch, so a Rails or Django test server can run it too.
  • @benchdog-ts/admin-api is one Fetch handler. Its validators are compiled from the spec at build time (no new Function, for edge runtimes); a test fails if they drift from the spec.
  • @benchdog-ts/express passes the contract on plain Express and after express.json().
  • Approvals (202 on a protected environment) come in Phase 8.

Phase 5: Ember and vanilla client

  • Vanilla client: payload in the page or from the endpoint, SSE updates.
  • @benchdog-ts/ember: service, helpers, <Flag>, route guards, test helpers.

Done in feature/joe/ember-client (2026-12-01):

  • @benchdog-ts/client: payload from the page or GET /client, live updates on GET /stream, overrides (optionally in localStorage).
  • @benchdog-ts/ember: the benchdog service (re-exported into the app), enabled and flagValue helpers, <Flag>, requireFlag, <BenchdogToolbar /> (the dev override toolbar moved here from Phase 6), and test-support.
  • test-apps/ember runs the QUnit tests in headless Chrome. The root ESLint config does not lint .gts or the Ember packages yet; ember-tsc type-checks them. Lint for them is an open item.

Phase 6: Dashboard

  • Flag list and search, flag page (gates, variants, JSON values, rules), environments and promotion, audit log view, role checks.
  • Dev override toolbar for Ember apps.
  • harnessed harnesses for the dashboard and for <Flag>. Dashboard tests use them.

Done in feature/joe/dashboard (2026-12-01):

  • apps/dashboard (Joinery components, Formwright forms) builds into @benchdog-ts/dashboard: static files with relative paths and hash routes, so any host can mount them.
  • Pages: flags by environment with search, the gate form, kill switch, promotion, the flag's history, a new-flag form, and the audit log with chain verification. Roles hide or disable what a user cannot do.
  • The tests run the real admin API handler on a MemoryStore inside the browser (13 tests). pnpm dashboard:demo serves the dashboard on Express with seeded flags.
  • Open items: variations, rules and schedules show as JSON and are not editable yet; harnessed harnesses for the dashboard; Switchyard is not used yet (the approval flow in Phase 8 is the first machine).

Change in test/joe/harnessed-should-and-stories (2026-12-03): <Flag> renders no element of its own, so a harness for it has no host element. The plan item "harnessed harnesses for <Flag>" changes to ToolbarHarness and ToolbarFlagHarness in @benchdog-ts/ember/test-support. A test of a <Flag> uses the harness of the content that the flag shows. The Jig stories for <Flag> and <BenchdogToolbar> are at /benchdog/stories/.

Done in feature/joe/dashboard-design (2026-12-01):

  • The dashboard has a new design in the style of the Stripe Dashboard: a sidebar with icons, cards on a grey page, status pills with a dot, and an orange band and pill for production. On a phone the sidebar becomes a top bar.
  • Formwright uses the brand green also in dark mode, and its fields have a focus ring.
  • The green and amber text in light mode uses darker colours, for WCAG AA contrast.

Done in feature/joe/audience (2026-12-02):

  • The admin API takes an audience option: groups (key and description), actorTypes (type and label) and lookupActors(query, user). It adds GET /audience, GET /actors and GET /flags/<key>/check, and GET /capabilities has audience: true. Evaluation does not change. The routes are in spec/openapi.yaml, and the guide has a section on them.
  • The dashboard flag page uses the API: a chip field with a name lookup for actors, a check box list of the known groups, sliders for the percentages, one save bar with the reason, and a side panel that says who gets the flag and checks one actor. A new Audience page lists the groups and the actor types. It is read-only. The expression gate and the rules use a row form for each condition, and a switch between the visual editor and JSON.
  • Decision (made by the assistant on 2026-12-02; Joe has not confirmed it, so he can reverse it): a group that a user keeps in the dashboard with a list of members is NOT in this change. The reasons: it needs storage for the members in each store, and a change in each host to read that storage. A segment already gives an audience that a user edits in the dashboard. Groups stay as functions that the app registers in code.
  • Done in feature/joe/actor-list-segments (2026-12-02): a list of actors that a user keeps in the dashboard is a segment of the kind "Actor list". The dashboard saves it as an Any of Equal on flipper_id, which is the actor id in each expression (SPEC section 5.6). Each core evaluates it with no change to the spec, the vectors, the stores or the admin API. The Segments page edits it with the actor field, and the Audience page lists the actor lists. Joe said "Finish everything" for the open items on 2026-12-02; the choice of a segment for this is the assistant's, and Joe can reverse it. A group stays a function in code.

Phase 7: Site, guide, first release (0.1, TypeScript slice)

  • docs/site landing page and docs-app guide (see Marketing site and guide).
  • Workbench card with status bench.
  • Release with the oss-release skill.

Done in feature/joe/site-guide (2026-12-01):

  • The landing page embeds the live demo: the built dashboard in demo mode (<meta name="benchdog-api" content="demo:memory">) runs the real admin API on a store in memory in the browser. scripts/build-site.mjs builds _site/ for Pages.
  • The guide was first one static page (docs/site/guide/). It is now a docs-app guide, as in the plan and the siblings (see Marketing site and guide).
  • The first release and the Workbench card wait for Joe (see Risks).

Phase 8: Lifecycle

  • Scheduled changes and ramps, with the workers in this phase for Node and the cron route.
  • Approvals: a Switchyard machine for the request (draft, pending, approved, applied, rejected).
  • Prerequisites, kill switch.
  • Stale flags: last-evaluated data (sampled, written in batches), dashboard report, benchdog refs CLI that finds flag keys in code.

Done in feature/joe/lifecycle (2026-12-01):

  • Schedules: applyDueSchedules writes due steps with a schedule.apply entry (the evaluator already applies them at read time, so no result changes); startScheduler for Node; POST /cron/schedules with a secret for serverless.
  • Approvals: in a protected environment a change answers 202 and waits; a second person with the approver role approves (approval.approve in the audit log) or rejects it. The kill switch never waits. ApprovalStore with a memory version; the database versions come with the stores. Change from the plan: the server uses a small state check, not a Switchyard machine.
  • Prerequisites: the API refuses a prerequisite on a missing flag or variation.
  • Stale flags: the client counts evaluations in memory and writes them to a UsageStore at an interval; GET /usage and the dashboard show the last use and mark stale flags.
  • @benchdog-ts/cli: benchdog refs and benchdog audit-verify.
  • The dashboard has an Approvals page and shows "sent for approval".

Phase 9: Audit extras

  • benchdog audit verify, webhooks (signed), Slack and Teams, CSV and JSON export, log sinks (Datadog, S3, a generic HTTP sink).

Done in feature/joe/audit-sinks (2026-12-01):

  • withAuditSinks(store, sinks) sends each new entry to each sink after the write; a failing sink reports to onError and never fails the write.
  • Sinks: webhookSink (HMAC-SHA256 signature, verifyWebhookSignature for receivers), slackSink, teamsSink, httpSink (Datadog, an S3 gateway, any JSON endpoint).
  • GET /audit/export?format=csv|json and auditCsv.

Phase 10: Release pipeline for gems and wheels

  • Extend the oss-release skill (~/.claude/skills/oss-release) for RubyGems and PyPI trusted publishing. One release.sh command still releases all three registries.

Done on 2026-12-02, without trusted publishing for now:

  • release.sh publishes each gem (ruby/*/*.gemspec) and each Python package (python/*/pyproject.toml) whose version the registry does not list yet. It builds them from main, after pnpm run prepack:native. gem push asks for the RubyGems login and OTP, and PyPI needs an API token (UV_PUBLISH_TOKEN, or the script asks).
  • prepack:native (scripts/bundle-dashboard.sh) copies the dashboard build into benchdog-rails and benchdog-django. Each host serves that copy when dashboard_dir is not set.
  • Versions: the gems share Benchdog::VERSION, and the two Python packages share one version. Each language has its own version, separate from the npm packages. To release, change the version by hand. The first release is 0.1.0. benchdog-django pins benchdog to the same version.
  • Still open: trusted publishing for RubyGems and PyPI in release.yml.

Done in feature/joe/ruby-python-cores (2026-12-01), the first part of Phases 11 and 12:

  • The Ruby gem and the Python package evaluate flags, compute buckets and check the audit chain. Each passes every shared vector (Ruby 180 examples, Python 177 tests), with Steep and strict mypy and no suppression comments. The three cores now give the same answers.
  • Python needs care: True == 1, so each number check excludes bool.

Phase 11: Ruby and Rails

  • benchdog gem core (passes all vectors), ActiveRecord store, Redis cache.
  • benchdog-rails: engine that mounts the dashboard, the admin API, view helpers, a controller concern for the actor, ActiveJob worker, generators for migrations.
  • benchdog-sidekiq. benchdog-flipper: backend, importer, and Flipper API compat.
  • The contract suite runs against a Rails test app.
  • Multi-database support (Flipper Pro parity): the ActiveRecord store takes an explicit writing and reading connection (connects_to), works with read replicas and the DatabaseSelector middleware, and reads its own writes after a change in the same request.

Done in feature/joe/rails (2026-12-02): the Ruby core has the store, the client and the admin API as a Rack app. benchdog-rails has the ActiveRecord store, the engine, the generator, the controller concern and the helpers. benchdog-flipper has the Flipper store, the importer and the Flipper HTTP API (so the Flipper API compat is done for Ruby only). The contract passes on the Rack app and on test-apps/rails (38 of 38 each). Decisions:

  • CAPABILITY_MISSING is status 422. The Flipper store has boolean, actors, groups, percentageOfActors, percentageOfTime, expressions and write.
  • The Flipper HTTP API leaves out a flag that Flipper cannot show, and a read of it gives 422 with the code 100. Each write has the audit actor flipper-api.
  • Still open: multi-database support, the ActiveJob worker, benchdog-sidekiq, an audit side store in the database, "external" marks for changes outside Benchdog, and approvals and the stream feed across processes. The gem does not include the dashboard until Phase 10.

Phase 12: Python and Django

  • benchdog core (passes all vectors), Redis cache.
  • benchdog-django: app with models and migrations, middleware, template tags, admin API views, dashboard mount, management command worker.
  • benchdog-fastapi, benchdog-flask, benchdog-celery. benchdog-waffle: backend and importer.
  • The contract suite runs against a Django test app.

Done in feature/joe/django (2026-12-02): the Python core has the store, the client, schedules and a framework-free admin API handler. benchdog-django has the ORM store, the URLs, the middleware, the flag_enabled tag and the benchdog_schedules command. The contract passes on the core handler and on test-apps/django (38 of 38 each). Decisions:

  • The Django API view does not use the CSRF check. A write without Authorization or X-Benchdog-Source is not signed in.
  • /stream reads the store version each second, so it sees writes from all worker processes.
  • Approvals are in a table, so all workers see them.
  • Still open: the usage store (/usage gives count: 0), FastAPI, Flask, Celery, waffle and Redis. The wheel does not include the dashboard until Phase 10.

Phase 13: More TS hosts

  • Fastify, Hono, NestJS (module, service, guard decorator), Next.js (route handlers, server components), Remix. One PR for each.

Done in feature/joe/ts-hosts (2026-12-01):

  • @benchdog-ts/hono, fastify, next, remix and nestjs. Each passes the full HTTP contract (33 tests), with the fixture shared from api-tests/fixture.
  • NestJS: useBenchdog(app, path, options) mounts the Express middleware. A route guard needs legacy decorators; the core packages use none, so it waits for a request from a Nest user.

Phase 14: More stores

  • Drizzle (with the Neon, PlanetScale and Turso HTTP drivers), MongoDB, DynamoDB, Upstash, Cloudflare KV and D1, Vercel Global Config. One PR for each.

Phase 15: Server and cache modes

  • Standalone server: Docker image, OIDC SSO, API tokens.
  • Snapshot + SSE mode. TTL read-through mode. Memcached, Valkey, Postgres LISTEN/NOTIFY.
  • Ruby and Python get the same modes.

Phase 16: More front ends

  • React, Vue and Svelte packages. OpenFeature web provider. Jig panel.

Done in feature/joe/frontends (2026-12-01):

  • @benchdog-ts/react (provider and hooks on useSyncExternalStore), @benchdog-ts/vue (createBenchdogPlugin and composables), @benchdog-ts/svelte (stores). Each keeps the app's flag types.
  • @benchdog-ts/openfeature: the server provider (from a client snapshot) and the web provider (from the payload), tested with the real OpenFeature SDKs. This takes the TypeScript part of Phase 17's OpenFeature work.
  • The Jig panel waits until Jig has a public panel API.

Phase 16b: Flipper Pro parity

Each feature on https://www.flippercloud.io/docs/pro/features that Benchdog did not have (checked 2026-12-01). The audit log, the self-hosted dashboard and Slack notices were already done. Multi-database support is in Phase 11.

  • Feature owners. An optional owner string on a flag (a team, a person or an email). The spec, the schema and the TS type get the field. It has no effect on evaluation, so the Ruby and Python cores need only a vector that shows that. The dashboard shows the owner in the flag list, filters by owner, and edits it on the flag page and the new-flag form.
  • Group preload (large actor sets). The evaluation context gets an optional memberOf array: the names of the groups that the actor is a member of. (It is not called groups, because groups is already the registry of predicates.) When memberOf is present, the group gate uses only that list and does not call the registered predicates (SPEC section 5.5). The vectors fix these cases: in the list but the predicate is false → on; predicate true but not in the list → off; an empty list → off; a list but no actor → off (the group gate needs an actor). These vectors have "flipper": false, so the Flipper oracle skips them. New vectors and all three cores change in the same PR. The TS client gets client.groupsFor(actor), which runs each registered predicate once, so an app can compute the memberships once for each request. spec/VERSION stays at 1: nothing is published yet, and the field is optional.
  • Call sites. benchdog refs gets --json output and repeatable --path options (the search paths). The admin API takes a references option (the object that benchdog refs --json prints, or an async function that gives it) and serves GET /references. Without the option, the route gives 404, the same as a host that does not have the route yet (Rails, Django). The dashboard shows the references on the flag page, with deep links for VS Code, Cursor, Zed, RubyMine, WebStorm and Sublime Text. Each viewer selects the editor; the browser keeps the choice.
  • Rule editor (Expressions UI). A visual editor in the dashboard for gates.expression, the targeting rules and the segments: conditions (property, operator, value), All and Any groups that can nest, segment references and percentage-of-actors conditions. An expression that the editor cannot show opens in a JSON editor, so no data is lost. A segments page lists, edits and deletes segments.
  • Site and guide. The landing page and the guide describe the four features. The comparison shows Flipper Pro parity.

Owners need no migration: the stores keep each flag as JSON. An owner change is a flag update, so it writes an audit entry. The deep links need an absolute path, so each viewer also sets the root of their local checkout in the dashboard. In production the source is usually not on the server, so the main way to supply references is benchdog refs --json at build time. The segment delete already refuses a segment that a flag uses (409).

Four stacked PRs: (1) spec change: owners and memberOf, with vectors, the three cores, the schema, the validators and the owner in the dashboard; (2) call sites: CLI, API route, contract, dashboard; (3) rule editor and segments page; (4) site and guide.

Phase 17: Foreign backends and OpenFeature

  • OpenFeature server providers in TS, Ruby and Python.
  • Backends and importers: Unleash, LaunchDarkly, then GrowthBook, Flagsmith, ConfigCat, PostHog. Each one declares its capabilities.

Phase 18: 0.x to 1.0

  • Freeze the spec, the schema and the admin API. Publish a stability policy.

Future work and research

Not recorded in the original plan.

Alternatives considered

Decisions (from the 20-question intake, 2026-12-01)

Product

  1. Name: Benchdog.
  2. Model: a library with pluggable backends. Joe's words: "support everything, but also provide our own back end". Benchdog has its own store. It also has backends that use Flipper, waffle and central services (Unleash, LaunchDarkly and others) as the source of truth.
  3. Parity: one written spec, a JSON schema for flag data, and shared JSON test vectors. Each language must pass all vectors.
  4. Compatibility: Flipper-style gates, OpenFeature providers, importers (Flipper, waffle, Unleash, LaunchDarkly), and the Flipper HTTP API shape.

Flag model

  1. Value types: boolean, variants (A/B/n with weights), and typed JSON values (string, number, object). These match the OpenFeature value types.
  2. Targeting: groups registered in code (Flipper style) and segments built in the dashboard from actor attributes. A rule can use both.
  3. Environments: one flag definition, with a separate state for each environment. The dashboard can copy a state to the next environment (promotion).
  4. Lifecycle, all in the first release line: scheduled changes and ramps, stale-flag detection (last evaluated, last value, code references), approvals (four eyes) on protected flags or environments, prerequisites, and a kill switch.

Backends and storage

  1. Ruby and Python: plain cores, then Rails and Django, then FastAPI, Flask, Sidekiq and Celery.
  2. TypeScript servers: Express, Fastify, Hono, NestJS, Next.js and Remix.
  3. TypeScript stores: Prisma, Drizzle, MongoDB and DynamoDB. Postgres, MySQL and SQLite come through Prisma and Drizzle.
  4. Serverless and edge stores: Upstash Redis (HTTP), Cloudflare KV and D1, Vercel Global Config, and Neon, PlanetScale and Turso HTTP drivers.

Cache and clients

  1. Cache and change propagation: all three modes, each optional. Joe's words: "Support all three optionally".
    • Layered: memory cache, then a shared cache (Redis, Valkey, Memcached), then the store. A change publishes an invalidation (Redis pub/sub or Postgres LISTEN/NOTIFY).
    • Read-through with a TTL.
    • Full snapshot in each process, with updates over SSE.
    • Polling is the fallback where a process cannot hold a connection (serverless).
  2. Front-end values: the server evaluates flags for the current actor and sends only the results. Rules and other actors stay private. SSE can push live updates.
  3. Ember: a benchdog service with tracked values, {{enabled}} and {{variant}} helpers, a <Flag> component, route guards, test helpers, harnessed harnesses, a dev override toolbar, and a Jig panel.
  4. Other front ends: a vanilla JS client, plus React, Vue and Svelte packages.

Audit, dashboard, repo

  1. Audit: an append-only log with before/after diffs and a required reason. Also webhooks, Slack and Teams, a hash chain for tamper evidence, and export to CSV, JSON and log sinks.
  2. Dashboard: one Ember app built with Joinery, Formwright and Switchyard. It ships as a static bundle. The Rails engine, the Django app, the TS middlewares and the Benchdog server mount it at /benchdog. All of them serve one admin HTTP API.
  3. Auth: the host app authenticates and returns a user. Benchdog maps the user to roles (viewer, editor, approver, admin) for each environment. The server mode adds OIDC SSO and API tokens.
  4. Repo: one polyglot monorepo. It publishes to npm, RubyGems and PyPI. One CI runs every conformance suite.

Risks

Risks and open items

  • npm scope. The @benchdog-ts scope returned 404 (free), but the npm org page returned 403, which is probably bot protection. Claim the scope in Phase 0 before any code uses it.
  • Flipper hash. If Flipper changes its bucket function, the compat vectors fail. Pin the Flipper version that the vectors come from.
  • Size. "Support everything" is a large matrix: 3 languages, about 15 hosts, about 12 stores, 3 cache modes, 4 front ends, 6 or more foreign backends. The conformance suites keep it correct. The phases keep each PR small. Some foreign backends can move after 1.0.
  • Foreign backends without write APIs. Some services do not let a client write all fields. Those backends are read-only in Benchdog, and the dashboard shows them as read-only.
  • Stale-flag writes. Last-evaluated data writes on the hot path. Sample it and write in batches, and make it optional.
  • Release tools. oss-release is npm only today. Phase 10 must finish before the first gem or wheel release.

Open questions

The original plan lists its open items under Risks.

Interview record

Each question of the interview with its answer and its source. A fact from the code or a document, a question that the author did not ask, and an assumption are rows too.

QuestionAnswerSource
Where does the text of this page come from?From the Markdown file BENCHDOG_PLAN.md at commit beba50d. The text of each section is the text of the Markdown file. A section that the Markdown file does not have says so.Document: BENCHDOG_PLAN.md

Changelog

DateAuthorChange
2026-12-01Joe GaudetCommit e22ed83: Add the Benchdog plan
2026-12-01Joe GaudetCommit ef2e4d9: Release 0.1: the TypeScript slice (#1 to #15) (#16)
2026-12-01Joe GaudetCommit 7dc0ed3: feat(dashboard): rule editor and segments page (Phase 16b, part 3) (#20)
2026-12-01Joe GaudetCommit e7a2ab9: feat: audience API, and a new flag form, Audience page and expression builder (#24)
2026-12-02Joe GaudetCommit 8788bdf: feat(dashboard): a segment can be an actor list, and an axe audit in the tests (#28)
2026-12-02Joe GaudetCommit 44f5d71: docs(guide): rebuild the guide as a Kolay docs-app (#27)
2026-12-02Joe GaudetCommit d83a8f9: feat: Rails, Django and Flipper backends, bundled dashboard, first gem and PyPI release (Phases 10 to 12) (#31)
2026-12-03Joe GaudetCommit 2881a79: test: toolbar harnesses, should checks and Jig stories (#33)
2026-12-04Joe Gaudet (agent)Converted from BENCHDOG_PLAN.md to this page. The text is the text of the Markdown file.
2026-12-04Joe Gaudet (agent)Status Building: the packages are at version 0.4.0 (packages/core/package.json), and the last phase (Phase 18, 0.x to 1.0) is not done. The Markdown file has no status line.

The prd skill of skillsaw wrote this page. The HTML in this file is the source of truth. The diagrams are the Mermaid sources in it.