Skip to content

feat(experimentation): experiment results model, task and endpoints#7796

Merged
gagantrivedi merged 1 commit into
mainfrom
feat/experiment-results-model
Jun 19, 2026
Merged

feat(experimentation): experiment results model, task and endpoints#7796
gagantrivedi merged 1 commit into
mainfrom
feat/experiment-results-model

Conversation

@gagantrivedi

@gagantrivedi gagantrivedi commented Jun 16, 2026

Copy link
Copy Markdown
Member

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • 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 experiment results stats layer (stacked on #7781; merge after it).

So the experiment detail page can show per-metric results — lift, chance-to-win, and a sample-ratio-mismatch check — this computes them from the warehouse on demand and stores one row per experiment, updated in place (mirroring the exposures panel).

  • ExperimentResults model (migration 0008), on a new abstract ExperimentComputation base now shared with ExperimentExposures: as_of / payload / last_error_at / refresh_requested_at, is_final, and record_refresh / record_failure / record_refresh_request.
  • compute_results_summary (services.py): derives the metric specs and the expected SRM split from the environment's multivariate allocations (control = unallocated remainder), then runs the feat(experimentation): results aggregation query and payload builder #7781 aggregation and feat(experimentation): Bayesian stats kernel #7769 kernel. SRM is skipped (and srm.unkeyed_variant logged) when an option has no variant key to attribute its share to.
  • compute_experiment_results task: recomputes the full window; on warehouse failure keeps the last good payload and logs results.compute_failed.
  • GET …/results/ and POST …/results/refresh/: read the row, or enqueue a refresh (202). _validate_refresh_request raises ValidationError before start / once final (400) and Throttled within the refresh interval (429 + Retry-After).

How did you test this code?

make test for the experimentation app — unit tests for the model, task, compute_results_summary / _experiment_metric_specs / _expected_variant_shares, and both endpoints, at 100% diff coverage. mypy and ruff clean.

@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jun 19, 2026 9:21am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ignored Ignored Preview Jun 19, 2026 9:21am
flagsmith-frontend-staging Ignored Ignored Preview Jun 19, 2026 9:21am

Request Review

@github-actions github-actions Bot added api Issue related to the REST API docs Documentation updates feature New feature or request and removed docs Documentation updates labels Jun 16, 2026
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.59%. Comparing base (1bdb7ca) to head (b4b866e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #7796    +/-   ##
========================================
  Coverage   98.58%   98.59%            
========================================
  Files        1466     1467     +1     
  Lines       57010    57332   +322     
========================================
+ Hits        56203    56525   +322     
  Misses        807      807            

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gagantrivedi gagantrivedi force-pushed the feat/experiment-results-model branch from acb3e36 to d94bd85 Compare June 16, 2026 10:57
@github-actions github-actions Bot added the docs Documentation updates label Jun 16, 2026
@github-actions github-actions Bot added feature New feature or request docs Documentation updates and removed feature New feature or request docs Documentation updates labels Jun 16, 2026
@gagantrivedi gagantrivedi force-pushed the feat/experiment-results-model branch from 85c5982 to 7db02c3 Compare June 17, 2026 06:42
@github-actions github-actions Bot added docs Documentation updates and removed feature New feature or request docs Documentation updates labels Jun 17, 2026
@github-actions github-actions Bot added feature New feature or request docs Documentation updates and removed feature New feature or request docs Documentation updates labels Jun 17, 2026
@gagantrivedi gagantrivedi force-pushed the feat/experiment-results-model branch from 4f4876e to 94671bf Compare June 17, 2026 09:48
@github-actions github-actions Bot added docs Documentation updates feature New feature or request and removed feature New feature or request docs Documentation updates labels Jun 17, 2026
@gagantrivedi gagantrivedi force-pushed the feat/experiment-results-model branch from 94671bf to 694bf2c Compare June 17, 2026 09:57
@github-actions github-actions Bot added docs Documentation updates feature New feature or request and removed feature New feature or request docs Documentation updates labels Jun 17, 2026
@github-actions github-actions Bot added feature New feature or request docs Documentation updates and removed feature New feature or request docs Documentation updates labels Jun 17, 2026
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

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

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  41.5 seconds
commit  17e9032
info  🔄 Run: #17579 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  37 seconds
commit  17e9032
info  🔄 Run: #17579 (attempt 1)

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

failed  1 failed

Details

stats  1 test across 1 suite
duration  45 seconds
commit  17e9032
info  📦 Artifacts: View test results and HTML report
🔄 Run: #17579 (attempt 1)

Failed tests

firefox › tests/project-permission-test.pw.ts › Project Permission Tests › Project-level permissions control access to features, environments, audit logs, and segments @enterprise

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

failed  1 failed

Details

stats  1 test across 1 suite
duration  45.8 seconds
commit  17e9032
info  📦 Artifacts: View test results and HTML report
🔄 Run: #17579 (attempt 2)

Failed tests

firefox › tests/project-permission-test.pw.ts › Project Permission Tests › Project-level permissions control access to features, environments, audit logs, and segments @enterprise

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

failed  1 failed

Details

stats  1 test across 1 suite
duration  45.9 seconds
commit  17e9032
info  📦 Artifacts: View test results and HTML report
🔄 Run: #17579 (attempt 3)

Failed tests

firefox › tests/project-permission-test.pw.ts › Project Permission Tests › Project-level permissions control access to features, environments, audit logs, and segments @enterprise

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

failed  1 failed

Details

stats  1 test across 1 suite
duration  45.2 seconds
commit  17e9032
info  📦 Artifacts: View test results and HTML report
🔄 Run: #17579 (attempt 4)

Failed tests

firefox › tests/project-permission-test.pw.ts › Project Permission Tests › Project-level permissions control access to features, environments, audit logs, and segments @enterprise

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

failed  1 failed

Details

stats  1 test across 1 suite
duration  45.1 seconds
commit  17e9032
info  📦 Artifacts: View test results and HTML report
🔄 Run: #17579 (attempt 5)

Failed tests

firefox › tests/project-permission-test.pw.ts › Project Permission Tests › Project-level permissions control access to features, environments, audit logs, and segments @enterprise

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  40.4 seconds
commit  19e2944
info  🔄 Run: #17657 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  45.6 seconds
commit  19e2944
info  🔄 Run: #17657 (attempt 1)

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  33.1 seconds
commit  19e2944
info  🔄 Run: #17657 (attempt 1)

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  19.4 seconds
commit  19e2944
info  🔄 Run: #17657 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  34.3 seconds
commit  b4b866e
info  🔄 Run: #17666 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  37.2 seconds
commit  b4b866e
info  🔄 Run: #17666 (attempt 1)

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

passed  5 passed

Details

stats  5 tests across 4 suites
duration  58.8 seconds
commit  b4b866e
info  🔄 Run: #17666 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  51.9 seconds
commit  b4b866e
info  🔄 Run: #17666 (attempt 1)

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

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

Zaimwa9
Zaimwa9 previously approved these changes Jun 17, 2026

@Zaimwa9 Zaimwa9 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking good! Thanks. Wish we had the control as a MV option.
If there are some details to finetune i'll take it up from here while implementing the frontend

Persist per-experiment Bayesian results and expose them. Add ExperimentResults
on a shared abstract ExperimentComputation base (with ExperimentExposures),
compute_results_summary orchestration (metric specs + expected SRM split, with
srm.unkeyed_variant / srm.overallocated skips), the compute_experiment_results
task, and the GET/POST results endpoints with refresh-request validation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants