Refactor/audit 2026 05 - #1
Merged
Merged
Conversation
Bundles 9 audit-driven lots developed together:
- perf(db): batch INSERT/DELETE in collection product operations
- refactor(commands/products): with_locked_db helper
- perf(maintenance): avoid clones in scan loops
- feat(extractor/batch): eta_seconds calculation
- test(commands/products,orphan_scanner,extractor/{normalize,recursive}): destructive-path coverage
- refactor: tighten error and lock conventions
Tests: 92 → 112 passing.
There was a problem hiding this comment.
Pull request overview
A large refactor/audit pass on the Rust Tauri backend, primarily applying Clippy lints, replacing deprecated std::io::Error::new(ErrorKind::Other, ...) with Error::other, extracting helpers, and adding unit tests for previously untested destructive paths (orphan scanner, normalize, recursive extractor, product uninstall).
Changes:
- Mechanical cleanups:
clamp,is_none_or,into_owned,sort_by_key, deprecation fixes, combinedif letchains,#[allow(dead_code)]annotations on intentionally-public-but-unused API surface,Defaultimpls. - Behavior-touching refactors: chunked batched INSERT/DELETE in
Database::add_products_to_collection/remove_products_from_collectionto stay under SQLite's host-parameter limit; ETA computation inRobustBatchProcessor; extraction ofperform_file_uninstall+ newwith_locked_dbhelper incommands/products.rs; reordered DAZ-reference extraction induf_parser::walk_json(semantically equivalent). - Substantial new unit-test coverage:
orphan_scanner,normalize(incl. destructiveextract_archives_parallel),recursive(depth guard + corrupt-zip error path),commands/products(uninstall stats/dry-run/dir-pruning).
Reviewed changes
Copilot reviewed 37 out of 38 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| .gitignore | Ignore CLAUDE.md |
| src-tauri/src/error.rs | #[allow(dead_code)] on InvalidArchive variant |
| src-tauri/src/db/{mod,models,product_files,import_tasks,repository}.rs | dead-code allows; chunked batched collection insert/delete |
| src-tauri/src/core/watcher.rs | Default impl for WatcherState, dead-code on Modified variant |
| src-tauri/src/core/trash.rs | io::Error::other migration |
| src-tauri/src/core/thumbnails.rs | Combined if/is_none_or |
| src-tauri/src/core/scene_analyzer.rs | Drop unused debug import |
| src-tauri/src/core/orphan_scanner.rs | is_multiple_of; large new tests for resolve_product_identity |
| src-tauri/src/core/manifest.rs | dead-code on action field |
| src-tauri/src/core/maintenance.rs | Borrow-vs-move cleanups, sort_by_key |
| src-tauri/src/core/extractor/* | Clippy cleanups, deprecation fixes, new tests for normalize/recursive, type alias BatchProcessOutcome, ETA in batch progress, _root rename in anchors |
| src-tauri/src/core/duf_parser.rs | Merged extraction branches |
| src-tauri/src/core/downloader/{mod,http,mediafire}.rs | Deprecation/redundant-closure cleanups, dropped unused CHUNK_SIZE |
| src-tauri/src/core/destination.rs | Derive Default instead of manual impl |
| src-tauri/src/core/catalog.rs | is_none_or, drop unused AppError import |
| src-tauri/src/commands/{archive,bundles,import_tasks,products,watcher}.rs | Default impls, with_locked_db helper, extracted perform_file_uninstall + new tests, clippy::too_many_arguments annotations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related Issue
Fixes #
Type of Change
Changes Made
Screenshots (if applicable)
Testing Performed
Checklist
npm run checkpassescargo checkpassescargo testpasses (if applicable)Additional Notes