fix(scanner): comment-anchor TODO grep + skip test-file markers (Codex #2)#15
Merged
Merged
Conversation
…#2) The TODO/FIXME/HACK/DOMAIN_QUESTION scan matched any occurrence of the marker words anywhere on a line, so string literals, regexes, and the scanner's own pattern produced phantom improvement tasks. It also surfaced markers living in test fixtures as if they were real work. - Anchor the grep pattern to a line-start comment opener (`^[ \t]*(//|\*|#)[ \t]*(TODO|FIXME|HACK|DOMAIN_QUESTION)[: ]`), so only genuine comment markers match — not bare string/regex occurrences. - Post-filter results through a new exported `isTestFile()` helper to drop markers that live in `__tests__/` dirs or `*.test`/`*.spec` files. - `GREP_EXCLUDE_DIRS` and `scanDeadCode` left unchanged on purpose: dead-code usage search still needs test files, so excluding them there would reintroduce false dead-code positives. Adds regression tests: test-file markers ignored, the grep pattern stays comment-anchored, and `isTestFile` classification. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Codex review finding #2 — scanner false-positive precision. The TODO/FIXME/HACK/DOMAIN_QUESTION scan matched the marker words anywhere on a line, so string literals, regexes, and even the scanner's own pattern definition produced phantom improvement tasks. It also surfaced markers that live in test fixtures as if they were real work.
Changes
^[ \t]*(//|\*|#)[ \t]*(TODO|FIXME|HACK|DOMAIN_QUESTION)[: ]. Only genuine line-start comment markers match now; bare'TODO'strings //FIXME/regexes no longer trip the scanner.isTestFile()helper (drops__tests__/dirs and*.test/*.specfiles in the result loop).GREP_EXCLUDE_DIRSandscanDeadCodeunchanged on purpose — dead-code usage search still needs to see test files; excluding them there would reintroduce false dead-code positives (the prior.tsxregression).Test plan
New regression tests in
scanner.test.ts:__tests__/.test/.specfiles are ignored, real source markers still flagged^…(//|\*|#)…)isTestFile()classification tablepnpm -r build && typecheck && testclean — 180 tests pass inasil-improvement-loop.