Skip to content

Add A/B test results tool with interactive UI#23

Merged
guitavano merged 1 commit into
mainfrom
guitavano/ab-test-results-screen
Jul 7, 2026
Merged

Add A/B test results tool with interactive UI#23
guitavano merged 1 commit into
mainfrom
guitavano/ab-test-results-screen

Conversation

@guitavano

@guitavano guitavano commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What

Ports the deco.cx admin Experiments results screen into this MCP App as a new tool with an interactive dashboard.

Tools

  • list_experiments — entry-point tool that launches the UI. Lists the site's experiments and resolves its production domains.
  • experiment_results — fetches per-goal conversions for each variant, a daily timeseries for the selected goal, and the A/B statistics (participants, target sample size, probability each variant is best). All computed server-side so the UI just renders.
  • create_experiment — creates a new experiment from the UI (the New button).

Statistics

api/lib/ab-test.ts is a server-side port of the admin's utils/statistics/abTest.ts (sampleSize, pBetter). The admin version pulls in jstat (~45KB) only for normal.cdf; since the client bundle is inlined into a single HTML resource, we reimplement the standard-normal CDF with an Abramowitz & Stegun erf approximation instead — no new dependency.

UI (web/tools/experiments/)

React 19 + recharts + shadcn:

  • Experiment list (Name / Created / Ended) with a New dialog
  • Results view: domain / period / date-range / device-browser-OS filters
  • Progress card (participants vs. target sample size)
  • Variant probability + timeseries line chart, goal conversion bar chart
  • Funnel / By-Goal tables

Notes

  • create_experiment inserts the experiment row (minus the traffic-split matcher block, which is configured in the editor). It surfaces admin errors (e.g. RLS) via an error field instead of failing silently.
  • Pre-existing lint/format issues in unrelated files (logs.ts, assets/index.tsx, monitor/index.tsx) are left untouched. New code passes lint, typecheck, and full build.

Test plan

  • bun run build (client + server)
  • bun run check (only pre-existing node_modules errors)
  • Lint clean on all new/changed files
  • Manually verified list / results / create against a real site

🤖 Generated with Claude Code


Summary by cubic

Adds an A/B test results tool with an interactive dashboard. Lets you list and create experiments, and view per-goal metrics, timeseries, and significance computed server-side.

  • New Features

    • Tools: list_experiments (opens UI and resolves domains), experiment_results (per-goal conversions, daily timeseries, sample size and “best” probabilities), create_experiment (New dialog).
    • Server-side stats in api/lib/ab-test.ts (sample size, pBetter) so the UI only renders precomputed data.
    • UI: experiment list, domain/period/date-range/device/browser/OS filters, progress card, variant probability, line and bar charts, funnel/by-goal tables.
    • App wiring: resource ui://mcp-app/experiments via createExperimentsAppResource, added to api/app.ts, and routed in web/router.tsx.
  • Dependencies

    • No new runtime deps. Avoids adding jstat by implementing the standard-normal CDF in api/lib/ab-test.ts.

Written for commit 98193e8. Summary will update on new commits.

Review in cubic

Ports the deco.cx admin Experiments results screen into the MCP App as a
new tool with an interactive dashboard.

- `list_experiments`: entry-point tool that launches the UI, listing the
  site's experiments and resolving its production domains
- `experiment_results`: fetches per-goal conversions, a daily timeseries,
  and the A/B statistics (participants, target sample size, probability
  each variant is best), computed server-side
- `create_experiment`: creates a new experiment from the UI
- `api/lib/ab-test.ts`: server-side port of the admin A/B math, with a
  jstat-free standard-normal CDF (Abramowitz & Stegun erf approximation)
- React UI (recharts + shadcn): experiment list with a New dialog, results
  view with domain/period/filter controls, variant probability, timeseries
  and goal charts, and funnel/by-goal tables

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
admin-mcp 98193e8 Commit Preview URL

Branch Preview URL
Jul 07 2026, 08:07 PM

@guitavano guitavano merged commit c266eae into main Jul 7, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant