Conversation
Summary of ChangesHello @kostyanf14, 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 introduces Sorbet type checking to the command-line interface (CLI) option classes. By converting CommonOptions, TestOptions, and InstallOptions into T::Structs, the codebase gains improved type safety and better maintainability. This change also serves as foundational work for future features, such as the ability to restore previous sessions, by providing a more robust and predictable structure for CLI arguments. 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 is a great step towards making the CLI classes type-safe by refactoring them to use Sorbet's T::Struct. The changes significantly improve code clarity and maintainability. I've found a few issues related to the new implementation. There's a critical issue with command-line argument parsing due to OptionParser instances not being memoized. I've also found a potential bug with the use of JsonHelper and some minor issues regarding the idiomatic use of T::Struct properties. Please see my detailed comments.
There was a problem hiding this comment.
Pull request overview
This PR migrates the CLI option containers to Sorbet-typed T::Struct classes to provide runtime type enforcement and better static typing as preparation for restoring previous sessions.
Changes:
- Replaced CLI option classes based on
attr_accessor/manual defaults withT::Structprops (common/test/install). - Updated
OptionParserwiring to mostly assign directly via generated setters (e.g.,&method(:foo=)). - Converted
AutoHCK::CLIitself to aT::Structand introduced typed helper methods (parser,sub_parser,parse).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d68d73e to
2e4d11b
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the CLI option handling classes to use Sorbet's T::Struct, which is a great improvement for type safety and code clarity. The changes are well-executed and consistently applied across all option classes. I've found one potential issue regarding the implementation of JsonHelper that will need to be addressed for the session restoration feature to work correctly.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Rework all attributes to the Sorbet struct property.
Unfortunately, sorbet typecheck cannot validate OptionParser
option type assignment to the sorbet property type, but it
works at runtime.
This is done as part of preparation for the ability to bring
up the previous session.
For example, the following code will pass typecheck but will
fail at runtime with type cast error:
```
prop :id, Integer, default: 2
parser.on('--id <id>', String,
'Set ID for AutoHCK run',
&method(:id=))
```
/ruby/3.3.0/gems/sorbet-runtime-0.6.12935/lib/types/configuration.rb:293:in `call_validation_error_handler_default':
Parameter 'id': Can't set AutoHCK::CliCommonOptions.id to "s" (instance of String) - need a Integer (TypeError)
Signed-off-by: Vitalii Chulak <vitalii@daynix.com>
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
2e4d11b to
80f3b01
Compare
|
Rspec failed due to new HLK release |
Rework all attributes to the Sorbet struct property. Unfortunately, sorbet typecheck cannot validate OptionParser option type assignment to the sorbet property type, but it works at runtime.
This is done as part of preparation for the ability to bring up the previous session.
For example, the following code will pass typecheck but will fail at runtime with type cast error:
/ruby/3.3.0/gems/sorbet-runtime-0.6.12935/lib/types/configuration.rb:293:in `call_validation_error_handler_default': Parameter 'id': Can't set AutoHCK::CliCommonOptions.id to "s" (instance of String) - need a Integer (TypeError)