refactor(cli): expose reusable quota snapshot probe - #34
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the CLI quota implementation by extracting the quota data model and platform-specific probing logic into a reusable crate::quota module, so other in-crate consumers can obtain the same authoritative quota snapshot without depending on the quota command’s internal modules.
Changes:
- Introduces
crates/degu/src/quota.rswith a singleprobe(&Path) -> Result<QuotaSnapshot, ProbeError>entry point and re-exports for the model/error types. - Moves/updates platform probing code (Linux VFS + Lustre, macOS stub) to return
QuotaSnapshotfromcrate::quota::model. - Updates the
quotacommand and its output/tests to use the newcrate::quotamodule types and probe function.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/degu/src/quota/platform/macos.rs | Updates macOS probe signature and model import to use QuotaSnapshot. |
| crates/degu/src/quota/platform/linux/lustre.rs | Switches Lustre provider imports/return type to QuotaSnapshot and updates constructor call sites. |
| crates/degu/src/quota/platform/linux.rs | Switches Linux VFS provider imports/return type to QuotaSnapshot; updates tests’ model imports. |
| crates/degu/src/quota/platform.rs | Updates platform dispatcher to return QuotaSnapshot and widens ProbeError visibility for reuse within the crate. |
| crates/degu/src/quota/model.rs | Renames/exposes the quota model as QuotaSnapshot and adjusts visibilities for cross-module reuse. |
| crates/degu/src/quota.rs | Adds the new reusable quota module façade (probe, re-exports). |
| crates/degu/src/lib.rs | Registers the new quota module in the crate root. |
| crates/degu/src/commands/quota/output/tests.rs | Updates output tests to construct QuotaSnapshot via the new model path. |
| crates/degu/src/commands/quota/output.rs | Updates output rendering to accept &QuotaSnapshot and import model types from crate::quota::model. |
| crates/degu/src/commands/quota.rs | Updates command implementation to call crate::quota::probe instead of the former private platform module. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Summary
Extracts the quota model and the platform quota probe into a small reusable
crate::quotamodule with a singleprobe(path) -> Result<QuotaSnapshot, ProbeError>entry point. Pure refactor: no behavior, output, JSON, or exit-code change.Previously the quota model and platform probe lived under
commands/quota/, reachable only from thequotacommand. They move tocrate::quota(quota/model.rs,quota/platform.rsand itslinux/linux/lustre/macoschildren), andcommands/quota.rsnow callscrate::quota::probe(&canonical)instead of a private submodule. The command still canonicalizes the target and probes it exactly as before;commands/quota/output.rskeeps renderingcrate::quota::modeltypes.Why
A follow-up wants to read one authoritative quota snapshot immediately before and after a permanent-cleanup batch, from outside the
quotacommand. Exposingcrate::quota::probeas the single shared entry point lets that consumer reuse the exact same probe rather than duplicating platform quota logic. This PR only makes the probe reusable; it adds no caller.Validation
cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warningson the host and forx86_64-unknown-linux-musl: clean.cargo test --workspace: green (thequotacommand output tests move with the model and pass unchanged).quotacommand's human and JSON output is byte-for-byte unchanged; this is a module move plus one re-export.