8000 fix: show a download meter when adding packages in a sandbox by norrietaylor · Pull Request #1583 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix: show a download meter when adding packages in a sandbox - #1583

Merged
norrietaylor merged 3 commits into
mainfrom
fix/sandbox-download-meter
Sep 24, 2026
Merged

norrietaylor merged 3 commits into
mainfrom
fix/sandbox-download-meter

Conversation

@norrietaylor
@norrietaylor norrietaylor commented Sep 23, 2026 •
Copy link
Copy Markdown
Member

Summary

In-session min add printed a static fetching <pkg> line per package and nothing while the bytes downloaded. The in-sandbox helper path (SessionChannel::install → /run/minenv_sock → env_min_helper.sh) only ever carried one-shot msg: lines, so it could not animate.

This adds a bar: line to that protocol, painted from the byte progress the session OpTracker already records:

  • The daemon paints at most ~12 Hz and only when the text changes; an empty bar: clears the row.
  • The helper redraws bar: in place on a TTY, clears it before any msg:/error: and at exit (no stale partial frame left in scrollback), and drops it when stdout is a pipe or log. Width is re-read per paint so a resize does not wrap the row.
  • Concurrent downloads collapse into one meter. Finished downloads stay in the totals, so the fill never moves backwards when one of several completes.
  • min add's meter is scoped to the added packages and their build/runtime closure, so a task building in another shell on the same session does not take it over. FetchSource/FetchIndex name no package and remain unscoped.
  • In-box min build gets the same meter via the shared sandbox_progress::relay.

Testing

  • cross clippy -p minimald --all-targets --target aarch64-unknown-linux-musl -- -D warnings: clean.
  • cross test -p minimald: all pass except two nsenter::tests cases (a_shim_that_is_no_longer_on_disk_is_named_as_the_failure, the_registered_shim_overrides_current_exe_and_yields_to_an_explicit_one), which fail identically on unmodified main under cross.
  • 19 sandbox_progress unit tests: meter formatting, monotonic totals, fetch→extract handoff, zero/unknown lengths, reset after an idle gap, scoping, clear-on-finish, repaint-after-message, and relay end to end.
  • Helper exercised against a scripted daemon under a pty at 30, 12 and 25 columns (clipped to width − 1, including with stdin not a tty) and through a pipe (only msg: lines).
  • just e2e (macOS, HVF): session e2e OK, including the in-sandbox min add jq proof over a real pty.
  • Manual: fresh isolated stack on this build, min add rust in-box over a real pty (cold cache). 149 in-place meter paints, e.g. Fetch sqlite +2 [> ] 1.39 MiB / 419 MiB → Fetch rust [================] 419 MiB / 419 MiB; zero backward steps in the byte count; final screen shows only the fetching … / Installed rust lines, no leftover meter frame.

Checklist

  • Docs updated if behavior changed
  • BREAKING CHANGE: footer present if this is a breaking change

norrietaylor and others added 2 commits September 23, 2026 08:51
In-session min add only printed a static "fetching" line while bytes
downloaded. Paint the existing fetch progress as a bar the in-sandbox
helper redraws in place.

Co-authored-by: Cursor <cursoragent@cursor.com>
Clear the meter instead of leaving its last frame in scrollback, keep
finished downloads in the totals so the fill never moves backwards,
scope an add's meter to the packages it installs, re-read the terminal
width per paint, and paint the same meter for in-box min build.
@coderabbitai
coderabbitai Bot commented Sep 23, 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: fe475655-cd2c-4854-ae10-2e15b862303f

📥 Commits

Reviewing files that changed from the base of the PR and between 85c9b4a and f73bc1d.

📒 Files selected for processing (4)
  • crates/minimald/src/env.rs
  • crates/minimald/src/env_min_helper.sh
  • crates/minimald/src/lib.rs
  • crates/minimald/src/sandbox_progress.rs

Included review availability: Your plan provides up to 5 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change adds a sandbox progress reporter for package installation and builds. It formats fetch and build status, relays progress frames through the helper, and redraws those frames on terminal output.

Changes

Sandbox progress reporting

Layer / File(s) Summary
Progress tracking and rendering
crates/minimald/src/sandbox_progress.rs, crates/minimald/src/lib.rs
Adds SandboxProgress to select and format fetch and build status, relay events, and test rendered output.
Install and build event integration
crates/minimald/src/env.rs
Routes install and build events through the reporter. Install progress is scoped to requested packages and their transitive dependencies.
Terminal progress meter
crates/minimald/src/env_min_helper.sh
Handles bar: frames on terminal output, clips them to terminal width, and clears an open meter before messages, errors, or loop exit.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Build as Install or build events
  participant Relay as sandbox_progress::relay
  participant Progress as SandboxProgress
  participant Helper as __min_rpc
  participant Terminal as Terminal output
  Build->>Relay: Forward operation events
  Relay->>Progress: Refresh progress and render messages
  Progress->>Helper: Write bar: and msg: frames
  Helper->>Terminal: Redraw meter and print messages
Loading

Suggested reviewers: evanspearman

Merge Risk: ⚪ Minimal · up to f73bc

This change adds a live download and build progress meter to min add and in-box min build when output goes to a terminal. The meter is omitted for piped or logged output and is cleared before messages, errors, and exit. No correctness or stability problems were identified. The worst plausible gap is that the meter might not appear for some builds, which does not affect results. The change looks ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 40 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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 clearly and concisely describes the main change: adding a download meter when packages are added in a sandbox.
Description check ✅ Passed The description includes the required Summary, Testing, and Checklist sections. It explains the implementation, scope, terminal behavior, tests, known baseline failures, and manual validation. The che…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

A rabbit watches fetch bytes flow,
A meter redraws in rows below.
Build status joins the passing stream,
Then clears away the final gleam.
The helper keeps each frame in view,
And sends a quiet message through.

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

@minimal-foundry
minimal-foundry Bot commented Sep 23, 2026 •
Copy link
Copy Markdown
Contributor

Approved: no findings at f73bc1d1ef9d.

Nothing to do.

Clobber: none: git log on the touched files shows only this PR's own three commits (0e3c7d7f/def16a78/f73bc1d1); nothing recent reverted.

Treat a zero reported length as unknown, give a finished unknown-length
download the size it received, and reset the totals once no download is
in flight. Measure the progress line against the terminal stdout writes
to, and keep narrow widths instead of assuming 80 columns.
@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minimal-review — approved

Verdict APPROVE — No findings.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Sep 23, 2026
@norrietaylor
norrietaylor merged commit 63a4b99 into main Sep 24, 2026
33 checks passed
@norrietaylor
norrietaylor deleted the fix/sandbox-download-meter branch September 24, 2026 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0