Repository navigation
fix(review): defect generator never injects into comments - #543
Merged
Merged
Conversation
The first sample validation (#505) found 9 of 78 brace-language injections inside multi-line comments, all dropped awaits in ky's JSDoc examples. The finders blanked one-line comments only, so documentation counted as code and the corpus scored the reviewer on defects that do not exist. Block comments spanning lines are now blanked for every brace-language finder and the Terraform block tracker. A /* or // inside a string opens no comment. TLS, file-mode and Terraform substitutions apply only where they match outside comments. On the pinned samples, no site falls inside a comment. TypeScript drop-await sites fell from 99 to 44 and drop-bounds-check from 15 to 12; other languages are unchanged. Closes #537
This was referenced Sep 24, 2026
Merged
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.
Closes #537.
Problem
The first sample validation (#505) found 9 of 78 brace-language injections inside multi-line comments. All were
drop-awaitin ky's JSDoc examples, e.g.const text = await ky(...)intypes/ky.ts. The finders (#503) blanked string literals and one-line comments, but a/* ... */block spanning lines was not tracked. Documentation counted as code, and the corpus scored the reviewer on defects that do not exist: 9 of the 20 TypeScript injections.The substitution templates (TLS, file modes, Terraform) matched raw lines, so a commented-out setting could be changed too.
Changes (
defects.py)_mask_lines:/*left open through the line that closes it;*/is still code;/*or//inside a string ("src/**/*.ts", a URL) opens no comment.Guards, awaits, C string calls and the HCL block tracker all use it.
_substitute(..., code_only=<syntax>): a rule applies only where it matches the same text once comments are blanked. Strings are kept, because some rules match inside them (PosixFilePermissions.fromString("rw-------")). It is used for:docs/SELF_IMPROVEMENT.mdnotes that code finders never touch comments.Verification on the pinned samples
Every site of every template on the brace-language and Terraform samples was checked with an independent block-comment tracker, and none is inside a comment now. The only counts that changed are TypeScript/JavaScript:
drop-awaitdrop-bounds-check@exampleblocks)Every other language is unchanged.
Test plan
tests/test_review_defects_comments.py(13 cases, 10 fail without the fix):strncpyand a Terraform attribute in block comments;/*inside a string, a URL.uv run devops ci --force: all 13 gates pass