fix: use actual parsed string in literal size error message#82
Conversation
The error format string was logging s[i+1:j] (which includes '+' from LITERAL+ syntax) but Atoi receives s[i+1:sizeEnd] (numeric only). Log the same string that was actually passed to Atoi. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines an error message within the parsing logic to enhance debugging. Previously, the error message for literal size parsing displayed an incorrect substring, potentially including non-numeric characters. The change ensures that the logged string precisely matches the input provided to the integer conversion function, thereby improving the clarity and utility of error reporting. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #82 +/- ##
==========================================
+ Coverage 15.47% 20.58% +5.11%
==========================================
Files 19 19
Lines 2074 2074
==========================================
+ Hits 321 427 +106
+ Misses 1698 1607 -91
+ Partials 55 40 -15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request correctly addresses an issue where the error message for parsing literal sizes was inaccurate. By changing s[i+1:j] to s[i+1:sizeEnd], the error message now reflects the exact substring that strconv.Atoi attempted to parse, which significantly improves debugging clarity. This is a valuable fix for diagnostic purposes.
Covers parseFetchTokens (quoted strings, escapes, NIL, error paths, deep nesting, container unwrap), findFetchContentEnd (edge cases, literals, quoted escapes, unterminated), ParseFetchResponse (empty, whitespace, quoted), and utility functions (GetTokenName, Token.String, CheckType, findLineEnd). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR corrects a debug/error message in the IMAP FETCH parser so that, when literal size parsing fails, the error reports the exact substring passed to strconv.Atoi (excluding the optional + from RFC 7888 LITERAL+ syntax).
Changes:
- Update
findFetchContentEndto logs[i+1:sizeEnd](the numeric portion) instead ofs[i+1:j]in the literal size parse error.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The error-path line in findFetchContentEnd is guarded by a digit-only loop making Atoi failure unreachable, so the patch check fails on it. Allow a small threshold so defensive error handling doesn't block PRs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Atoi can fail on digit-only input when the number overflows int. Test with a 20-digit number to hit the error branch at parse.go:301. Remove codecov.yml threshold workaround since the line is now covered. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
findFetchContentEndwas loggings[i+1:j](includes+from LITERAL+ syntax) butAtoireceivess[i+1:sizeEnd](numeric part only)Atoi, making debug output accurateSpotted by Gemini Code Assist in #81.
Test plan
🤖 Generated with Claude Code