Repository navigation
Prioritize matching provider operations - #831
Conversation
…search-5f24 # Conflicts: # packages/worker/src/mcp/tools/search.node.test.ts
…search-5f24 # Conflicts: # packages/worker/src/mcp/tools/search.node.test.ts
📝 WalkthroughWalkthroughSearch ranking now derives provider identities from capability sources, applies semantic identity affinity during reranking, preserves exact non-provider matches, and expands tests for package, value, builtin, and remote-provider ordering. ChangesProvider-aware MCP search ranking
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CapabilitySpec
participant capabilityMatchToCandidate
participant rerankCandidates
participant OnlineSearchTest
CapabilitySpec->>capabilityMatchToCandidate: provide source and capability identity
capabilityMatchToCandidate->>rerankCandidates: pass identity fields and provider key
rerankCandidates->>OnlineSearchTest: return provider-aware ranked capabilities
OnlineSearchTest->>OnlineSearchTest: assert exact and provider ordering
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ac8f33f. Configure here.
|
🔎 Preview deployed: https://kody-pr-831.kody-a99.workers.dev Worker: Mocks:
|
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 `@packages/worker/src/mcp/tools/search.node.test.ts`:
- Around line 1860-1865: Anchor both ordering assertions around the rankedNames
checks for remote:living-room:get_player_status and
remote:living-room:list_players by first verifying each expected name is
present, then compare their positions with repo_get_check_status. Preserve the
existing ordering expectations while preventing missing entries from passing
through indexOf(-1).
- Around line 1703-1718: Update the ordering assertions around capabilityNames
to first assert that every referenced Sonos capability and repo_get_check_status
exists with a non-negative index (or equivalent known-present assertion), then
compare their ordering. Apply the same presence-anchoring approach to the
related assertions in the new test, while preserving the intended
Sonos-before-repo ordering checks.
🪄 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 Plus
Run ID: 4559c924-57db-43e7-84a0-2f3c6194301b
📒 Files selected for processing (2)
packages/worker/src/mcp/tools/search.node.test.tspackages/worker/src/mcp/tools/search.ts

Summary
Production evidence
After #830, the Sonos query fell to 0.8s but still ranked
repo_get_check_statusfirst. This change targets that final relevance gap and assertssonos_list_playersplussonos_get_player_statusahead of the observed competitor.Validation
npm run validateSystem recap — extends existing primitives (medium risk)
Mode: recap · Base:
main@4837c435· Head:c4478a72Classification: extends — MCP search scoring changes without adding a primitive.
Primitives touched
mcp-serverSystem map
Search combines existing lexical/vector scores with bounded provider/entity affinity while preserving exact package and value matches.
Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context (unchanged, included only when an edge crosses it).
Invariants
per-user-isolation: scoring only uses the caller-scoped candidate set.compact-mcp-surface: no public schema or tool changes.Summary by CodeRabbit