Skip to content

refactor(cli): expose reusable quota snapshot probe - #34

Merged
FeathBow merged 1 commit into
mainfrom
feat/quota-snapshot
Aug 8, 2026
Merged

refactor(cli): expose reusable quota snapshot probe#34
FeathBow merged 1 commit into
mainfrom
feat/quota-snapshot

Conversation

@FeathBow

@FeathBow FeathBow commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

Extracts the quota model and the platform quota probe into a small reusable crate::quota module with a single probe(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 the quota command. They move to crate::quota (quota/model.rs, quota/platform.rs and its linux/linux/lustre/macos children), and commands/quota.rs now calls crate::quota::probe(&canonical) instead of a private submodule. The command still canonicalizes the target and probes it exactly as before; commands/quota/output.rs keeps rendering crate::quota::model types.

Why

A follow-up wants to read one authoritative quota snapshot immediately before and after a permanent-cleanup batch, from outside the quota command. Exposing crate::quota::probe as 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 warnings on the host and for x86_64-unknown-linux-musl: clean.
  • cargo test --workspace: green (the quota command output tests move with the model and pass unchanged).
  • The quota command's human and JSON output is byte-for-byte unchanged; this is a module move plus one re-export.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.rs with a single probe(&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 QuotaSnapshot from crate::quota::model.
  • Updates the quota command and its output/tests to use the new crate::quota module 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.

@FeathBow
FeathBow merged commit cb1566c into main Aug 8, 2026
11 checks passed
@FeathBow
FeathBow deleted the feat/quota-snapshot branch August 8, 2026 22:41
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.

2 participants