Add Dialer.GetMaxUID as alt method using RFC-4731#83
Conversation
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 enhances the 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces Dialer.GetMaxUID(), a more efficient method to retrieve the maximum UID from a mailbox by leveraging RFC-4731. The changes include the new method implementation, parsing logic for the server response, documentation updates in README.md, a new example, and corresponding unit and integration tests. My review focuses on improving the robustness of the response parsing and adopting best practices for disabling integration tests. Overall, this is a valuable addition.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #83 +/- ##
==========================================
+ Coverage 20.58% 20.81% +0.22%
==========================================
Files 19 19
Lines 2074 2095 +21
==========================================
+ Hits 427 436 +9
- Misses 1607 1617 +10
- Partials 40 42 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
* Add Dialer.GetMaxUID as alt method using RFC-4731 * Use t.Skip() instread of if (false) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * strings.Split -> strings.Fields; camelCase instead of snake Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix: fix indentation and add tests for parseMaxUIDSearchResponse coverage Fix indentation issues from applying review suggestions and add unit tests covering error paths (no ESEARCH line, empty response, non-numeric MAX value) to satisfy code coverage requirements. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address review feedback for parseMaxUIDSearchResponse - Rename searchMaxUIDre to searchMaxUIDRE for naming consistency - Use case-insensitive regex with capturing group to extract MAX value - Handles MAX not being the last token (RFC 4731 allows MIN/MAX/COUNT) - Add tests for case-insensitive matching and MAX-not-last scenarios Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address code review feedback for GetMaxUID - Handle empty mailbox: ESEARCH without MAX returns 0, nil (RFC 4731) - Detect malformed ESEARCH MAX values and return error - Add RFC-4731 server requirement caveat to README and example - Example now handles GetMaxUID error instead of silently ignoring it Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: simplify ESEARCH detection in parseMaxUIDSearchResponse - Replace redundant strings.EqualFold on "* " (no letters) with == - Move strings.ToUpper inside prefix check to avoid uppercasing every non-ESEARCH line Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Martin Brugnara <mb@martinbrugnara.me> Co-authored-by: Martin Brugnara <martin@0x6d62.eu> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
As per the title, it adds Dialer.GetMaxUID as an alternative and cheaper method to get the latest email UID.
This method uses imap "SEARCH + RETURN" feature and thus requires RFC-4731.
Examples have been provided in the
README.mdandexamples/search/main.go.Tests have been added to
message_test.goandintegration_test.go.The latter are disabled for the test server (greenmail:2.1.2) does not support RFC-4731.