Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughRefactors the OTA update flow by removing a monolithic component and replacing it with a modular ota/ directory (store, task, UI), tightens MenuItem prop types and moves styling helper, updates import/mock mappings, and consolidates transcript words from the same speaker into single segments with updated tests. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant UpdateChecker
participant useOTA
participant updateStore
participant TauriUpdater
User->>UpdateChecker: open menu (idle)
UpdateChecker->>useOTA: subscribe / render
useOTA->>updateStore: subscribe
User->>UpdateChecker: "Check for updates"
UpdateChecker->>useOTA: handleCheckForUpdate()
useOTA->>updateStore: setState(checking)
useOTA->>TauriUpdater: check()
TauriUpdater-->>useOTA: response (update | null) or error
alt update available
useOTA->>updateStore: checkSuccess(update) -> state: available
User->>UpdateChecker: "Download"
UpdateChecker->>useOTA: handleStartDownload()
useOTA->>updateStore: setState(downloading)
TauriUpdater-->>useOTA: progress events
useOTA->>updateStore: downloadProgress(%)
TauriUpdater-->>useOTA: finished
useOTA->>updateStore: downloadFinished -> state: ready
User->>UpdateChecker: "Install"
UpdateChecker->>useOTA: handleInstall()
useOTA->>updateStore: setInstalling() -> state: installing
useOTA->>TauriUpdater: installAndRelaunch()
else no update
useOTA->>updateStore: checkSuccess(null) -> state: noUpdate
else error
useOTA->>updateStore: checkError(err) -> state: error
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Multiple new files split responsibilities (state, tasks, UI) and require reading each piece plus integration points (Tauri updater, XState store). Transcript and MenuItem changes are straightforward. Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 2 inconclusive)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
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.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/desktop/src/components/main/sidebar/profile/shared.tsx (1)
34-39: Use array notation withcnper coding guidelines.The
cnutility should receive an array of class segments for consistency.As per coding guidelines.
Apply this diff:
<span - className={cn( + className={cn([ "rounded-full", "px-2 py-0.5", "bg-red-500", "text-xs font-semibold text-white", - )} + ])} >
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
apps/desktop/src/components/main/sidebar/profile/ota.tsx(0 hunks)apps/desktop/src/components/main/sidebar/profile/ota/index.tsx(1 hunks)apps/desktop/src/components/main/sidebar/profile/ota/store.ts(1 hunks)apps/desktop/src/components/main/sidebar/profile/ota/task.ts(1 hunks)apps/desktop/src/components/main/sidebar/profile/shared.tsx(2 hunks)apps/desktop/src/components/task-manager.tsx(1 hunks)apps/desktop/src/mocks/updater.ts(1 hunks)apps/desktop/src/utils/transcript.test.ts(1 hunks)apps/desktop/src/utils/transcript.ts(1 hunks)
💤 Files with no reviewable changes (1)
- apps/desktop/src/components/main/sidebar/profile/ota.tsx
🧰 Additional context used
📓 Path-based instructions (1)
apps/desktop/**/*.{tsx,jsx}
📄 CodeRabbit inference engine (apps/desktop/.cursor/rules/style.mdc)
apps/desktop/**/*.{tsx,jsx}: When there are many className values with conditional logic in React components, use thecnutility imported asimport { cn } from "@hypr/ui/lib/utils"
When usingcn, always pass an array of class segments (e.g.,cn([ ... ]))
When usingcn, split the array by logical grouping of classes for readability
Files:
apps/desktop/src/components/task-manager.tsxapps/desktop/src/components/main/sidebar/profile/ota/index.tsxapps/desktop/src/components/main/sidebar/profile/shared.tsx
🧠 Learnings (2)
📚 Learning: 2025-10-20T06:06:12.693Z
Learnt from: CR
PR: fastrepl/hyprnote#0
File: apps/desktop/.cursor/rules/style.mdc:0-0
Timestamp: 2025-10-20T06:06:12.693Z
Learning: Applies to apps/desktop/**/*.{tsx,jsx} : When there are many className values with conditional logic in React components, use the `cn` utility imported as `import { cn } from "hypr/ui/lib/utils"`
Applied to files:
apps/desktop/src/components/main/sidebar/profile/shared.tsx
📚 Learning: 2025-10-20T06:06:12.693Z
Learnt from: CR
PR: fastrepl/hyprnote#0
File: apps/desktop/.cursor/rules/style.mdc:0-0
Timestamp: 2025-10-20T06:06:12.693Z
Learning: Applies to apps/desktop/**/*.{tsx,jsx} : When using `cn`, split the array by logical grouping of classes for readability
Applied to files:
apps/desktop/src/components/main/sidebar/profile/shared.tsx
🧬 Code graph analysis (5)
apps/desktop/src/utils/transcript.ts (1)
crates/whisper-local/src/model/actual.rs (1)
segments(178-181)
apps/desktop/src/utils/transcript.test.ts (1)
apps/desktop/src/utils/transcript.ts (1)
buildSegments(8-31)
apps/desktop/src/components/main/sidebar/profile/ota/index.tsx (3)
apps/desktop/src/components/main/sidebar/profile/ota/task.ts (1)
useOTA(28-38)apps/desktop/src/components/main/sidebar/profile/shared.tsx (1)
MenuItem(3-49)packages/utils/src/cn.ts (1)
cn(20-22)
apps/desktop/src/components/main/sidebar/profile/ota/task.ts (1)
apps/desktop/src/components/main/sidebar/profile/ota/store.ts (1)
updateStore(25-106)
apps/desktop/src/components/main/sidebar/profile/shared.tsx (1)
packages/utils/src/cn.ts (1)
cn(20-22)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: ci (macos, macos-14)
🔇 Additional comments (20)
apps/desktop/src/utils/transcript.ts (1)
19-28: LGTM! Clean segment merging implementation.The logic correctly consolidates adjacent words from the same speaker into single segments, with proper edge-case handling for empty arrays and clean word separation.
apps/desktop/src/mocks/updater.ts (1)
19-19: LGTM! Mock now simulates update available.Switching from
check_1(no update) tocheck_2(update available) allows testing the full OTA download and install flow.apps/desktop/src/utils/transcript.test.ts (1)
28-76: LGTM! Comprehensive test coverage for segment merging.The testcases array structure improves maintainability and the new scenarios thoroughly validate the speaker merging logic:
- Empty input handling
- Single word segment creation
- Adjacent words from same speaker merging
- Different speakers creating separate segments
apps/desktop/src/components/main/sidebar/profile/shared.tsx (2)
1-1: LGTM! Correct styling utility import.Switching from
clsxtocnaligns with the project's styling utilities and enables Tailwind class merging.
11-14: LGTM! Tightened prop types improve type safety.Explicitly typing
iconandsuffixIconasReact.ComponentType<{ className?: string }>ensures proper component contracts and enables className forwarding.apps/desktop/src/components/main/sidebar/profile/ota/store.ts (3)
1-23: LGTM! Well-structured state and context types.The state enumeration and context shape provide clear contracts for the OTA update flow, with appropriate fields for tracking update status, payload, error, and download progress.
25-61: LGTM! Clean state transition handlers.The handlers for
setState,checkSuccess,checkError, andstartDownloadcorrectly manage context updates and state transitions.
76-105: LGTM! Complete lifecycle management.The remaining handlers (
downloadFinished,cancelDownload,setInstalling,reset) correctly manage state cleanup and transitions for the complete update lifecycle.apps/desktop/src/components/task-manager.tsx (1)
6-6: LGTM! Import path updated for modular OTA structure.The import now points to the dedicated task module, aligning with the refactored OTA directory structure.
apps/desktop/src/components/main/sidebar/profile/ota/index.tsx (6)
21-29: LGTM! Clean checking state UI.The MenuItem correctly shows a spinner and disables interaction during update checks.
31-39: LGTM! Clear no-update feedback.The success indicator and message appropriately communicate that the software is current.
68-77: LGTM! Clear download prompt with visual indicator.The download button clearly displays the version and uses a red dot badge to draw attention to the available update.
79-108: LGTM! Excellent download progress UI with cancel option.The progress bar correctly binds to
downloadProgress.percentage, and the cancel button provides good UX. Thecnusage with array notation follows coding guidelines.
110-119: LGTM! Clear install prompt with animated indicator.The pulsing red dot effectively draws attention to the ready-to-install state.
121-139: LGTM! Complete state coverage for OTA flow.The installing and idle states provide appropriate feedback and interaction points for the full update lifecycle.
apps/desktop/src/components/main/sidebar/profile/ota/task.ts (5)
7-26: LGTM! Robust update check with auto-reset.The check logic correctly handles both success and error cases. The defensive state check before auto-resetting
noUpdate(lines 16-17) prevents race conditions if the user manually triggers another action during the timeout.
28-38: LGTM! Clean hook interface for OTA state.The
useOTAhook effectively exposes both the store context and action handlers, providing a simple API for components.
40-68: LGTM! Complete download flow with progress tracking.The download handler correctly processes all three event types (
Started,Progress,Finished) and properly initializes contentLength from the Started event before accumulating chunk progress.
70-81: LGTM! Safe cancel with error suppression.Catching and logging (rather than propagating) the close error is appropriate since cancellation should succeed regardless of cleanup failures.
83-101: LGTM! Development-safe install handler.Skipping install and relaunch in development (line 93) prevents disrupting the dev environment while still allowing state transitions to be tested.
No description provided.