fix(protocol): drop PROTOCOL_VERSION lockstep — D-192 (#875)

Removes the version-mismatch guard from Protocol.decode_snapshot() and the
PROTOCOL_VERSION constant from the client (server side done in #874).

Core changes:
- protocol.gd: remove const PROTOCOL_VERSION, remove version mismatch guard,
  remove "version" from return dict, add gauntlet_mode/room_id decode
- sim_bridge.gd: remove handshake version check; relax handshake guard to
  require only a valid Dictionary (server no longer sends protocol_version);
  emit handshake_complete(0) for API compat
- loading_screen.gd: drop "· protocol N" suffix from version label
- test_harness.gd: replace Protocol.PROTOCOL_VERSION with literal 23

Test updates (21 files): replace "version": Protocol.PROTOCOL_VERSION with
"version": 23 in all snapshot bytes dicts; remove snapshot.version == N
assertions; remove version-rejection tests (test_rejects_version_6,
test_decode_snapshot_rejects_missing_version, test_decode_snapshot_rejects_old_version,
test_protocol_rejects_version_mismatch, test_sim_bridge_test_snapshot_uses_current_protocol_version).

Also includes: #872 bookmark_catalog carry-forward regression test, and
#873 merge-path flow tests (test_merge_path_flows_sprint37.gd).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-21 17:29:49 +02:00
co-authored by Claude Sonnet 4.6
parent 708ab25614
commit d72fcc7847
21 changed files with 490 additions and 193 deletions
+3 -29
View File
@@ -188,7 +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,
"version": 23,
"entities": [
{"entity_id": 1, "x": 5.0, "y": 10.0, "z": 0, "kind": "Npc"},
{"entity_id": 2, "broken": true}, # Missing required fields
@@ -282,7 +282,6 @@ func test_decode_snapshot_v2_full() -> void:
assert_that(snapshot).is_not_null()
assert_that(snapshot.tick).is_equal(500)
assert_that(snapshot.version).is_equal(Protocol.PROTOCOL_VERSION)
# game_time
assert_that(snapshot.game_time).is_not_null()
@@ -309,7 +308,6 @@ func test_existing_fixtures_have_v2_fields() -> void:
var bytes = _load_fixture(fixture_name)
var snapshot = Protocol.decode_snapshot(bytes)
assert_that(snapshot).is_not_null()
assert_that(snapshot.version).is_equal(Protocol.PROTOCOL_VERSION)
assert_that(snapshot.player_facing).is_equal("North")
assert_that(snapshot.game_time).is_not_null()
@@ -324,30 +322,6 @@ func test_multi_entity_visibility_sectors() -> void:
assert_that(snapshot.entities[3].visibility).is_equal("Forward")
# -- Version enforcement (strict PROTOCOL_VERSION check) --------------------
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"},
]}
var encoded: Variant = Messagepack.encode(v1_raw)
assert_that(encoded.status).is_null()
var snapshot: Variant = Protocol.decode_snapshot(encoded.value)
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) ----------------
func test_decode_batch_input_fixture() -> void:
@@ -391,7 +365,7 @@ 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": Protocol.PROTOCOL_VERSION,
"version": 23,
"entities": [],
"bookmark_catalog": {
"bookmarks": [
@@ -451,7 +425,7 @@ func test_decode_snapshot_no_bookmark_catalog_is_null() -> void:
# Snapshot without bookmark_catalog key → field should be null.
var raw := {
"tick": 2,
"version": Protocol.PROTOCOL_VERSION,
"version": 23,
"entities": [],
}
var encoded: Variant = Messagepack.encode(raw)