Repository navigation
refactor: split lib.rs Tauri commands into commands modules - #295
Conversation
…with 5 updates Bumps the cargo-minor-and-patch group with 5 updates in the /src-tauri directory: | Package | From | To | | --- | --- | --- | | [tauri](https://github.com/tauri-apps/tauri) | `2.12.1` | `2.12.2` | | [serde_json](https://github.com/serde-rs/json) | `1.0.151` | `1.0.154` | | [uuid](https://github.com/uuid-rs/uuid) | `1.26.1` | `1.28.0` | | [tokio](https://github.com/tokio-rs/tokio) | `1.53.1` | `1.53.2` | | [tauri-build](https://github.com/tauri-apps/tauri) | `2.7.1` | `2.7.2` | Updates `tauri` from 2.12.1 to 2.12.2 - [Release notes](https://github.com/tauri-apps/tauri/releases) - [Commits](tauri-apps/tauri@tauri-v2.12.1...tauri-v2.12.2) Updates `serde_json` from 1.0.151 to 1.0.154 - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](serde-rs/json@v1.0.151...v1.0.154) Updates `uuid` from 1.26.1 to 1.28.0 - [Release notes](https://github.com/uuid-rs/uuid/releases) - [Commits](uuid-rs/uuid@v1.26.1...v1.28.0) Updates `tokio` from 1.53.1 to 1.53.2 - [Release notes](https://github.com/tokio-rs/tokio/releases) - [Commits](tokio-rs/tokio@tokio-1.53.1...tokio-1.53.2) Updates `tauri-build` from 2.7.1 to 2.7.2 - [Release notes](https://github.com/tauri-apps/tauri/releases) - [Commits](tauri-apps/tauri@tauri-build-v2.7.1...tauri-build-v2.7.2) --- updated-dependencies: - dependency-name: serde_json dependency-version: 1.0.152 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor-and-patch - dependency-name: tauri dependency-version: 2.12.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor-and-patch - dependency-name: tauri-build dependency-version: 2.7.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor-and-patch - dependency-name: tokio dependency-version: 1.53.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-minor-and-patch - dependency-name: uuid dependency-version: 1.28.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: cargo-minor-and-patch ... Signed-off-by: dependabot[bot] <support@github.com>
Move IPC handlers out of the god-file so feature PRs stop conflicting, with shared pick_file and typed TeachingPdfEntry. Closes #242. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
pountzas
left a comment
There was a problem hiding this comment.
Review: refactor split of lib.rs (#242)
The split itself is clean. I compared every function, struct and const from the old lib.rs against its new home with whitespace and visibility normalized: all ~75 commands, CommandResult/ok/err, MusicFilePayload, ALLOWED_MS_SETTINGS_PAGES, RestoreAlwaysOnTop and the window-layout helpers are byte-for-byte moves apart from path prefixes (crate::, super::) and pub visibility. The sorted generate_handler! list is identical (75 entries incl. the 7 companion commands), parameter names are unchanged (so invoke args still match), run() only changed formatting, and teaching_pdf.rs (#291 validation) is untouched. pick_file keeps the same filters, parent, save-name and always-on-top restore; there were no dialog titles before, so none are lost.
Acceptance criteria: lib.rs size/contents ✅, module layout per table ✅, fn names + handler list ✅, single CommandResult ✅, shared pick_file ✅, typed TeachingPdfEntry ✅ (with one regression below), #291 moved unchanged ✅. Still open: CI check was in progress when reviewed (build-windows skipped), and the manual smoke list is unchecked.
Required changes (priority order)
src-tauri/src/commands/teaching_pdf.rscmd_list_teaching_pdfs: don't fail the whole library when one stored entry doesn't matchTeachingPdfEntry; skip invalid entries (and defaulttitle/lastOpenedAt) so loading stays as tolerant as before.src-tauri/src/commands/teaching_pdf.rs: add unit tests that pin the on-disk camelCase JSON round-trip and the skip-invalid behavior.- Before merge: confirm CI
checkis green and run the Windows smoke list from the PR test plan (pickers, Teaching PDF open/save/export, Focus mode animation, dictation).
Optional: #242 asked for move-only commits first, then pick_file, then TeachingPdfEntry. This is one squashed commit. I verified the moves mechanically, so it isn't blocking.
Skip invalid stored entries and default missing title/lastOpenedAt so typed TeachingPdfEntry does not regress the old frontend filter. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
#[tauri::command]handlers fromsrc-tauri/src/lib.rsintosrc-tauri/src/commands/<area>.rs(keyboard, mouse, window, profiles, files, teaching_pdf, library, dictation, system, prediction, input_preview).window/layout.rs; keeplib.rsas mods,AppState,run(), andgenerate_handler!(~171 lines).pick_filereplaces the four near-identical pickers;CommandResult/ok/errlive incommands/mod.rs; typedTeachingPdfEntryfor list/save (on-disk JSON unchanged). Command fn names and invoke strings unchanged.Commit message
refactor: split lib.rs Tauri commands into commands modulesRelated issue
Fixes #242
Part of #244
Accessibility impact
N/A — backend module split only; no user-facing behavior change.
Test plan
cargo check --locked(src-tauri)cargo test --locked(152 passed)npm test(559 passed)generate_handler!cmd list matches pre-split baseline (68 commands)Screenshots (if UI changed)
N/A
Made with Cursor