-
Notifications
You must be signed in to change notification settings - Fork 11
feat(crate): init soar-package crate #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Warning Rate limit exceeded@QaidVoid has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 18 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
WalkthroughA new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
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 |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
🧹 Nitpick comments (2)
crates/soar-package/src/error.rs (1)
16-22: Consider adding context toMagicBytesErrorandSeekError.These variants lack context that would help with debugging. Consider including the file path or expected vs actual bytes.
- #[error("Failed to read magic bytes")] + #[error("Failed to read magic bytes from {path}")] #[diagnostic(code(soar_package::magic_bytes))] - MagicBytesError, + MagicBytesError { path: String }, - #[error("Failed to seek in file")] + #[error("Failed to seek in file {path}: {reason}")] #[diagnostic(code(soar_package::seek))] - SeekError, + SeekError { path: String, reason: String },crates/soar-package/src/formats/common.rs (1)
213-214: Consider preserving the original error context.The error mapping discards the original
std::io::Errorfromenv::current_dir(), which could make debugging more difficult.Apply this diff to preserve error context:
let base_dir = env::current_dir() - .map_err(|_| PackageError::Custom("Error retrieving current directory".into()))?; + .with_context(|| "retrieving current directory".to_string())?;This uses the
ErrorContexttrait (already in scope) to convert toPackageError::IoError, preserving the original error source.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (18)
Cargo.toml(2 hunks)crates/soar-package/Cargo.toml(1 hunks)crates/soar-package/src/error.rs(1 hunks)crates/soar-package/src/formats/appimage.rs(1 hunks)crates/soar-package/src/formats/common.rs(10 hunks)crates/soar-package/src/formats/mod.rs(1 hunks)crates/soar-package/src/formats/wrappe.rs(1 hunks)crates/soar-package/src/lib.rs(1 hunks)crates/soar-package/src/traits.rs(1 hunks)soar-cli/Cargo.toml(1 hunks)soar-cli/src/install.rs(1 hunks)soar-cli/src/use.rs(1 hunks)soar-core/Cargo.toml(1 hunks)soar-core/src/constants.rs(0 hunks)soar-core/src/database/models.rs(1 hunks)soar-core/src/error.rs(1 hunks)soar-core/src/package/formats/mod.rs(0 hunks)soar-core/src/package/mod.rs(0 hunks)
💤 Files with no reviewable changes (3)
- soar-core/src/package/mod.rs
- soar-core/src/constants.rs
- soar-core/src/package/formats/mod.rs
🧰 Additional context used
🧬 Code graph analysis (7)
crates/soar-package/src/traits.rs (1)
soar-core/src/database/models.rs (8)
pkg_name(252-254)pkg_name(270-272)pkg_id(256-258)pkg_id(274-276)version(260-262)version(278-280)repo_name(264-266)repo_name(282-284)
crates/soar-package/src/lib.rs (2)
crates/soar-package/src/formats/common.rs (1)
integrate_package(326-400)crates/soar-package/src/formats/mod.rs (1)
get_file_type(66-105)
crates/soar-package/src/formats/wrappe.rs (3)
crates/soar-package/src/formats/common.rs (1)
create_portable_link(207-227)crates/soar-package/src/traits.rs (1)
pkg_name(9-9)soar-core/src/database/models.rs (2)
pkg_name(252-254)pkg_name(270-272)
soar-cli/src/use.rs (1)
crates/soar-package/src/formats/common.rs (1)
integrate_package(326-400)
crates/soar-package/src/formats/appimage.rs (2)
crates/soar-utils/src/fs.rs (1)
read_file_signature(223-233)crates/soar-package/src/formats/common.rs (2)
symlink_desktop(142-193)symlink_icon(85-122)
soar-cli/src/install.rs (1)
crates/soar-package/src/formats/common.rs (1)
integrate_package(326-400)
crates/soar-package/src/formats/common.rs (2)
crates/soar-package/src/traits.rs (1)
pkg_name(9-9)soar-core/src/database/models.rs (2)
pkg_name(252-254)pkg_name(270-272)
🪛 GitHub Actions: CI
Cargo.toml
[warning] 1-1: cargo-machete detected unused dependencies: serde, tracing in soar-package/Cargo.toml.
crates/soar-package/Cargo.toml
[warning] 1-1: cargo-machete detected unused dependencies: serde, tracing in soar-package/Cargo.toml.
🔇 Additional comments (21)
soar-core/Cargo.toml (1)
22-22: LGTM!Clean dependency migration. The
imageandsquishydependencies are correctly moved to the newsoar-packagecrate, and the workspace reference is properly configured.crates/soar-package/src/formats/wrappe.rs (1)
1-39: LGTM on the overall structure and documentation.Good use of the new
Resulttype alias and comprehensive doc comments following Rust conventions.crates/soar-package/src/error.rs (2)
7-39: Well-structured error types with diagnostic codes.Good use of
thiserrorandmiettefor rich error handling. TheFromimplementations provide clean error conversion.
44-64: Clean implementation ofErrorContexttrait.The trait provides a consistent pattern for enriching IO errors with contextual information. This is a good abstraction.
soar-cli/src/install.rs (1)
31-31: LGTM!Import correctly updated to reference
integrate_packagefrom the newsoar-packagecrate.soar-cli/Cargo.toml (1)
37-37: LGTM!The workspace dependency addition for
soar-packageis correctly configured and consistent with other workspace dependencies in the manifest.soar-cli/src/use.rs (1)
14-14: LGTM!The import path update correctly reflects the migration of
integrate_packageto the newsoar-packagecrate. The function usage remains consistent throughout the file.crates/soar-package/src/traits.rs (1)
1-19: LGTM!The
PackageExttrait is well-designed with clear documentation. The four accessor methods provide essential package metadata needed for integration operations. The trait interface is appropriately minimal and focused.soar-core/src/database/models.rs (1)
20-20: LGTM!The re-export of
PackageExtfromsoar_packagecorrectly delegates the trait definition to the new crate while maintaining backward compatibility. The existing implementations forPackageandInstalledPackageremain unchanged and continue to satisfy the trait contract.soar-core/src/error.rs (1)
51-52: LGTM!The
PackageErrorvariant correctly wraps the externalsoar_package::PackageErrortype, consolidating package-related error handling. The automaticFromconversion via the#[from]attribute ensures seamless error propagation throughout the codebase.crates/soar-package/src/formats/appimage.rs (2)
33-42: LGTM!The function signature correctly uses the crate-local
Resulttype, and the early return guard efficiently skips unnecessary work when both desktop integration assets are already present.
8-15: LGTM!The import consolidation correctly brings in the necessary types from the parent module (
PNG_MAGIC_BYTES) and the crate's error handling (ErrorContext,Result) and traits (PackageExt).crates/soar-package/src/lib.rs (1)
1-41: LGTM!The public API surface is well-designed with clear module organization and comprehensive documentation. The re-exports provide convenient access to key functionality (error types, format detection, integration, magic bytes, and traits), making the crate ergonomic to use. The example code demonstrates proper usage patterns.
crates/soar-package/src/formats/mod.rs (3)
1-12: LGTM!The module structure and imports are well-organized. The public module declarations and use statements are appropriate for the package format detection functionality.
14-33: LGTM!The magic byte constants are well-defined with clear documentation. The offset information in comments (e.g., "at offset 8", "at offset file_size - 801") is helpful for understanding where these bytes are expected in the file.
35-50: LGTM!The
PackageFormatenum is well-structured with appropriate derives and clear documentation for each variant. TheUnknownvariant provides a good fallback for unrecognized formats.crates/soar-package/src/formats/common.rs (5)
1-44: LGTM!The imports have been correctly updated to reference the new error types from
crate::error, and theSUPPORTED_DIMENSIONSconstant provides clear documentation of the supported icon dimensions for desktop integration.
69-122: LGTM!The function has been properly updated with comprehensive documentation and the new error type. The logic for normalizing icon dimensions and creating symlinks is correct, and error handling is consistent throughout.
124-193: LGTM!The function has been properly updated with clear documentation explaining the desktop file modification behavior. The return type migration and error handling are consistent with the new error model.
229-303: LGTM!The function has been properly updated with comprehensive documentation explaining the portable directory setup logic. The return type migration is consistent, and the logic correctly handles both unified and individual portable paths.
305-400: LGTM!The function has been properly updated with comprehensive documentation explaining the integration workflow. The return type migration is consistent throughout, including the closure definitions, and the format-specific integration logic is correct.
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.