Add optional Xquik search backend#3
Conversation
|
Warning Review limit reached
More reviews will be available in 38 minutes and 29 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?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 credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. 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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds a new ChangesXquik search backend integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
cmd/search.go (1)
61-63: ⚡ Quick winUse normalized
productfor xquik type gating.Line 61 checks global
searchTypeinstead of the parsedproductargument already passed torunSearch. This creates avoidable hidden coupling and can drift from parser behavior.💡 Suggested fix
- if searchType != "top" && searchType != "latest" { + if product != "Top" && product != "Latest" { return models.TimelinePage{}, nil, fmt.Errorf("xquik backend supports tweet search only") }🤖 Prompt for 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. In `@cmd/search.go` around lines 61 - 63, The xquik type gating check on line 61 references the global searchType variable instead of using the product parameter already passed to the runSearch function. Replace the searchType variable with the product parameter in the conditional check to use the normalized argument and avoid hidden coupling with global state.
🤖 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 `@internal/api/xquik.go`:
- Around line 97-103: The io.ReadAll call on resp.Body reads an unbounded
response from an external backend, creating an out-of-memory risk from large or
malicious payloads. Wrap resp.Body with io.LimitReader to set a maximum size
limit before passing it to io.ReadAll. This ensures that responses exceeding the
configured limit are rejected before attempting to read them into memory,
protecting against memory exhaustion attacks.
---
Nitpick comments:
In `@cmd/search.go`:
- Around line 61-63: The xquik type gating check on line 61 references the
global searchType variable instead of using the product parameter already passed
to the runSearch function. Replace the searchType variable with the product
parameter in the conditional check to use the normalized argument and avoid
hidden coupling with global state.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 037f65b4-5604-4a43-8cd9-848ea0d6b7d4
📒 Files selected for processing (3)
cmd/search.gointernal/api/xquik.gointernal/api/xquik_test.go
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0e55317cdb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| searchCmd.Flags().IntVar(&searchCount, "count", 20, "Number of results") | ||
| searchCmd.Flags().StringVar(&searchCursor, "cursor", "", "Pagination cursor") | ||
| searchCmd.Flags().StringVar(&searchType, "type", "top", "Search type: top, latest, people, media") | ||
| searchCmd.Flags().StringVar(&searchBackend, "backend", "x", "Search backend: x or xquik") |
There was a problem hiding this comment.
Preserve the backend in pagination hints
When users run x-cli search ... --backend xquik, the next-page hint still omits this new flag and prints a command that defaults back to the x backend. Following that hint sends the opaque Xquik cursor to the existing GraphQL search path, so pagination either fails or fetches the wrong backend; include --backend xquik in the printed command when the non-default backend is selected.
Useful? React with 👍 / 👎.
| } | ||
|
|
||
| func (tweet xquikTweet) toModel() *models.Tweet { | ||
| return &models.Tweet{ |
There was a problem hiding this comment.
Preserve Xquik tweet metrics in model mapping
The Xquik search schema returns engagement and media fields on SearchTweet (https://docs.xquik.com/openapi.yaml), but this conversion only populates id, text, author, and time. In pretty output, output.printTweetPretty suppresses zero-value stats, so tweets returned by --backend xquik display as if they have no likes, reposts, replies, views, or media even when the API returned them.
Useful? React with 👍 / 👎.
Summary
--backend xquik.Validation
go test ./...Duplicate and policy checks
Summary by CodeRabbit
--backendflag to choose between available search backends.topandlatestsearch types for tweet searches.