analyse: surface the 3D-stage → 2D fallback instead of failing silently - #7
Open
DheerajNalapat wants to merge 1 commit into
Open
DheerajNalapat wants to merge 1 commit into
DheerajNalapat wants to merge 1 commit into
Conversation
When createStage3D failed once -- most often Chrome's live-WebGL-context limit, hit with several Limelight tabs open -- ensureStage() swallowed the exception and latched STAGE3D_OK=false for the tab. Every later frame then drew the 2D room while the toggle still read "3D stage", with nothing on the console or the screen to say why, and only a reload recovered it. That is the silent failure the notes warn against. Now the fall-back is loud: a console.warn carrying the real error, and a note beside the view button -- "3D stage unavailable (<reason>) -- showing 2D room". And the build guard is per selection rather than permanent, so re-selecting the 3D stage retries a build that has since become possible (a freed WebGL context, say) without reloading the page. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
/analyseroom view has three modes —stage3d,room2d,fixtures. When you pick 3D stage it can silently draw the 2D room instead, and stay stuck there: the toggle keeps saying "3D stage" while the flat 2D elevation renders, with nothing on the console or the screen to explain why. Only a page reload recovers it.Root cause
ensureStage()builds the WebGL stage lazily. On any failure it did two harmful things:So a single failure to create the stage latched the tab into the 2D fallback permanently. The most common trigger on a machine where WebGL otherwise works: Chrome caps live WebGL contexts (~16), and several open Limelight tabs (
/stage,club3d.html, multiple/analyse) exhaust them, sonew THREE.WebGLRenderer()throws "Too many active WebGL contexts" — swallowed, latched, stuck.This is exactly the "Silent failures cost more than ugly ones — surface the error" rule in
AGENTS.md. Not a regression: the 3D path is correct and renders fine in a clean tab (verified — Intel Mesa WebGL,createStage3Dreturns a real stage). The bug is the silent, permanent degrade.Fix (
synth/analyse.htmlonly)console.warnthe real exception, and record the reason.STAGE3D_TRIED), and re-selecting the 3D stage clears it, so a failure that has since cleared (a freed WebGL context) recovers without a reload.Verification
Reproduced and verified on the running portal by forcing
createStage3Dto throw:console.warnwith the real errorNo other files touched.
🤖 Generated with Claude Code