Skip to content

🎨 Palette: Improve CLI Feedback & Formatting#190

Closed
abhimehro wants to merge 4 commits intomainfrom
palette-ux-improvements-5962504483824375634
Closed

🎨 Palette: Improve CLI Feedback & Formatting#190
abhimehro wants to merge 4 commits intomainfrom
palette-ux-improvements-5962504483824375634

Conversation

@abhimehro
Copy link
Owner

💡 What:

  • Added format_duration helper to display durations in Xm Ys format (e.g., 2m 05s) in the summary table.
  • Replaced silent sleeps with interactive countdown_timer during API retries and folder creation polling.
  • Fixed brittle tests in tests/test_plan_details.py to correctly mock USE_COLORS.

🎯 Why:

  • Wait Feedback: Users previously stared at a static screen during long waits (e.g., 60s deletion propagation or exponential backoff). Now they see a live countdown.
  • Readability: Duration in seconds (e.g., 125.5s) is harder to parse than 2m 05s.
  • Reliability: Fixed a test that was failing in some environments due to improper patching of global variables.

📸 Before/After:

  • Before: Duration: 125.5s | Silent wait for 60s.
  • After: Duration: 2m 05s | ⏳ Waiting for deletions to propagate: [████░░] 30s...

Accessibility:

  • Improved feedback for long-running operations reduces user anxiety (is it hung?).
  • Clearer time formatting improves cognitive processing.

PR created automatically by Jules for task 5962504483824375634 started by @abhimehro

Co-authored-by: abhimehro <84992105+abhimehro@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 11, 2026 22:41
@google-labs-jules
Copy link

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@trunk-io
Copy link

trunk-io bot commented Feb 11, 2026

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

@github-actions
Copy link

👋 Development Partner is reviewing this PR. Will provide feedback shortly.

@gemini-code-assist
Copy link

Summary of Changes

Hello @abhimehro, 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 significantly enhances the user experience of the CLI by providing clearer feedback during long-running operations and improving the readability of duration displays. It replaces static, silent waits with dynamic countdown timers, reducing user anxiety about application responsiveness. Additionally, it refines how durations are presented in summary tables, making them easier to comprehend at a glance. These changes also include a fix for a test suite to ensure consistent behavior across different environments.

Highlights

  • Improved CLI Feedback: Introduced a "countdown_timer" for API retries and folder creation, replacing silent waits with interactive progress displays.
  • Enhanced Duration Formatting: Implemented a "format_duration" helper to present time in a human-readable "Xm Ys" format (e.g., "2m 05s") in summary tables.
  • Test Reliability Fixes: Addressed brittle tests in "tests/test_plan_details.py" by correctly mocking "USE_COLORS" using "monkeypatch" for improved stability.
Changelog
  • .python-version
    • Updated Python version declaration to include a newline character.
  • main.py
    • Added a new "format_duration" function to convert seconds into a "Xm Ys" string format.
    • Replaced "time.sleep" with "countdown_timer" during API retry logic in "verify_access_and_get_folders".
    • Replaced "time.sleep" with "countdown_timer" during folder creation polling in "create_folder".
    • Applied "format_duration" to display individual plan entry durations in the summary table.
    • Applied "format_duration" to display the total duration in the summary table.
  • tests/test_plan_details.py
    • Removed the "unittest.mock.patch" import.
    • Refactored "test_print_plan_details_no_colors" to use "monkeypatch.setattr" for mocking "main.USE_COLORS".
    • Refactored "test_print_plan_details_empty_folders" to use "monkeypatch.setattr" for mocking "main.USE_COLORS".
    • Refactored "test_print_plan_details_with_colors" to use "monkeypatch.setattr" for mocking "main.USE_COLORS".
Activity
  • PR created automatically by Jules for task 5962504483824375634, initiated by @abhimehro.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly improves the command-line interface experience by providing better feedback during long-running operations. The introduction of format_duration makes time reporting more human-readable, and replacing silent sleep calls with an interactive countdown_timer is a great enhancement for user feedback. The fix in the tests to use monkeypatch for mocking globals is also a good move towards more robust testing. I have one suggestion in main.py to make the format_duration function slightly more concise and idiomatic. Overall, these are excellent changes.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the CLI user experience by making long waits visible (countdown/progress feedback) and by formatting sync durations more readably in the summary output, plus stabilizing a flaky test around USE_COLORS.

Changes:

  • Added format_duration() and used it in the summary table output.
  • Replaced time.sleep(...) waits with countdown_timer(...) in retry/polling paths.
  • Updated tests/test_plan_details.py to use monkeypatch for USE_COLORS instead of unittest.mock.patch.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.

File Description
main.py Adds duration formatting and swaps silent waits for interactive countdowns in retry/polling + summary formatting changes.
tests/test_plan_details.py Switches to monkeypatch for USE_COLORS to make tests less brittle.
.python-version Normalizes the single-line file formatting (no semantic change).

Comment on lines 842 to +849
wait_time = RETRY_DELAY * (2**attempt)
log.warning(
"Request failed (attempt %d/%d). Retrying in %ds...",
attempt + 1,
MAX_RETRIES,
wait_time,
)
time.sleep(wait_time)
countdown_timer(int(wait_time), "Retrying")
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description says silent sleeps were replaced during "API retries", but only verify_access_and_get_folders() uses countdown_timer() here. Other API calls still go through _retry_request() which continues to time.sleep(wait_time) (main.py:606-622), so users may still see silent backoff waits. Either update _retry_request() to use countdown_timer() (when interactive) or narrow the PR description/intent.

Copilot uses AI. Check for mistakes.
Comment on lines +231 to +238
def format_duration(seconds: float) -> str:
"""Formats duration in a human-readable way (e.g., 2m 05s)."""
if seconds < 60:
return f"{seconds:.1f}s"

minutes = int(seconds // 60)
rem_seconds = int(seconds % 60)
return f"{minutes}m {rem_seconds:02d}s"
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format_duration() is new user-visible formatting logic but currently has no direct unit tests. Adding focused tests for boundary conditions (e.g., <60s, exactly 60s, rounding behavior) will prevent regressions in CLI output formatting.

Copilot generated this review using guidance from repository custom instructions.
wait_time,
)
time.sleep(wait_time)
countdown_timer(int(wait_time), "Retrying")
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that this call uses countdown_timer(), note that the current implementation writes \r...{remaining}s... without clearing the line each tick. When remaining drops from 10→9 (or 100→99), terminals can show leftover characters from the previous, longer line. Consider updating countdown_timer() to clear the line on every update (e.g., prefix each frame with \r\033[K, similar to render_progress_bar).

Copilot uses AI. Check for mistakes.
main.py Outdated
Comment on lines +232 to +237
"""Formats duration in a human-readable way (e.g., 2m 05s)."""
if seconds < 60:
return f"{seconds:.1f}s"

minutes = int(seconds // 60)
rem_seconds = int(seconds % 60)
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format_duration() truncates seconds via int(seconds % 60) and formats sub-minute durations with seconds:.1f. This can produce surprising outputs around boundaries (e.g., 59.95s -> "60.0s" instead of "1m 00s") and under-report durations (125.9s -> "2m 05s"). Consider rounding to the nearest whole second first, then deriving minutes/seconds from that (and using a consistent Xm YYs format).

Suggested change
"""Formats duration in a human-readable way (e.g., 2m 05s)."""
if seconds < 60:
return f"{seconds:.1f}s"
minutes = int(seconds // 60)
rem_seconds = int(seconds % 60)
"""Formats duration in a human-readable way (e.g., 2m 05s).
We first round to the nearest whole second to avoid surprising
outputs around boundaries (e.g., 59.95s -> 1m 00s instead of
60.0s) and then derive minutes/seconds from that integer.
"""
# Normalize to an integer number of seconds via rounding, not truncation.
total_seconds = int(round(seconds))
# For sub-minute durations, show whole seconds (e.g., "5s", "42s").
if total_seconds < 60:
return f"{total_seconds:d}s"
# For longer durations, show "Xm YYs" using the rounded total seconds.
minutes, rem_seconds = divmod(total_seconds, 60)

Copilot uses AI. Check for mistakes.
@abhimehro abhimehro enabled auto-merge (squash) February 13, 2026 02:07
abhimehro added a commit that referenced this pull request Feb 13, 2026
- No code changes made.
- Responding to PR comment regarding supersession.

Co-authored-by: abhimehro <84992105+abhimehro@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 13, 2026 03:21
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

main.py Outdated
Comment on lines +233 to +239
if seconds < 60:
return f"{seconds:.1f}s"

minutes, rem_seconds = divmod(int(seconds), 60)
return f'{minutes}m {rem_seconds:02d}s'


Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format_duration() can produce misleading output around the 60s boundary (e.g., seconds=59.95 formats as 60.0s because rounding happens after the < 60 check). Also, for >= 60 it truncates fractional seconds via int(seconds), which can underreport durations (especially the TOTAL where floats are summed). Consider rounding once up front (e.g., to whole seconds) before branching/divmod so 59.95 becomes 1m 00s and totals are consistent.

Suggested change
if seconds < 60:
return f"{seconds:.1f}s"
minutes, rem_seconds = divmod(int(seconds), 60)
return f'{minutes}m {rem_seconds:02d}s'
# Round once to whole seconds so behavior is consistent around the 60s
# boundary and we don't under-report longer durations due to truncation.
total_seconds = int(round(seconds))
if total_seconds < 60:
# For sub-minute durations, show whole seconds for clarity and to
# match the rounded value used for longer durations.
return f"{total_seconds}s"
minutes, rem_seconds = divmod(total_seconds, 60)
return f"{minutes}m {rem_seconds:02d}s"

Copilot uses AI. Check for mistakes.
main.py Outdated
f"Folder '{sanitize_for_log(name)}' not found yet. Retrying in {wait_time}s..."
)
time.sleep(wait_time)
# Local countdown with line clearing to avoid trailing characters when digits shrink (e.g., 10→9)
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the new use of countdown_timer() here, be aware countdown_timer() doesn’t clear the line on each tick (it only clears once at the end). When remaining seconds shrink (e.g., 10→9), trailing characters can be left on screen. Consider updating countdown_timer() to include \033[K (or fixed-width padding) per iteration so the countdown renders cleanly.

Copilot uses AI. Check for mistakes.
Copilot AI added a commit that referenced this pull request Feb 13, 2026
…wn timer UX, and add tests

Co-authored-by: abhimehro <84992105+abhimehro@users.noreply.github.com>
…wn timer UX, and add tests

Co-authored-by: abhimehro <84992105+abhimehro@users.noreply.github.com>
@abhimehro abhimehro closed this Feb 13, 2026
auto-merge was automatically disabled February 13, 2026 03:56

Pull request was closed

@abhimehro abhimehro deleted the palette-ux-improvements-5962504483824375634 branch February 13, 2026 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants