chore(client): gdformat pass on atlas codec scripts

Formatting-only cleanup of the #969/#960-A codec + bridge scripts to match
gdformat output (the pre-push gdformat check is advisory; these landed
un-formatted). No behavior change — 70/70 protocol tests green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-24 19:03:29 +02:00
co-authored by Claude Opus 4.7
parent 33a2ed6aae
commit 69ed80c96c
3 changed files with 51 additions and 22 deletions
+21 -4
View File
@@ -16,6 +16,7 @@ func _load_fixture(name: String) -> PackedByteArray:
# -- Snapshot decoding ----------------------------------------------------------
func test_decode_snapshot_one_npc() -> void:
var bytes = _load_fixture("snapshot_one_npc")
var snapshot = Protocol.decode_snapshot(bytes)
@@ -102,6 +103,7 @@ func test_decode_snapshot_multi_entity() -> void:
# -- PlayerInput decoding -------------------------------------------------------
func test_decode_input_move_north() -> void:
var bytes = _load_fixture("input_move_north")
var input = Protocol.decode_player_input(bytes)
@@ -124,6 +126,7 @@ func test_decode_input_perception_mode() -> void:
# -- PlayerInput encoding -------------------------------------------------------
func test_encode_decode_roundtrip_unit_variant() -> void:
var bytes = Protocol.encode_player_input(50, "MoveEast")
assert_that(bytes.size()).is_greater(0)
@@ -148,6 +151,7 @@ func test_encode_decode_roundtrip_data_variant() -> void:
# -- Cross-language roundtrip: GDScript encode matches Rust decode ---------------
func test_gdscript_encode_matches_rust_fixture() -> void:
# Encode the same MoveNorth input as the Rust fixture
var bytes = Protocol.encode_player_input(100, "MoveNorth")
@@ -164,6 +168,7 @@ func test_gdscript_encode_matches_rust_fixture() -> void:
# -- Negative tests: malformed/truncated input -----------------------------------
func test_decode_snapshot_truncated_bytes() -> void:
var truncated := PackedByteArray([0x82, 0xa4]) # Incomplete msgpack map
var result = Protocol.decode_snapshot(truncated)
@@ -189,7 +194,8 @@ func test_decode_snapshot_malformed_entities_counted() -> void:
var raw := {
"tick": 7,
"version": 23,
"entities": [
"entities":
[
{"entity_id": 1, "x": 5.0, "y": 10.0, "z": 0, "kind": "Npc"},
{"entity_id": 2, "broken": true}, # Missing required fields
{"x": 1.0}, # Missing entity_id, y, z, kind
@@ -217,6 +223,7 @@ func test_encode_produces_nonempty_bytes() -> void:
# -- Batch input encoding (Vec<PlayerInput> wire format) -----------------------
func test_encode_player_inputs_single() -> void:
var inputs: Array = [{"tick": 10, "action_name": "MoveNorth"}]
var bytes := Protocol.encode_player_inputs(inputs)
@@ -276,6 +283,7 @@ func test_encode_player_inputs_empty() -> void:
# -- v2 snapshot decoding -------------------------------------------------------
func test_decode_snapshot_v2_full() -> void:
var bytes = _load_fixture("snapshot_v2_full")
var snapshot = Protocol.decode_snapshot(bytes)
@@ -304,7 +312,9 @@ func test_decode_snapshot_v2_full() -> void:
func test_existing_fixtures_have_v2_fields() -> void:
# All fixtures are generated by fixture_snapshot() — verify decoder extracts v2+ fields
for fixture_name in ["snapshot_one_npc", "snapshot_empty", "snapshot_player", "snapshot_multi_entity"]:
for fixture_name in [
"snapshot_one_npc", "snapshot_empty", "snapshot_player", "snapshot_multi_entity"
]:
var bytes = _load_fixture(fixture_name)
var snapshot = Protocol.decode_snapshot(bytes)
assert_that(snapshot).is_not_null()
@@ -324,6 +334,7 @@ func test_multi_entity_visibility_sectors() -> void:
# -- Batch input fixture (D-030 Layer 1 bidirectional symmetry) ----------------
func test_decode_batch_input_fixture() -> void:
# Rust-generated Vec<PlayerInput> fixture — verifies bidirectional Layer 1 compatibility
var bytes = _load_fixture("input_batch_two")
@@ -341,6 +352,7 @@ func test_decode_batch_input_fixture() -> void:
# -- Diagonal movement fixtures (D-030 Layer 1 cross-language) -----------------
func test_decode_diagonal_fixtures() -> void:
# All 4 diagonal fixtures: clockwise NE, SE, SW, NW
var diagonals: Array = [
@@ -361,14 +373,17 @@ func test_decode_diagonal_fixtures() -> void:
# -- v23: BookmarkCatalog decode -----------------------------------------------
func test_decode_snapshot_with_bookmark_catalog() -> void:
# Hand-built dict — fixture generation requires server work, skip round-trip (#614).
var raw := {
"tick": 1,
"version": 23,
"entities": [],
"bookmark_catalog": {
"bookmarks": [
"bookmark_catalog":
{
"bookmarks":
[
{
"id": "bm_tycoon_arion",
"title": "The Arion Run",
@@ -436,6 +451,7 @@ func test_decode_snapshot_no_bookmark_catalog_is_null() -> void:
# -- v23: RequestBookmarkCatalog + ConfirmBookmark encoding --------------------
func test_encode_request_bookmark_catalog_roundtrip() -> void:
var bytes := Protocol.encode_request_bookmark_catalog()
assert_that(bytes.size()).is_greater(0)
@@ -467,6 +483,7 @@ func test_encode_confirm_bookmark_roundtrip() -> void:
# -- Atlas layer-stream protocol (#969, D-225) ---------------------------------
func test_decode_atlas_response_ready() -> void:
var bytes := _load_fixture("atlas_response_ready")
var resp = Protocol.decode_atlas_layer_response(bytes)