Skip to content

fix(rg): preserve collected diagnostics in quiet match paths#1755

Merged
chaliy merged 1 commit into
mainfrom
2026-05-25-fix-diagnostics-loss-in-rg-quiet-mode
May 25, 2026
Merged

fix(rg): preserve collected diagnostics in quiet match paths#1755
chaliy merged 1 commit into
mainfrom
2026-05-25-fix-diagnostics-loss-in-rg-quiet-mode

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented May 25, 2026

Motivation

  • collect_rg_inputs now accumulates read errors into collected_inputs.stderr, but several opts.quiet early-return paths used ExecResult::ok(...) which dropped those diagnostics causing rg -q needle missing.txt readable.txt to lose missing-file messages when --messages is enabled.
  • The change restores ripgrep-compatible behavior by ensuring collected read diagnostics are emitted even when quiet early-returns occur while preserving quiet-mode exit semantics.

Description

  • Replace early return Ok(ExecResult::ok(String::new())) quiet-path returns with ExecResult values that set stdout to empty, stderr to collected_inputs.stderr.clone(), and exit_code to 0 in the binary/text/multiline/line-match quiet branches.
  • Add two differential test cases to the existing rg differential suite that cover -q with a missing file plus a matching readable file and the --no-messages -q counterpart to assert diagnostics are present or suppressed appropriately.
  • Keep all other rg behavior and exit-code semantics unchanged.

Testing

  • Ran cargo test -p bashkit rg::tests::test_rg_diff_cases -- --nocapture which executed the rg differential cases and completed successfully with no test failures.
  • Ran the repository test run during development and the test suite completed without failing tests for the exercised targets.

Codex Task

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 25, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 0ea13c3 Commit Preview URL May 25 2026, 04:33 PM

collect_rg_inputs accumulates read errors into collected_inputs.stderr,
but quiet early-return paths used ExecResult::ok which dropped those
diagnostics, causing 'rg -q needle missing.txt readable.txt' to lose
missing-file messages when --messages is enabled.

Thread stderr through rg_quiet_result so the quiet selected paths
preserve collected diagnostics. Adds two differential cases:
- -q with missing file + readable match
- --no-messages -q to verify diagnostics are suppressed

Rebased on current main; original PR #1755 by chaliy.
@chaliy chaliy force-pushed the 2026-05-25-fix-diagnostics-loss-in-rg-quiet-mode branch from ebd0f69 to 0ea13c3 Compare May 25, 2026 15:16
@chaliy chaliy merged commit bd2ed68 into main May 25, 2026
33 checks passed
@chaliy chaliy deleted the 2026-05-25-fix-diagnostics-loss-in-rg-quiet-mode branch May 25, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant