rework api.md and add public facing endpoints - #4833
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe legacy API guide was replaced with a comprehensive reference. It documents HTTP conventions, authentication, public and authenticated endpoints, account and commerce operations, and matchmaking WebSocket behavior. ChangesAPI reference documentation
Estimated code review effort: 2 (Simple) | ~15 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/API.md`:
- Around line 1425-1428: Update the WebSocket close-code documentation near the
existing policy and verification codes to describe replacement behavior: when
the same JWT connects through a newer socket, close the previous socket with
code 1000 and reason "Replaced by newer connection", and state that only the
newest socket remains active.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f830d0ea44
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| - aggregated stats, including wins, losses, total games, and nested | ||
| FFA/team/Humans-vs-Nations/ranked counters |
There was a problem hiding this comment.
Remove the nonexistent Humans-vs-Nations stats bucket
Integrations cannot retrieve the advertised Humans-vs-Nations counters from this response: PlayerStatsTreeSchema allows the public/private/singleplayer trees to contain only the Free For All and Team modes, while ranked statistics are split into 1v1 and 2v2; there is no Humans-vs-Nations leaf. Clients modeled on this description may therefore look for a bucket that valid profiles never expose.
Useful? React with 👍 / 👎.
| "accountUsername": "Player", | ||
| "username": "Player" |
There was a problem hiding this comment.
Do not promise username in ranked entries
A ranked response is not required to contain this username field: RankedLeaderboardEntrySchema defines accountUsername and public_id but deliberately drops the legacy username, and the canonical leaderboard fixtures omit it. The shipped list also falls back directly from accountUsername to public_id, so integrations relying on this documented fallback can receive undefined; remove the field or mark it as non-contractual legacy data.
Useful? React with 👍 / 👎.
| This is the public HTTP and WebSocket API exposed by the OpenFront API | ||
| worker. It documents endpoints intended for the game client, public websites, | ||
| and player integrations. It is kept aligned with the route registry and |
There was a problem hiding this comment.
Document the matchmaking WebSocket
This claims to document the public WebSocket API used by the game client, but the reference contains no WebSocket route at all. The shipped ranked flow in src/client/Matchmaking.ts connects to /matchmaking/join with instance_id and mode, then authenticates through an initial JWT-bearing message, and tests/matchmaking treats that handshake as the integration contract; omitting it leaves integrations unable to reproduce the game's matchmaking flow.
Useful? React with 👍 / 👎.
| Returns the player's recorded sessions. A result has this shape: | ||
|
|
||
| ```json | ||
| { | ||
| "results": [ | ||
| { |
There was a problem hiding this comment.
Show the sessions response array
The endpoint returns a list of recorded sessions, but this example shows only a bare session object and never defines the top-level response as an array. An integration modeled on the example can attempt to parse the wire response as one object, or invent a results envelope like the neighboring game-history endpoint, so wrap the item in the actual array response.
Useful? React with 👍 / 👎.
Description:
better document player facing endpoints
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
w.o.n