8000 fix: route mip trace output to stderr instead of stdout by gominimal-aw-bot[bot] · Pull Request #1315 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix: route mip trace output to stderr instead of stdout - #1315

Merged
norrietaylor merged 1 commit into
mainfrom
inbox-patch/mip-trace-stderr-cb86a2f497eac70f
Aug 29, 2026
Merged

norrietaylor merged 1 commit into
mainfrom
inbox-patch/mip-trace-stderr-cb86a2f497eac70f

Conversation

@gominimal-aw-bot
@gominimal-aw-bot gominimal-aw-bot Bot commented Aug 28, 2026 •
Copy link
Copy Markdown
Contributor

Routing-Key: inbox-route/I_kwDOSUhdos8AAAABNw930g

mip dump --packages prints a machine-readable JSON array on stdout, but the CLI's tracing subscriber was initialised with ot::StdoutWriter, so any trace event fired while a command ran was written to stdout as well. A trace line emitted ahead of the JSON corrupted the stream and broke any consumer parsing the dump through a pipe. Those lines also carried ANSI escapes unconditionally, because tracing-subscriber's default ansi feature stays enabled, so colour codes appeared even on a non-terminal pipe.

This adds ot::StderrWriter, the stderr counterpart of StdoutWriter that keeps the same MultiProgress suspension so trace logs and progress bars don't clobber each other, and points the mip subscriber at it. ANSI colouring is now gated on stderr being a terminal, so redirected diagnostics stay plain text. stdout now carries only the command's payload.

No test was added: the change is subscriber wiring in main() plus a delegating writer mirroring the (untested) StdoutWriter, and the harness has no natural unit surface for asserting main's output stream.

Verification

  • cargo fmt --all --check — clean
  • cargo clippy --workspace --locked -- -D warnings — clean, no warnings
  • cargo build --workspace --locked — Finished, ok
  • cargo test --workspace --locked — ok, all suites passed (exit 0)

Summary by CodeRabbit

  • New Features
    • Diagnostic and tracing output is now directed to the error output stream, keeping standard output available for primary results.
    • Terminal formatting is enabled automatically when supported, improving readability in interactive sessions.
    • Progress indicators now pause while messages are written and resume cleanly afterward, preventing output from overlapping or becoming difficult to read.

The mip tracing subscriber was initialised with ot::StdoutWriter, so
any trace event fired during a command's execution was written to
stdout. For `mip dump --packages`, whose stdout carries a
machine-readable JSON array, a trace line emitted ahead of the payload
corrupted the stream and broke any consumer parsing it through a pipe.
The lines also carried ANSI escapes unconditionally, because
tracing-subscriber's default `ansi` feature stays enabled here.

Add ot::StderrWriter, the stderr counterpart of StdoutWriter that keeps
the same MultiProgress suspension so logs and progress bars don't
clobber each other, and point the mip subscriber at it. Gate ANSI
colouring on stderr being a terminal so redirected diagnostics stay
plain text.
@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 Aug 28, 2026
@gominimal-aw-bot
gominimal-aw-bot Bot requested a review from a team as a code owner August 28, 2026 06:31
@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 Aug 28, 2026
@coderabbitai
coderabbitai Bot commented Aug 28, 2026 •
Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 48d92394-92d9-44fe-96d0-0e0d43361b74

📥 Commits

Reviewing files that changed from the base of the PR and between 5406ecc and e94d591.

📒 Files selected for processing (3)
  • crates/mip/src/main.rs
  • crates/ot/src/indicatif_shim.rs
  • crates/ot/src/lib.rs

Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

The CLI now sends tracing output to stderr and enables ANSI formatting only when stderr is a terminal. The output crate adds and re-exports a progress-aware StderrWriter.

Changes

Stderr output integration

Layer / File(s) Summary
Progress-aware stderr writer
crates/ot/src/indicatif_shim.rs, crates/ot/src/lib.rs
StderrWriter suspends shared progress rendering during stderr writes and is available through the indicatif-gated public exports.
Terminal-aware CLI tracing
crates/mip/src/main.rs
Tracing output uses stderr. ANSI formatting is enabled only when stderr is a terminal.

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

Merge Risk: ⚪ Minimal · up to e94d5

The change keeps machine-readable command output on stdout and routes diagnostics to stderr, with plain text when redirected. No actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: twitchyliquid64

Poem

A rabbit writes where progress glows,

To stderr now the tracing flows.
When terminals can show the light,
ANSI colors bloom just right.
The progress bars pause, then cheer,
While StderrWriter keeps paths clear.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 3 files. Write 8000 docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, clear, and accurately identifies the main change: routing mip trace output from stdout to stderr.
Description check ✅ Passed The description clearly explains the problem, implementation, and verification results. It includes summary and testing information, although it uses a Verification heading instead of Testing and omit…
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.
Full details: Description check

Explanation

The description clearly explains the problem, implementation, and verification results. It includes summary and testing information, although it uses a Verification heading instead of Testing and omits the checklist.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch inbox-patch/mip-trace-stderr-cb86a2f497eac70f

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

@norrietaylor
norrietaylor merged commit 251efc6 into main Aug 29, 2026
33 checks passed
@norrietaylor
norrietaylor deleted the inbox-patch/mip-trace-stderr-cb86a2f497eac70f branch August 29, 2026 05:58
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0