Repository navigation
feat(playground): a loop guard, a Stop that stops, and room for 20 heap objects - #223
Merged
Merged
Conversation
…mits - Trace off: a loop guard counts loop turns and function entries and stops a run after 1,000,000, with one plain message. The calls are spliced into the learner's text, so lines stay the learner's own, and catch/finally cannot swallow the stop. - Stop and the host timeout backstop discard the sandbox iframe and mount a fresh one; the next run waits for it to be ready. - Remove the Timeout and Animations settings, which nothing read. Stored settings that still hold them load. - Heap limit: 20 objects in 2D (5x4), 9 in 3D. A step that fits 2D but not 3D is drawn in 2D with one quiet line; the 3D choice is kept. - 2D arrows on a floor larger than 2x2 run along gutters and bands, so they never pass behind an object. - Choosing 3D widens a narrow lens pane once, if the window has room. - 3D: a middle frame with more than two slots shows two and "+N more", focused slots first. - Bring the Playground developer guide in line with the code. Co-Authored-By: Claude Opus 5.5 <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 changes
Endless code no longer freezes the tab when Trace is off. Untraced code is rewritten only to count loop turns and function calls. Past 1,000,000 the run ends with: "Stopped after 1,000,000 loop turns and calls: a loop or recursion probably does not end. Turn Trace on to watch it step by step." The learner's own
try/catch/finallycannot swallow the stop, lines keep their numbers, and callbacks and code afterawaitare counted too. There is no setting for the limit.Stop really stops. The sandbox iframe is discarded and replaced on Stop, on the host's timeout, and when a new run starts over an old one. Before, Stop changed nothing and a stuck sandbox stayed stuck.
Two dead settings are removed: Timeout and Animations were read by nothing. Stored settings that still hold them load as before. Font size and word wrap stay.
The heap draws up to 20 objects in 2D (it was 9), and 9 in 3D. A step that fits 2D but not 3D is shown in 2D with the line "This step is too large for 3D, so it is shown in 2D"; steps that fit go back to 3D and the choice of 3D is kept. On floors larger than 2×2, reference arrows run along the gutters between cards. Story layouts are unchanged.
Choosing 3D widens a narrow lens pane to the 3D minimum, once, at the moment of switching. It keeps 320px for the editor and 240px for the side pane, and does nothing when the window has no room.
A middle frame in 3D shows two slots and "+N more", with the slots in focus first. It used to show one line cut off.
docs/Playground-Developer-Guide.mdis brought in line with the code.Checks
npx tsc -b,npm run lint,npm run test:run(1,250 tests in 94 files) andnpm run buildpass; three.js is not in the entry graph. This branch was also merged locally with the content and visual polish PRs: no conflicts, and all checks pass on the combined tree.Checked in the browser:
while (true) {}stops with the message; a loop insidetry/catch/finallyprints nothing from either block; an endlessawaitloop stops after the synchronous code finishes; a normal loop with a timer runs as before; an error still reports the learner's line.Limits that remain
'x'.repeat(...), a regular expression that backtracks) or code built withevalornew Function.🤖 Generated with Claude Code