8000 fix(minimald): trim the state volume on every tick and at quiesce by gominimal-aw-bot[bot] · Pull Request #1744 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minimald): trim the state volume on every tick and at quiesce - #1744

Merged
norrietaylor merged 1 commit into
mainfrom
inbox-patch/fix/trim-on-every-tick-and-quiesce-e478e1c491f4d4a8
Sep 29, 2026
Merged

norrietaylor merged 1 commit into
mainfrom
inbox-patch/fix/trim-on-every-tick-and-quiesce-e478e1c491f4d4a8

Conversation

@gominimal-aw-bot
@gominimal-aw-bot gominimal-aw-bot Bot commented Sep 26, 2026 •
Copy link
Copy Markdown
Contributor

Routing-Key: inbox-route/I_kwDOSUhdos8AAAABTSyXrQ

The guest only returned freed disk space to the host when the periodic
maintenance trim ran, and only when the preceding cache clean succeeded.
A failed sweep stranded extents earlier work had already freed, and a
clean shutdown reclaimed nothing at all.

This change runs the trim unconditionally on both maintenance tick paths,
and trims best-effort in quiesce_state_volume before teardown so a clean
stop returns every freed extent to the host.

Verification

  • cargo fmt --all --check — clean
  • cargo build --workspace --locked — clean
  • cargo clippy -p minimald --locked -- -D warnings -A clippy::result_unit_err — clean
  • cargo test -p minimald --lib maintenance — 3 passed

Workspace-wide clippy/test report pre-existing failures unrelated to
this change: result_unit_err on session_host.rs (tree pins Rust 1.97.0;
sandbox has 1.98.0 where the lint is new) and netns/checkouts tests that
need privileges or a clean /tmp this sandbox lacks.

Summary by CodeRabbit

  • Bug Fixes
    • State-volume trimming now runs after maintenance cleans, including when a clean fails, and completes before maintenance requests are answered.
    • The state volume is also trimmed during shutdown after filesystem syncing and before unmounting. Trim failures are logged without blocking shutdown; filesystem sync failures continue to propagate.

The guest only returned freed disk space to the host when the
periodic maintenance trim ran, and only when the preceding cache
clean succeeded. A failed sweep therefore stranded the extents
earlier work had already freed, and a clean shutdown reclaimed
nothing at all.

Run the trim unconditionally on both maintenance tick paths, and
trim best-effort in quiesce_state_volume before teardown so a clean
stop returns every freed extent to the host.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@gominimal-aw-bot
gominimal-aw-bot Bot requested a review from a team as a code owner September 26, 2026 11:32
@gominimal-aw-bot gominimal-aw-bot Bot added the agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. label Sep 26, 2026
@coderabbitai
coderabbitai Bot commented Sep 26, 2026 •
Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: 0ef443f8-28a9-488f-ae07-2f7fcc17adeb

📥 Commits

Reviewing files that changed from the base of the PR and between 3c17671 and 596b733.

📒 Files selected for processing (2)
  • crates/minimald/src/guest.rs
  • crates/minimald/src/maintenance.rs

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

quiesce_state_volume now trims after syncing and before unmounting. Maintenance now trims the mounted state volume after every clean, whether the clean succeeds or fails. Explicit requests receive a response after trimming completes.

Changes

State-volume trim flows

Layer / File(s) Summary
Trim after maintenance cleans
crates/minimald/src/maintenance.rs
Explicit and periodic cleans now trim the mounted state volume after success or failure. Explicit requests are answered after trimming.
Trim before volume teardown
crates/minimald/src/guest.rs
quiesce_state_volume trims after sync and before unmount. Trim errors are logged and swallowed; sync errors still propagate.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: norrietaylor, twitchyliquid64

Merge Risk: 🔵 Low · up to 596b7

A failed cache clean can queue a trim that overlaps shutdown, potentially trimming the filesystem beneath the detached state-volume mountpoint. This is a bounded operational risk, so the change remains mergeable with owner awareness.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title uses the required Conventional Commit format and clearly describes the main change: trimming the state volume on maintenance ticks and during quiesce.
Description check ✅ Passed The description explains the problem, the implementation, and verification results. It is mostly complete, although it does not use the template headings exactly and omits the Checklist section.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

A rabbit checks the volume trim,
Then watches cleanups finish their work.
Sync comes first before the trim,
A missed trim waits for another sweep.
The rabbit hops, with state tucked in.

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

@gominimal-aw-bot gominimal-aw-bot Bot added the agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch label Sep 26, 2026
@norrietaylor norrietaylor changed the title fix: fix(minimald): trim the state volume on every tick and at quiesce fix(minimald): trim the state volume on every tick and at quiesce Sep 28, 2026
@norrietaylor
norrietaylor merged commit 6727d04 into main Sep 29, 2026
32 checks passed
@norrietaylor
norrietaylor deleted the inbox-patch/fix/trim-on-every-tick-and-quiesce-e478e1c491f4d4a8 branch September 29, 2026 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0