Skip to content

fix(playground): TypeScript runs, timers are awaited, Console text is plain - #205

Merged
mnaimfaizy merged 1 commit into
mainfrom
feat/playground-basics
Oct 11, 2026
Merged

mnaimfaizy merged 1 commit into
mainfrom
feat/playground-basics

Conversation

@mnaimfaizy

Copy link
Copy Markdown
Owner

PR 6 of the ADR 0004 build plan: the basics the October audit found broken.

Changes

  • TypeScript runs. Types are stripped by Monaco's own TypeScript worker (no new dependency, nothing added to the bundle). Step lines and error lines are mapped back to the learner's source through the emit's source map (services/sourceMapLines.ts). A syntax error shows in the Console with its line.
  • A run waits for its timers. The sandbox script (now components/execution/sandboxRuntime.ts) tracks pending timers and reports when none is left, instead of 50 ms after the synchronous code. An interval that is never cleared ends at the execution timeout with a note in the Console.
  • Console text is plain. It was HTML-escaped and then escaped again by React. escapeHtml and sanitizeForDisplay are gone; a string prints as written.
  • The toolbar fits from 768px up, and Run is always visible.
  • Names. "Example snippet" is now "example" (utils/examples.ts); user-visible "timeline" wording is now about steps. The old step and lens types keep their names because the lens PR replaces them.
  • Removed an effect in PlaygroundApp.tsx that could leave a TypeScript run stuck on "running".

Evidence

  • Type check, lint, 415 tests in 41 files and the build pass.
  • Seen at /playground, 1024px wide: the default code prints all five lines including the one after a 1 s timer; strings show without entities or quotes; the TypeScript Promise Chain example runs and records 7 steps; Run is visible.

Open

  • With Trace on, an error thrown inside a callback carries no line (the old tracer does not step inside callbacks; tracer v2 fixes this).
  • The Settings "Timeout" slider is not wired to the cap.
  • Not checked: Python, Firefox, Safari.

🤖 Generated with Claude Code

… plain

- TypeScript: types are stripped by Monaco's own TypeScript worker (no
  new dependency) and step and error lines are mapped back to the
  learner's source through the emit's source map
- a run reports once no timer is pending, or at the execution timeout
  with a note in the Console, instead of 50 ms after the synchronous code
- Console text is no longer HTML-escaped before React escapes it, and a
  string prints as written
- the toolbar fits from 768px up; Run is always visible
- "example snippet" becomes "example"; "timeline" wording becomes steps

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mnaimfaizy mnaimfaizy self-assigned this Oct 11, 2026
@mnaimfaizy
mnaimfaizy merged commit 8836779 into main Oct 11, 2026
9 checks passed
@mnaimfaizy
mnaimfaizy deleted the feat/playground-basics branch October 11, 2026 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant