π¨ Palette: Add critical red warning to speaker delete action#459
π¨ Palette: Add critical red warning to speaker delete action#459EffortlessSteven wants to merge 1 commit intomainfrom
Conversation
π‘ What: Made the delete action warning red in the prompt. π― Why: Brings consistency to destructive action warnings to make sure they are clearly seen by users. πΈ Before/After: Not visual in browser, visual in terminal prompt. βΏ Accessibility: Improves visual salience of non-recoverable actions.
|
π 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. |
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 10 minutes and 13 seconds. β How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. π¦ How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. βΉοΈ Review infoβοΈ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: π Files selected for processing (2)
β¨ Finishing Touchesπ§ͺ Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request adds unit tests for the interactive speaker deletion command and introduces a colorized warning message to the deletion prompt to alert users that the action is irreversible. A review comment suggests refactoring the new tests into a class to maintain consistency with the existing test organization in the file and consolidating imports for better maintainability.
| def test_handle_delete_command_interactive( | ||
| registry: SpeakerRegistry, sample_embedding: np.ndarray, monkeypatch | ||
| ): | ||
| """Should delete speaker interactively when user inputs 'y'.""" | ||
| import argparse | ||
|
|
||
| from transcription.speaker_identity import _handle_delete | ||
|
|
||
| speaker_id = registry.register_speaker("Test Speaker", sample_embedding) | ||
| args = argparse.Namespace(speaker_id=speaker_id, force=False) | ||
|
|
||
| # Mock sys.stdin.isatty to simulate interactive terminal | ||
| monkeypatch.setattr("sys.stdin.isatty", lambda: True) | ||
|
|
||
| # Mock input to return 'y' | ||
| monkeypatch.setattr("builtins.input", lambda prompt: "y") | ||
|
|
||
| result = _handle_delete(registry, args) | ||
|
|
||
| assert result == 0 | ||
| assert registry.get_speaker(speaker_id) is None | ||
|
|
||
|
|
||
| def test_handle_delete_command_interactive_abort( | ||
| registry: SpeakerRegistry, sample_embedding: np.ndarray, monkeypatch | ||
| ): | ||
| """Should not delete speaker interactively when user inputs 'n'.""" | ||
| import argparse | ||
|
|
||
| from transcription.speaker_identity import _handle_delete | ||
|
|
||
| speaker_id = registry.register_speaker("Test Speaker", sample_embedding) | ||
| args = argparse.Namespace(speaker_id=speaker_id, force=False) | ||
|
|
||
| # Mock sys.stdin.isatty to simulate interactive terminal | ||
| monkeypatch.setattr("sys.stdin.isatty", lambda: True) | ||
|
|
||
| # Mock input to return 'n' | ||
| monkeypatch.setattr("builtins.input", lambda prompt: "n") | ||
|
|
||
| result = _handle_delete(registry, args) | ||
|
|
||
| assert result == 0 | ||
| assert registry.get_speaker(speaker_id) is not None |
There was a problem hiding this comment.
The new tests for the delete command are added as module-level functions, which deviates from the organizational pattern established in the rest of the file where tests are grouped into classes (e.g., TestSpeakerRegistry, TestIdentityMapping). For better maintainability and consistency, these tests should be encapsulated within a class, such as TestSpeakerCLI. Additionally, common imports like argparse and _handle_delete can be consolidated at the top of the class or module.
References
- Maintain consistency with existing code structure and organizational patterns within the file. (link)
Benchmark ResultsCommit: Baseline Comparison
Overall: β All metrics within thresholds Details
|
Codecov Reportβ All modified and coverable lines are covered by tests. π’ Thoughts on this report? Let us know! |
π‘ What: Made the delete action warning red in the prompt.
π― Why: Brings consistency to destructive action warnings to make sure they are clearly seen by users.
πΈ Before/After: Not visual in browser, visual in terminal prompt.
βΏ Accessibility: Improves visual salience of non-recoverable actions.
PR created automatically by Jules for task 12737496808467700653 started by @EffortlessSteven