Skip to content

Conversation

@sanchitram1
Copy link
Contributor

No description provided.

@sanchitram1 sanchitram1 requested a review from jhheider July 26, 2025 04:04
@sanchitram1 sanchitram1 merged commit 5c97905 into main Jul 26, 2025
4 checks passed
Copy link
Member

@jhheider jhheider left a comment

Choose a reason for hiding this comment

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

looks good, is limit needed?

@jhheider jhheider requested a review from Copilot July 26, 2025 04:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR modifies the leaderboard endpoint to accept a list of specific project IDs instead of returning all projects with a simple limit. The main changes transform the endpoint from a GET request with a path parameter to a POST request with a JSON body containing project IDs and limit parameters.

  • Changed leaderboard endpoint from GET to POST with structured request body
  • Added filtering by specific project IDs rather than returning all projects
  • Enhanced validation with better error messages and consistent limits

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
api/src/handlers.rs Modified leaderboard handler to accept POST requests with project ID filtering and improved validation
api/README.md Updated documentation to reflect new leaderboard endpoint structure and added development task commands

WHERE ut_source.name = 'source'
WHERE
c.id = ANY($1::uuid[]) AND ut_source.name = 'source'
AND ut_source.name = 'source'
Copy link

Copilot AI Jul 26, 2025

Choose a reason for hiding this comment

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

This condition is duplicated - 'ut_source.name = 'source'' appears on both line 391 and 392, which is redundant and should be removed.

Suggested change
AND ut_source.name = 'source'

Copilot uses AI. Check for mistakes.
Comment on lines +352 to +354
if req.project_ids.len() > RESPONSE_LIMIT as usize {
return HttpResponse::BadRequest().json(json!({
"error": format!("Too many project IDs (maximum {} allowed)", RESPONSE_LIMIT)
Copy link

Copilot AI Jul 26, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider using a separate constant for the project IDs limit instead of reusing RESPONSE_LIMIT, as these may have different business requirements in the future.

Copilot uses AI. Check for mistakes.
@sanchitram1 sanchitram1 deleted the modify-leaderboard branch July 26, 2025 07:23
@sanchitram1
Copy link
Contributor Author

sanchitram1 commented Jul 26, 2025

actually limit is needed - we run it for all registered projects, and then limit the result set to how many we want to display on the leaderboard

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.

3 participants