Skip to content

Add visual feedback during transcription#46

Open
Whamp wants to merge 1 commit intomainfrom
palette-transcribe-spinner-6385827874869081713
Open

Add visual feedback during transcription#46
Whamp wants to merge 1 commit intomainfrom
palette-transcribe-spinner-6385827874869081713

Conversation

@Whamp
Copy link
Owner

@Whamp Whamp commented Jan 30, 2026

User description

Added a "Transcribing..." spinner to the CLI to provide visual feedback during audio processing. Refactored ChirpApp to reuse the Console instance and added a test case to verify the behavior.


PR created automatically by Jules for task 6385827874869081713 started by @Whamp


PR Type

Enhancement


Description

  • Add visual feedback spinner during audio transcription

  • Refactor ChirpApp to store Console instance for reuse

  • Wrap parakeet.transcribe call with status spinner display

  • Add comprehensive test to verify spinner behavior


Diagram Walkthrough

flowchart LR
  A["ChirpApp.__init__"] -->|"Store console instance"| B["self.console"]
  C["_transcribe_and_inject"] -->|"Wrap with status"| D["console.status spinner"]
  D -->|"Display Transcribing..."| E["User feedback"]
  F["Test suite"] -->|"Verify spinner"| G["test_transcription_shows_spinner"]
Loading

File Walkthrough

Relevant files
Enhancement
main.py
Store console instance and add transcription spinner         

src/chirp/main.py

  • Convert local console variable to instance variable self.console for
    reuse across methods
  • Store Console instance from RichHandler or create new one if not found
  • Wrap parakeet.transcribe call with self.console.status context manager
    displaying "Transcribing..." message
  • Maintain existing spinner initialization behavior for model loading
+7/-6     
Tests
test_chirp_app.py
Add test for transcription spinner display                             

tests/test_chirp_app.py

  • Create new test file with comprehensive mocking setup for ChirpApp
    dependencies
  • Mock external modules (sounddevice, winsound, keyboard) to avoid
    import errors
  • Implement test_transcription_shows_spinner to verify spinner is
    displayed during transcription
  • Assert that both "Initializing Parakeet model" and "Transcribing"
    status messages appear
  • Validate console.status is called with correct parameters
+90/-0   

Display a "Transcribing..." spinner in the CLI while the Parakeet model is processing audio.
This provides immediate visual feedback to the user during the transcription phase, which can take several seconds.

- Refactor `ChirpApp` to store `self.console` for reuse.
- Wrap `parakeet.transcribe` call with `console.status`.
- Add `tests/test_chirp_app.py` to verify the presence of the spinner.

Co-authored-by: Whamp <1115485+Whamp@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 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.

@qodo-code-review
Copy link

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Possible None deref: self.console is typed as Optional[Console] but is used without a defensive non-None
assertion/check, which could raise an AttributeError in unexpected initialization paths
and obscure the real transcription failure.

Referred Code
with self.console.status("[bold yellow]Transcribing...[/bold yellow]", spinner="dots"):
    text = self.parakeet.transcribe(waveform, sample_rate=16_000, language=self.config.language)

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-code-review
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Add lock around status spinner

To ensure thread-safe usage of the console spinner, introduce a threading.Lock
and acquire it before showing the status message.

src/chirp/main.py [156-157]

-with self.console.status("[bold yellow]Transcribing...[/bold yellow]", spinner="dots"):
-    text = self.parakeet.transcribe(waveform, sample_rate=16_000, language=self.config.language)
+# In __init__ (add):
+self._console_lock = threading.Lock()
 
+# In _transcribe_and_inject:
+with self._console_lock:
+    with self.console.status("[bold yellow]Transcribing...[/bold yellow]", spinner="dots"):
+        text = self.parakeet.transcribe(waveform, sample_rate=16_000, language=self.config.language)
+
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies a potential race condition with the rich console spinner in a multi-threaded context and proposes a valid solution using a lock, which enhances the application's stability.

Medium
General
Isolate module mocks to prevent side-effects

To prevent side effects on other tests, replace permanent module-level mocking
of sounddevice, winsound, and keyboard with a temporary patch using
unittest.mock.patch.dict for better test isolation.

tests/test_chirp_app.py [4-7]

 # Mock sounddevice and winsound immediately
-sys.modules["sounddevice"] = MagicMock()
-sys.modules["winsound"] = MagicMock()
-sys.modules["keyboard"] = MagicMock()
+# sys.modules["sounddevice"] = MagicMock()
+# sys.modules["winsound"] = MagicMock()
+# sys.modules["keyboard"] = MagicMock()
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies that module-level patching can cause side effects in other tests and proposes a safer, more isolated approach using patch.dict, which is a significant improvement for test suite robustness.

Low
Simplify console initialization

Simplify the console initialization logic by using a next() call on a generator
expression to find the console from handlers or create a new one.

src/chirp/main.py [56-62]

-self.console: Optional[Console] = None
-for handler in self.logger.handlers:
-    if isinstance(handler, RichHandler):
-        self.console = handler.console
-        break
-if not self.console:
-    self.console = Console(stderr=True)
+self.console = next(
+    (
+        getattr(handler, "console")
+        for handler in self.logger.handlers
+        if isinstance(handler, RichHandler) and getattr(handler, "console", None)
+    ),
+    Console(stderr=True),
+)
  • Apply / Chat
Suggestion importance[1-10]: 5

__

Why: The suggestion offers a more concise and Pythonic way to initialize self.console by using a generator expression with next, which improves code readability and elegance.

Low
  • More

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant