H13: Say which part of the world differs when a soak hash does
When a client's world hash differs from the server's, the soak report now names the part that differs (tide, props, pieces or loot), the client's ClientWorld tick, and each piece whose entry differs on the two sides, so the next transient mismatch can be traced. - NetWorld.world_detail(): part hashes and a piece list. world_hash() is unchanged: the same bytes, hashed in four parts. - The server's world_hash log lines and the soak clients' hash lines carry the detail. A full soak with this (24 clients, 2 matches) compared 3,743 hashes with 0 differing, so the mismatch didn't come back to trace yet. Refs #80 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -294,3 +294,23 @@ func test_the_client_refuses_what_the_server_would() -> void:
|
||||
assert_false(replica.dirty, "a world nothing was done to can be used again")
|
||||
assert_eq(_predict(_command(W)), Building.Result.OK)
|
||||
assert_true(replica.dirty)
|
||||
|
||||
|
||||
func test_world_detail_names_the_part_that_differs() -> void:
|
||||
_tick(_command(W))
|
||||
_deliver()
|
||||
_agrees("placed")
|
||||
var ours: Dictionary = NetWorld.world_detail(server)
|
||||
var theirs: Dictionary = NetWorld.world_detail(world)
|
||||
for part: String in ["tide", "props", "pieces", "loot"]:
|
||||
assert_eq(ours[part], theirs[part], part)
|
||||
assert_eq(str(ours["piece_list"]), str(theirs["piece_list"]))
|
||||
assert_eq((ours["piece_list"] as Array).size(), 1)
|
||||
# A building piece a tick ahead on the client: only the pieces differ.
|
||||
replica.sync(server.tick + 1)
|
||||
theirs = NetWorld.world_detail(world)
|
||||
assert_eq(ours["props"], theirs["props"])
|
||||
assert_eq(ours["loot"], theirs["loot"])
|
||||
assert_ne(ours["pieces"], theirs["pieces"])
|
||||
assert_ne(str(ours["piece_list"]), str(theirs["piece_list"]))
|
||||
assert_ne(NetWorld.world_hash(world), NetWorld.world_hash(server))
|
||||
|
||||
Reference in New Issue
Block a user