Skip to content

test(fix): add composing-fixes and collision edge-case tests - #52

Merged
protosphinx merged 1 commit into
mainfrom
bot/fix-compose-tests
Aug 9, 2026
Merged

test(fix): add composing-fixes and collision edge-case tests#52
protosphinx merged 1 commit into
mainfrom
bot/fix-compose-tests

Conversation

@protosphinx

Copy link
Copy Markdown
Member

Why

The per-file buffer in applyFixes lets multiple rule fixes compose on
the same file in a single call (the second fix operates on the output of
the first, not the original raw content). This core feature had zero test
coverage: every existing test applies exactly one fix rule per file.

The jaccard collision detector also has a special-case branch
(if (a.size === 0 && b.size === 0) return 0) to guard against
divide-by-zero when both descriptions tokenize to empty sets (all words
are 2 chars or fewer). This path was also untested.

What

  • test/fix-compose.test.ts (new file, 6 tests)
    • Compose name-drift and deprecated-tools-field on the same file
    • Compose tool-fields-ambiguous and tools-duplicate on the same file
    • Compose two rules across two files in one call
    • Verify notes array has one entry per applied fix when composing
    • Verify a diagnostic whose file is not in the parsed list is counted as skipped
    • Dry-run with composed fixes does not write to disk
  • test/checks.test.ts (2 additions)
    • description-collision does not fire when both descriptions tokenize to empty sets
    • description-collision message includes the computed Jaccard score

Tests

  • All existing 210 tests continue to pass
  • 8 new tests added; total is 218

Self-merge gate

  • all CI checks pass
  • LOC delta < 250 (added + removed): 171 lines added, 0 removed
  • no public-API surface change
  • no runtime-dependency additions
  • no workflow file changes
  • tests added or extended: yes, new test file + 2 additions to checks.test.ts

Generated by Claude Code

- fix-compose.test.ts: 6 tests covering the per-file buffer in applyFixes
  that lets multiple rule fixes compose on the same file in one call.
  Also covers the skipped-count path when a diagnostic references a file
  not present in the parsed list.
- checks.test.ts: 2 tests covering the jaccard(empty, empty) -> 0 branch
  in the collision detector (descriptions consisting only of words with
  2 chars or fewer produce empty token sets and must not collide), and
  verifies the Jaccard score appears in the diagnostic message.
@protosphinx protosphinx added the automated Opened by the daily bot label Aug 9, 2026 — with Claude
@protosphinx
protosphinx merged commit ad9a3c7 into main Aug 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated Opened by the daily bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant