Skip to content

fix(deps): respect -q flag for provider command stream#9457

Merged
jdx merged 1 commit intojdx:mainfrom
JamBalaya56562:pr9457
Apr 28, 2026
Merged

fix(deps): respect -q flag for provider command stream#9457
jdx merged 1 commit intojdx:mainfrom
JamBalaya56562:pr9457

Conversation

@JamBalaya56562
Copy link
Copy Markdown
Contributor

Summary

Follow-up to #8792. After mise prepare was renamed to mise deps, -q started leaking provider command output again — running mise deps install -q against e.g. a bundler provider still streams bundle install's stdout/stderr through the prefix-tagged tee in the deps engine.

#8792 fixed the summary path (Prepared:/Failed:/All dependencies are up to date) by routing it through the logger via info!/error!, and that change carried over to src/cli/deps/install.rs after the rename. But the provider command stream is a separate path that bypasses the logger entirely, so -q never had any effect on it.

Root cause

In src/deps/engine.rs::execute_command, the with_on_stdout / with_on_stderr callbacks unconditionally write captured lines via prefix_println! / prefix_eprintln!. Both macros expand to calm_io::stdoutln! / calm_io::stderrln! and never consult Settings::quiet, so the quiet flag passes straight through.

mise install -q does not have this issue because the install path uses with_pr(...) and routes output through MultiProgressReport::add, which returns a QuietReport (no-op println / set_message) when Settings::quiet is set. The deps engine instead sets explicit on_stdout / on_stderr callbacks that take precedence over the pr fallback in CmdLineRunner — so the QuietReport never sees the streamed lines.

Fix

Read Settings::get().quiet once before the closures and skip the prefix_println! / prefix_eprintln! calls when set. The progress.set_message call is left in place: it is a no-op for QuietReport and still drives the spinner under ProgressReport in normal mode.

This matches mise install -q behavior — the provider command stream is suppressed, while logger-routed status (Installed:, Failed:) continues to follow the normal quiet level (errors only).

Test plan

  • Added a regression assertion in e2e/cli/test_deps: with the existing codegen provider, mise deps --force --only codegen -q must contain neither the prefix-tagged stream output ([deps.codegen]) nor the info-level summary (Installed:). The assertion immediately above the new lines proves the same command without -q does emit [deps.codegen] codegen, so the pair anchors both directions.
  • mise run test:e2e cli/test_deps cli/test_deps_depends cli/test_deps_tool_install — could not run on this Windows machine (no MSVC link.exe, so even cargo check fails to link build scripts). Relying on CI for full verification.

🤖 Generated with Claude Code

Follow-up to jdx#8792. After `mise prepare` was renamed to `mise deps`, the
summary path stayed quiet via info!/error! but the provider command
stream went back to ignoring -q because the on_stdout/on_stderr callbacks
in DepsEngine::execute_command write captured lines through prefix_println!
and prefix_eprintln!, which expand to calm_io::stdoutln!/stderrln! and
never consult Settings::quiet.

The `mise install -q` path does not have this problem because it routes
output through with_pr(...), and MultiProgressReport::add returns a
QuietReport when quiet is set. The deps engine sets explicit on_stdout/
on_stderr callbacks instead, which take precedence over the pr fallback
in CmdLineRunner — so the QuietReport never sees the streamed lines.

Read Settings::get().quiet once before the closures and short-circuit the
prefix prints when set. progress.set_message is left untouched: it is a
no-op for QuietReport and still drives the spinner under ProgressReport.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 28, 2026

Greptile Summary

This PR fixes a quiet-flag regression in src/deps/engine.rs where the -q/--quiet flag had no effect on streamed provider command output (stdout/stderr) in the deps engine. The fix reads Settings::get().quiet once before the closures and short-circuits the prefix_println!/prefix_eprintln! calls, matching the behavior of mise install -q. A regression test covering both the suppressed stream ([deps.codegen]) and the INFO-level status (Installed:) is added to e2e/cli/test_deps.

Confidence Score: 5/5

Safe to merge — minimal, targeted fix with no logic regressions and a clean regression test.

The change is small, well-scoped, and consistent with how the rest of the codebase handles quiet mode. The quiet bool is captured by value before the closures (correct), progress.set_message is intentionally preserved outside the quiet guard (correct), and the e2e test anchors both the positive and negative cases.

No files require special attention.

Important Files Changed

Filename Overview
src/deps/engine.rs Captures Settings::get().quiet once before closures and adds early-return guards in with_on_stdout / with_on_stderr to suppress prefix-tagged stream output in quiet mode; progress.set_message is intentionally kept outside the quiet guard for spinner UX.
e2e/cli/test_deps Adds two regression assertions anchoring both directions of the quiet flag: verifies [deps.codegen] and Installed: are absent when -q is passed, immediately after an assertion that proves they appear without -q.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[execute_command] --> B{prefixes set AND not raw?}
    B -- No --> Z[runner.execute]
    B -- Yes --> C[read quiet from Settings]
    C --> D[register with_on_stdout closure]
    C --> E[register with_on_stderr closure]

    D --> F[on_stdout fired]
    F --> G[progress.set_message always runs]
    G --> H{quiet?}
    H -- Yes --> I[return - suppress output]
    H -- No --> J[prefix_println to stdout]

    E --> K[on_stderr fired]
    K --> L{quiet?}
    L -- Yes --> M[return - suppress output]
    L -- No --> N[prefix_eprintln to stderr]

    J --> Z
    N --> Z
Loading

Reviews (1): Last reviewed commit: "fix(deps): respect -q flag for provider ..." | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements the -q/--quiet flag for the mise deps command to suppress provider stream output, matching the behavior of mise install. The dependency engine was updated to skip printing to stdout and stderr when the quiet setting is enabled, and new E2E tests were added to verify this functionality. A review comment suggests an optimization to move the quiet check to the top of the stdout closure to prevent unnecessary string cloning and progress message updates.

Comment thread src/deps/engine.rs
Comment on lines 772 to +777
if let Some(progress) = progress {
progress.set_message(line.clone());
}
if quiet {
return;
}
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.

medium

Moving the quiet check to the top of the closure avoids an unnecessary line.clone() and a dynamic dispatch call to progress.set_message when quiet mode is enabled. Since QuietReport::set_message is a no-op, skipping it entirely is more efficient and consistent with the on_stderr implementation below.

Suggested change
if let Some(progress) = progress {
progress.set_message(line.clone());
}
if quiet {
return;
}
if quiet {
return;
}
if let Some(progress) = progress {
progress.set_message(line.clone());
}

@jdx jdx merged commit 3ead3fb into jdx:main Apr 28, 2026
35 checks passed
@JamBalaya56562 JamBalaya56562 deleted the pr9457 branch April 28, 2026 21:05
mise-en-dev added a commit that referenced this pull request Apr 29, 2026
### 🚀 Features

- **(deps)** add aube provider by @jdx in
[#9452](#9452)
- **(ls-remote)** add strict metadata mode by @jdx in
[#9448](#9448)

### 🐛 Bug Fixes

- **(env)** parse concatenated short form `-Eval` correctly by @bts in
[#9456](#9456)
- **(http)** improve HTML detection by using Content-Type header by
@phateffect in [#9407](#9407)
- **(task)** install monorepo subdir tools before running deps by @jdx
in [#9454](#9454)

### 📦️ Dependency Updates

- update astral-tokio-tar advisory by @jdx in
[#9449](#9449)
- respect -q flag for provider command stream by @JamBalaya56562 in
[#9457](#9457)

### New Contributors

- @JamBalaya56562 made their first contribution in
[#9457](#9457)
- @bts made their first contribution in
[#9456](#9456)
- @phateffect made their first contribution in
[#9407](#9407)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
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