Skip to content

feat: include relevanceScore in GET /bounties/recommended response#104

Open
DrGalio wants to merge 1 commit into
devasignhq:mainfrom
DrGalio:fix/bounty-recommendations-include-relevance-score
Open

feat: include relevanceScore in GET /bounties/recommended response#104
DrGalio wants to merge 1 commit into
devasignhq:mainfrom
DrGalio:fix/bounty-recommendations-include-relevance-score

Conversation

@DrGalio

@DrGalio DrGalio commented Mar 22, 2026

Copy link
Copy Markdown

Fixes #22

The GET /bounties/recommended endpoint already implements weighted scoring against tech tags and caches results for 15 minutes, but it was stripping the relevanceScore from the response before returning it.

Changes

  • Keep relevanceScore in response: Removed the destructuring that stripped it (line 198)
  • Include relevanceScore: 0 for the no-tech-stack fallback path
  • Updated tests to assert relevanceScore is present in the response

Before

{ "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

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
@devasign-app

devasign-app Bot commented Mar 22, 2026

Copy link
Copy Markdown

Merge Score: 95/100

🟢 ███████████████████░ 95%

The PR successfully resolves the issue by retaining the relevanceScore in the /bounties/recommended response and correctly handling the fallback path. The tests have been appropriately updated to assert the presence of the score. The implementation is clean, efficient, and ready to be merged.

Code Suggestions (1)

Low Priority (1)

  1. packages/api/src/routes/bounties.ts (Line 169)
    Add a type annotation to the results array for better type safety.

Reasoning: Initializing an empty array with let results = []; implicitly assigns it the type any[] in TypeScript. Adding a specific type annotation improves type safety, enables better IDE autocompletion, and prevents unintended assignments later in the code.

Suggested Code:

let results: Array<typeof openBounties[0] & { relevanceScore: number }> = [];
📊 Review Metadata
  • Processing Time: 37s
  • Analysis Date: 3/22/2026, 3:52:44 PM

🤖 This review was generated by AI. While we strive for accuracy, please use your judgment when applying suggestions.

💬 Questions about this review? Open an issue or contact support.

@devasign-agent devasign-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff correctly exposes relevanceScore in both the scored path and the no-tech-stack fallback (set to 0), removes the destructuring that previously stripped the field, and updates tests to assert its presence. Weighted scoring and caching logic remain intact.

@devasign-agent devasign-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement GET /bounties/recommended — personalized recommendations

1 participant