fix: write client_command's actual field name (actionId, not action) - #3972
Open
liamnschermerhorn-code wants to merge 2 commits into
Open
Conversation
The win_game handler builds the packet with `action`, but the field is `actionId`
in every protocol version's client_command definition. The intended value is
therefore never written.
This is currently harmless rather than broken: the missing field serialises as
undefined, which protodef writes as 0, and 0 happens to be the value that was
intended (perform_respawn). So the packet has always come out correct by
coincidence.
It is still wrong, and fragile -- it only works while the intended action is 0 and
while undefined keeps coinciding with it. Write the documented field name.
Verified the emitted bytes are unchanged on 26.1:
{ action: 0 } -> 0c00
{ actionId: 0 } -> 0c00
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.
The
win_gamehandler inlib/plugins/game.jsbuilds the packet withaction, but the field isactionIdin every protocol version'sclient_commanddefinition. The intended value is therefore never written.This is currently harmless rather than broken, and I want to be upfront about that: the missing field serialises as
undefined, protodef writes that as0, and0is exactly the value that was intended (perform_respawn). The packet has always come out correct by coincidence.It is still wrong, and it is fragile — it only holds while the intended action is
0and whileundefinedkeeps coinciding with it. Worth writing the documented field name.Verified the emitted bytes are unchanged on 26.1:
So this is a no-op at the wire level today and purely a correctness fix.
npx standardpasses.