Skip to content

feat(experimentation): add conversion-over-time rows to experiment results - #8451

Merged
gagantrivedi merged 4 commits into
mainfrom
feat/experiment-conversion-timeseries
Sep 4, 2026
Merged

feat(experimentation): add conversion-over-time rows to experiment results#8451
gagantrivedi merged 4 commits into
mainfrom
feat/experiment-conversion-timeseries

Conversation

@gagantrivedi

@gagantrivedi gagantrivedi commented Sep 3, 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 conversion-rate-over-time chart on the experiment results page (backend half; frontend follows).

The results payload only carried headline statistics, so the dashboard had nothing to draw a per-variant conversion rate over time from.

  • ResultsSummary.exposures_timeseries: per-bucket newly exposed identities per variant, computed in the same run as the metrics so both sides of the rate share one as_of.
  • MetricResult.conversions_timeseries: per-bucket identities whose first post-exposure conversion landed in that bucket, per variant. Occurrence metrics only; null for value metrics.
  • One gatherer, get_results_aggregates, runs the results, conversions and exposures reads with a single ResultsQueryBuilder. The conversions query reuses the exposures CTE and each slot's attribution condition, so bucket totals equal the metric's sum, and joins only the charted metrics' events.
  • Stored payloads predating this lack the two keys; the frontend should treat them as optional.

How did you test this code?

Unit tests for the query builder, bucket decoding and summary assembly. Ran the gatherer against a local ClickHouse with seeded events: pre-exposure conversions ignored, duplicate events counted once, quarantined identities excluded, and day/hour bucket totals match each metric's sum.

@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

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

3 Skipped Deployments
Project Deployment Actions Updated
docs Ignored Ignored Preview Sep 3, 2026 11:57am UTC
flagsmith-frontend-preview Ignored Ignored Preview Sep 3, 2026 11:57am UTC
flagsmith-frontend-staging Ignored Ignored Preview Sep 3, 2026 11:57am UTC

Request Review

@github-actions github-actions Bot added api Issue related to the REST API docs Documentation updates labels Sep 3, 2026
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 6a60c134-2b90-47a1-a0e3-f363709ca143

📥 Commits

Reviewing files that changed from the base of the PR and between a08ccf5 and 04569b7.

📒 Files selected for processing (1)
  • api/experimentation/dataclasses.py

Included review availability: Your plan provides up to 8 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The experimentation results API adds conversion bucket and conversion time-series dataclasses. It builds ClickHouse queries for first post-exposure conversions on occurrence metrics. The service retrieves exposure and conversion buckets, groups them by time bucket and variant, and attaches chart data to result summaries. Tests cover query generation, row decoding, warehouse access, serialisation, and summary computation. Observability catalogue references are updated for moved service lines.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Merge Risk: ⚪ Minimal · up to 04569

This change documents exposure time-series behavior for conversion analytics. No current merge-blocking risk remains.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added feature New feature or request and removed docs Documentation updates labels Sep 3, 2026
@gagantrivedi
gagantrivedi marked this pull request as ready for review September 3, 2026 11:05
@gagantrivedi
gagantrivedi requested review from a team as code owners September 3, 2026 11:05
@gagantrivedi
gagantrivedi requested review from matthewelwell and removed request for a team September 3, 2026 11:05
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

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

@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Sep 3, 2026
@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.81%. Comparing base (07f6835) to head (04569b7).

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #8451    +/-   ##
========================================
  Coverage   98.81%   98.81%            
========================================
  Files        1621     1621            
  Lines       66138    66277   +139     
========================================
+ Hits        65354    65493   +139     
  Misses        784      784            

☔ 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.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor
✅ private-cloud · depot-ubuntu-latest-16 — run #20111 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  47.7 seconds
commit  04569b7
info  🔄 Run: #20111 (attempt 1)

🗂️ Previous results
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #20111 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  37.7 seconds
commit  04569b7
info  🔄 Run: #20111 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #20111 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  44.7 seconds
commit  04569b7
info  🔄 Run: #20111 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #20111 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  35.1 seconds
commit  04569b7
info  🔄 Run: #20111 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #20109 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  1 minute, 16 seconds
commit  a08ccf5
info  🔄 Run: #20109 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #20109 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  40.3 seconds
commit  a08ccf5
info  🔄 Run: #20109 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #20107 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  32.8 seconds
commit  39414dd
info  🔄 Run: #20107 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #20107 (attempt 1)

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  38.3 seconds
commit  39414dd
info  🔄 Run: #20107 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #20109 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  50.8 seconds
commit  a08ccf5
info  🔄 Run: #20109 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #20107 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  48.2 seconds
commit  39414dd
info  🔄 Run: #20107 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #20107 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  33.6 seconds
commit  39414dd
info  🔄 Run: #20107 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #20109 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  33.6 seconds
commit  a08ccf5
info  🔄 Run: #20109 (attempt 1)

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 1bbea4f2-7787-4678-9819-534f721ae992

📥 Commits

Reviewing files that changed from the base of the PR and between 07f6835 and 7aaf391.

📒 Files selected for processing (6)
  • api/experimentation/dataclasses.py
  • api/experimentation/results_query.py
  • api/experimentation/services.py
  • api/tests/unit/experimentation/test_models.py
  • api/tests/unit/experimentation/test_services.py
  • docs/docs/deployment-self-hosting/observability/_events-catalogue.md

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Comment thread api/experimentation/services.py Outdated
@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 Sep 3, 2026
@github-actions github-actions Bot added docs Documentation updates and removed feature New feature or request docs Documentation updates labels Sep 3, 2026
@github-actions github-actions Bot added the feature New feature or request label Sep 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: c12e7b7d-0959-420e-906f-bec1f5b92c2f

📥 Commits

Reviewing files that changed from the base of the PR and between 7aaf391 and 39414dd.

📒 Files selected for processing (7)
  • api/experimentation/dataclasses.py
  • api/experimentation/results_query.py
  • api/experimentation/services.py
  • api/tests/unit/experimentation/test_models.py
  • api/tests/unit/experimentation/test_services.py
  • api/tests/unit/experimentation/test_tasks.py
  • docs/docs/deployment-self-hosting/observability/_events-catalogue.md

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Comment thread api/experimentation/dataclasses.py
@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 Sep 3, 2026
@gagantrivedi
gagantrivedi requested review from Zaimwa9 and removed request for matthewelwell September 3, 2026 12:22
@Flagsmith Flagsmith deleted a comment from themis-blindfold Bot Sep 3, 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.

Approving as I have non-blocking comments.

I wonder if we really need the hourly granularity though or if we are ok to tease with "incoming results" if the experiment is younger than 72h

Comment thread api/experimentation/services.py
Comment thread api/experimentation/services.py
@gagantrivedi
gagantrivedi merged commit 72bb92f into main Sep 4, 2026
35 checks passed
@gagantrivedi
gagantrivedi deleted the feat/experiment-conversion-timeseries branch September 4, 2026 08:17
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.

2 participants