Skip to content

fix(rg): match binary json output#1737

Merged
chaliy merged 1 commit into
mainfrom
2026-05-24-rg-next-parity-batch
May 25, 2026
Merged

fix(rg): match binary json output#1737
chaliy merged 1 commit into
mainfrom
2026-05-24-rg-next-parity-batch

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented May 24, 2026

What

Match real rg JSON behavior for binary files.

Why

Real rg does not emit human binary-match summaries in --json mode. It emits JSON match/end events, sets binary_offset, and treats NUL bytes as record breaks unless --text is set.

How

  • Preserve binary summary output for non-JSON mode.
  • In JSON mode, search eligible binary inputs as JSON events and emit binary_offset on end events.
  • Count skipped recursive binary files in JSON summary searches, matching real rg.
  • Add differential cases for explicit and recursive binary JSON searches against pinned real rg.

Risk

  • Low
  • Touches rg JSON output for binary files only.

Checklist

  • Tests added or updated
  • Backward compatibility considered

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

cloudflare-workers-and-pages Bot commented May 24, 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 cb5c214 Commit Preview URL May 25 2026, 12:28 AM

@chaliy chaliy force-pushed the 2026-05-24-rg-next-parity-batch branch 3 times, most recently from cb981c4 to 7da5a51 Compare May 25, 2026 00:02
@chaliy chaliy force-pushed the 2026-05-24-rg-next-parity-batch branch from 7da5a51 to cb5c214 Compare May 25, 2026 00:28
@chaliy chaliy merged commit 89acc14 into main May 25, 2026
34 checks passed
@chaliy chaliy deleted the 2026-05-24-rg-next-parity-batch branch May 25, 2026 00:51
chaliy added a commit that referenced this pull request May 25, 2026
Verify default-mode 'binary file matches ...' reporting:
- explicit binary file argument
- binary stdin

Main already implements input.explicit handling differently than the
original PR proposed (using a bool field rather than skip_binary_by_default);
the meaningful contribution is the regression coverage.

Rebased on current main; original PR #1756 by chaliy (refactor portion
superseded by #1737).
chaliy added a commit that referenced this pull request May 25, 2026
#1756)

Adds regression coverage to `test_rg_binary_text_modes` for the default-mode "binary file matches ..." reporting path: explicit binary file argument and binary stdin. The refactor portion of the original PR is superseded by main's `RgInput::explicit` design (#1737); this commit captures the meaningful behavioral regression coverage.
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.

1 participant