Skip to content

Remove unnecessary checks in middleware#868

Merged
tudddorrr merged 1 commit intodevelopfrom
remove-unnecessary-middleware-checks
Feb 27, 2026
Merged

Remove unnecessary checks in middleware#868
tudddorrr merged 1 commit intodevelopfrom
remove-unnecessary-middleware-checks

Conversation

@tudddorrr
Copy link
Collaborator

No description provided.

@tudddorrr tudddorrr force-pushed the remove-unnecessary-middleware-checks branch from 20d0929 to cec851d Compare February 27, 2026 20:14
@claude
Copy link

claude bot commented Feb 27, 2026

This PR is a clean, well-scoped cleanup. The removed checks are genuinely redundant given the middleware pipeline guarantees upstream.

Verification of key removals:

  • if (!key) in requireScopes: Safe — apiRouteAuthMiddleware rejects requests with missing/invalid API keys before this runs (now documented with the new comment).
  • if (ctx.state.jwt.api) in userTypeGate, ownerGate, requireEmailConfirmed: Safe — API JWTs are signed with game.apiSecret, while protected route auth uses JWT_SECRET. An API JWT cannot pass protectedRouteAuthMiddleware, so jwt.api === true was never reachable in these protected-route functions.
  • if (!user) checks: Safe — protectedRouteUserMiddleware already throws 401 if getUserFromToken fails.

No issues found. The changes reduce noise without affecting behaviour.

@tudddorrr tudddorrr merged commit feb34e6 into develop Feb 27, 2026
8 checks passed
@tudddorrr tudddorrr deleted the remove-unnecessary-middleware-checks branch February 27, 2026 20:28
@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.88%. Comparing base (390c253) to head (cec851d).
⚠️ Report is 3 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #868      +/-   ##
===========================================
+ Coverage    96.40%   96.88%   +0.47%     
===========================================
  Files          389      388       -1     
  Lines         6239     6201      -38     
  Branches       805      797       -8     
===========================================
- Hits          6015     6008       -7     
+ Misses         122      100      -22     
+ Partials       102       93       -9     

☔ 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.

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