mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:45:54 +01:00
[PR #918] viewer: say the world file could not be read when the body read fails, not that the JSON is invalid (WORLD-JSON-READ-MISREPORTED) #955
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#955
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/918
Author: @TuroYT
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:fix/viewer-world-json-read-error📝 Commits (1)
23b7059viewer: report body read failures separately from invalid JSON (WORLD-JSON-READ-MISREPORTED)📊 Changes
2 files changed (+28 additions, -9 deletions)
View changed files
📝
tests/test_viewer_streaming.cjs(+19 -4)📝
viewer/index.html(+9 -5)📄 Description
Claimed in the coordination issue as: WORLD-JSON-READ-MISREPORTED (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135526454)
What was wrong
viewer/index.html,loadWorld()(line 119 before this change):world = await response.json();ran inside the same try as the fetch. The catch chose its message fromresponse, which is set once the fetch has returned. So when the status was 200 and the body read failed (for example a dropped connection), the viewer saidworld/world.json could not be read as valid JSON.The file may be valid, and the failure was the network.Reproduction on
main(a28927849), with a stubbed fetch and the function read from the file in memory:What changed
loadWorld()reads the body withresponse.text()and parses it withJSON.parseas two separate steps. Astagevariable records which step was running when the error was thrown.... could not be read.when the read failed,... could not be read as valid JSON.when the parse failed,... could not be loaded.when the fetch failed (unchanged),... download timed out.when the deadline fired (unchanged).json:now providetext:. The test sandbox gets the hostJSON, so parsed arrays compare as before.could not be read.and notvalid JSON; a valid body still loads.Overlap with open pull requests
loadChunkinviewer/index.htmland adds fixtures and tests after line 456 of the test file. This pull request does not touch those hunks. ItsloadWorldhunk is at lines 110-130, and its test hunks are at lines 21-22, 68-95 and 110.loadWorld.Tested
The new cases fail on the unfixed
viewer/index.html(themainversion, run with the new test file):The valid-body case also fails on the unfixed code, because its mock provides only
text()and the old code callsjson().Not tested: a real browser. The viewer was not served or opened, so no page load, console or network check was done. The change is inside
loadWorld(), which runs once at startup. No GPU, no game files.AI-assisted (Claude Code).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.