ops: detect malformed TODO issue references in todo-checker - #22119
Draft
claude[bot] wants to merge 5 commits into
Draft
ops: detect malformed TODO issue references in todo-checker#22119claude[bot] wants to merge 5 commits into
claude[bot] wants to merge 5 commits into
Conversation
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>
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
self-requested a review
July 29, 2026 23:30
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.
Requested by Adrian Sutton · Slack thread
Before:
todo-checker.shonly saw comments already written in theTODO(<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)inOPContractsManagerV2.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 expectedTODO(<ref>): <description>format. Additionally, a validTODO(<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:364fix is deliberately NOT included here — issue #18382 is closed, so fixing the format in this PR would make the scheduled--check-closedjob 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 missingrgmade 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/FIXMEtoken followed within a few punctuation/whitespace characters by an issue-reference-looking token (#123,repo#123, ororg/repo#123), then subtracts lines already using the parenthesizedTODO(...)/FIXME(...)form (those are the main check's domain). The short window is the false-positive guard: prose likeTODO: fix the bug from PR #123or a bareTODO: fix this lateris 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--verboseand fail the run in--strict, exactly like format mismatches. Verified: the scan flags the:364near-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).