Repository navigation
fix(gamification): answer 400 for malformed JSON on the rotate, servers and federation score routes - #16730
Merged
diegosouzapw merged 1 commit intoOct 16, 2026
Conversation
…rs and federation score routes
diegosouzapw
merged commit Oct 16, 2026
ad37e8f
into
cheaper-inference:release/v3.8.52
49 of 60 checks passed
This was referenced Oct 17, 2026
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.
Summary
POST /api/gamification/rotate,/serversand/federation/scorecallrequest.json()outside anytry, so a body that is not valid JSON makes the handler throw an unhandledSyntaxError. The other POST routes of the module (invite,invite/redeem,transfer) already answer400with{ error: "Invalid JSON body" }in that case; these three now do the same, with the same CORS headers.Related Issues
Target Branch
release/v3.8.xbranch (release/v3.8.52, built on7f1be3bbf0), notmainValidation
routes)tests/unit/gamification/*.test.tsand the*gamification*.test.tsfiles oftests/unit/) passes with the change.eslintandprettier --checkon the changed files are clean;check:ai-attributionandcheck:changelog-integritypass.Tests Added Or Updated
tests/unit/gamification/malformed-json-400.test.ts(new): one case per route postsnot-jsonand expects400. On the base7f1be3bbf0the three cases fail withSyntaxError: Unexpected token 'o', "not-json" is not valid JSON(3 fail); with the change they pass.Coverage Notes
src/; the new test calls the changed code directly. I measured that the handler throws; I did not measure which status the framework turns the throw into.Reviewer Notes
changelog.d/fixes/PENDING-<slug>.md, one line, left for you to rename.