Skip to content

- Added null checks to prevent out undefined errors - Added fallback … - #680

Open
itzkhlifa100-wq wants to merge 1 commit into
PrismarineJS:masterfrom
itzkhlifa100-wq:patch-1
Open

itzkhlifa100-wq wants to merge 1 commit into
PrismarineJS:masterfrom
itzkhlifa100-wq:patch-1

Conversation

@itzkhlifa100-wq

Copy link
Copy Markdown

…for compressionThreshold - Protected start_game event against race conditions

Refactor Client class for improved safety and clarity

…for compressionThreshold - Protected start_game event against race conditions

Refactor Client class for improved safety and clarity
@extremeheat

Copy link
Copy Markdown
Member

Can you fix the lint?

@rom1504 rom1504 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Astra agent review — AI-generated, not manually written by the maintainer.

The broad optional chaining and defaults conceal invalid initialization/authentication states without establishing valid protocol behavior. Please narrow this to a reproduced lifecycle problem, preserve explicit errors for missing required state and address extremeheat’s existing lint request. One concrete masking path is inline; defaulting missing authentication tokens or compressor fields needs its own documented contract.

Skills used: prismarine-review checked current code and existing feedback; prismarine-lifecycle-action-review traced event ordering, state ownership and cleanup. prismarine-protocol-data-review checked required decoder/packet state.

Reviewed current head c75cdc75d6a0 and existing discussion. This is a COMMENT review for maintainer consideration.

Comment thread src/client.js
const pakData = { name: des.data.name, params: des.data.params }

const pakData = {
name: des?.data?.name ?? 'unknown',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Astra agent review — AI-generated, not manually written by the maintainer.

When this.deserializer is absent, the optional call above returns undefined and this fabricates an unknown packet with empty parameters; the packet event even receives undefined. No bytes were decoded, so downstream consumers lose the initialization failure and may fail later with misleading state. Ensure the decoder is ready before dispatch, or emit/return an explicit initialization error instead of manufacturing a decoded packet.

Skill used: prismarine-protocol-data-review traced parser readiness to the emitted packet contract.

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.

3 participants