Skip to content

feat(rg): validate sort choices - #1698

Merged
chaliy merged 1 commit into
mainfrom
2026-05-22-rg-batch-19
May 23, 2026
Merged

chaliy merged 1 commit into
mainfrom
2026-05-22-rg-batch-19

Conversation

@chaliy

@chaliy chaliy commented May 23, 2026

Copy link
Copy Markdown
Contributor

What

Validate rg --sort and rg --sortr values against real ripgrep's accepted choice set.

Why

Real rg exits 2 for unknown sort choices. Bashkit previously accepted any value and searched anyway.

How

  • Add parse_sort_value for path, modified, accessed, created, and none.
  • Convert rg option parse failures into rg-style ExecResult errors with exit code 2.
  • Add data-driven real-rg differential cases for invalid --sort and --sortr values.
  • Update direct rg error tests to assert stderr/exit-code behavior.

Risk

  • Low
  • Affects rg option parsing and invalid-argument error surfacing.

Checklist

  • Tests added or updated
  • Backward compatibility considered

@cloudflare-workers-and-pages

Copy link
Copy Markdown

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 0c60fe1 Commit Preview URL May 23 2026, 01:17 AM

@chaliy
chaliy merged commit 51eacc7 into main May 23, 2026
34 checks passed
@chaliy
chaliy deleted the 2026-05-22-rg-batch-19 branch May 23, 2026 01:29
chaliy added a commit that referenced this pull request May 30, 2026
## What
Validate `rg --sort` and `rg --sortr` values against real ripgrep's
accepted choice set.

## Why
Real rg exits 2 for unknown sort choices. Bashkit previously accepted
any value and searched anyway.

## How
- Add `parse_sort_value` for `path`, `modified`, `accessed`, `created`,
and `none`.
- Convert rg option parse failures into rg-style `ExecResult` errors
with exit code 2.
- Add data-driven real-rg differential cases for invalid `--sort` and
`--sortr` values.
- Update direct rg error tests to assert stderr/exit-code behavior.

## Risk
- Low
- Affects rg option parsing and invalid-argument error surfacing.

## Checklist
- [x] Tests added or updated
- [x] Backward compatibility considered
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