🎨 Palette: Add trailing space to generic input prompts#698
Conversation
…t collision Co-authored-by: abhimehro <84992105+abhimehro@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
There was a problem hiding this comment.
Gates Passed
6 Quality Gates Passed
See analysis details in CodeScene
Quality Gate Profile: Pay Down Tech Debt
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
There was a problem hiding this comment.
Pull request overview
This PR improves CLI prompt readability by ensuring generic input wrappers always separate the prompt text from the user’s typed input with a trailing space, preventing visual “prompt/input collision” in interactive runs.
Changes:
- Auto-append a trailing space to
promptinget_validated_input()when missing. - Auto-append a trailing space to
promptinget_password()when missing. - Document prompt-collision and generic-input cancellation safety learnings in
.Jules/palette.md.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| main.py | Ensures input()/getpass() prompts rendered via shared wrappers end with a trailing space for clearer UX. |
| .Jules/palette.md | Records UX and safety learnings about prompt formatting and cancellation handling scope. |
There was a problem hiding this comment.
Code Review
This pull request introduces automatic trailing space appending to input prompts in main.py and updates the .Jules/palette.md documentation with learnings on prompt collision and cancellation safety. Feedback recommends using .isspace() for a more robust whitespace check in the prompt handling logic to avoid redundant spacing and suggests consolidating the new documentation entries to avoid redundancy with existing content.
| if not prompt.endswith(" "): | ||
| prompt += " " |
There was a problem hiding this comment.
Using .endswith(" ") only checks for a literal trailing space. If the prompt ends with other whitespace characters like a newline (\n) or a tab (\t), this logic will append an unnecessary extra space. Using .isspace() on the last character is more robust as it ensures any form of whitespace separation is respected, preventing redundant spaces in those cases.
| if not prompt.endswith(" "): | |
| prompt += " " | |
| if prompt and not prompt[-1].isspace(): | |
| prompt += " " |
| if not prompt.endswith(" "): | ||
| prompt += " " |
There was a problem hiding this comment.
Using .endswith(" ") only checks for a literal trailing space. If the prompt ends with other whitespace characters like a newline (\n) or a tab (\t), this logic will append an unnecessary extra space. Using .isspace() on the last character is more robust as it ensures any form of whitespace separation is respected, preventing redundant spaces in those cases.
| if not prompt.endswith(" "): | |
| prompt += " " | |
| if prompt and not prompt[-1].isspace(): | |
| prompt += " " |
| ## 2025-03-24 - [Input Prompt Collision] | ||
|
|
||
| **Learning:** When prompting users for input via generic wrappers (e.g., `input()` or `getpass()`), if the prompt string lacks a trailing space, the user's typed input will visually collide with the prompt text, creating a poor aesthetic and confusing UX. | ||
| **Action:** Always append a trailing space automatically to prompt strings in generic input handler functions if one is not provided by the caller. |
There was a problem hiding this comment.
This new entry is largely redundant with the existing learning and action recorded on lines 33-34. While it specifies "generic wrappers", the core issue (visual collision) and the solution (trailing space) are already covered. Consider consolidating these entries to keep the palette file concise and maintainable.
💡 What: Added logic to automatically append a trailing space to prompt strings in
get_validated_inputandget_passwordif one is missing.🎯 Why: When prompting users for input via generic wrappers, if the prompt string lacks a trailing space, the user's typed input visually collides with the prompt text. This creates a cluttered and confusing user experience.
♿ Accessibility: Improves readability for visually impaired users and screen readers by ensuring distinct separation between the system's prompt and the user's input.
(Also recorded critical learnings regarding generic input cancellation safety in
.Jules/palette.md).PR created automatically by Jules for task 7855502334136946876 started by @abhimehro