Conversation
…bels, auth propagation Component 1 (PR #485): Route triage 'no messages' and modelarmor error bodies to stderr so stdout stays machine-readable. Component 2 (PR #466): Add colored error[variant]: labels to stderr on TTY, respecting NO_COLOR. Replace emoji hint with colorized text. Component 3 (PR #446): Propagate auth errors as GwsError::Auth in calendar, chat, docs, drive, script, sheets helpers instead of silently proceeding unauthenticated. dry-run bypass preserved.
🦋 Changeset detectedLatest commit: f4f20a4 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 consolidates several improvements focused on enhancing the clarity and utility of output and error handling. The changes ensure that diagnostic information is properly routed to stderr, error messages are more visually distinct and informative, and authentication failures are explicitly reported, leading to a more robust and user-friendly command-line experience. Highlights
Changelog
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 rollup of several fixes for output and error handling. The changes correctly route diagnostic messages to stderr, add colored error labels, and properly propagate authentication failures instead of failing silently. The code is well-structured and includes relevant tests for the new functionality. I have one suggestion to improve the error output for accessNotConfigured errors to avoid printing redundant information.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #525 +/- ##
==========================================
+ Coverage 67.94% 68.10% +0.15%
==========================================
Files 40 40
Lines 17721 17954 +233
==========================================
+ Hits 12040 12227 +187
- Misses 5681 5727 +46 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Use if/else so that accessNotConfigured errors get the specialized hint guidance instead of redundantly printing both the generic summary and the hint. Non-accessNotConfigured Api errors and all other variants still get the generic error[variant]: summary line.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request is a rollup of several changes aimed at improving output hygiene. It correctly routes diagnostic messages to stderr, adds colored error labels for better readability, and properly propagates authentication failures instead of letting them fail silently. The changes are well-implemented and include corresponding tests. I've found one high-severity issue in a test that doesn't correctly verify the intended behavior, giving a false sense of security.
model_armor_post function. A proper integration test would require HTTP mocking (e.g. mockito/wiremock) which is out of scope for this PR.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request is a great rollup of several hygiene improvements for the CLI's output and error handling. The changes to route diagnostics to stderr, add colored error labels, and propagate authentication errors correctly are all valuable enhancements. I've found one area in the error printing logic where code duplication can be removed to improve maintainability, as noted in the specific comment. Overall, this is a solid set of changes.
Use early return in accessNotConfigured branch so the generic eprintln! only appears once, eliminating the duplicated else blocks.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request is a great rollup of several hygiene improvements. Routing diagnostics to stderr, adding colored error labels, and propagating authentication errors instead of failing silently are all excellent changes that improve the tool's usability and robustness. The changes are well-structured and include relevant tests. I've found one high-severity security issue related to terminal escape injection in the new error printing logic, with a suggestion for a fix.
Add sanitize_for_terminal() to strip control characters (ANSI escape sequences, bell, backspace, etc.) from error messages before printing to stderr, preventing terminal escape injection from API responses. Newlines and tabs are preserved for readability. The function is pub(crate) so it can be reused by other modules that print untrusted content to stderr.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request is a rollup of several improvements to stderr/stdout hygiene and error handling. It correctly routes diagnostic messages to stderr, adds colored error labels for better readability, and critically, fixes authentication error propagation to fail early instead of silently proceeding. The changes are well-implemented and include corresponding tests.
Apply sanitize_for_terminal() to all 16 remaining eprintln sites that print unsanitized error strings to stderr. This prevents terminal escape sequence injection through error messages. Files updated: - workflows.rs (4 sites) - watch.rs (2 sites) - gmail/mod.rs (3 sites) - executor.rs (1 site) - subscribe.rs (1 site) - token_storage.rs (2 sites) - credential_store.rs (2 sites) - setup.rs (1 site) - generate_skills.rs (1 site) Also fixes clippy: map_err -> inspect_err where closure only logs.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request is a rollup of several fixes for output and error handling hygiene. It correctly routes diagnostic messages to stderr, adds colored error labels, propagates authentication errors instead of failing silently, and sanitizes error output for security. The changes are well-implemented across the codebase and improve the tool's usability and robustness. I have reviewed the changes and found no issues.
Summary
Consolidates #485, #466, and #446 into a single rollup and adds codebase-wide terminal sanitization to prevent escape sequence injection through error messages.
Component 1 — Route diagnostics to stderr (#485)
println!→eprintln!via extractedno_messages_msg()helperComponent 2 — Colored error labels (#466)
error[api]:,error[auth]:, etc. printed to stderr in bold color on TTYNO_COLORenv var (de-facto standard)hint:prefix replaces emoji foraccessNotConfiguredguidanceComponent 3 — Auth error propagation (#446)
GwsError::Authinstead of silently proceeding withAuthMethod::None--dry-runbypass preservedComponent 4 — Terminal sanitization helper
sanitize_for_terminal()function strips ANSI escape sequences and control characters (preserving\n/\t) before printing to stderrprint_error_jsonto prevent escape sequence injection via API error responsestest_error_path_message_includes_status_and_bodytest from modelarmor.rs (only testedformat!(), not actual behavior)Component 5 — Codebase-wide sanitization (16 sites across 9 files)
Every
eprintln!that prints an unsanitized error string now wraps it withsanitize_for_terminal():workflows.rswatch.rsgmail/mod.rsexecutor.rssubscribe.rstoken_storage.rscredential_store.rssetup.rsgenerate_skills.rsAlso fixes clippy:
map_err→inspect_errinworkflows.rswhere closures only log and return the error unchanged.Tests
test_sanitize_for_terminal_strips_control_chars— verifies ANSI codes and control chars are stripped,\n/\tpreservedtest_colorize_respects_no_color_env— verifiesNO_COLORdisables ANSI codestest_error_label_contains_variant_name— verifies each variant renders correctlyempty_result_message_is_not_json— verifies diagnostic is not valid JSONCloses #485, closes #466, closes #446