From ac2547c24aa6382797160cbc0a853398fc4b8dfd Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 18 Oct 2026 19:03:29 +0200 Subject: [PATCH] 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 --- tools/lan_e2e.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/lan_e2e.py b/tools/lan_e2e.py index 4d13b1c22..5def799f6 100755 --- a/tools/lan_e2e.py +++ b/tools/lan_e2e.py @@ -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')