Skip to content

feat: replace json with messagepack#867

Merged
rmrt1n merged 6 commits intomainfrom
winton/replace_json
Feb 12, 2026
Merged

feat: replace json with messagepack#867
rmrt1n merged 6 commits intomainfrom
winton/replace_json

Conversation

@winton-library
Copy link
Contributor

@winton-library winton-library commented Feb 3, 2026

TL;DR

Replace JSON serialization with MessagePack to preserve uint64 precision in command payloads, events, and component data.

What changed?

  • Switched from JSON to MessagePack for serializing command payloads, events, and component data
  • Updated protobuf definitions to use bytes instead of google.protobuf.Struct for payloads
  • Changed TypeSchema to use string JSON schema instead of Struct
  • Added comprehensive tests to verify uint64 precision is preserved
  • Added the github.com/shamaton/msgpack/v3 dependency

How to test?

Run the new test cases that verify uint64 precision:

  • TestQueue_Uint64Precision in pkg/cardinal/internal/command/queue_test.go
  • TestColumn_MsgpackTypeCoverage in pkg/cardinal/internal/ecs/column_internal_test.go

These tests verify that large uint64 values (above 2^53-1) maintain their precision through serialization and deserialization.

Why make this change?

JSON serialization converts uint64 values to float64, which loses precision for values larger than 2^53-1 (9007199254740991). This is problematic for game systems that rely on precise uint64 values for things like currency amounts, entity IDs, or timestamps.

MessagePack is a binary serialization format that preserves the full range of uint64 values. This change ensures that all numeric types maintain their precision throughout the serialization/deserialization process, which is critical for financial transactions and other systems requiring exact numeric representation.

This was referenced Feb 3, 2026
Copy link
Contributor Author

winton-library commented Feb 3, 2026


How to use the Graphite Merge Queue

Add the label graphite/merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@winton-library winton-library requested a review from rmrt1n February 3, 2026 21:11
@winton-library winton-library self-assigned this Feb 3, 2026
@winton-library winton-library added Feature Created by Linear-GitHub Sync enhancement New feature or request labels Feb 3, 2026 — with Graphite App
@winton-library winton-library removed the Feature Created by Linear-GitHub Sync label Feb 3, 2026
@winton-library winton-library marked this pull request as ready for review February 3, 2026 21:12
@rmrt1n rmrt1n changed the base branch from ryan/refactor to graphite-base/867 February 4, 2026 08:46
@rmrt1n rmrt1n force-pushed the winton/replace_json branch from 5f60c48 to cecf1ac Compare February 4, 2026 15:26
@rmrt1n rmrt1n force-pushed the graphite-base/867 branch from a8c31d1 to 4e794df Compare February 4, 2026 15:26
@rmrt1n rmrt1n changed the base branch from graphite-base/867 to ryan/refactor February 4, 2026 15:26
@winton-library winton-library requested a review from rmrt1n February 5, 2026 05:05
@rmrt1n rmrt1n mentioned this pull request Feb 5, 2026
Copy link
Contributor

@rmrt1n rmrt1n left a comment

Choose a reason for hiding this comment

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

LGTM. Don't merge yet to make review of the upstack PR easier. We'll merge the whole stack at once once everything is reviewed.

@rmrt1n rmrt1n force-pushed the winton/replace_json branch 4 times, most recently from dd86e1f to 4f8ef79 Compare February 6, 2026 15:59
@rmrt1n rmrt1n force-pushed the winton/replace_json branch 2 times, most recently from d527108 to 2e1b2e3 Compare February 12, 2026 07:51
@codecov
Copy link

codecov bot commented Feb 12, 2026

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
130 1 129 0
View the full list of 1 ❄️ flaky test(s)
::TestMain

Flake rate in main: 100.00% (Passed 0 times, Failed 1 times)

Stack Traces | 0s run time
FAIL	github..../world-engine/pkg/cardinal [build failed]

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@rmrt1n rmrt1n force-pushed the winton/replace_json branch from 2e1b2e3 to 14bcc11 Compare February 12, 2026 07:54
Base automatically changed from ryan/refactor to main February 12, 2026 09:36
@rmrt1n rmrt1n force-pushed the winton/replace_json branch from 168bc44 to a77c553 Compare February 12, 2026 15:25
@rmrt1n rmrt1n merged commit e04f8ab into main Feb 12, 2026
8 checks passed
@rmrt1n rmrt1n deleted the winton/replace_json branch February 12, 2026 15:28
@rmrt1n rmrt1n mentioned this pull request Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants