Skip to content

feat(experimentation): refresh experiment exposures via task processor#7751

Closed
gagantrivedi wants to merge 3 commits into
feat/experiment-exposure-snapshotsfrom
feat/experiment-exposure-tasks
Closed

feat(experimentation): refresh experiment exposures via task processor#7751
gagantrivedi wants to merge 3 commits into
feat/experiment-exposure-snapshotsfrom
feat/experiment-exposure-tasks

Conversation

@gagantrivedi

@gagantrivedi gagantrivedi commented Jun 11, 2026

Copy link
Copy Markdown
Member
  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature. (deferred — flag-gated and not user-visible yet; docs land with the UI. Events catalogue regenerated here.)
  • 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 experimentation results layer (v0.1: experiment exposures panel). Second backend slice, stacked on #7740 — the API endpoint and UI follow.

  • compute_experiment_exposures(experiment_id) — computes the full-window exposures summary and stores it via record_refresh. Window is started_atended_at or now, so a completed experiment's final refresh is frozen at its end. Warehouse errors are absorbed into record_failure (the last good payload survives; nothing raises into the task processor). Never-started experiments are skipped.
  • refresh_running_experiment_exposures — recurring sweep every EXPERIMENTATION_EXPOSURES_REFRESH_MINUTES (new setting, default 60) enqueueing one compute per RUNNING experiment; no-op when EXPERIMENTATION_CLICKHOUSE_URL is unset. No staleness filter: the sweep cadence is the refresh interval, and an as_of-older-than-interval check would skip every other sweep (task latency keeps as_of slightly younger than the interval).
  • Completing an experiment enqueues the final refresh from transition_experiment_status, making the stored row the durable record once events pass the 90-day ClickHouse TTL.
  • structlog eventsexperimentation.exposures.computed / exposures.compute_failed; events catalogue regenerated.

How did you test this code?

  • Unit tests: compute task (stored payload/as_of, completed-experiment frozen window, failure preserves last good payload, never-started skip, log events asserted), sweep (enqueues running experiments only; skips without a warehouse DSN), complete action enqueues the final refresh / start does not.
  • pytest tests/unit/experimentation/ — 257 passed; ruff + mypy strict clean.

@vercel

vercel Bot commented Jun 11, 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 11, 2026 8:25am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ignored Ignored Preview Jun 11, 2026 8:25am
flagsmith-frontend-staging Ignored Ignored Preview Jun 11, 2026 8:25am

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 11, 2026
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.55%. Comparing base (ef36c14) to head (7aac101).

Additional details and impacted files
@@                         Coverage Diff                         @@
##           feat/experiment-exposure-snapshots    #7751   +/-   ##
===================================================================
  Coverage                               98.55%   98.55%           
===================================================================
  Files                                    1454     1453    -1     
  Lines                                   55987    56086   +99     
===================================================================
+ Hits                                    55177    55276   +99     
  Misses                                    810      810           

☔ 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 added the docs Documentation updates label Jun 11, 2026
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request docs Documentation updates labels Jun 11, 2026
@github-actions github-actions Bot added the docs Documentation updates label Jun 11, 2026
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request docs Documentation updates labels Jun 11, 2026
@gagantrivedi

Copy link
Copy Markdown
Member Author

Superseded: the task-processor approach is cut in favour of an explicit refresh endpoint, landing with the GET endpoint in the next PR.

@gagantrivedi gagantrivedi deleted the feat/experiment-exposure-tasks branch June 11, 2026 08:44
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.

1 participant