fix(control-plane): dashboard success rate defaults to 100% and actually covers 24h - #792
Merged
Merged
Conversation
The summary endpoint computed success_rate from calendar-today (UTC) executions only, returned 0 when nothing had run, and counted in-flight executions as failures. An idle system therefore showed a red 0% under a label claiming "last 24 hours". Compute the rate over executions started in the rolling last-24h window, count only terminal executions in the denominator, and report 100 when none have finished - no completed runs means nothing has failed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The summary endpoint returns success_rate as a 0-100 percentage, but the dashboard multiplied it by 100 again before display. The test fixtures mirrored the same wrong 0-1 scale, so the tautology passed while a real server response would have rendered 9100%. Align the fixtures with the actual API contract. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
📊 Coverage gateThresholds from
✅ Gate passedNo surface regressed past the allowed threshold and the aggregate stayed above the floor. |
Contributor
📐 Patch coverage gateThreshold: 80% on lines this PR touches vs
✅ Patch gate passedEvery surface whose lines were touched by this PR has patch coverage at or above the threshold. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The dashboard "Success rate" stat (desktop app tile labeled last 24 hours, web dashboard success stat) had three compounding bugs:
/api/ui/v1/dashboard/summaryreturnedsuccess_rate: 0, so an idle system showed a red 0% as if everything had failed. Nothing failing should read healthy: it now returns 100.[now-24h, now]window (derived from the already-fetched today+yesterday query results, no extra storage round-trip).While fixing the consumer side, the web dashboard turned out to double-scale the value (
successRate * 100on an already-0–100 percentage) — its test fixtures mirrored the same wrong 0–1 scale, so tests passed while a real server response would have rendered 9100%. Fixture scales are aligned with the actual API contract.The desktop app needs no change: its "last 24 hours" label is now truthful and it renders the server value as-is.
Validation contract
success_rateis 100 (idle reads healthy, not failed)executions.today/executions.yesterdayremain calendar-day counts (unchanged)91from the API as "91%", not "9100%"Each new test maps to one of the items above (
TestExecutionsSummarySuccessRateRolling24h, thecalculateSuccessRateedge cases, the idle-summary endpoint test, and the corrected web fixtures).Test plan
go test ./...— 49 packages pass; the one failure (internal/server: TestStartAndStopCoverAdditionalBranches) reproduces identically on cleanorigin/mainin the same environment (WSL-specific, green in CI)golangci-lint run— no findings in touched filesnpm ci && npm run buildandnpm run test:coverage— 683/683 tests pass🤖 Generated with Claude Code