Skip to content

[WIP] feat: Experiments V2 wizard + Warehouse Connection Settings UI#7195

Draft
talissoncosta wants to merge 16 commits intomainfrom
feat/experiments-v2
Draft

[WIP] feat: Experiments V2 wizard + Warehouse Connection Settings UI#7195
talissoncosta wants to merge 16 commits intomainfrom
feat/experiments-v2

Conversation

@talissoncosta
Copy link
Copy Markdown
Contributor

@talissoncosta talissoncosta commented Apr 9, 2026

  • I have read the Contributing Guide.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to the Experiments V2 and Data Warehouse features. Built with mock data from Pencil designs — ready for backend integration.

Experiments V2 — Wizard + Results Dashboard

5-step wizard for creating experiments + results dashboard.

Wizard steps:

  1. Experiment Details — name, hypothesis, type selection, start/end dates
  2. Select Metrics — primary + secondary metric selection
  3. Flag & Variations — multi-variant flag selector (single-variant flags filtered out) + variation table
  4. Segments & Traffic — segment selector + traffic allocation
  5. Review & Launch — full configuration summary with inline edit

Results dashboard — status badge, timeline progress, metric comparison table, variation breakdown.

PO feedback applied:

  • Renamed "Audience" → "Segments" (terminology alignment)
  • Removed traffic split visualisation (auto-calculated, no user value)
  • Removed export button (unused)
  • Only multi-variant flags selectable for experiments
  • Added start/end date fields

Warehouse Connection Settings

5-state connection flow: Empty → Config → Testing → Connected → Error. Route at /organisation/:organisationId/warehouse.

How to check

All states are accessible via routes:

  • Wizard: /project/:projectId/environment/:environmentId/experiments/create
  • Results: /project/:projectId/environment/:environmentId/experiments/:experimentId
  • Warehouse: /organisation/:organisationId/warehouse

How did you test this code?

  • App: ENV=local npm run dev → navigate to the routes above to check all states
  • Automated: lint clean

@talissoncosta talissoncosta requested a review from a team as a code owner April 9, 2026 21:04
@talissoncosta talissoncosta requested review from kyle-ssg and removed request for a team April 9, 2026 21:04
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, reopen this pull request to trigger a review.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Apr 16, 2026 6:51pm
flagsmith-frontend-staging Ready Ready Preview, Comment Apr 16, 2026 6:51pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Apr 16, 2026 6:51pm

Request Review

@github-actions github-actions bot added front-end Issue related to the React Front End Dashboard feature New feature or request labels Apr 9, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-7195 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-7195 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-7195 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7195 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7195 Finished ✅ Results

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  51.5 seconds
commit  aa7f863
info  🔄 Run: #15948 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  17 passed

Details

stats  17 tests across 14 suites
duration  1 minute, 1 second
commit  aa7f863
info  🔄 Run: #15948 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  17 passed

Details

stats  17 tests across 14 suites
duration  1 minute, 2 seconds
commit  aa7f863
info  🔄 Run: #15948 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  11 passed

Details

stats  11 tests across 8 suites
duration  52.3 seconds
commit  aa7f863
info  🔄 Run: #15948 (attempt 1)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Visual Regression

16 screenshots compared. See report for details.
View full report

talissoncosta and others added 9 commits April 16, 2026 14:47
… stories

Implements the Experiments V2 UI from the Pencil designs as separated,
modular React components with mock data. This is the frontend scaffolding
for the new experiment creation wizard and results dashboard.

Components are organised into four layers:

- `wizard/` — Reusable wizard primitives (Layout, Sidebar, StepIndicator,
  Header, NavButtons). Zero experiment knowledge — can be reused for any
  future multi-step wizard.
- `shared/` — Experiment-specific building blocks (SelectableCard,
  VariationTable, TrafficSplitBar, StatusBadge, ExperimentStatCard,
  MetricsComparisonTable).
- `steps/` — Five wizard step components, each a pure presentation
  component receiving state via props.
- `flag-detail/` — LinkedExperimentSection for the feature flag detail page.

- **CreateExperimentPage** (`/experiments/create`) — 5-step wizard:
  1. Experiment Details (name, hypothesis, type)
  2. Select Metrics (search, primary/secondary)
  3. Flag & Variations (flag dropdown, variation table)
  4. Audience & Traffic (segment, traffic slider, split bar)
  5. Review & Launch (summary with edit buttons)

- **ExperimentResultsPage** (`/experiments/:experimentId`) — Dashboard with
  stat cards (users enrolled, winning variation, probability, lift) and
  metrics comparison table.

19 stories under `Experiments/` with interactive controls and light/dark
mode support. Wizard components are nested under `Experiments/Wizard/`.
A composed `Wizard` story demonstrates all primitives working together.

- All data is mock/fake — no API calls yet. Mock data is centralised in
  `types.ts` for easy replacement with RTK Query hooks later.
- Routes gated behind `experimental_flags` feature flag.
- Global `Select` (react-select) registered in Storybook preview for
  SearchableSelect compatibility.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace hardcoded font-size (11-28px) with semantic tokens
  (--font-caption-xs-size through --font-h3-size)
- Replace hardcoded font-weight (400-700) with tokens
  (--font-weight-regular through --font-weight-bold)
- Replace hardcoded JetBrains Mono with var(--font-family)
- Replace hardcoded #ffffff with var(--color-surface-default)
- Fix SelectableCard border-width shift (1px→2px) using inset box-shadow
  for unselected state and 2px transparent border always
- Add box-shadow: var(--shadow-sm) to cards and tables for depth
- Add flex-wrap to stat cards row for tablet responsiveness

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ck state

- Pre-populate wizard with realistic mock data (name, hypothesis, type,
  3 metrics, flag, segment) so the review step looks complete on first visit
- Show hypothesis in a styled block instead of truncated key-value
- Show experiment type with icon badge
- Show metrics with name + description + role badge
- Show variations with coloured dots and value badges
- Show traffic split visualisation bar with labels
- All using semantic tokens

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…d config

- Add experiment timeline progress bar (day 23 of 30)
- Add recommendation callout with green success styling
- Add experiment configuration grid (type, flag, audience, traffic)
- All values using semantic tokens

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Introduces the `motion` library (v12.38) as the standard for JS-driven
animations in the frontend, alongside existing CSS motion tokens.

- `common/utils/motion.ts` — 10 reusable motion presets (fadeIn, slideInRight,
  staggerContainer, springBounce, shakeX, badgeEntrance, pageCrossfade, etc.)
- `web/styles/_animations.scss` — CSS keyframes (shake, spin, fade-in, pulse)
  and mixins (focus-ring, input-error-shake, spinner)
- `documentation/MotionPresets.stories.tsx` — Interactive Storybook demos

New "Data Warehouse" settings page with 5 states and animated transitions:

- **Empty** — CTA to connect, fade-in entrance
- **Config Form** — Snowflake/BigQuery/Databricks type selector, connection
  form fields, slide-in-right entrance via motion
- **Testing** — Spinner + staggered progress steps via motion stagger presets
- **Connected** — Status card with spring-bounce icon, badge entrance,
  staggered stats, connection details grid
- **Error** — Shake animation on error card, error message box, retry

State transitions use AnimatePresence with pageCrossfade for smooth crossfades.

All values use semantic design tokens. Mock data for showcase purposes.

Replace `window.Utils` import (caused circular dependency crash) with
minimal mock providing only the functions Input.js actually calls.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…obals

- Remove cosmetic motion animations (fadeIn, slideInRight, springBounce,
  shakeX, badgeEntrance, AnimatePresence crossfade) from warehouse
  components. Keep only the functional stagger on TestingState progress steps.
- Add warehouse route at /organisation/:organisationId/warehouse
- Stub common/utils/utils in Storybook webpack to fix circular dep crash
- Register all legacy prop-type globals (OptionalString, RequiredFunc, etc.)
  in Storybook preview for Input.js compatibility

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The svg colour rule was applying to all descendant svgs, including the
icon inside the CTA button, causing poor contrast on primary buttons.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Applied PO feedback from the experiments review meeting:

- Rename user-facing "Audience" → "Segments" in the wizard step field,
  review step section header, wizard step title config, and the
  results-page config label. Internal types (AudienceConfig) kept as-is
  to avoid scope creep.
- Remove the "Traffic Split" field from the wizard step — the split bar
  was auto-calculated per variation with no user control. Delete the
  TrafficSplitBar component (no other consumers) along with its SCSS
  and the now-unused `variations` prop + splits computation in
  AudienceTrafficStep.
- Remove the "Export" button from the results page actions — PO flagged
  it as unused.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Applied PO feedback:

- Only multi-variant flags are eligible for experiments. Added an
  `isMultiVariant: boolean` field to FlagOption, marked MOCK_FLAGS
  accordingly, and filter the selector's options so single-variant
  flags don't appear. Added a hint under the field explaining the
  constraint.
- Added optional start/end date fields to ExperimentDetails. Rendered
  as side-by-side date inputs in the details step, surfaced in the
  review step's details section as a single "Dates" row.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
All states are accessible via app routes — stories were redundant
for validation. Routes:
- /experiments/create (wizard)
- /experiments/:id (results)
- /organisation/:id/warehouse (connection flow)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Show EmptyState component when no metrics exist, guiding users to
create their first metric. Also replaced the inline search-empty
div with EmptyState for consistency.

Added `availableMetrics` prop (defaults to MOCK_METRICS) so the
real API integration can pass the actual list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Renamed "Traffic Allocation" to "Experiment Enrollment" and added a
visual breakdown showing Control (current flag value) vs Experiment
(randomly assigned to variations) with their percentages. Makes it
clear what happens to users not enrolled in the experiment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
All wizard steps now handle the "no data" case with EmptyState:
- Flag step: no multi-variant flags available
- Segments step: no segments defined
- Metrics step: already added (previous commit)

These states are visible for UX validation when the mock data is
cleared or the real API returns empty lists.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entry point for the experiments flow — table with filter tabs
(All/Running/Draft/Completed), search, status badges, linked flag
display, and summary footer. Matches the V2 Dashboard design.

Includes empty state for no experiments + search-empty state.
Row click navigates to the experiment results page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reordered wizard: Flag & Variations → Details → Metrics → Segments
→ Review. Flag selection is now the first step, matching the
natural dependency flow (flag drives variations, which affects
metrics and segments).

Removed the Experiment Type selector (A/B Test / Multivariate /
Feature Flag) — the type is implied by the flag's variation count
(2 = A/B, 3+ = multivariate). "Feature Flag" (on/off toggle) was
contradictory since experiments require multi-variant flags.

Updated ReviewLaunchStep section order and edit-step indices to
match the new flow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Show guidance when a flag has zero variations — "Add at least 2
variations (control + treatment) to run an experiment." Prevents
users from proceeding without the minimum required variations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant