[PR #900] [MERGED] lan_e2e light: wait for the border chunk's light before comparing (#891) #2897

Closed
opened 2026-11-02 15:59:56 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/900
Author: @ludovic111
Created: 10/18/2026
Status: ✅ Merged
Merged: 10/18/2026
Merged by: @ludovic111

Base: main ← Head: fix/server-light-border


📝 Commits (1)

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

📊 Changes

1 file changed (+8 additions, -2 deletions)

View changed files

📝 tools/lan_e2e.py (+8 -2)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Fixes #891.

What

lan_e2e --server-thread --check light failed its border step: the guest's border chunk had block light 0 two blocks from glowstone placed in the chunk past it. The server lights it correctly; the check read too early.

same_light() waits until the host's light equals the guest's. On the server thread the host's game is a client too, so 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. In-frame nothing changes: there the host reads the server's own world, so same_light already waited.

How it was found (temporary logging on the server thread, not committed)

set_block (225,200,0) chunk lit=Some(false)          # chunk 14: finished, not lit (the ring past what the guest tracks)
light job (13,0) submitted                           # an edit in an unlit chunk queues full light jobs for its 3x3
lit (13,0) first=false changed=[(13,15,0),(13,16,0),(13,17,0)]
broadcast (13,0) sections=111000000000000000 tracked=[(host, true, false), (Guest, true, false)]

So Hub::broadcast_light_changes sends the border chunk's new light to both clients, as vanilla's ChunkMap.isChunkOnTrackedBorder does. A dedicated server takes the same path (lan_update_streaming).

I also tried the fix the issue suggested: one more lit ring, an extra area radius of view distance + 2 (vanilla lights out to view distance + 2 and keeps the ring past it decorated at INITIALIZE_LIGHT). The edit was then relit in place and broadcast the same way, and the check still failed until it waited. The result clients see is the same either way, so the streaming change was dropped: it would have generated and kept about 16 % more chunks per player for nothing visible. No engine change means no generation or memory cost to measure.

Self-check (Mac mini, fast profile, origin/main + this branch)

lan_e2e --check light --server-thread   PASS {torch 4205, roof 1183, hole 1183, border 1904, border_cleared 1904}  (twice; the
                                        guest's border light read 0, then 13 ten ticks later)
lan_e2e --check light                   PASS (same counts)
origin/main, old check, --server-thread FAIL "the border chunk by the glowstone has block light 0, not 13" (reproduced)

Only tools/lan_e2e.py changes (skip-release).

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/900 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/server-light-border` --- ### 📝 Commits (1) - [`ac2547c`](https://github.com/horizon-rust/horizon/commit/ac2547c24aa6382797160cbc0a853398fc4b8dfd) lan_e2e light: wait for the border chunk's light before comparing ### 📊 Changes **1 file changed** (+8 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tools/lan_e2e.py` (+8 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #891. ## What `lan_e2e --server-thread --check light` failed its border step: the guest's border chunk had block light 0 two blocks from glowstone placed in the chunk past it. **The server lights it correctly; the check read too early.** `same_light()` waits until the host's light equals the guest's. On the server thread the host's game is a client too, so 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. In-frame nothing changes: there the host reads the server's own world, so `same_light` already waited. ## How it was found (temporary logging on the server thread, not committed) ``` set_block (225,200,0) chunk lit=Some(false) # chunk 14: finished, not lit (the ring past what the guest tracks) light job (13,0) submitted # an edit in an unlit chunk queues full light jobs for its 3x3 lit (13,0) first=false changed=[(13,15,0),(13,16,0),(13,17,0)] broadcast (13,0) sections=111000000000000000 tracked=[(host, true, false), (Guest, true, false)] ``` So `Hub::broadcast_light_changes` sends the border chunk's new light to both clients, as vanilla's `ChunkMap.isChunkOnTrackedBorder` does. A dedicated server takes the same path (`lan_update_streaming`). I also tried the fix the issue suggested: one more lit ring, an extra area radius of view distance + 2 (vanilla lights out to view distance + 2 and keeps the ring past it decorated at INITIALIZE_LIGHT). The edit was then relit in place and broadcast the same way, and the check still failed until it waited. The result clients see is the same either way, so the streaming change was dropped: it would have generated and kept about 16 % more chunks per player for nothing visible. No engine change means no generation or memory cost to measure. ## Self-check (Mac mini, fast profile, origin/main + this branch) ``` lan_e2e --check light --server-thread PASS {torch 4205, roof 1183, hole 1183, border 1904, border_cleared 1904} (twice; the guest's border light read 0, then 13 ten ticks later) lan_e2e --check light PASS (same counts) origin/main, old check, --server-thread FAIL "the border chunk by the glowstone has block light 0, not 13" (reproduced) ``` Only `tools/lan_e2e.py` changes (skip-release). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:59:56 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2897
No description provided.