fix(filter/tsc): severity-rank clusters + per-severity header#56
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
V0.4.1 polish round, item #1 of 4 (severity rank → quarantine → overload truncation → cache-stable header). Lands the deferred
§ 9c-bitem fromdocs/plans/filter-engine/00-decisions.mdbefore 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:
Now:
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 bareN errorswhen only errors are present.infostays 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— bumpTSC_FILTER_VERSIONtsc/2→tsc/3.Test plan
bun test— 317/317 pass (+5 new: 2 cluster severity-rank tests, 3 render header tests)bun x biome ci .— cleanbun run typecheck— cleanRisk / 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/3bump means archivedtsc/2evidence carries the pre-rank ordering attribution. Rollback: revert this commit, no migrations.