fix(game): survive the pdf-only analysis result window - #202
Merged
marota merged 1 commit intoAug 3, 2026
Merged
Conversation
Game Mode crashed with "TypeError: Cannot convert undefined or null to
object" whenever the operator ran Analyze & Suggest, right as the
overflow graph became available.
Step 2 streams a ``pdf`` event (emitted as soon as the overflow-graph
file is written) seconds before the ``result`` event that carries the
actions. The pdf branch merged into the previous result:
setResult(p => ({ ...(p || {}), pdf_url, pdf_path, ... }))
On a first analysis ``p`` is null, so the resulting object had NO
``actions`` key — despite ``AnalysisResult`` declaring it required (the
``as AnalysisResult`` cast hid it from the type checker). The Game Mode
snapshot effect then ran ``Object.keys(result.actions)`` on that
intermediate state and threw, taking down the app through the error
boundary. The classic workspace was unaffected because that effect is
behind ``gameBridge.isGameMode()``.
Seed ``actions`` on the pdf merge so a partial result is always
structurally valid, and harden the two Game Mode consumers that read
the map unguarded (the snapshot effect and ``buildChosenActionRecord`` /
``combinedBeatsUnderlying``, which would have thrown next once an action
was starred).
Both regression tests fail without the fix.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FSWwhkaPiAsxasECiBws8k
Signed-off-by: Antoine Marot <amarot91@gmail.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.
Game Mode crashed with "TypeError: Cannot convert undefined or null to object" whenever the operator ran Analyze & Suggest, right as the overflow graph became available.
Step 2 streams a
pdfevent (emitted as soon as the overflow-graph file is written) seconds before theresultevent that carries the actions. The pdf branch merged into the previous result:On a first analysis
pis null, so the resulting object had NOactionskey — despiteAnalysisResultdeclaring it required (theas AnalysisResultcast hid it from the type checker). The Game Mode snapshot effect then ranObject.keys(result.actions)on that intermediate state and threw, taking down the app through the error boundary. The classic workspace was unaffected because that effect is behindgameBridge.isGameMode().Seed
actionson the pdf merge so a partial result is always structurally valid, and harden the two Game Mode consumers that read the map unguarded (the snapshot effect andbuildChosenActionRecord/combinedBeatsUnderlying, which would have thrown next once an action was starred).Both regression tests fail without the fix.
Claude-Session: https://claude.ai/code/session_01FSWwhkaPiAsxasECiBws8k