feat(intake): count errored missing scores as 0 in evaluator rollups [ASE-616]#772
feat(intake): count errored missing scores as 0 in evaluator rollups [ASE-616]#772shanaiabuggy wants to merge 2 commits into
Conversation
…[ASE-616] Evaluator score rollups averaged only over scored runs (the score SQL INNER JOINs evaluator_results), so errored/unscored runs were dropped from the denominator — inflating score means and making them non-comparable across experiments. Switch scores to a fixed denominator: - A run that ERRORED with no score counts as 0 (a real failed attempt). - A run that SUCCEEDED with no score is excluded (the evaluator wasn't run on it; counting it 0 would wrongly penalize partial-coverage evaluators). - An errored run that DID record a score keeps it. Implemented in _score_rollups_sql via the session's root_status: scored sessions keep their value; errored-unscored sessions contribute 0 (UNION ALL + LEFT ANTI JOIN against the scored set); successful-unscored sessions are left out. Cost and latency (_metric_rollups_sql) are unchanged — a missing value there is unmeasured. Studio: the existing aggregate-metric tooltip on score cells now notes "Errored runs with no score count as 0." No new UI elements. Validated end-to-end against ClickHouse: new integration test seeds a scored, an errored-unscored, and a succeeded-unscored run — mean = avg(1.0, 0) = 0.5 over 2 test cases (the succeeded-unscored one excluded). Existing rollup tests unchanged. Signed-off-by: shanaiabuggy <59746633+shanaiabuggy@users.noreply.github.com>
📝 WalkthroughWalkthroughErrored sessions without evaluator scores now contribute zeroes to evaluation rollups. Integration tests cover denominator behavior, and evaluator score tooltips explain when missing scores from errored runs count as zero. ChangesEvaluation score rollups
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
web/packages/studio/src/components/dataViews/ExperimentGroupDataView/MeanValueTooltipCell.tsx (1)
31-36: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMake the new prop readonly.
Change it to
readonly countsMissingAsZero?: boolean.As per coding guidelines, “Use
readonlyfor immutable properties in TypeScript interfaces and types.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/packages/studio/src/components/dataViews/ExperimentGroupDataView/MeanValueTooltipCell.tsx` around lines 31 - 36, Update the countsMissingAsZero property in the MeanValueTooltipCellProps interface to be readonly while preserving its optional boolean type and existing documentation.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@services/intake/tests/integration/spans/test_experiment_rollups.py`:
- Around line 326-330: Add an errored session with a non-null score to the seeds
in the experiment rollup integration test, then extend the expected assertions
to verify that its recorded score is retained rather than replaced or
supplemented with zero. Keep the existing unscored errored and successful
unscored cases unchanged.
---
Nitpick comments:
In
`@web/packages/studio/src/components/dataViews/ExperimentGroupDataView/MeanValueTooltipCell.tsx`:
- Around line 31-36: Update the countsMissingAsZero property in the
MeanValueTooltipCellProps interface to be readonly while preserving its optional
boolean type and existing documentation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 92f2b99f-8664-4f2d-b9f9-8a87a11b1f59
📒 Files selected for processing (4)
services/intake/src/nmp/intake/spans/evaluation_rollup_repository.pyservices/intake/tests/integration/spans/test_experiment_rollups.pyweb/packages/studio/src/components/dataViews/ExperimentGroupDataView/MeanValueTooltipCell.tsxweb/packages/studio/src/components/dataViews/ExperimentGroupDataView/index.tsx
| seeds: list[tuple[str, str, float | None, bool]] = [ | ||
| ("run-ok", "case-ok", 1.0, False), # scored -> 1.0 | ||
| ("run-err", "case-err", None, True), # errored + no score -> counts as 0 | ||
| ("run-skip", "case-skip", None, False), # succeeded + no score -> excluded from the denominator | ||
| ] |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Cover errored sessions that already have a score.
This misses the anti-join protection: a regression that unions 0 alongside a real errored-session score still passes. Add an errored, scored seed and assert its recorded value is retained.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@services/intake/tests/integration/spans/test_experiment_rollups.py` around
lines 326 - 330, Add an errored session with a non-null score to the seeds in
the experiment rollup integration test, then extend the expected assertions to
verify that its recorded score is retained rather than replaced or supplemented
with zero. Keep the existing unscored errored and successful unscored cases
unchanged.
|
…t in the rollup Addresses CodeRabbit on #772: the errored-missing-scores test only covered errored+unscored (->0) and successful+unscored (excluded); a regression that unioned 0 for every errored session would have slipped through. Adds an errored+scored seed and asserts its 0.8 is retained (mean 0.6). Also marks the MeanValueTooltipCell countsMissingAsZero prop readonly per the coding guideline. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: shanaiabuggy <59746633+shanaiabuggy@users.noreply.github.com>
Closes ASE-616
Why
Evaluator score rollups (the aggregate means in the Experiments table) averaged only over scored runs — the score SQL INNER JOINs
evaluator_results, so a run with no score was dropped from the denominator. That inflates score means (errored runs excluded instead of counted as failures) and makes means non-comparable across experiments (the denominator varies per metric/experiment). Our standard — and Harbor's / switchyard-bench's — is a fixed denominator with no-score counted as 0.Cost/latency are different: a missing value there is unmeasured, not zero, so those keep excluding missing. The rollup already computes scores and cost/latency on separate SQL paths, so this change is localized to the score path.
Change
Backend —
services/intake/src/nmp/intake/spans/evaluation_rollup_repository.py_score_rollups_sqlnow uses a fixed denominator, keyed on the session'sroot_status:UNION ALL(scored sessions) +LEFT ANTI JOINagainst the scored set (errored-unscored → 0)._scoped_sessions_sqlnow selectsroot_status._metric_rollups_sql(cost/latency) is unchanged.Studio — the existing aggregate-metric tooltip on score cells appends "Errored runs with no score count as 0." No new popovers/indicators (per the ticket).
Validation
Ran the rollup integration tests against real ClickHouse (testcontainers):
mean = avg(1.0, 0) = 0.5over 2 test cases (the succeeded-unscored one excluded).Scope notes
root_status = 'error'is treated as a failed→0 attempt;cancelled/unknown/success-with-no-score are excluded (conservative — doesn't penalize ambiguous states).🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
UI Improvements