Skip to content

fix(cargo): preserve complete failure diagnostics - #4643

Open
pocketman70651 wants to merge 1 commit into
rtk-ai:developfrom
pocketman70651:fix/cargo-preserve-failure-diagnostics
Open

pocketman70651 wants to merge 1 commit into
rtk-ai:developfrom
pocketman70651:fix/cargo-preserve-failure-diagnostics

Conversation

@pocketman70651

Copy link
Copy Markdown

Summary

  • Preserve complete Cargo failure diagnostics in direct CLI output. cargo test -- --nocapture previously lost panic messages/backtraces, text builds dropped rustc explanation/footer lines, and JSON builds omitted diagnostics after the first 20 errors / 10 warnings.
  • Stream unmatched build/check/test lines, retain diagnostic continuations (including progress-looking text and ANSI headers), and avoid replaying already-emitted output in summaries. Render every JSON diagnostic, retain notes/footers and original records when rendered text is unavailable.
  • Keep successful test aggregation and progress filtering. JSON savings come from removing envelopes/artifact records rather than dropping errors. Existing JSON/clippy batch stream merging is unchanged. This does not bypass failed commands or change hooks.

Test plan

  • cargo fmt --all --check, cargo clippy --offline --locked --all-targets, cargo test --offline --locked
  • Four new regression tests failed on the unmodified baseline before implementation; focused Cargo unit tests and three CLI integration tests pass with --no-default-features.
  • Real macOS x86_64 / Rust 1.99.0 offline fixtures: successful named test; 800-character panic through three functions with RUST_BACKTRACE=full; captured and nocapture failures (46 and 43 frames respectively); text type error; 21 uniquely numbered JSON compile errors; Clippy failure. Direct diagnostic contents, every frame/symbol/location (normalizing addresses only), and exit 101 were compared from full captures. All 21 JSON rendered diagnostics, including feat: comprehensive economics analysis and code quality improvements #21 and its source location, survive.
  • The JSON savings regression retains its >=60% requirement and uses RTK's byte-based token estimator, while requiring every diagnostic to remain present.

No Codex/global installation was used for these checks. Live Codex hook trust/automatic rewriting is outside this filter-only PR. The executable integration tests use deterministic fake-Cargo fixtures; the real Rust cases above were also run separately.

Full suite: 4674 passed, 8 upstream-ignored; exit 0. The initial sandbox run could not bind the loopback listener required by an existing hook test, so the full suite was rerun with that execution permission (no tests skipped). Final focused Cargo suite: 87 passed; CLI suite: 3 passed.

@CLAassistant

CLAassistant commented Oct 18, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added bug Something isn't working cargo output-filtering labels Oct 18, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟡 Risk medium

Summary

Fixes Cargo output filtering so complete failure diagnostics are preserved: panic messages/backtraces from cargo test -- --nocapture, text build error explanations/footers, and JSON diagnostics beyond the previous 20-error/10-warning caps. It refactors the build/test handlers from block-based to line-based streaming, removes arbitrary truncation caps, and avoids replaying already-emitted output in summaries.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Analyzed automatically by wshm · This is an automated analysis, not a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cargo output-filtering

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants