Define session status model#14
Conversation
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughDerives a normalized application-level session status from persisted listener session state and the STT chunk ledger, persists it on snapshots, exposes it in reads, adds types, a schema migration, and test coverage for the mappings. ChangesApp Session Status Normalization
Sequence Diagram(s)sequenceDiagram
participant Client
participant DB
participant Normalizer as Normalizer(Service)
participant Ledger as STT_Ledger
Client->>DB: request note (readNote)
DB-->>Client: row with metadata + sttChunks path
Client->>Ledger: load latest stt-chunks.jsonl
Ledger-->>Client: sttChunks
Client->>Normalizer: normalizeAppSessionStatus({listenerSession, sttChunks})
Normalizer-->>Client: AppSessionStatus (state, detail, counts)
Client-->>DB: (on save) persist session_status_json
Note right of Normalizer: derives state from listenerSession + sttChunks
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Review rate limit: 1/3 review remaining, refill in 37 minutes and 30 seconds. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a status normalization system for application sessions, aggregating listener states and transcription chunk progress into a unified sessionStatus field. While the logic is supported by new unit tests, the implementation relies on synchronous file I/O within the Electron main process, which can lead to UI freezes—especially in noteSummaryFromRow where it creates an N+1 I/O bottleneck. Feedback also identifies redundant ledger parsing in readNote, suggesting a move toward asynchronous operations or database persistence for session metadata.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fc40a8c79c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
Defines a product-level session status model for MirrorNote notes and normalizes listener metadata plus STT chunk ledger state into that model.
Why
The app needs a stable session-state contract before building user-facing recovery UX. Listener metadata and chunk retry state were available separately, but there was no single app-level state for recording, degraded, finalizing, transcribing, failed, completed, or recoverable sessions.
Changes
AppSessionStateandAppSessionStatustypes to the desktop renderer contract.normalizeAppSessionStatus()in the desktop main process to derive app-level session status fromlistenerSessionmetadata and latest STT chunk states.sessionStatuson note summaries and note details.Validation:
node apps/desktop/main/native-launch.node-test.cjsnpm run desktop:checkgit diff --check -- apps/desktop/main.cjs apps/desktop/main/native-launch.node-test.cjs apps/desktop/src/types.tsSummary by CodeRabbit
New Features
Improvements
Tests