fix(status): require total, not errors, for the error-rate panel#1472
Open
kylebernhardy wants to merge 1 commit into
Open
fix(status): require total, not errors, for the error-rate panel#1472kylebernhardy wants to merge 1 commit into
kylebernhardy wants to merge 1 commit into
Conversation
The error-rate derived-metric override declared ['count', 'errors'], but recomputeErrorRate reads count and total — never errors. On a Harper whose success records lack an errors column, MetricPanel showed a false "field unavailable" empty state for a chart that would render fine, while a genuinely missing total (which silently zeroes the numerator and renders a flat 100% error rate) was never flagged. Change the override to ['count', 'total'] and pin it behaviorally: the new tests feed recomputeErrorRate records with each declared required field omitted and assert the output changes (load-bearing), and assert that omitting errors leaves the output untouched — so the test fails if either the override or the recompute drifts. Fixes #1441 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UZEaYdKFXuQw2Hf6XpPdEV
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the required fields for the 'error-rate' derived metric from ['count', 'errors'] to ['count', 'total'] in specRequiredFields.ts. It also adds comprehensive unit tests in specRequiredFields.test.ts to verify that the required fields match what recomputeErrorRate actually reads, ensuring that 'total' is required and 'errors' is not. There are no review comments, and I have no feedback to provide.
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
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.
Fixes #1441 — error-rate panel declares wrong required fields, can falsely blank a working chart.
The
error-rateentry inDERIVED_REQUIRED_FIELDSdeclared['count', 'errors'], butrecomputeErrorRatereadscountandtotal— nevererrors. Two failure modes:successrecords lack anerrorscolumn, MetricPanel showed a false "field unavailable" empty state for a chart that would have rendered fine.totalwas never flagged — the recompute silently treats it as 0 and renders a misleading flat 100% error rate instead of the explicit empty state.The override is now
['count', 'total'], pinned behaviorally: the new tests omit each declared required field from a fixture and assert the recompute output actually changes, and assert that omittingerrorschanges nothing — so the test fails if either the override or the recompute drifts.Where to look: the one-line change in
src/features/instance/status/analytics/lib/specRequiredFields.tsplus the new tests inspecRequiredFields.test.ts.Verified with
tsc -b, the full vitest suite (197 files / 1312 passed), dprint, and oxlint. Codex and Gemini cross-model reviews both came back with no findings.Generated by kAIle (Claude Fable 5).