~/experiment

We ran one, and we knew the right answer in advance.

Petri Coffee is an A/B/n test on self-hosted Flagsmith, set up and finished from the editor. The shoppers are simulated but go through the real SDK: assignment, exposures and events are all real. Only the decision to buy is random, with true rates hidden from Flagsmith and Petri, so at the end we can check whether the pipeline recovered them. Real experiments never give you that.

01 · Pre-registration

Decided before the first shopper arrived.

Written down on 28 Nov 2026 at 12:47 IST. The decision rule was in the first commit (12:45 IST), before any traffic.

Hypothesis
Shoppers hesitate at checkout because they don't know what delivery costs or how long it takes. A delivery promise on the buy button raises checkout conversion without lowering order value.
Flag
checkout_cta, multivariate, read with getExperimentFlag("checkout_cta", shopperId)
Arms
control "Buy now" · free_shipping "Buy now · free shipping" · arrives_tomorrow "Buy now · arrives tomorrow", 33/33/33, every shopper enrolled
Unit
The shopper: a cookie identity, so a returning shopper always sees the same arm
Primary
Checkout conversion: occurrence of checkout_completed per identity. Expected to increase.
Guardrail
Revenue per shopper: mean of order_value (₹499 × quantity). Must not decrease.
Rule
Ship the best arm only at ≥ 95% chance to beat control, with no guardrail more than 80% likely hurt, no sample-ratio mismatch and no phantom arms. The rule →
Stopping
Run until 29 Nov about 13:00 IST (about 24 hours), then apply the rule once. No early stopping on a peek.
Power
At a 9% baseline, detecting a lift to 12.5% (+39%) with 80% power at α = 0.05 needs about 1,200 shoppers per arm. 6 shoppers a minute for 24 hours gives about 3,000 per arm: enough for that effect, not for a small one like +9%. Said in advance.

02 · Traffic

Simulated shoppers, real stack.

The simulator sends Poisson arrivals at 6 a minute to the running shop. Each shopper:

  1. VisitsGET / without a cookie. The server mints an identity and calls getExperimentFlag; Flagsmith assigns the arm and the SDK sends $flag_exposure.
  2. Reads the buttonThe label comes from the HTML it was served.
  3. Maybe buysWith a probability that depends only on that label, then POST /checkout with a quantity of 1–3. The server sends checkout_completed and order_value.

Only step 3's coin flip is synthetic. Assignment, exposure logging, event delivery to the self-hosted events endpoint, and Flagsmith's aggregation and inference are all real.

Ground truth, in simulate.mjs

ArmTrue buy rateTrue lift
control9.0%—
free_shipping12.5%+38.9%
arrives_tomorrow9.8%+8.9%

Neither Flagsmith nor Petri sees these numbers.

03 · What Petri caught on the way

Two problems that would have cost the whole day.

PETRI012

Events going to Flagsmith Cloud

The obvious way to point the Node SDK at a self-hosted server is apiUrl. Flags then work, but the event processor still sends exposures and events to events.api.flagsmith.com: a day of zero data and no error. Petri flagged the new Flagsmith({...}) call; the shop sets eventProcessorConfig.eventsApiUrl. Already reported upstream: flagsmith-nodejs-client#332.

HTTP 500

Setting variant keys

PATCH …/mv-options/{id}/ without feature in the body raises KeyError: 'feature' in Flagsmith. Petri sends a full PUT instead. Already reported upstream: Flagsmith#9119.

04 · Results so far

Both true effects inside Flagsmith's intervals.

● interim · 28 Nov 2026, 17:23 IST · 2,028 shoppers · submitted before the pre-registered stop
ArmShoppersTrue rateMeasuredTrue liftMeasured lift (95%)Chance to winExpected lossTruth inside?
control6489.0%8.0%——baseline——
free_shipping67112.5%12.1%+38.9%+50.4% (+0.6% … +100.3%)98%0.23%yes
arrives_tomorrow7099.8%9.3%+8.9%+16.0% (−24.3% … +56.3%)78%2.57%yes
Flagsmith's dashboard

"Confirmed" at 3 hours

At 894 shoppers, under the ~1,200 per arm the power calculation needs, the banner said "94% Winner Probability Confirmed · Consider rolling out free_shipping", with an interval of −19% to +155%. The rule waits for both the 95% bar and the planned stop.

Sample-ratio check

Fair, by Petri's own test

Flagsmith reports no sample-ratio p-value while the experiment runs (#9128). Petri's chi-square against the 33/33/33 split: p = 0.24 at 2,028 shoppers.

The earliest look, 14 minutes in at 519 shoppers, showed free_shipping at +111% against a true +39%. That's what calling a winner after half an hour looks like. The interim look →

05 · The decision

Not taken yet, on purpose.

  1. Submitted before the stopWe submitted before the pre-registered stop (29 Nov, 13:00 IST), so every number here is interim and the experiment keeps running.
  2. Petri says: provisionalThe verdict is SHIP free_shipping, but Petri marks it provisional until the stop, and the peek-safe sequential test says not yet (p = 0.110). Flagsmith's banner already says "confirmed".
  3. Ground truth, so farBoth true lifts (+38.9%, +8.9%) lie inside Petri's intervals, and the leader is the truly best arm. Completing early would be the peeking we measured: 36.5% false ships.