Remove a duplicated next call - #872
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues remain.
Pull request overview
Fixes duplicate Express next calls in authentication middleware and removes redundant test coverage.
Changes:
- Corrects authentication fallback control flow.
- Adds regression coverage for a single
nextcall. - Removes duplicated tests.
File summaries
| File | Description |
|---|---|
packages/api/src/middleware/authentication.ts |
Prevents duplicate next calls. |
packages/api/src/middleware/authentication.test.ts |
Adds regression coverage and removes duplicate tests. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #872 +/- ##
=======================================
Coverage 98.64% 98.64%
=======================================
Files 99 99
Lines 2807 2808 +1
Branches 538 539 +1
=======================================
+ Hits 2769 2770 +1
Misses 38 38
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
liam-lloyd
approved these changes
Sep 16, 2026
liam-lloyd
self-requested a review
September 16, 2026 00:26
liam-lloyd
reviewed
Sep 16, 2026
slifty
force-pushed
the
noissue-cleanup
branch
from
September 16, 2026 16:38
18a27d2 to
5c7ab79
Compare
slifty
enabled auto-merge
September 16, 2026 17:25
The extractUserIsAdminFromAuthToken describe block appeared twice, word for word, so its cases ran twice without adding any coverage. Claude-Session: 237cac91-cf26-4d1c-81ae-093e451be49e
When a user token failed and the admin token succeeded, the middleware called next() and then fell through to next(err). That passed the user token's 401 on to the error handler after the request had already moved on to the route. Claude-Session: 237cac91-cf26-4d1c-81ae-093e451be49e
slifty
force-pushed
the
noissue-cleanup
branch
from
September 16, 2026 17:26
5c7ab79 to
31e2aa0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a bug that Claude noticed when I was working on the token introspection issue (#870).
Specifically there was a case where
nextcould be called twice, which is not something we want to happen because express is expecting each request to result in a linear next chain.It also noticed a duplicated test so I figured that's worth taking out at the same time.