test(fix): add composing-fixes and collision edge-case tests - #52
Merged
Conversation
- 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.
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.
Why
The per-file buffer in
applyFixeslets multiple rule fixes compose onthe 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
jaccardcollision detector also has a special-case branch(
if (a.size === 0 && b.size === 0) return 0) to guard againstdivide-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)name-driftanddeprecated-tools-fieldon the same filetool-fields-ambiguousandtools-duplicateon the same filenotesarray has one entry per applied fix when composingtest/checks.test.ts(2 additions)description-collisiondoes not fire when both descriptions tokenize to empty setsdescription-collisionmessage includes the computed Jaccard scoreTests
Self-merge gate
Generated by Claude Code