-
Notifications
You must be signed in to change notification settings - Fork 1
🎨 Palette: Interactive Wait States for CLI #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,11 @@ | ||
| # Palette's Journal | ||
|
|
||
| ## 2024-10-18 - CLI UX Adaptation | ||
| **Learning:** When a "frontend" agent encounters a CLI-only repo, the "interface" becomes the terminal output. Accessibility principles (contrast, readability, clear feedback) still apply but translate to ANSI colors, clear spacing, and descriptive log messages instead of ARIA labels. | ||
| **Action:** Adapting web-centric UX patterns (like "toast notifications") to CLI equivalents (colored log lines or summary tables). | ||
|
|
||
| ## 2025-02-18 - Visual Feedback in CLI Tables | ||
| **Learning:** CLI summary tables are the "dashboard" of a command-line tool. Missing visual cues (like color-coding status) in these tables reduces scannability, just like a dashboard widget without status indicators. | ||
| **Action:** Always check if status indicators in CLI output are visually distinct (colored) to improve "glanceability" of the results. | ||
|
|
||
| ## 2025-05-23 - Interactive Wait States | ||
| **Learning:** Long static sleeps (like 60s) in CLIs cause "is it hung?" anxiety for users. Static logs aren't enough for long pauses. | ||
| **Action:** Always use a countdown or progress indicator for waits > 5s to provide reassurance of activity. | ||
|
|
||
| ## 2024-03-22 - CLI Interactive Fallbacks | ||
| **Learning:** CLI tools often fail hard when config is missing, but interactive contexts allow for graceful recovery. Users appreciate being asked for missing info instead of just receiving an error. | ||
| **Action:** When `sys.stdin.isatty()` is true, prompt for missing configuration instead of exiting with an error code. | ||
|
|
||
| ## 2024-03-24 - Active Waiting Feedback | ||
| **Learning:** Even short recurring waits (like polling retries) can feel unresponsive if they only show a static log message. A "spinner" or countdown makes the CLI feel alive and working. | ||
| **Action:** Replace static `sleep()` loops with visual countdowns in interactive modes, while preserving logs for non-interactive/audit modes. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -267,7 +267,11 @@ | |||||||||||||||||
| raise | ||||||||||||||||||
| wait_time = delay * (2 ** attempt) | ||||||||||||||||||
| log.warning(f"Request failed (attempt {attempt + 1}/{max_retries}): {e}. Retrying in {wait_time}s...") | ||||||||||||||||||
| time.sleep(wait_time) | ||||||||||||||||||
|
|
||||||||||||||||||
| if wait_time >= 2: | ||||||||||||||||||
| countdown_timer(wait_time, "Retrying") | ||||||||||||||||||
| else: | ||||||||||||||||||
| time.sleep(wait_time) | ||||||||||||||||||
|
|
||||||||||||||||||
| def _gh_get(url: str) -> Dict: | ||||||||||||||||||
| if url not in _cache: | ||||||||||||||||||
|
|
@@ -446,12 +450,15 @@ | |||||||||||||||||
| log.info("Created folder %s (ID %s) [Polled]", sanitize_for_log(name), grp["PK"]) | ||||||||||||||||||
| return str(grp["PK"]) | ||||||||||||||||||
| except Exception as e: | ||||||||||||||||||
| log.warning(f"Error fetching groups on attempt {attempt}: {e}") | ||||||||||||||||||
Check warningCode scanning / Prospector (reported by Codacy) Use lazy % formatting in logging functions (logging-fstring-interpolation) Warning
Use lazy % formatting in logging functions (logging-fstring-interpolation)
Check noticeCode scanning / Pylintpython3 (reported by Codacy) Use lazy % formatting in logging functions Note
Use lazy % formatting in logging functions
|
||||||||||||||||||
|
|
||||||||||||||||||
| if attempt < MAX_RETRIES: | ||||||||||||||||||
| wait_time = FOLDER_CREATION_DELAY * (attempt + 1) | ||||||||||||||||||
|
||||||||||||||||||
| wait_time = FOLDER_CREATION_DELAY * (attempt + 1) | |
| wait_time = int(FOLDER_CREATION_DELAY * (attempt + 1)) |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This conditional logic is redundant because countdown_timer already checks USE_COLORS internally. Consider simplifying to the pattern used at lines 664-666: log the message when not USE_COLORS, then always call countdown_timer. This would make the code more maintainable and consistent with other wait patterns in the codebase.
| if USE_COLORS: | |
| countdown_timer(wait_time, f"Waiting for folder '{name}'") | |
| else: | |
| log.info(f"Folder '{name}' not found yet. Retrying in {wait_time}s...") | |
| time.sleep(wait_time) | |
| if not USE_COLORS: | |
| log.info(f"Folder '{name}' not found yet. Retrying in {wait_time}s...") | |
| countdown_timer(wait_time, f"Waiting for folder '{name}'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The countdown_timer function expects an int parameter, but wait_time could potentially be a float if the delay parameter is passed as a float. Consider explicitly converting wait_time to an integer with int(wait_time) before passing it to countdown_timer to ensure type safety and prevent potential TypeErrors from the range() function.