Skip to content

fix(filter/tsc): severity-rank clusters + per-severity header#56

Merged
Asgarrrr merged 1 commit into
mainfrom
filter/tsc-severity-rank
May 8, 2026
Merged

fix(filter/tsc): severity-rank clusters + per-severity header#56
Asgarrrr merged 1 commit into
mainfrom
filter/tsc-severity-rank

Conversation

@Asgarrrr

@Asgarrrr Asgarrrr commented May 8, 2026

Copy link
Copy Markdown
Owner

Summary

V0.4.1 polish round, item #1 of 4 (severity rank → quarantine → overload truncation → cache-stable header). Lands the deferred § 9c-b item from docs/plans/filter-engine/00-decisions.md before V0.5 filters arrive so the engine pattern is consistent from day 1 of the next roster.

Bug fixed

Errors get buried under larger warning clusters today. With 1 TS2322 error and 30 TS6133 unused-var warnings, the bullet order is:

- **TS6133** ×30 — same shape: ...    ← warnings first because cluster is largest
- **TS2322** src/auth/login.ts:42:3 — Type 'string' is not assignable to type 'number'.

Now:

- **TS2322** src/auth/login.ts:42:3 — Type 'string' is not assignable to type 'number'.    ← error surfaces first
- **TS6133** ×30 — same shape: ...

Header rewrite

Today: # tsc — 33 errors in 4 files (Tms) — conflates 3 errors and 30 warnings under "errors".

After: # tsc — 3 errors, 30 warnings in 4 files (Tms). Singularizes per-severity (1 error, 2 warnings); falls back to bare N errors when only errors are present. info stays singular regardless of count.

Implementation

  • cluster.ts — primary sort key on severity (error → warning → info), tiebreakers unchanged (members.length desc, ruleId, first-member file).
  • render.ts — count by severity instead of total; build header from non-empty severity parts.
  • index.ts — bump TSC_FILTER_VERSION tsc/2tsc/3.

Test plan

  • bun test — 317/317 pass (+5 new: 2 cluster severity-rank tests, 3 render header tests)
  • bun x biome ci . — clean
  • bun run typecheck — clean
  • Existing fixtures (small/medium/large.txt) are pure errors → snapshots unchanged

Risk / rollback

Output shape changes only when a run has multiple severities. None of the committed fixtures do, so snapshots are byte-identical and the bench compression numbers stay valid. The tsc/3 bump means archived tsc/2 evidence carries the pre-rank ordering attribution. Rollback: revert this commit, no migrations.

V0.4.1 polish round, item #1 of 4. Errors no longer get buried
under larger warning clusters, and the header stops conflating
warnings and infos under "errors".

Cluster sort gains a primary key on severity (error → warning
→ info), then falls through to the existing tiebreakers
(members.length desc, ruleId, first-member file). Tsc emits a
single severity per ruleId, so reading members[0].severity for
the cluster's severity is sound.

Header rewrite: instead of `# tsc — 33 errors in 4 files`,
emit `# tsc — 3 errors, 30 warnings in 4 files` when severities
mix. Singularizes per-severity (`1 error, 2 warnings`); falls
back to the bare `N errors` shape when only errors are present.
"info" stays singular regardless of count (tsc convention; "infos"
reads wrong in English).

`§ 9c-b` deferred item from `docs/plans/filter-engine/00-decisions.md`,
tagged "V0.4 candidate" but slipped — landing it now before V0.5
filters arrive so the engine pattern is consistent from day 1
of the next roster.

Bump `tsc/2 → tsc/3`. The header shape changes for any input
with multiple severities; bumping lets `observation.json`
attribute archived runs to the pre-rank renderer. Existing
fixtures (small/medium/large.txt) are pure errors → snapshots
unchanged.

Verified: 317/317 tests pass (+5 new), biome ci clean, typecheck
clean.
@Asgarrrr
Asgarrrr merged commit bff66f5 into main May 8, 2026
2 checks passed
@Asgarrrr
Asgarrrr deleted the filter/tsc-severity-rank branch May 8, 2026 15:11
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.

1 participant