viewer: follow a camera link opened in the open page (VIEWER-FOLLOW-CAM-LINK) #2329
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2329"
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?
Imported from ubiquitarianism/leonida. Originally posted by syfyra on 2026-11-26T13:53:29Z.
Claimed in the coordination issue as: VIEWER-FOLLOW-CAM-LINK
What and why
Pcopies a link to the current view (#cam=x,y,z,yaw,pitch), and the viewer reads that hash once, at startup. Opening such a link in a tab that already shows the viewer changes only the hash: the browser makes a same-document navigation, the page does not reload, and the camera stayed where it was. The same happened with Back and Forward between two links. A shared view therefore only worked in a fresh tab. The VIEWER-HUNT finding in #1608 noted this as an untested edge.The viewer now applies the hash again on
hashchange, through the same helper that applies it at startup. A hash that is not a camera link (empty, malformed, another fragment) leaves the camera where it is, as at startup.Puseshistory.replaceState, which fires nohashchange, so copying a link does not move the camera.Tested
node --test tests/test_viewer_streaming.cjs(Node 26): a new test runs the whole viewer module with a link in the hash, checks that it places the camera, then fireshashchangewith a second link (camera and look follow, pitch clamped as at startup) and with five hashes that are not camera links (nothing moves). Onmainthe new test fails (nohashchangehandler); with the change all 58 tests pass.viewer/serve.py(test terrain): setting the hash to a second link moves the HUD position there,#notacamleaves it, and Back twice returns to each earlier link.viewer/index.htmland this test file.scripts/check_no_game_data.pyon both files.GPUs tested: n/a (viewer logic, Node harness)
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by kurrutako on 2026-11-26T14:15:44Z.
Verified at head
0370dc2a1(merge-base is currentmain73516a290, so the branch is up to date).node --test tests/test_viewer_streaming.cjson the PR: 58 of 58 pass, 3 of 3 runs. Onmain: 57 of 57 pass.mainwhen it is run againstmain'sviewer/index.html(handlers.get(...) is not a function: nothing listens forhashchange), and passes with the PR.history.replaceState(viewer/index.html:252), which does not firehashchange.python -I scripts/check_no_game_data.pyon both changed files: clean.Windows 11, Node.js 24.15.0. No browser, GPU or game files.
AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T15:44:01Z.
Review: COMMENTED
Windows 11/Node: 58/58 viewer tests passed, including an already-open viewer accepting a valid camera hash change and ignoring an invalid one. No findings.
AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:02:30Z.
Review: COMMENTED
Draft review against current
main: extractingapplyCamHashand wiringaddEventListener("hashchange", ...)inviewer/index.html:429-435looks clean and clean-room verified. Still Draft with no CI run yet — please mark Ready for Review so CI runs green.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:28:56Z.
Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.
(AI-assisted triage.)
Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T13:05:19Z.
Review: APPROVED
Now ready for review and
MERGEABLE. Clean-room verified: extractingapplyCamHashand wiringhashchangeinviewer/index.html:429-435(no feedback loop withhistory.replaceState) with tests intests/test_viewer_streaming.cjsis clean and verified (@lixonik,@kurrutako).Approving — ready to merge once CI runs green on current
main.(AI-assisted review.)
Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T13:33:25Z.
Replayed hash changes through a real EventTarget on Node 26.13.1 with
0370dc2a1+e04721c7. The test loaded the actual viewer module with a synthetic empty manifest and mocked graphics classes. Both arms restored the initial camera. On main dispatching a newhashchangeleft the old position. The PR followed the second pose, returned to the first, followed the second again, and kept the pose for malformed links. All 70 checked-in viewer-streaming tests passed. This exercises the event and camera state in Node.AI-assisted with OpenAI Codex.