feat: include relevanceScore in GET /bounties/recommended response#104
feat: include relevanceScore in GET /bounties/recommended response#104DrGalio wants to merge 1 commit into
Conversation
The issue (devasignhq#22) asks to 'Return top matches with relevance scores' but the endpoint was stripping relevanceScore from the response. Changes: - Keep relevanceScore in scored bounties response (remove destructuring that strips it) - Add relevanceScore: 0 for no-tech-stack fallback path - Add relevanceScore assertions to existing tests Fixes devasignhq#22
Merge Score: 95/100🟢 The PR successfully resolves the issue by retaining the Code Suggestions (1)Low Priority (1)
Reasoning: Initializing an empty array with Suggested Code: let results: Array<typeof openBounties[0] & { relevanceScore: number }> = [];📊 Review Metadata
|
There was a problem hiding this comment.
End goal
The GET /bounties/recommended endpoint returns personalized bounty recommendations that include a relevanceScore for each item so clients can display why bounties were recommended.
✅ Acceptance criteria met (all 5 met)
- C1 — The GET /bounties/recommended response includes a relevanceScore field for each bounty in the data array (no longer stripped from the response).
- C2 — The relevanceScore reflects the weighted scoring of the user's tech_stack against the bounty's tech_tags.
- C3 — When the user has no tech stack, the fallback path returns bounties with relevanceScore set to 0.
- C4 — Recommended results continue to be cached for 15 minutes.
- C5 — Tests assert that relevanceScore is present in the recommended response.
The diff correctly removes the destructuring that stripped relevanceScore from the scored path (line 198) and adds relevanceScore: 0 to the no-tech-stack fallback. Tests now assert relevanceScore values for both the scored and tie-breaking cases. The weighted scoring logic and 15-minute caching are preserved unchanged. All criteria are met.
Fixes #22
The
GET /bounties/recommendedendpoint already implements weighted scoring against tech tags and caches results for 15 minutes, but it was stripping therelevanceScorefrom the response before returning it.Changes
relevanceScorein response: Removed the destructuring that stripped it (line 198)relevanceScore: 0for the no-tech-stack fallback pathrelevanceScoreis present in the responseBefore
{ "data": [{ "id": "2", "title": "Bounty 2", ... }] }After
{ "data": [{ "id": "2", "title": "Bounty 2", "relevanceScore": 2, ... }] }This allows clients to display the relevance score to users and understand why certain bounties were recommended.
@algora-io