Skip to content

fix: serialize character before storing on player meta - #1

Open
gregogun wants to merge 1 commit into
masterfrom
fix/character-meta-serialization-on-select
Open

fix: serialize character before storing on player meta#1
gregogun wants to merge 1 commit into
masterfrom
fix/character-meta-serialization-on-select

Conversation

@gregogun

Copy link
Copy Markdown
Collaborator

Summary

  • Characters.select() stored the raw Character class instance on player meta. In RESOURCE mode, Player.setMeta proxies through a cross-resource export call which msgpack-serializes its arguments, stripping getter-backed fields (appearanceId, name, metadata) since they live on the prototype rather than as own properties.
  • getActive() then rehydrated a plain object missing those fields, silently producing characters with appearanceId: undefined (and other fields) for any consumer using Characters.getActive() in a RESOURCE-mode satellite.
  • Fix: select() now stores character.serialize() (own-properties only), which round-trips correctly through Character.from(). Simplified getActive()'s fallback branch accordingly.
  • Bumped @open-core/framework devDependency from a local file:../opencore-framework link to the latest published version (^1.1.0).

Test plan

  • pnpm run typecheck
  • pnpm run test (8/8 passing)

Characters.select() stored the raw Character instance on player meta.
In RESOURCE mode, Player.setMeta proxies through a cross-resource
export call that msgpack-serializes arguments, stripping the
getter-backed fields (appearanceId, name, metadata) since they live on
the prototype, not as own properties. getActive() then rehydrated a
plain object missing those fields. Storing character.serialize() keeps
only own properties, which round-trip correctly through Character.from().

Also points the @open-core/framework devDependency at the latest
published version instead of a local file: link.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

1 participant