Skip to content

fix(report): hide empty 'Worst N Sessions' and 'Recurring Failures' sections#296

Merged
decko merged 5 commits into
mainfrom
soda/284
May 19, 2026
Merged

fix(report): hide empty 'Worst N Sessions' and 'Recurring Failures' sections#296
decko merged 5 commits into
mainfrom
soda/284

Conversation

@decko
Copy link
Copy Markdown
Owner

@decko decko commented May 19, 2026

Summary

Hide the Worst N Sessions and Recurring Failures sections in the HTML report when they have no data to display. Both sections are now omitted entirely rather than rendered as empty placeholders.

The recurring-failure detector was also improved: exact-text grouping was replaced with Jaccard-similarity clustering (≥ 60 % token overlap) so near-duplicate findings across different files are merged into one row. The minimum session threshold was also raised from 2 → 3 to filter out one-off coincidences.


Acceptance Criteria

  • Worst N Sessions hidden when empty — template guards with {% if worst_sessions %}, entire <section> omitted when list is empty
  • Fuzzy matching for recurring failures — Jaccard similarity clustering (≥ 0.60 threshold) using tokenize() from _common.py
  • Recurring failures section hidden when empty — template guards with {% if recurring_failures %}, entire <section> omitted
  • Grouped findings with count + representative example — table shows issue text, severity badge, count, and session list
  • Tests for empty and populated states — 4 empty-state tests + 1 populated-state test + 6 unit tests for Jaccard clustering logic
  • Towncrier fragmentchanges/284.fix present with clear description

Review Results

Specialist Verdict Findings
Implementation ✅ pass 0
Verification ✅ pass 0
Code Review ✅ pass 0

All 1617 tests passed (4 skipped, 4 deselected). ruff check, ruff format, and ty check all clean.


Refs #284

Assisted-by: Claude Opus 4.6 (1M context) noreply@anthropic.com
Assigned-by: decko

decko added 5 commits May 19, 2026 12:45
Wrap <section class='worst-sessions'> in {% if worst_sessions %} so the
entire section is omitted from the HTML output when no retrieval metrics
produce a session ranking.

Previously the section was always rendered, showing 'Worst 0 Sessions'
and an empty-state paragraph.  This was visual noise when the report was
generated without --judge.

Also updates test_no_needs_attention_when_all_pass to use a direct
element-presence assertion instead of relying on the now-removed
'Worst 0 Sessions' heading text.
…ing and ≥3 session threshold (#284)

Replace the exact-text-match grouping with a greedy Jaccard-similarity
clustering algorithm:

* Issues whose token sets have Jaccard similarity ≥ 0.60 are merged into
  the same cluster (cross-file fuzzy matching).
* Raise the session threshold from >1 to ≥3, eliminating single-pair
  noise from the Recurring Failures table.
* Tokenisation reuses raki.metrics.knowledge._common.tokenize() for
  consistent stop-word removal and lower-casing.
* Internal _IssueCluster dataclass replaces the untyped dict accumulator.

New tests cover: 3-session pass, 2-session exclusion, Jaccard merging,
Jaccard non-merging, severity escalation, and count-descending sort.
Wrap the entire <section> containing the Recurring Failures table in an
{% if recurring_failures %} guard so the section is completely omitted
from the rendered HTML when no issue cluster meets the ≥3 session
threshold.

Previously the section was always shown with an empty-state paragraph,
which was misleading noise at the top of the page.

Adds test_recurring_failures_section_hidden_when_empty to verify the
section element does not appear in reports with no qualifying failures.
…ing (#284)

Three test updates caused by the new ≥3 session threshold and hidden
sections:

* test_recurring_failures_section: switched from _make_report_with_samples
  (SQL injection in 2 sessions, below threshold) to the new
  _make_report_with_recurring_failures fixture (3 sessions) and updated
  the assertion to check for the actual section heading element.

* test_no_recurring_failures_shows_empty_state: behaviour changed from
  'show empty-state paragraph' to 'hide section entirely'; now asserts
  that <h2>Recurring Failures</h2> is absent from the HTML.

* test_no_worst_sessions_shows_empty_state: behaviour changed from
  'show empty-state paragraph' to 'hide section entirely'; now asserts
  that class="worst-sessions" is absent from the HTML.

Also adds _make_report_with_recurring_failures() helper for tests that
need a report where recurring failures threshold is met.
@decko decko added the ai-assisted Implemented with AI assistance label May 19, 2026
@decko decko merged commit 23eee4f into main May 19, 2026
4 checks passed
@decko decko deleted the soda/284 branch May 19, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-assisted Implemented with AI assistance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant