fix(client): align tests and data with server v4 protocol changes

Server team shipped strict PROTOCOL_VERSION enforcement (c05ff7b),
1-indexed verb priorities, and "Observe" label for ExamineNpc.
Updates all test snapshots to include version: 4, fixes sim_bridge
test mode priorities (0-indexed → 1-indexed) and labels, replaces
v1 backward-compat tests with strict version rejection tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 00:04:58 +01:00
co-authored by Claude Opus 4.6
parent 7af8de0117
commit 52972e6f21
5 changed files with 41 additions and 26 deletions
+15 -13
View File
@@ -188,6 +188,7 @@ func test_decode_snapshot_malformed_entities_counted() -> void:
# Snapshot with one valid and one malformed entity — decode_errors should count the bad one
var raw := {
"tick": 7,
"version": Protocol.PROTOCOL_VERSION,
"entities": [
{"entity_id": 1, "x": 5.0, "y": 10.0, "z": 0, "kind": "Npc"},
{"entity_id": 2, "broken": true}, # Missing required fields
@@ -321,10 +322,10 @@ func test_multi_entity_visibility_sectors() -> void:
assert_that(snapshot.entities[3].visibility).is_equal("Forward")
# -- v1 backward compatibility (no v2 fields → graceful null defaults) --------
# -- Version enforcement (strict PROTOCOL_VERSION check) --------------------
func test_decode_v1_snapshot_graceful_defaults() -> void:
# Minimal v1 snapshot — only tick + entities, no v2 fields
func test_decode_snapshot_rejects_missing_version() -> void:
# Snapshot without version field → rejected by strict version check
var v1_raw := {"tick": 10, "entities": [
{"entity_id": 1, "x": 5.0, "y": 5.0, "z": 0, "kind": "Player"},
]}
@@ -332,16 +333,17 @@ func test_decode_v1_snapshot_graceful_defaults() -> void:
assert_that(encoded.status).is_null()
var snapshot: Variant = Protocol.decode_snapshot(encoded.value)
assert_that(snapshot).is_not_null()
assert_that(snapshot.tick).is_equal(10)
assert_that(snapshot.entities.size()).is_equal(1)
# v2 fields should be null/empty, not crash
assert_that(snapshot.version).is_null()
assert_that(snapshot.game_time).is_null()
assert_that(snapshot.player_facing).is_null()
assert_that(snapshot.visible_tiles.size()).is_equal(0)
# Entity should have null visibility
assert_that(snapshot.entities[0].visibility).is_null()
assert_that(snapshot).is_null()
func test_decode_snapshot_rejects_old_version() -> void:
# Snapshot with version 2 → rejected by strict version check
var old_raw := {"tick": 10, "version": 2, "entities": []}
var encoded: Variant = Messagepack.encode(old_raw)
assert_that(encoded.status).is_null()
var snapshot: Variant = Protocol.decode_snapshot(encoded.value)
assert_that(snapshot).is_null()
# -- Batch input fixture (D-030 Layer 1 bidirectional symmetry) ----------------