Skip to content

feat(#783): surface failureCategory breakdown from metrics.json in sequant stats - #786

Merged
admarble merged 5 commits into
mainfrom
feature/783-feat-stats-surface-failurecategory-breakdown-from-
Jul 19, 2026
Merged

admarble merged 5 commits into
mainfrom
feature/783-feat-stats-surface-failurecategory-breakdown-from-

Conversation

@admarble

@admarble admarble commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

AC Verification

AC Description Status Evidence
AC-1 Breakdown rendered adjacent to outcome section ✅ Implemented src/commands/stats.ts (calculateFailureCategoryBreakdown + display block after outcome bars); dogfooded on the real 102-run corpus
AC-2 unclassified distinct from unknown ✅ Implemented run.failureCategory ?? "unclassified"; test asserts both buckets coexist
AC-3 Hidden with zero failed runs ✅ Implemented failedCount > 0 guard; asserted by test
AC-4 Post-filter computation ✅ Implemented Filters force log-mode (#640) — asserted for --label and --since; breakdown is a pure function of the passed runs
AC-5 JSON output includes breakdown ✅ Implemented failureCategories in --json metrics output; CSV N/A (log-sourced)
AC-6 Unit tests (mixed + zero-failure corpus) ✅ Implemented 10 tests in src/commands/stats-failure-categories.test.ts

Test plan

  • npm run build, npm run lint pass
  • npx vitest run src/commands/stats-failure-categories.test.ts src/commands/stats.test.ts — 30/30 pass
  • Dogfooded against the real .sequant/metrics.json (102 runs, 25 failed): renders unclassified 23 (92%), billing 2 (8%); hidden under --label; present in --json

QA verdict: READY_FOR_MERGE (see issue comment)

Closes #783

🤖 Generated with Claude Code

admarble added 2 commits July 18, 2026 11:41
Add a Failure Categories section to the metrics-based analytics display,
computed from MetricRun.failureCategory over failed runs and rendered
adjacent to the outcome bars. Pre-#761 records without the field are
bucketed as "unclassified", distinct from the "unknown" enum value.
Section is hidden when there are zero failed runs. The --json metrics
output includes the same breakdown as failureCategories; CSV is
log-sourced and unaffected. Cohort filters (--label/--since) continue to
force log-mode per #640, so the breakdown is post-filter by construction.

Fixes #783
admarble added 3 commits July 18, 2026 20:51
Widen the breakdown from failed-only to any run that recorded a failure
(outcome "failed" or "partial") — a partial run's failed issue is equally
the answer to "what's killing my runs". Success runs never carry a
failureCategory and stay excluded. This deliberately widens AC-1's literal
"over failed runs" wording (per user decision); the header is relabeled
"(N runs with a failure)" and the hide condition is now "no run recorded a
failure". AC-2 unclassified bucketing is preserved for uncategorized
partials. Tests, analytics docs, and CHANGELOG updated.
…s-surface-failurecategory-breakdown-from-

# Conflicts:
#	CHANGELOG.md
…s-surface-failurecategory-breakdown-from-

# Conflicts:
#	CHANGELOG.md
@admarble
admarble merged commit 2277a0a into main Jul 19, 2026
5 checks passed
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.

feat(stats): surface failureCategory breakdown from metrics.json

1 participant