feat: use case-insensitive transport protocol name comparison in ClientFactory#281
Conversation
Summary of ChangesHello @tchapacan, 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
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
|
🧪 Code Coverage
Generated by coverage-comment.yml |
There was a problem hiding this comment.
Code Review
This pull request introduces case-insensitive matching for transport protocol names, which is a great feature for improving user experience. The implementation is solid, introducing a normalizeProtocolName function and applying it consistently across the client factory logic. The accompanying tests are thorough and cover the new case-insensitive behavior well. I have one minor suggestion to improve an error message for better diagnostics.
5632879 to
59564aa
Compare
ishymko
left a comment
There was a problem hiding this comment.
What do you think about a helper like below for all dicts using transport name as a key
class CaseInsensitiveMap<T> extends Map<string, T> {
set(key: string, value: T): this {
return super.set(key.toUpperCase(), value);
}
get(key: string): T | undefined {
return super.get(key.toUpperCase());
}
has(key: string): boolean {
return super.has(key.toUpperCase());
}
delete(key: string): boolean {
return super.delete(key.toUpperCase());
}
}It appears that there is a plenty of places which required explicit normalization, so I am concerned a bit about potential errors due to some places being missed.
e2e5d61 to
69a079a
Compare
69a079a to
831a67d
Compare
|
Yes agreed that's a smart way to achieve this. I added the class inside the |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a CaseInsensitiveMap to handle transport protocol names in a case-insensitive manner throughout the ClientFactory. This is a good improvement for robustness. The changes are applied consistently where protocol names are used as map keys, and new tests have been added to verify the case-insensitive behavior. My review includes one critical fix for the new CaseInsensitiveMap class to correctly handle initialization with an iterable, which is a subtle but important bug in the current implementation.
ishymko
left a comment
There was a problem hiding this comment.
Thank you again @tchapacan!
P.S. Pushed a cosmetic one myself 9b03665 - definitely a matter of taste, just prefer internals to be below public items in files.
Description
Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
CONTRIBUTINGGuide.fix:which represents bug fixes, and correlates to a SemVer patch.feat:represents a new feature, and correlates to a SemVer minor.feat!:, orfix!:,refactor!:, etc., which represent a breaking change (indicated by the!) and will result in a SemVer major.Fixes #264 🦕
Release-As: 0.3.8
BEGIN_COMMIT_OVERRIDE
feat: use case-insensitive transport protocol name comparison in ClientFactory
Release-As: 0.3.8
END_COMMIT_OVERRIDE