Skip to content

fix(status): require total, not errors, for the error-rate panel#1472

Open
kylebernhardy wants to merge 1 commit into
stagefrom
kyle/error-rate-required-fields
Open

fix(status): require total, not errors, for the error-rate panel#1472
kylebernhardy wants to merge 1 commit into
stagefrom
kyle/error-rate-required-fields

Conversation

@kylebernhardy

Copy link
Copy Markdown
Member

Fixes #1441 — error-rate panel declares wrong required fields, can falsely blank a working chart.

The error-rate entry in DERIVED_REQUIRED_FIELDS declared ['count', 'errors'], but recomputeErrorRate reads count and total — never errors. Two failure modes:

  • On a Harper whose success records lack an errors column, MetricPanel showed a false "field unavailable" empty state for a chart that would have rendered fine.
  • A genuinely missing total was 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 omitting errors changes 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.ts plus the new tests in specRequiredFields.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).

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

@gemini-code-assist gemini-code-assist Bot 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.

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.

@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 47.59% 4494 / 9442
🔵 Statements 47.92% 4792 / 9998
🔵 Functions 39.52% 1070 / 2707
🔵 Branches 39.83% 2910 / 7306
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/features/instance/status/analytics/lib/specRequiredFields.ts 95.45% 92.85% 100% 94.73% 97, 117
Generated in workflow #1440 for commit 1b0f236 by the Vitest Coverage Report Action

@kylebernhardy kylebernhardy marked this pull request as ready for review July 11, 2026 18:16
@kylebernhardy kylebernhardy requested a review from a team as a code owner July 11, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

error-rate panel declares wrong required fields, can falsely blank a working chart

1 participant