fix: per-unit N+1 findings, readable numbers, fallback attribution (#13 #14 #15) #43

Merged
james.maes merged 1 commits from fix/issues-13-14-15-stored-rules-attribution into develop 2026-11-27 01:44:29 +00:00
Owner

Summary

  • #13 N_PLUS_ONE now raises one finding per unit of work. Repeat patterns are grouped by (unitKind, unitName), pods and windows are aggregated per statement shape before the thresholds apply, findings dedupe on rule + unit, and the evidence lists the top 5 repeated shapes (table, repeats, normalized SQL) plus a count of the rest. Existing per-shape findings close as "No longer detected" on the next analysis.
  • #14 New NumberText formats counts with grouping or K/M/B suffixes, percentages to one decimal and sizes in MB, with no scientific notation. Every rule's evidence table goes through it. MISSING_INDEX now names its candidate columns in the summary.
  • #15 AttributionListener names statements that have no UnitOfWork instead of using one (none) bucket. Order: reported process, then the outermost process or backend step on the action stack (process:<name>), then the thread name with numbers collapsed (thread:alerts-worker-#), then (none). The unit kind stays OTHER, and names are bounded so attribution_max_keys still holds. Opening real units in core for durable job chunks, the health runner and alerts workers remains a core change.

Tests

  • StoredRuleTest: repeatsGroupByUnitNotByStatementShape and summariesAreHumanReadable (new). It also asserts that no rule emits scientific notation.
  • NumberTextTest (new).
  • AttributionTest: fallbackNamesStatementsWithoutAUnitOfWork and threadPatterns (new); the existing (none) assertions now use the thread pattern.
  • ./mvnw verify passes: checkstyle, 135 tests and the JaCoCo gate.

Fixes #13
Fixes #14
Fixes #15

🤖 Generated with Claude Code

## Summary - **#13** `N_PLUS_ONE` now raises one finding per unit of work. Repeat patterns are grouped by `(unitKind, unitName)`, pods and windows are aggregated per statement shape before the thresholds apply, findings dedupe on rule + unit, and the evidence lists the top 5 repeated shapes (table, repeats, normalized SQL) plus a count of the rest. Existing per-shape findings close as "No longer detected" on the next analysis. - **#14** New `NumberText` formats counts with grouping or K/M/B suffixes, percentages to one decimal and sizes in MB, with no scientific notation. Every rule's evidence table goes through it. `MISSING_INDEX` now names its candidate columns in the summary. - **#15** `AttributionListener` names statements that have no `UnitOfWork` instead of using one `(none)` bucket. Order: reported process, then the outermost process or backend step on the action stack (`process:<name>`), then the thread name with numbers collapsed (`thread:alerts-worker-#`), then `(none)`. The unit kind stays `OTHER`, and names are bounded so `attribution_max_keys` still holds. Opening real units in core for durable job chunks, the health runner and alerts workers remains a core change. ## Tests - `StoredRuleTest`: `repeatsGroupByUnitNotByStatementShape` and `summariesAreHumanReadable` (new). It also asserts that no rule emits scientific notation. - `NumberTextTest` (new). - `AttributionTest`: `fallbackNamesStatementsWithoutAUnitOfWork` and `threadPatterns` (new); the existing `(none)` assertions now use the thread pattern. - `./mvnw verify` passes: checkstyle, 135 tests and the JaCoCo gate. Fixes #13 Fixes #14 Fixes #15 🤖 Generated with [Claude Code](https://claude.com/claude-code)
james.maes added 1 commit 2026-11-27 00:54:00 +00:00
fix: per-unit N+1 findings, readable numbers and fallback attribution
maven / build (push) Successful in 5m50s
build / maven (push) Successful in 5m57s
b71d1cc43f
- N_PLUS_ONE groups repeat patterns by (unitKind, unitName), dedupes on
  rule + unit and lists the top 5 repeated statement shapes as evidence (#13)
- NumberText: grouping / K,M,B suffixes, one-decimal percentages, no
  scientific notation in rule summaries and evidence; MISSING_INDEX names
  its candidate columns (#14)
- AttributionListener names statements without a UnitOfWork by reported
  process, outermost process on the action stack, then thread-name pattern
  instead of one anonymous (none) bucket (#15)

Fixes #13
Fixes #14
Fixes #15

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
james.maes merged commit 6b8bae4d94 into develop 2026-11-27 01:44:29 +00:00
Sign in to join this conversation.