fix(ui): 🐛 fix double-paste and related UI issues#185
Conversation
AI Code Review SummaryPR: #185 (fix(ui): 🐛 fix double-paste and related UI issues) Overall AssessmentDetected 5 actionable findings, prioritize CRITICAL/HIGH before merge. Major Findings by Severity
Actionable Suggestions
Potential Risks
Test Suggestions
File-Level Coverage Notes
Inline Downgraded Items (processed but not inline)
Coverage Status
Uncovered list:
No-patch covered list:
Runtime/Budget
|
| ), | ||
| })); | ||
| }) | ||
| .catch((error) => { |
There was a problem hiding this comment.
[HIGH] Missing tests for commitNewCommand error handling and inflight cleanup
No tests verify that commitNewCommand removes the inflight ID on rejection or that the error path behaves correctly.
Suggestion: Add unit tests mocking promptCommandCreate rejection to assert inflightCreateIds is cleared and console.warn is called.
Risk: Memory leak in tests due to unresolved Set entries; production UX may fail silently without coverage.
Confidence: 0.90
| isEditing={editingId === command.id} | ||
| onEdit={() => setEditingId(editingId === command.id ? null : command.id)} | ||
| onCancelEdit={() => setEditingId(null)} | ||
| onEdit={() => { |
There was a problem hiding this comment.
[HIGH] Missing tests for pendingCreate command edit and cancel interactions
New UX flow where editing a pending command commits it and canceling removes it is not covered by tests.
Suggestion: Add React Testing Library tests rendering CommandItem with pendingCreate=true to verify onCommitNewCommand is called on edit and onRemoveCommand on cancel.
Risk: Users may lose unsaved pending commands or enter broken edit states due to unverified interaction logic.
Confidence: 0.90
| const current = settingsStore.getState(); | ||
| const cmd = current.commands.find((c) => c.id === id); | ||
| if (!cmd || !cmd.pendingCreate) return; | ||
| if (!cmd.name.trim()) return; |
There was a problem hiding this comment.
[MEDIUM] Missing boundary tests for commitNewCommand empty name guard
Whitespace-only names are rejected early but this guard has no regression tests.
Suggestion: Add tests for empty string, whitespace-only, and valid name inputs to ensure the boundary is respected.
Risk: Accidental backend calls with invalid names if the trim check is removed or altered.
Confidence: 0.85
| if (!cmd || !cmd.pendingCreate) return; | ||
| if (!cmd.name.trim()) return; | ||
|
|
||
| if (!isTauri()) { |
There was a problem hiding this comment.
[MEDIUM] Missing tests for commitNewCommand non-Tauri fallback
The non-Tauri branch strips pendingCreate locally but lacks test coverage.
Suggestion: Add a test that mocks isTauri() returning false and asserts the store update strips pendingCreate without calling the backend.
Risk: Regression in web-only mode where pending commands may never become persisted or may trigger unintended IPC calls.
Confidence: 0.85
| > | ||
| <Trash2 className="size-3.5" /> | ||
| </button> | ||
| {command.source === "user" ? ( |
There was a problem hiding this comment.
[MEDIUM] Missing tests for command remove button source gate
The conditional rendering of the remove button based on command.source is untested.
Suggestion: Add component tests asserting the remove button is present for user-sourced commands and absent for built-in/system sources.
Risk: Built-in commands could be accidentally exposed to deletion if the gate logic regresses.
Confidence: 0.85
Summary
Test Plan
🤖 Generated with TiyCode