lan_e2e light: wait for the border chunk's light before comparing

On the server thread, lan_e2e --check light failed its border step (#891):
the guest's border chunk still had block light 0 next to glowstone placed
in the chunk past it. The server was right; the check was not.
same_light() waits until the host's light equals the guest's, but on the
server thread the host's game is a client too, and both are dark until
the light update arrives. They agreed at once, same_light returned, and
the next line read the guest's light before the update came.

The check now waits up to 100 ticks for the guest's border light, then
compares the host's with it.

With temporary logging on the server thread: the glowstone lands in a
finished chunk that isn't lit (the ring past what the guest tracks), so
the edit queues a full light job for its neighbours. The border chunk's
job then relights sections 15 to 17, and Hub::broadcast_light_changes
sends them to both clients as a tracked border chunk, as
ChunkMap.isChunkOnTrackedBorder does. Nothing in the engine changes.

Fixes #891

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-18 19:03:29 +02:00
parent 73787507d1
commit ac2547c24a
+8 -2
View File
@@ -1260,9 +1260,15 @@ def check_light(host, guest, out):
host('command', command=f'setblock {near} {y} {gz} minecraft:glowstone')
try:
lo, hi = (untracked * 16 - 16, y - 3, gz - 8), (untracked * 16 - 1, y + 3, gz + 8)
# On the server thread the host's game is a client too, as dark as the guest until the light
# update arrives: wait for it before comparing them.
for _ in range(10):
lit = guest.raw('light', near - 2, y, gz, near - 2, y, gz)['block']
if lit == 'd':
break
host.wait(10)
assert lit == 'd', f'the border chunk by the glowstone has block light {lit}, not 13, after 100 ticks'
results['border'] = same_light(host, guest, lo, hi, 'border chunk')
lit = guest.raw('light', near - 2, y, gz, near - 2, y, gz)['block']
assert lit == 'd', f'the border chunk by the glowstone has block light {lit}, not 13'
finally:
host('command', command=f'setblock {near} {y} {gz} minecraft:air')
results['border_cleared'] = same_light(host, guest, lo, hi, 'border chunk without the glowstone')