Conversation
Compiles Sourcemeta Blaze's C++ compiler to WebAssembly so schema compilation and step-by-step trace evaluation run entirely in the browser, with no server or port dependency. Adds a debugger button to the nav bar that opens a full-screen editor where you can paste any schema + instance and step through push/pass/fail evaluation with synced Monaco highlighting on both panels. Signed-off-by: itvi-1234 <rjsumit71@gmail.com>
Contributor
Preview Deployed!
Last updated at 2026-09-04T14:41:50Z |
The debugger's schema panel now opens pre-filled with whatever schema is currently loaded in Studio's main editor (converted from YAML if that's the active format), instead of always starting from a sample schema. The instance panel is left as a sample for the user to edit, since there's no equivalent "current instance" in Studio's main view. Signed-off-by: itvi-1234 <rjsumit71@gmail.com>
DEFAULT_SCHEMA now mirrors Studio's own default schema (src/data/defaultJSONSchema.json) instead of an unrelated sample, and DEFAULT_INSTANCE is a person that actually validates against it — verified against the real Blaze evaluator. Previously the sample instance didn't correspond to whatever schema a fresh Studio session seeds the debugger with, so a first-time "Compile & Trace" click against the just-opened default schema failed for unrelated reasons. Signed-off-by: itvi-1234 <rjsumit71@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.
Summary
Adds a Custom Debugger to Studio: paste any JSON Schema + instance and step through the real Sourcemeta Blaze evaluator's push/pass/fail trace, with synced highlighting in both the schema and instance editors.
Everything runs entirely client-side — Blaze's C++ compiler is compiled to WebAssembly and bundled alongside its official pure-JS evaluator port, so there is no server, no local port, and no network dependency. It works fully offline on GitHub Pages, same as the rest of Studio.
What's included
src/lib/blaze/— the compiledblaze_wasm.wasm/.js(Blaze's compiler via Emscripten) plus the matching pure-JS evaluator (evaluator.mjs,describe.mjs,opcodes.mjs) from the same Blaze build, wrapped byindex.ts'straceCustom(schemaText, instanceText).src/components/CustomDebugger/— the debugger UI: dual Monaco editors (schema/instance), a call-stack visualizer, and step controls (step back/forward, play, jump to next failure).NavigationBar.tsx) opens the debugger as a full-screen overlay, wired throughAppContext/AppProvider(isCustomDebuggerOpen/openCustomDebugger/closeCustomDebugger) so it's reachable from both the normal and fullscreen nav bar instances. It mounts lazily (CustomDebuggerGate.tsx) so the ~1.5MB WASM module is only fetched on first use.resolveEvaluatePath.ts— Blaze'sevaluatePathfollows the JSON Schema spec's evaluation-path format, which inserts a literal$reftoken into the path and continues with the referenced schema's own relative path. That doesn't line up with the pasted schema text's physical JSON pointers, so this walks the same path against the parsed schema, following$refhops, to recover the pointer that highlighting can actually use. Same-document refs ($defs, etc.) now resolve and highlight correctly; a genuine external$ref(a different document) still can't be highlighted, since that document's text isn't available client-side..changeset/wasm-custom-debugger.md) for the release.Why WebAssembly
Blaze's compiler is C++-only; there's no JS/WASM build of it upstream. Studio is a static site with no backend, so a local compile server wasn't an option here. Compiling the compiler to WASM keeps the "paste schema, paste instance, see it debug" flow fully static and portable, consistent with how the rest of Studio works.