All docs
docs / reference
Changelog
Every release and what changed.
On this page
Notable changes to Petri. The format follows Keep a Changelog, and versions follow Semantic Versioning.
Unreleased
Changed
- Petri Watch, proven on a staged incident: it caught an arm that stopped converting and named the right commit, while all 20 static rules passed (docs/watch.md).
- Fixed: numbers are grouped the same everywhere (2,323,204, not 23,23,204); the health line keeps the alert's time; "how many more users" says when an effect is too small to detect instead of quoting millions.
- Measured: the A/A simulation adds a harmful case (a variant 20% worse). Peeking ships it 1.9% of the time; Petri's single look and the sequential test, 0 of 2,000.
- Agent Skill: reads the health and Watch lines of
petri-check experiments(stale results, alerts first) and offers a stagedramprollout as pull requests. - MCP
petri_plan_changecan propose a stagedramp(flag, variant, percent) and the production opt-in;petri_rulecovers PETRI001–020. - Docs: a command overview in the CLI reference, sections for
lock, all offline rules listed, and the npm README lists every command.
0.1.5 (2026-11-28)
Extension 0.1.5 and petri-check 0.1.4 (CLI, MCP, Action).
Added
- Staged rollout: a
rampchange inpetri.plan.jsonserves the decided winner to a share of users (10 → 50 → 100), refused while an experiment still runs on the flag (measured: 10% → 12%, 50% → 44% of 200 sampled users). - Experiments as pull requests:
petri.plan.jsonwithpetri-check apply [--dry-run](idempotent; production needs"production": true), the Action'scommand: apply/dry_run, and the MCP toolpetri_plan_change(proposes an entry plus a dry run, changes nothing). petri-check rehearse: real visitors through the running app (cookie identities;--convert formfollows the page's form like a browser), then a recount of Flagsmith's enrolments and conversions. Refuses production; exits 1 on a mismatch with likely causes. Proven on a throwaway Flagsmith: 30/30, 15/15 on a correct shop, and 15 → 7 on one with an untracked checkout route.- Audience checks at launch: the start approval warns about other running experiments read in the same code, and segment overrides on the flag.
- PETRI017–020: a per-user variant in a cached/static response; a browser
event lost to navigation (no
flush()); Pythonmax_buffer_items=1; an experiment flag read from an SDK that sends no experiment events. All offline. - After completion: Watch alerts if users are still enrolled in a losing arm after an experiment was completed.
- PETRI016: the installed Flagsmith SDK predates the experiment API
(
@flagsmith/nodejs< 9.1.0,@flagsmith/flagsmith< 12.1.0, or a legacy package), so nothing is recorded. Offline; points atpackage.json. - End-to-end CI on self-hosted Flagsmith: every push boots Flagsmith with
experimentation, runs the bootstrap, creates the experiment, and runs
petri-checklive (clean, then a planted bug caught), plus lock, report and watch. - MCP prompt
wire_experiment: Petri's wiring checklist (one item per rule) for any agent setting up an experiment, ending with a required cleanpetri_check. - Peek-safe sequential test: a mixture SPRT on the hourly timelines gives
each variant an always-valid p-value (0.3% false ships under hourly peeking
in the A/A simulation). Shown in
experimentsandreport. - Health scorecard: traffic split (α = 0.001), arms vs variants, missing
conversions per arm, event storage, measurement continuity, treatment lock,
result freshness and novelty (early vs late lift). In the tree, results
panel,
experiments,reportand MCP. - Watch → Pause: a Petri Watch alert in the editor offers to pause the experiment (approval-gated), so broken data stops accumulating.
- "How much longer?": a keep-running verdict says how many more users per arm would decide it at the current lift.
- False-ship eval (
eval/aa.mjs): 2,000 simulated A/A experiments. Peeking ships a do-nothing variant 36.5% of the time, Petri's single look 8.0% (4.1% with the Bonferroni bar), and a real +39% winner is found 99.7% of the time. petri-check report: a Markdown decision record (pre-registration, per-arm results with intervals and expected loss, sample ratio, treatment lock, Watch, planned stop, verdict, decision), also written to the GitHub job summary.- Safer self-host defaults: Flagsmith binds to
127.0.0.1, and secrets come from the environment (random in Codespaces). - Sample size and ETA:
petri-check lock --mde 20%sizes the planned stop from the control rate (two-proportion power, 80%, Bonferroni across variants). The CodeLens andexperimentsline show progress and an ETA from the current enrolment rate. - Offline event checks from the lock: with a committed
petri.lock.json, CI catches a renamed metric event (PETRI002) or a metric nothing sends any more (PETRI003) without a Flagsmith key. - PETRI014: a conversion tracked under a different identity than the
exposure (
user.emailvsuser.id), so it is never attributed. - PETRI015: a new random identity on every call (
randomUUID()…), so every visit is a new user. Both run offline. - Production guard: every Flagsmith write to an environment named like
production is titled
[PRODUCTION]and warns that real users are affected. - Early decisions are labelled: completing before the pre-registered stop shows a warning and a Complete early button, and the decision memory records that it was decided early.
- Verified edits: after an approved copilot edit (such as removing the
losing code), Petri runs the project's tests (
petri.verifyCommandornpm test) and restores the file if they fail. - Petri Watch: reads running experiments' hourly per-arm timelines and
alerts when an arm stops converting or enrolling, enrolment stops, or the
split breaks (Poisson and chi-square tests, complete hours only), blaming
the last commit that touched the experiment's code. In the editor
(notification and tree),
petri-check watch(exit 1,--refresh), the Action (command: watch, on a schedule) and MCP. - Pre-registered stop:
petri-check lock --stop-at/--stop-nor Petri: Pre-register When to Decide records when to decide. The CodeLens shows progress, and a SHIP before the stop is marked provisional in the copilot's report andpetri-check experiments. Display only. - Decision memory: completing an experiment records the decision and its
evidence (winner, value, lift, interval, chance to win, expected loss, n) in
petri.lock.json, and a lens shows it above every line holding the shipped value.
0.1.4 (2026-11-28)
Extension only; the petri-check CLI is unchanged at 0.1.3.
Added
- Launch gate: before an experiment starts, Petri runs the rules as if it were running. If the code would record wrong or no data, the approval names each file and line and the button reads "Start anyway".
0.1.3 (2026-11-28)
Added
Multiple variants. A ship verdict with two or more variants now says whether the result also clears a Bonferroni-corrected bar (97.5% for two). The rule itself is unchanged, as pre-registered.
Expected loss per arm in the results panel, the copilot's report and ship verdicts: how much worse than control an arm is on average in the cases where it is worse, so "98% to win" comes with the size of the downside.
petri-checkreadsflagsmith.env, so afterselfhost/bootstrap.mjsthe CLI runs all 12 rules with no flags or variables.Approval policy test: every copilot tool runs against a recording Flagsmith client. A decline means nothing is written, an approval means exactly the shown request is sent, and an unclassified new tool fails the build.
Treatment lock (
PETRI013):petri.lock.jsonrecords each running experiment's variants, split, metrics and a fingerprint of every code path serving it (written on start, released on completion; alsopetri-check lockand Petri: Lock Running Experiments). Changing what a running experiment serves is flagged in the editor as you type, in CI offline from the committed lockfile, and against live Flagsmith (variant values, split, metrics).Measured comparison (docs/eval.md, harness in
eval/): with Petri an agent fixed the same 6 planted bugs with 48% fewer tokens, 53% fewer turns and 42% less time; both conditions fixed 6/6.Skill cleanup as a pull request: the losing-code removal can be a PR carrying the verdict line, the numbers, a real-or-simulated traffic note and a checklist; the agent never merges it.
Agent Skill
skills/flagsmith-experiment-check: wiring check → verdict → gated completion with the Flagsmith CLI →flagsmith evaluatecheck → gated cleanup.petri-check experiments(one line per experiment with the verdict, interval, chance to win, expected loss, SRM and therollout_variantid) and--format brief(one short line per finding), for agents.MCP server:
npx petri-check mcpgives any coding agent three read-only tools:petri_check,petri_experiments(results, SRM, expected loss and Petri's verdict) andpetri_rule. No tool changes Flagsmith or code.
Fixed
petri-checkno longer crashes with a stack trace when Flagsmith is unreachable: it names the URL and exits 2.
0.1.2 (2026-11-28)
Added
- Zero-click self-hosting.
selfhost/bootstrap.mjsturns a fresh Flagsmith into a ready one: admin account, organisation, project with Development and Production, organisation API key and event storage. It writesflagsmith.jsonandflagsmith.env, and Petri connects without a prompt. - GitHub Codespaces.
.devcontainer/starts Flagsmith with experimentation, runs the bootstrap, builds and installs Petri, and installs the demo shop. - Online playground at https://ivan825.github.io/petri/: all 12 diagnostics and the decision rule run in the browser on pasted code, against a built-in copy of the Petri Coffee project whose problems you can toggle.
0.1.1 (2026-11-28)
Fixed
- The SRM guard now works on running experiments. Flagsmith returns a
nullsample-ratio-mismatch p-value while an experiment runs (Flagsmith#9128), so the decision rule's SRM check never fired. When Flagsmith reports none, Petri now runs its own chi-square test of exposures against the configured split (100 exposures minimum). The tree view marks it "(Petri)", and the copilot's report says which test it used.
0.1.0 (2026-11-28)
The first version: published on
GitHub Releases
(petri.vsix), Open VSX,
and as the petri-check CLI on
npm.
Added
- Connection. Connect to self-hosted Flagsmith or Flagsmith Cloud with
an organisation API key or a user token, stored in VS Code's
SecretStorage; pick a project and environment. Flag and experiment data
refreshes every 60 seconds (
petri.autoRefreshSeconds). - Experiments API client for the Admin API and the native Experiments API: experiments, experiment metrics, start, pause and complete, results and exposures recompute, and warehouse connections.
- Scanner for flag reads, exposures and
trackEventcalls in JavaScript, TypeScript, Python, Go and other languages, by SDK method name (getExperimentFlag,getValue,hasFeature,isFeatureEnabled,trackEventand their snake_case and PascalCase forms). - Diagnostics PETRI001 to PETRI012 in the Problems panel, each aimed at
a way an experiment silently loses or skews its data, with quick fixes
where a safe one exists. See docs/diagnostics.md.
They include PETRI012, for self-hosted users whose SDK still sends
events to Flagsmith Cloud because
eventsApiUrlis not set, and PETRI009, for "phantom arms" created by exposures sent with the served value instead of the variant key. - In-editor views. A sidebar tree of experiments and flags, CodeLens above each flag read with the experiment's status, lift and chance to win, hovers with the split and per-arm results, and a results panel with a plot of each arm's 95% credible interval.
- Decision rule. One deterministic rule shared by the UI and the copilot: ship only at 95% or more chance to win on the primary metric, with no guardrail likely hurt (more than 80% chance), no sample ratio mismatch (p < 0.001) and no phantom arms.
- Lifecycle. Start, pause and complete an experiment (ship a variant, keep control or turn the flag off) from the tree, the results panel or the command palette. Completing against the decision rule shows a warning in the approval.
- Approvals and audit log. Every write to Flagsmith shows the exact
HTTP request, and every code edit shows a diff, in a modal; nothing is
sent or applied without approval. Each decision is appended to
.petri/audit.jsonl. - Experiment Copilot, an agent on the Anthropic API (official
@anthropic-ai/sdk, model set bypetri.model, defaultclaude-opus-5-5) that can turn a selection into an experiment, judge results by the decision rule, complete the experiment and propose removing the losing code path, with every write going through the same approvals. See docs/copilot.md. - Self-hosting.
Petri: Start Self-Hosted Flagsmith (Docker)starts Flagsmith with experimentation enabled using Docker Compose. - Petri Coffee, a one-page demo shop whose buy button is an experiment, and a simulator that sends shoppers through the real HTTP app.
Known issues
- Setting a key on a multivariate option with
PATCH /api/v1/projects/{p}/features/{f}/mv-options/{id}/withoutfeaturein the body returns 500 (KeyError: 'feature') in Flagsmith. Petri sendsPUTwith the full option instead.