fix(code reviewer) error pattern precision - #4801
Merged
Merged
Conversation
…es in the error code area in the events/logs
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryReviewed the word-boundary regex refactor of Files Reviewed (2 files)
Reviewed by claude-sonnet-5 · Input: 22 · Output: 5.7K · Cached: 407K Review guidance: REVIEW.md from base branch |
jeanduplessis
approved these changes
Jul 27, 2026
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
The admin Error Analysis matched HTTP status codes as bare substrings, so
LIKE '%429%'bucketed any message containing those three digits as RateLimited. A session id, byte count, duration or timestamp was enough to trigger
it.
'%500%'had the same problem and caught text like "5000 tokens".This switches the status code branches to a Postgres word boundary regex, so
429 matches in "HTTP 429" but not in "4290", "14290" or "req_429abc".
The defect affected every status code branch, not just 429, so the fix covers
401, 403, 404, 429, 500, 502 and 503.
Changes
httpStatus(code)andanyHttpStatus(...codes)helpers inbuildErrorCategoryExpr, producingerror_message ~ '\y<code>\y'in place ofLIKE '%<code>%'.Upstream Server Error branches.
'%rate limit%' OR '%Rate limit%') intoILIKEon the branches being rewritten.status codes still bucket correctly, and rate limit text matches regardless of
case.
Verification
No manual testing. This is a SQL classification change with no user facing entry
point to exercise by hand, and it is covered by tests against a real database.
admin-code-reviews-routersuite, 21 testsLIKE '%<code>%'restored, the new precisiontest fails; with the fix in place all 21 pass. Confirms the test is not
passing for an unrelated reason.
Visual Changes
N/A. No component or layout changes. Bucket counts on the admin Error Analysis
chart will shift for existing rows, but that needs production data to
screenshot.
Reviewer Notes
is used in both SELECT and GROUP BY, and parameter placeholders are renumbered
by position, so Postgres would stop recognizing the two as the same expression
and the query would fail with a GROUP BY error. Same reason the reason labels
directly above are inlined. The pattern is built from a number literal, so
there is nothing to escape.
terminal_reasoncases are matched first in the CASE, so rows that carry a mapped reason never
reach these message patterns. The fallback applies to rows written before the
callback started consuming
failure.code.ILIKEis a small behavior change beyond precision. Those branches were casesensitive before, so "Authentication" or "RATE LIMIT" did not match and now
do. That is the intent, but it is a recall change rather than a precision one.
timeout,parseandnetworkbranches still use case sensitiveLIKEwith duplicated variants. They are not part of this defect, so they were left
alone.