feat: add --dry-run support to events helper commands#457
feat: add --dry-run support to events helper commands#457joeVenner wants to merge 1 commit intogoogleworkspace:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 15be912 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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 introduces a Highlights
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 adds --dry-run support to the events +renew and events +subscribe helper commands, which is a great feature for usability and testing. The implementation in subscribe.rs is well-structured by handling the dry-run case and exiting early. However, the implementation in renew.rs has introduced significant code complexity and duplication. I've provided a suggestion to refactor it for better maintainability, following the cleaner pattern used in subscribe.rs. Additionally, there's a small piece of duplicated code in subscribe.rs that can be removed. Addressing these points will make the code cleaner and easier to maintain.
e1e9983 to
38fbb1e
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds --dry-run support to the events +renew and events +subscribe helper commands. The implementation for +renew looks good, but I found a critical issue in +subscribe where the dry-run mode is not honored when an existing subscription is used, leading to real API calls being made. Additionally, I've pointed out a couple of places where error handling could be improved by avoiding unwrap_or_default() to prevent silently failing on serialization errors.
38fbb1e to
92b1e6a
Compare
|
Fixed Issues:
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a --dry-run feature to the events +renew and events +subscribe helper commands, which is a great addition for usability and testing. The implementation correctly adds an early-exit path for dry runs.
However, I've identified a critical issue across the changes: several calls to serde_json::to_string_pretty are followed by .unwrap(). This can cause the CLI to panic if serialization fails for any reason. In some places, this even replaces the safer unwrap_or_default() from the previous code. My review comments include suggestions to handle these Results gracefully and prevent potential crashes.
92b1e6a to
c7b347e
Compare
|
Fixed! Reverted
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a --dry-run mode for the events +renew and events +subscribe helper commands, which is a great feature for usability and testing. The implementation correctly separates the dry-run logic from the actual execution. However, there is a critical issue in how JSON serialization errors are handled. The use of unwrap_or_default() can lead to silent failures where the command exits successfully but produces no output, which can be problematic for scripting and automation. I've added comments with suggestions to properly propagate these errors.
c7b347e to
f812893
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable --dry-run mode for the events +renew and events +subscribe commands, enhancing usability by allowing users to preview actions without making API calls. The implementation is largely well-executed. However, I've identified a performance issue in the +subscribe command where an authentication token is fetched eagerly, even in scenarios where it's not used. My review includes a detailed comment on this issue with a recommendation for improvement.
|
Fixed! Reverted All code review fixes have been applied and pushed to
|
f812893 to
7b40990
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a --dry-run mode for the events +renew and events +subscribe helper commands, which is a valuable feature for allowing users to simulate commands without making live API calls. The implementation correctly isolates the dry-run logic and prevents side effects like API calls and directory creation. I've identified one high-severity issue in subscribe.rs where an input parameter is not validated in the dry-run path, potentially leading to misleading output. Addressing this will make the dry-run simulation more reliable.
Add dry-run mode to gws events +renew and gws events +subscribe commands. When --dry-run is specified, the commands print what actions would be taken without making any API calls. This allows agents to simulate requests and learn without reaching the server.
7b40990 to
15be912
Compare
|
/gemini review |
|
Code Review Fixes Applied
|
There was a problem hiding this comment.
Code Review
This pull request introduces a --dry-run mode for the gws events +renew and gws events +subscribe commands. The implementation correctly adds logic to simulate the commands' actions and print the expected outcomes without making any actual API calls or filesystem changes. The changes are well-structured, exiting early in the command handlers for dry runs. Additionally, the PR improves error handling by replacing unwrap_or_default() with proper error propagation when serializing JSON, which enhances the robustness of the CLI. The code quality is high and I did not find any issues of high or critical severity.
Add dry-run mode to gws events +renew and gws events +subscribe commands. When --dry-run is specified, the commands print what actions would be taken without making any API calls. This allows agents to simulate requests and learn without reaching the server.
Description
Please include a summary of the change and which issue is fixed. If adding a new feature or command, please include the output of running it with
--dry-runto prove the JSON request body matches the Discovery Document schema.Dry Run Output:
// Paste --dry-run output here if applicableChecklist:
AGENTS.mdguidelines (no generatedgoogle-*crates).cargo fmt --allto format the code perfectly.cargo clippy -- -D warningsand resolved all warnings.pnpx changeset) to document my changes.