Skip to content

fix(scanner): comment-anchor TODO grep + skip test-file markers (Codex #2)#15

Merged
telivity-otaip merged 1 commit into
mainfrom
fix/scanner-todo-precision
Jun 18, 2026
Merged

fix(scanner): comment-anchor TODO grep + skip test-file markers (Codex #2)#15
telivity-otaip merged 1 commit into
mainfrom
fix/scanner-todo-precision

Conversation

@telivity-otaip

Copy link
Copy Markdown
Collaborator

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

  • Comment-anchor the grep pattern^[ \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.
  • Skip test-file markers via a new exported isTestFile() helper (drops __tests__/ dirs and *.test / *.spec files in the result loop).
  • Left GREP_EXCLUDE_DIRS and scanDeadCode unchanged on purpose — dead-code usage search still needs to see test files; excluding them there would reintroduce false dead-code positives (the prior .tsx regression).

Test plan

New regression tests in scanner.test.ts:

  • markers in __tests__/.test/.spec files are ignored, real source markers still flagged
  • the emitted grep pattern stays comment-anchored (^…(//|\*|#)…)
  • isTestFile() classification table

pnpm -r build && typecheck && test clean — 180 tests pass in asil-improvement-loop.

…#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>
@telivity-otaip telivity-otaip merged commit e4b6147 into main Jun 18, 2026
2 checks passed
@telivity-otaip telivity-otaip deleted the fix/scanner-todo-precision branch June 18, 2026 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant