Skip to content

Migrate leaderboard API to new router#811

Merged
tudddorrr merged 1 commit intodevelopfrom
migrate-leaderboard-api
Feb 5, 2026
Merged

Migrate leaderboard API to new router#811
tudddorrr merged 1 commit intodevelopfrom
migrate-leaderboard-api

Conversation

@tudddorrr
Copy link
Collaborator

No description provided.

@claude
Copy link

claude bot commented Feb 4, 2026

PR Review: Leaderboard API Migration to New Router

This PR successfully migrates the leaderboard API from koa-clay services to the new router pattern. After thorough analysis of the code changes, validation logic, middleware composition, and test coverage, I have no significant improvements to suggest.


✅ What I Validated

Code Quality:

  • Proper migration from @Validate decorators to Zod schemas with .meta() descriptions
  • Correct use of withMiddleware() wrapper for middleware composition
  • Appropriate middleware ordering (requireScopesloadLeaderboardloadAlias)
  • Clean separation of concerns (common.ts for middleware, docs.ts for documentation, separate files for routes)
  • Proper use of docsKey: 'LeaderboardAPI' option in the router

Schema Validation:

  • GET route correctly validates optional query parameters without requiring x-talo-alias header
  • POST route properly validates required x-talo-alias header using playerAliasHeaderSchema
  • Props schema correctly allows nullable values for deletion (value: z.string().nullable())

Business Logic:

  • Null prop handling works correctly via createProps filter and mergeAndSanitiseProps
  • Test coverage confirms props deletion works for unique leaderboards without uniqueByProps
  • uniqueByProps behavior is correct (different props = different entries)
  • Pessimistic locking pattern maintained for concurrent entry creation prevention

Documentation:

  • Docs properly migrated to separate docs.ts file
  • All route parameters documented via schema .meta() descriptions
  • Samples preserved from old implementation

🎯 Summary

No issues found. The migration is clean, follows the documented patterns in CLAUDE.md, and maintains all existing functionality with proper test coverage.

@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.52%. Comparing base (422b232) to head (ba94a09).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #811   +/-   ##
========================================
  Coverage    98.52%   98.52%           
========================================
  Files          357      359    +2     
  Lines        18848    18840    -8     
  Branches      1768     1765    -3     
========================================
- Hits         18570    18563    -7     
+ Misses         270      269    -1     
  Partials         8        8           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tudddorrr tudddorrr force-pushed the migrate-leaderboard-api branch from c862ace to ba94a09 Compare February 5, 2026 01:45
@tudddorrr tudddorrr merged commit 20f800c into develop Feb 5, 2026
10 checks passed
@tudddorrr tudddorrr deleted the migrate-leaderboard-api branch February 5, 2026 02:00
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.

1 participant