Skip to content

ops: detect malformed TODO issue references in todo-checker - #22119

Draft
claude[bot] wants to merge 5 commits into
developfrom
claude/todo-checker-near-miss
Draft

ops: detect malformed TODO issue references in todo-checker#22119
claude[bot] wants to merge 5 commits into
developfrom
claude/todo-checker-near-miss

Conversation

@claude

@claude claude Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Requested by Adrian Sutton · Slack thread

Before: todo-checker.sh only saw comments already written in the TODO(<ref>) form. A TODO that clearly referenced an issue but was slightly malformed — e.g. TODO:(#123), TODO (#123), TODO[#123], TODO: #123, or FIXME equivalents — was silently ignored, so it never got format-checked or swept when the issue closed. The tree has exactly one such comment: TODO:(#18382) in OPContractsManagerV2.sol:364 (stray colon before the paren), invisible to the checker since it was added.

After: the checker flags malformed issue references as errors under --strict (the mode every main CI pipeline runs), with a warning pointing at the exact line and the expected TODO(<ref>): <description> format. Additionally, a valid TODO(<ref>) with no trailing description (e.g. TODO(client-pod#826)) — previously also invisible because the capture regex required trailing text — is now tracked by the existing format and closed-issue checks.

Note on the one existing offender: the OPContractsManagerV2.sol:364 fix is deliberately NOT included here — issue #18382 is closed, so fixing the format in this PR would make the scheduled --check-closed job fail. That comment gets fixed (or removed) in a separate PR, and this PR's strict todo-issues check will stay red until that lands — expected, and why this PR stays draft/unmerged for now.

Also in this PR: the script now fails fast with an [Error] when ripgrep is not installed — previously a missing rg made every scan come back empty and the script exited 0 having checked nothing.

How: a new near-miss scan runs after the main check: it greps for a TODO/FIXME token followed within a few punctuation/whitespace characters by an issue-reference-looking token (#123, repo#123, or org/repo#123), then subtracts lines already using the parenthesized TODO(...)/FIXME(...) form (those are the main check's domain). The short window is the false-positive guard: prose like TODO: fix the bug from PR #123 or a bare TODO: fix this later is not flagged, and neither are hex colors or markdown headings, because letters can't appear between the token and the reference. Same exclusion globs as the main scan; near-misses warn in --verbose and fail the run in --strict, exactly like format mismatches. Verified: the scan flags the :364 near-miss and nothing else across the whole tree, and the existing 63 canonical matches are unchanged by the regex relaxation (the only additions are the two previously-invisible valid-ref lines).

claude and others added 5 commits July 29, 2026 22:54
The checker's capture regex only sees comments already in the
TODO(<ref>) form, so a TODO that clearly references an issue but is
malformed (e.g. TODO:(#123), TODO (#123), TODO[#123], TODO: #123)
was silently ignored. Add a near-miss scan that flags a TODO/FIXME
token closely followed by an issue-reference-looking token unless the
line already uses the parenthesized form, and fail under --strict like
other format mismatches. Bare TODOs with no issue reference are
intentionally not flagged.

Also relax the capture regex so a valid TODO(<ref>) with no trailing
description (e.g. TODO(client-pod#826)) is tracked by the existing
format and closed-issue checks instead of being invisible.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Adrian Sutton <ajsutton@users.noreply.github.com>
…anagerV2

TODO:(#18382) had a stray colon between TODO and the parenthesized
issue reference, making it invisible to ops/scripts/todo-checker.sh.
Use the canonical TODO(#18382): form.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Adrian Sutton <ajsutton@users.noreply.github.com>
Without rg the scans silently come back empty and the script exits 0
having checked nothing.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Adrian Sutton <ajsutton@users.noreply.github.com>
The TODO comment fix changed the contract's source, and semver-diff
requires a version change whenever a contract's semver-lock entry
changes. Patch bump per OPCM versioning rules (patch = development
changes) and regenerate the semver-lock entry.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Adrian Sutton <ajsutton@users.noreply.github.com>
Issue #18382 is closed, so fixing the TODO:(#18382) format here would
make the scheduled --check-closed job fail. The comment fix (and its
required OPContractsManagerV2 version bump + semver-lock regen) lands
in a separate PR; this PR's strict todo-issues check stays red until
then, which is expected.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Adrian Sutton <ajsutton@users.noreply.github.com>
@ajsutton ajsutton self-assigned this Jul 29, 2026
@ajsutton
ajsutton self-requested a review July 29, 2026 23:30
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.

2 participants