Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 20 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIntroduces a new ChangesFilters Feature
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant Route
participant FilterMiddleware
participant QueryParameterFilterParser
participant BHContext
participant Handler
Client->>Route: HTTP request with query params
Route->>FilterMiddleware: invoke middleware chain
FilterMiddleware->>QueryParameterFilterParser: ParseAndValidate(request.URL.Query())
QueryParameterFilterParser-->>FilterMiddleware: Filters or ValidationError
alt validation error
FilterMiddleware-->>Client: 400 Bad Request
else success
FilterMiddleware->>BHContext: set Filters
FilterMiddleware->>Handler: call next handler
end
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cmd/api/src/api/middleware/filters.go`:
- Around line 38-58: `FilterMiddleware` is rebuilding the query filter parser on
every request instead of once when the middleware is created. Move the
`filters.NewQueryParameterFilterParser(append(model.IgnoreFilters(),
model.AllPaginationQueryParameters()...)...)` construction out of the inner
`http.HandlerFunc` closure in `FilterMiddleware`, so the parser and its regex
compilation happen once per route registration. Keep the request-time logic in
the closure using the prebuilt parser, while preserving the existing
`ParseAndValidate` and `bhctx.Get` behavior.
In `@packages/go/filters/parser.go`:
- Around line 34-39: The QueryParameterFilterParser currently accepts partial
matches from junk input and uses an ambiguous value character class in
NewQueryParameterFilterParser. Update the valuePattern in
QueryParameterFilterParser to anchor the full operator:value expression so
FindStringSubmatch only matches complete filters, and replace the current value
class with an explicit RE2-safe class that matches the documented syntax. Keep
the fix localized to NewQueryParameterFilterParser and the parsing logic that
consumes valuePattern.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: d3a0a5ec-4e3f-4345-86d7-6b1f5dda7441
📒 Files selected for processing (7)
cmd/api/src/api/constant.gocmd/api/src/api/middleware/filters.gocmd/api/src/api/router/router.gocmd/api/src/bhctx/bhctx.gopackages/go/filters/filter.gopackages/go/filters/parser.gopackages/go/filters/parser_test.go
superlinkx
left a comment
There was a problem hiding this comment.
Approving in case I get pulled in other directions. I'd like the CR comment addressed and you may want to use AsType (it's a nit, but it is nicer if you want to use it). Otherwise, ship it
Description
Describe your changes in detail
Motivation and Context
Resolves BED-8594
Why is this change required? What problem does it solve?
How Has This Been Tested?
Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc.
Screenshots (optional):
Types of changes
Checklist:
Summary by CodeRabbit
New Features
Bug Fixes
400 Bad Requestwhen filter parameters are invalid.