Skip to content

scan / analyze / clean pattern unification#83

Merged
mors119 merged 1 commit into
FrilLab:mainfrom
mors119:refactor/pattern
Jun 19, 2026
Merged

scan / analyze / clean pattern unification#83
mors119 merged 1 commit into
FrilLab:mainfrom
mors119:refactor/pattern

Conversation

@mors119

@mors119 mors119 commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

What

scan / analyze / clean pattern unification

Why

Pattern Unification for Tauri Implementation

Closes #79
Closes #80

Checklist

Required

  • cargo check passes
  • cargo fmt --check passes
  • cargo clippy --workspace --all-targets -- -D warnings passes
  • cargo test passes

Functional Validation

  • I verified the behavior locally
  • I added or updated tests when necessary

Documentation

  • README or docs were updated if needed
  • New configuration or behavior is documented

Safety

  • Cleanup behavior was reviewed for safety
  • No destructive behavior was introduced without confirmation

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced error handling across scan, analyze, and cleanup commands with descriptive failure messages
    • Added ecosystem classification support for detected projects (Rust, Node, Java)
    • Improved artifact analysis with additional metadata tracking (file size, modification date, age)
    • Enabled data model serialization for better output handling
  • Tests

    • Added unit tests for formatting functions and analysis calculations

@mors119 mors119 merged commit eea1427 into FrilLab:main Jun 19, 2026
1 check passed
@mors119 mors119 deleted the refactor/pattern branch June 19, 2026 08:25
@mors119 mors119 restored the refactor/pattern branch June 19, 2026 08:26
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 552aadbc-b307-4c60-9faa-4f06c984900a

📥 Commits

Reviewing files that changed from the base of the PR and between f5274b3 and a6e64fa.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (37)
  • apps/dustfril-cli/Cargo.toml
  • apps/dustfril-cli/src/commands/analyze.rs
  • apps/dustfril-cli/src/commands/clean.rs
  • apps/dustfril-cli/src/commands/scan.rs
  • apps/dustfril-cli/src/format/mod.rs
  • apps/dustfril-cli/src/format/size_format.rs
  • apps/dustfril-cli/src/format/time_format.rs
  • apps/dustfril-cli/src/main.rs
  • crates/dustfril-core/Cargo.toml
  • crates/dustfril-core/src/analyzer/analyze.rs
  • crates/dustfril-core/src/analyzer/tests.rs
  • crates/dustfril-core/src/api/analyze.rs
  • crates/dustfril-core/src/api/clean.rs
  • crates/dustfril-core/src/api/scan.rs
  • crates/dustfril-core/src/cleaner/executor.rs
  • crates/dustfril-core/src/cleaner/plan.rs
  • crates/dustfril-core/src/cleaner/tests.rs
  • crates/dustfril-core/src/detector/project.rs
  • crates/dustfril-core/src/detector/rust/git.rs
  • crates/dustfril-core/src/detector/rust/registry.rs
  • crates/dustfril-core/src/detector/rust/target.rs
  • crates/dustfril-core/src/detector/scan.rs
  • crates/dustfril-core/src/detector/tests.rs
  • crates/dustfril-core/src/error.rs
  • crates/dustfril-core/src/format/mod.rs
  • crates/dustfril-core/src/lib.rs
  • crates/dustfril-core/src/models/analysis_result.rs
  • crates/dustfril-core/src/models/artifact.rs
  • crates/dustfril-core/src/models/artifact_analysis.rs
  • crates/dustfril-core/src/models/artifact_type.rs
  • crates/dustfril-core/src/models/cleanup_candidate.rs
  • crates/dustfril-core/src/models/cleanup_plan.rs
  • crates/dustfril-core/src/models/cleanup_recommendation.rs
  • crates/dustfril-core/src/models/cleanup_result.rs
  • crates/dustfril-core/src/models/ecosystem.rs
  • crates/dustfril-core/src/models/mod.rs
  • crates/dustfril-core/src/models/scan_result.rs

📝 Walkthrough

Walkthrough

Introduces a DustError/DustResult error model in dustfril-core, renames ArtifactLocation to Artifact, adds an Ecosystem enum, extends ArtifactAnalysis with analysis fields, enables serde on all models, converts every scan/analyze/clean function to return DustResult, and updates CLI commands to handle failures explicitly with stderr messages.

Changes

Error model, model evolution, serde, fallible pipeline, and CLI error handling

Layer / File(s) Summary
DustError / DustResult foundation
crates/dustfril-core/src/error.rs, crates/dustfril-core/src/lib.rs
Defines DustError enum with Io, InvalidPath, ScanFailed, AnalysisFailed, CleanupFailed variants, a DustResult<T> alias, Display/Error/From<io::Error> impls, and replaces the public format module with error.
Model renames, Ecosystem enum, ArtifactAnalysis fields, and serde
crates/dustfril-core/src/models/artifact.rs, crates/dustfril-core/src/models/artifact_analysis.rs, crates/dustfril-core/src/models/ecosystem.rs, crates/dustfril-core/src/models/scan_result.rs, crates/dustfril-core/src/models/artifact_type.rs, crates/dustfril-core/src/models/cleanup_*.rs, crates/dustfril-core/src/models/analysis_result.rs, crates/dustfril-core/src/models/mod.rs, crates/dustfril-core/Cargo.toml
Renames ArtifactLocationArtifact (with serde), introduces Ecosystem {Rust, Node, Java}, adds size_bytes/last_modified/age_days/recommendation to ArtifactAnalysis, enables Serialize/Deserialize on all model types, updates ScanResult.artifacts to Vec<Artifact>, drops artifact_location module, and adds serde dependency.
Detector: Artifact rename, Ecosystem field, and fallible scan functions
crates/dustfril-core/src/detector/project.rs, crates/dustfril-core/src/detector/rust/..., crates/dustfril-core/src/detector/scan.rs, crates/dustfril-core/src/api/scan.rs, crates/dustfril-core/src/detector/tests.rs
Updates git/registry/target detectors to return Option<Artifact>, adds ecosystem: Ecosystem::Rust to detected Project, converts scan_project/scan_workspace/scan_global and api::scan to return DustResult<ScanResult> with ? propagation. Tests unwrap scan results.
Analyzer and cleaner: fallible signatures and test updates
crates/dustfril-core/src/analyzer/analyze.rs, crates/dustfril-core/src/api/analyze.rs, crates/dustfril-core/src/api/clean.rs, crates/dustfril-core/src/cleaner/executor.rs, crates/dustfril-core/src/cleaner/plan.rs, crates/dustfril-core/src/analyzer/tests.rs, crates/dustfril-core/src/cleaner/tests.rs
Changes analyzer::analyze, api::analyze, cleaner::create_cleanup_plan, execute_cleanup, and api::clean::build_plan/execute to return DustResult<...>, propagates errors with ?, wraps results in Ok(...). Tests updated to use Artifact fixtures and unwrap results.
CLI commands: explicit error handling
apps/dustfril-cli/src/commands/scan.rs, apps/dustfril-cli/src/commands/analyze.rs, apps/dustfril-cli/src/commands/clean.rs
Wraps all api::scan, api::analyze, and api::clean::* calls in match expressions, printing Scan failed/Analysis failed/Cleanup failed to stderr and returning early on Err. Also prints artifact paths in the analyze output loop.
CLI format module separation
apps/dustfril-cli/src/main.rs, apps/dustfril-cli/src/format/mod.rs, apps/dustfril-cli/src/format/size_format.rs, apps/dustfril-cli/Cargo.toml
Adds mod format at the CLI crate root with size_format/time_format submodules and wildcard re-exports, adds format_size unit tests covering B/KB/MB/GB, and adds chrono = "0.4" dependency.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • FrilLab/dustfril#34: Initial detector/scan implementation and ArtifactLocation/ScanResult data model that this PR renames and makes fallible.
  • FrilLab/dustfril#45: Established the cleanup pipeline (api/clean.rs, cleaner/plan.rs, cleaner/executor.rs) that this PR converts to return DustResult.
  • FrilLab/dustfril#78: Previous CLI API-layer adoption that this PR extends with explicit match-based error handling in scan/analyze/clean commands.

Poem

🐇 Hippity-hoppity, errors abound,
DustError arrives to keep failures sound!
ArtifactLocation? Gone with a wink —
Artifact leaps to the very edge of the brink.
Serde on all models, the pipeline goes clean,
The tidiest Rust burrow I've ever seen! ✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mors119 mors119 deleted the refactor/pattern branch June 19, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TASK] scan / analyze / clean pattern unification [TASK] Separate formatter from core

1 participant