feat(playground): block bundle upload while the editor reports type errors - #1548
Merged
joshunrau merged 3 commits intoSep 16, 2026
Merged
Conversation
…rrors The transpiler state was never a type check: esbuild strips types without checking them, so an instrument that fails tsc still reaches status 'built' and uploaded happily. Monaco already validates every instrument file, so a new diagnostics slice holds the error-severity markers owned by the typescript and javascript languages, and UploadBundleDialog disables Upload and lists them while that list is non-empty. useEditorErrorSync asks for markers one file at a time rather than reading every marker monaco holds, because monaco also holds models for the runtime declarations, globals.d.ts and files the user has deleted, none of which should block an upload. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…fails A failed upload reported only the status line as the notification message, so a 409 said nothing about why the instrument was rejected. The status now titles the notification as "409 - Conflict", and the message is whatever the JSON body carries under `message`, or nothing when the body has none or is not JSON at all. A request that never got a response keeps its previous "HTTP Request Failed" notification. Co-Authored-By: Claude Opus 5 (1M context) <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.
Summary
Two changes to the playground's Upload Bundle flow.
1. Type errors block the upload. The transpiler state was never a type check — esbuild strips types without checking them, so an instrument that fails
tscstill reachedstatus: 'built'and uploaded happily. Monaco already validates every instrument file (diagnostics: true,onlyVisibleoff), so a newdiagnosticsslice holds its error-severity markers owned by thetypescript/javascriptlanguages,useEditorErrorSynckeeps it current, andUploadBundleDialogdisables Upload and lists the offendingfile (line N): messagewhile that list is non-empty.handleSubmitre-checks, so the programmatic path fails loudly too.The hook asks for markers one file at a time rather than reading every marker monaco holds: monaco also holds models for the runtime declarations,
globals.d.ts, and files the user has deleted (deleteFilenever disposes a model), none of which should block an upload.2. A failed request shows the API's own message. A failure reported only the status line, so a 409 said nothing about why the instrument was rejected. The status now titles the notification —
409 - Conflict— and the message is whatever the JSON body carries undermessage(string, or a string array joined), or nothing when the body has none or is not JSON. A request that never got a response keeps its previousHTTP Request Failednotification.Verification
pnpm lint(34/34) andpnpm test(1160 tests) pass. No e2e test: the Playwright suite starts api, gateway and web only — the playground is not inplaywright.config.ts— and there is noapps/playground/vitest.config.ts, so this app has no unit tier either.Driven manually in a browser against the dev server:
const brokenValue: number = 'not a number';→ dialog showedindex.ts (line 28): Type 'string' is not assignable to type 'number'., Upload disabled. Undo → block gone.409+{"message":"An instrument with the same title already exists"}→ notification titled409 - Conflictwith that message;409+ atext/plainbody → title alone, no message line.Known gaps
Both come from existing
EditorPanebehaviour, left alone here:addFiles) get no monaco model until opened, so their errors do not register. Single-file adds are fine —addFileselects the new file.EditorPane, whose existing cleanup disposes all models, so diagnostics genuinely disappear and the gate reports nothing.apps/playground/AGENTS.mddocuments the gate under "Talking to an ODC instance".🤖 Generated with Claude Code