Repository navigation
feat(wasm): serve RenderDocument from sysml-engine and sysml-wasm - #2158
Open
devin-ai-integration[bot] wants to merge 5 commits into
Open
devin-ai-integration[bot] wants to merge 5 commits into
devin-ai-integration[bot] wants to merge 5 commits into
Conversation
The combined module and the engine answer RenderDocument with the protojson RenderDocumentResponse the service answers, in the forms markdown, html and asciidoc, refusing pdf by naming the three. The pipeline the service rendered through is extracted to internal/doc/docset — document definitions, sibling plans, the files a set writes, evaluation, the backends and the fault classification each transport maps to its status codes — so the service, the engine and the workspace render through one implementation. Positioned diagrams fall back to Mermaid with the renderer's notice under the engine, which runs no Graphviz. Scope declaration walking moves to symbols.Scope. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ment The document pipeline (docir, docrender, docset, translate/filename) the engine now links grows the gate's gzipped js builds to 10,816,237 bytes (sysml-engine, was 9,451,750) and 11,396,106 bytes (sysml-wasm, was 10,413,317); the budgets move to 11,000,000 and 11,500,000, the measured sizes recorded in their comments. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
… converter The engine's query context now supplies ElementID as the service's does, through queryexec.OpenElementIDs over the model's documents, so a document query projecting elementId answers ids where the binary links the converter; the js build links none and leaves the column absent, which docs/reference/wasm.md now states. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
There was a problem hiding this comment.
Devin Review found 1 finding. Devin automatically fixed it.
Fixed by Devin (1)
- Native document IDs remain absent — The engine's query context now supplies ElementID through queryexec.OpenElementIDs over the model's documents, as the service does; the js build links no converter and leaves elementId absent, which docs/reference/wasm.md states.
sysml-engine and sysml-wasm link no converter, so the elementId column RenderDocument answers is empty on every target, not only the js build; the comment and docs/reference/wasm.md say so. Co-Authored-By: jason.han <hanhuijun@gmail.com>
The module's GetServerInfo now ends with render_document, render_document_html, render_document_asciidoc and render_document_file_name; the Node client's wasm connection test lists the capabilities it expects and so lists them too. Co-Authored-By: jason.han <hanhuijun@gmail.com>
This branch has not been deployed
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 and why
sysml-wasm(andsysml-engine) now serveRenderDocument, so a browser consumer such as the view editor runs the whole document pipeline — the definition's queries, its document plan and tree, and the Markdown, HTML or AsciiDoc backend — from the embedded module, without asysml-grpcservice. Until nowcombined.Callanswered it withCodeUnimplemented.RenderDocumentRequest/RenderDocumentResponse(modelHash,documentId,form→markdown|html|asciidoc,fileName), so a typed client'srenderDocumentworks over either transport unchanged.internal/frontend/grpc/docquery.gois extracted to a new packageinternal/doc/docset(Definitions,Names,SiblingPlans,Files,Evaluate,Render,Forms,UnknownFormError,NotDocumentError,FaultOf,OriginOf,QueryOutcomeOf). The gRPC service, the engine andmodeldoc.RenderDocumentMarkdown(workspace/LSP) all render through it; the gRPC status mapping (queryPlanCode/queryExecCode/docPlanCode/docIRCode) collapses tofaultCode(docset.FaultOf(err)), and the engine maps the same faults to its JSON-RPC codes.model.DocumentNames/SiblingDocumentPlans/DeclaredDocumentDefinitionsandmodeldoc.DocumentFilesmove there; their scope walk becomessymbols.Scope.Declarations/WalkDeclarations, whichworkspace/modelnow uses too.markdown(default),htmlandasciidoc— the same three the service renders. The brief proposed refusingasciidocunder wasm, butdocrender.AsciiDocis pure Go; Asciidoctor.js is only needed forrep language "asciidoc"prose bodies, which fail the same way in every form, anddocpdfis the PDF form, which the service already refuses.pdf(or any other spelling) is refused with InvalidArgument:form "pdf" is not one a document is rendered in: markdown, html or asciidoc.WithoutGraphviz, so a positioned view falls back to Mermaid with the renderer's notice (drawn as Mermaid, not at its stated positions: Graphviz (dot) is not installed); the service's output is unchanged (it still writes DOT).GetServerInfoadvertisesrender_document,render_document_html,render_document_asciidoc,render_document_file_name(all four are capabilitiessysml-grpcreports;tests/wasmchecks that).docs/reference/wasm.md,client/node/README.md(the module's RPC surface),docs/internals/architecture.md(new package), changelog fragment. The Node/Python clients have no served-by-wasm method table to update, and.agents/skills/testing-engine-browserhas no method table.Wasm size
GOOS=js GOARCH=wasm go build ./cmd/sysml-wasmsucceeds. Onlyinternal/doc/docir,internal/doc/docrender,internal/doc/docsetandinternal/translate/filenamejoin the js build (noos/exec, no cgo, no third-party packages;docpdfstays forbidden bytests/wasm). Measured with the library snapshot embedded, go1.27.4,gzip -9:sysml-wasm,go buildsysml-wasm,-trimpath -ldflags="-s -w"sysml-engine,-trimpath -ldflags="-s -w"The gate's own gzip (
TestWasmRuns/js/fits_the_*_size_budget) reads 11,396,106 (sysml-wasm, was 10,413,317) and 10,816,237 (sysml-engine, was 9,451,750); the second commit raises those two budgets to 11,500,000 and 11,000,000 and records the sizes in their comments. If the budgets should move in their own PR instead, that commit can be dropped from this one.Browser harness
Per
.agents/skills/testing-engine-browser: a page outside the checkout loadedbuild/sysml-wasm.wasm(this tree, 47,331,296 bytes, served asapplication/wasm, uncompressed localhost) throughwasm_exec.js;globalThis.sysmlWasmappeared 365–1320 ms after navigation.ParseSourcesofdocs/manual/examples/prose.sysmlreturnedmodelHash5f06c856…2900cc;GetServerInfolisted the four new capabilities last.RenderDocumentanswers, first lines:formomitted (markdown), 66.8 ms,fileName: "Prose-MassReport.md":form: "html", 4.0 ms,fileName: "Prose-MassReport.html":…
form: "asciidoc", 4.9 ms:= Telescope Mass Report/:stem: latexmath/This report is _generated_ by …,fileName: "Prose-MassReport.adoc". Error probes, each followed by a working call:form: "pdf"→ code 3 naming the three forms;Prose::Missing→ 5symbol not found: Prose::Missing;modelHash: "not-a-hash"→ 5model not found: not-a-hash;Prose::Telescope→ 3… is not a document: one is a part def specializing DocumentQueries::Document. No console errors, rejections or Go exits.Known limitation observed, not introduced here (identical on develop): the module's
ParseSources/ParseFilediagnostics forprose.sysmlincludedocument-plan-invalid-context("document planning requires an index, resolver, and semantic model") on therep language "markdown"body — the core's document check pass runs without the resolver/semantic model the planner needs. Rendering is unaffected.How it was verified
Gates on this head:
go build ./...ok ·go vet ./...ok ·gofmt -l .empty ·GOOS=js GOARCH=wasm go build ./cmd/sysml-wasmok ·go test ./...ok (the only failures of the first full run —TestPackageLayeringwantinginternal/doc/docsetassigned to thedoclayer, the self-model'ssurfaces.sysmllisting the served methods, and a stale localstdlib.snapshot— are fixed in this head or were environment) ·make lintok (staticcheck + gosec) ·go test -count=1 ./tests/hygieneok ·python3 scripts/check-doc-ids.pyok ·python3 scripts/changelog.py checkok · the two-line comment gate prints nothing.New tests:
TestRenderDocumentRoutesThroughEngine(combined: markdown default, html, asciidoc,fileName, refusedpdf, unknown document, non-document, missingdocumentId, missing model);tests/wasmTestEngineRenderDocumentMatchesTheRendererGoldens(engine output equalsdocrender's telescope goldens in all three forms),TestEngineRenderDocumentFallsBackToMermaid(positioned views ofgraph_views.sysml→ two Mermaid blocks with the notice in Markdown and HTML, no DOT),TestEngineRenderDocumentRefusals;TestCombinedWireParitynow comparesRenderDocumenton the combined module againstsysml-grpcprotojson in every form;docsetunit tests for the form refusal andFaultOf/OriginOf/QueryOutcomeOf; the wasm dependency and capability gates updated. The gRPCRenderDocumenttests andtests/grpcare unchanged and green.Checklist
make testandmake lintpass locallychanges/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (none moved; the two wasm size budgets are raised in their own commit)F4,K5) in the body, docs, or changelogLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/6fb986d1fe074cfc89d598daed8a896a
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/6fb986d1fe074cfc89d598daed8a896a?variant=devin
Requested by: @HuiJun
🟢 Devin Review found nothing to fix · View findings · Follow Devin's work