feat(raycast): add server-backed search#567
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
📜 Recent review details🔇 Additional comments (2)
📝 WalkthroughSummary by CodeRabbitRelease Notes
WalkthroughAdds server-backed registry search: URL/types, strict parsing and normalization, runtime fetcher, debounced command orchestration with pagination, UI wiring to show server results or local fallback, and tests plus tokenized local filtering. ChangesServer-backed registry search
Sequence Diagram(s)sequenceDiagram
participant User as User Input
participant Command as Registry Command
participant FetchFunc as fetchRegistrySearch
participant Runtime as fetch (HTTP)
participant Parser as parseRegistrySearch
participant UI as Raycast UI
User->>Command: Type search query
Command->>Command: Debounce 300ms
Command->>FetchFunc: Call with query/category
FetchFunc->>FetchFunc: Build registrySearchUrl
FetchFunc->>Runtime: HTTP GET /api/registry/search
Runtime-->>FetchFunc: JSON response
FetchFunc->>Parser: Parse response body
Parser-->>FetchFunc: ParsedRegistrySearch
FetchFunc-->>Command: Return results + nextOffset
Command->>Command: Update serverSearch state
Command->>UI: Render visibleEntries
UI-->>User: Show server-ranked results
User->>Command: Click "Load More"
Command->>FetchFunc: Call with offset
FetchFunc->>Runtime: HTTP GET with offset
Runtime-->>FetchFunc: Next page JSON
FetchFunc-->>Command: Append to results
Command->>UI: Re-render with more entries
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error)
✅ Passed checks (7 passed)
✨ Finishing Touches✨ Simplify code
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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: 3
🤖 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 `@integrations/raycast/src/feed.ts`:
- Around line 652-658: The current local fallback tokenization can yield
tokens=[] for punctuation-only but non-empty searchText, causing every entry to
match; after computing tokens from query in the feed filter, add a guard: if
query is non-empty and tokens.length === 0 then return an empty array (or
no-results) instead of continuing to match all entries; modify the block where
query, tokens, and entries are used (referencing variables searchText, query,
tokens, entries) to short-circuit in that case so punctuation-only queries
produce no results.
- Around line 243-244: The pagination params are dropped because the code uses
truthy checks for options.limit and options.offset; change those checks in
registrySearchUrl to test for undefined/null (e.g., if (options.limit !==
undefined) and if (options.offset !== undefined)) so that 0 values are
preserved, and still call url.searchParams.set("limit", String(options.limit)) /
set("offset", String(options.offset)) when present.
In `@integrations/raycast/src/registry-command.tsx`:
- Around line 311-347: The loadMoreSearchResults function needs to ignore stale
responses by capturing a request key (e.g., const requestKey =
`${normalizedSearchText}::${searchCategory ?? ""}`) before calling
fetchRegistrySearch and then, before any state mutation in both the success and
catch branches, verify the current active key still equals requestKey; only then
merge entries/update total/nextOffset/status/error and isLoading. Use the same
requestKey check around the setServerSearch calls so an in-flight response for
an old query/category cannot append into a newer active search.
🪄 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 UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: dcc83308-1c01-454b-b6fe-b1a1e2bc471a
📒 Files selected for processing (4)
integrations/raycast/src/feed.tsintegrations/raycast/src/registry-command.tsxintegrations/raycast/src/runtime.tsintegrations/raycast/test/feed.test.ts
📜 Review details
🔇 Additional comments (2)
integrations/raycast/src/runtime.ts (1)
13-20: LGTM!Also applies to: 235-258
integrations/raycast/test/feed.test.ts (1)
9-9: LGTM!Also applies to: 22-22, 28-30, 38-38, 244-297, 350-365, 538-547, 564-569, 763-820
JSONbored
left a comment
There was a problem hiding this comment.
Action: request changes
- The server-backed search direction fits #489, and the Raycast checks are green.
- Three current issues still need fixing before merge:
- Preserve explicit
limit=0/offset=0inregistrySearchUrl; the current truthy checks drop those values. - Return no local fallback results for punctuation-only non-empty search text; current empty-token behavior can match every entry.
- Guard
loadMoreSearchResultsagainst stale responses before appending or setting errors so an old query/category cannot mutate a newer search. - Please keep the fix narrow and rerun the Raycast test/feed lane.
1f2d20e to
313aff7
Compare
Add server-backed registry search for the Raycast extension with local fallback filtering. Preserve explicit limit=0/offset=0 in the search URL, return no local fallback matches for punctuation-only search text, and guard load-more pagination against stale query/category responses.
313aff7 to
1b72a7c
Compare
|
Hi @JSONbored thanks for reviewing. Please review again. |
JSONbored
left a comment
There was a problem hiding this comment.
@YB0y the prior server-search blockers look fixed, but the PR is currently conflicted.
- Resolve the current merge conflicts against
main. - Keep the fixes for explicit zero pagination params, punctuation-only local fallback search, and stale-response protection.
- Re-run the Raycast checks after conflict resolution.
- Expected validation:
npm testfromintegrations/raycast,npm run lint,npm run build,pnpm validate:raycast-feed, andgit diff --check. - No additional server-search behavior changes are requested from my review if the conflict-resolved branch stays green.
|
Resolved the merge conflict against current main and kept the existing server-search fixes for explicit zero pagination params, punctuation-only local fallback search, and stale load-more responses. Reran the requested Raycast validation: npm test, npm run lint, npm run build, pnpm validate:raycast-feed, and git diff --check all pass. |
@YB0y thanks, this looks ready for merge.
A few notes:
- The current branch is clean against
origin/main, required Raycast/worktree checks are green, andgit diff --checkis clean. - The previous server-search blockers look addressed: explicit
limit=0/offset=0are preserved, punctuation-only fallback search returns no results, and load-more responses are guarded against stale query/category state. - No requested changes from me.
Summary
/api/registry/search.Closes #489
Refs #557
Quality Evidence
Validation
npm testfromintegrations/raycastnpm run lintfromintegrations/raycastnpm run buildfromintegrations/raycastpnpm validate:raycast-feedpnpm buildgit diff --checkNotes
context, and one showing a selected result detail pane.