Repository navigation
Conversation
Log output went to Xcode and Gradle build logs, CI logs and the detached bugsee-cli.log file with escape codes, because tracing-subscriber enables ANSI by default. Colour now needs an interactive stderr, and a non-empty NO_COLOR turns it off too. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Claude finished @krassx's task in 37s —— View job Code review: PR #85 (no ANSI codes unless stderr is a terminal)I reviewed the diff against Findings (2, both P3, posted inline)
Checked, no problem found
Overall risk: Low
Positives: The change is small and uses the right criterion (stderr TTY plus |
| .with_ansi(ansi_enabled( | ||
| std::io::stderr().is_terminal(), | ||
| std::env::var_os("NO_COLOR").as_deref(), | ||
| )) |
There was a problem hiding this comment.
Severity: P3 Low
Problem: The unit tests only cover the pure predicate ansi_enabled. Nothing checks that the wiring (.with_ansi(...), and the decision happening after daemonize so the redirected fd 2 is seen) actually produces escape-free output. CLAUDE.md says tests/ should pin behaviour through the compiled binary.
Scenario: Someone drops .with_ansi(...) or moves the subscriber setup ahead of daemonize. Every test still passes and the escape codes come back in Xcode, Gradle and CI logs.
Fix: Add an assert_cmd test that runs the binary with stderr piped (so it's not a TTY) and asserts the captured stderr contains no \x1b. tests/elf_upload.rs already captures stderr and has a strip_ansi helper. That helper is now unnecessary for piped stderr, and an assertion there would pin the fix cheaply.
| /// Colour only an interactive terminal: Xcode / Gradle / CI logs and the | ||
| /// detached `bugsee-cli.log` file would otherwise be full of escape codes. | ||
| /// Honours <https://no-color.org> (any non-empty `NO_COLOR` disables colour). | ||
| fn ansi_enabled(stderr_is_terminal: bool, no_color: Option<&std::ffi::OsStr>) -> bool { |
There was a problem hiding this comment.
Severity: P3 Low
Problem: ansi_enabled was inserted between the existing // NOT #[tokio::main] comment block (lines 16-19) and fn main(). That block now sits above ansi_enabled, so it documents the wrong item. The new /// doc comment also runs on from it as one comment.
Impact: The comment guarding the fork-before-runtime invariant, which CLAUDE.md calls load-bearing, is no longer next to main. A future editor of main won't see it.
Fix: Move ansi_enabled above the // NOT #[tokio::main] block, or below main, so the block stays attached to fn main().
…y test Move ansi_enabled below main so the load-bearing '// NOT #[tokio::main]' comment documents fn main again. Add an assert_cmd integration test that runs the binary with piped stderr and asserts no ESC bytes in the log output. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Claude finished @krassx's task in 22s —— View job Code review: PR #85 (no ANSI codes unless stderr is a terminal), re-review after pushI re-read the full diff against Earlier findings: both addressed by 724c516
New findings: none. Checked, no problem found
Overall risk: Low Positives: The change is small. The decision is a pure function with unit tests. It is also pinned end to end through the binary. The |
Logs written to Xcode/Gradle build output, CI logs and the detached
bugsee-cli.logcontained ANSI escape codes, sincetracing_subscriber::fmt()enables ANSI by default.Colour is now enabled only when stderr is a terminal, and a non-empty
NO_COLORdisables it (https://no-color.org).Tested:
cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo testall pass; unit tests for the decision function.🤖 Generated with Claude Code