Repository navigation
feat(view): add case and mixed rendering kinds - #871
Conversation
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…mixed Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/reference/lsp.md
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…mixed Co-Authored-By: jason.han <hanhuijun@gmail.com>
…mixed Co-Authored-By: jason.han <hanhuijun@gmail.com>
…mixed Co-Authored-By: jason.han <hanhuijun@gmail.com>
|
This branch now conflicts with
To resolve: merge current Planned merge order for the view and docs PRs: #889 → #881 → #871 → #882 → #884 → #885 → #886. Each needs these files regenerated again after the one before it merges. Re-run the full gate ( |
…mixed Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…mixed Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…mixed Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
|
Hold on pushes: please don't push to this branch, including |
…mixed Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…mixed Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…mixed Co-Authored-By: jason.han <hanhuijun@gmail.com>
What and why
Adds two rendering kinds to
internal/ir/view, built from the semantic model like the existing kinds and written in every graph form (text,mermaid,dot,plantuml):KindCase("case") — a use-case diagram. Namedcaserather thanusecasebecause SysML'sCaseDefinition/CaseUsageis the root of the family, and the kind also draws analysis and verification cases. Case-family definitions and usages are use-case nodes; actor and stakeholder members are actor nodes with association edges; subject members are«subject»boxes; objectives are note nodes carrying their documentation; anincludethat references an existing case is an«include»edge to it, and aninclude use casedeclaring its own body is a node of its own with an«include»edge; a nested case gets a composition edge. Packages, parts and other definitions are transparent containers.KindMixed("mixed") — structure, ports, connectors, state and action graphs, cases, and typing/specialization/«perform»/«exhibit»edges on one canvas. It reuses the existing builders through per-element entry points that share one node-ID allocator (renderState,renderAction,renderInterconnectionWithIDs,treeNode, the case walk). Reference edges are drawn only between nodes already on the canvas. Ports follow the interconnection port display (-render-ports, REPLminimal/full, LSP and engineports): by default a part draws the ports its connectors end at, connectors end at those pins, and render data carries nodeportsand edgefromPort/toPort.Selection. SysML's standard view library has no dedicated case or mixed view definition, so a new non-normative bundled library,
OpenSysML Libraries/OpenSysMLRenderings.sysml, declaresasCaseDiagram,asMixedDiagram,view def CaseViewandview def MixedView. A view asks for a kind withrender asCaseDiagram;or by specializingCaseView. For case diagrams these are optional shorter forms: the standard route, aGeneralViewfiltered on case-family metaclasses, is added separately in #886.MixedView/asMixedDiagramstay extension vocabulary, since standard SysML has no mixed view. The pseudo-views#case,#mixedand#case:<element>work wherever pseudo-views already work: CLI-render, REPL%render, LSPopensysml/render, gRPCRenderView, and documentDiagramblocks. No new flag is added.Forms. PlantUML uses native
usecase,actor,rectangle <<subject>>andnote. In the mixed PlantUML form, control nodes are explicitcircleelements, so no edge is dropped. Non-package containers (part, action and state definitions, connection definitions) nest their children and ports in arectangle { … }. Ausecaseoractorcannot contain nodes, so its non-case children are drawn flat with anot represented:notice. In Mermaid, cases are stadiums, objectives arenotch-rectand relationship kinds are named on the edge. In DOT, cases areshape=ellipse, objectivesshape=noteand specializationarrowhead=empty. Mermaid and DOT have no stick figure, so actors are boxes with an«actor»keyword line. The new shapes apply only to case and mixed renderings, and no existing golden changed.markdown/csv/tsvare refused withWrongFormError, and so is thed2form added on develop, whose writer has no case or mixed layout yet. The CLI, REPL, LSP and documentDiagramblocks all report this refusal rather than writing an empty diagram. Pilot B&W, Cameo (ucframe) and the palettes apply to both kinds.Validity in other tools. A model that uses
OpenSysMLRenderingsis valid SysML v2 that depends on a non-normative OpenSysML library. Other tools resolve it when given theOpenSysML Librariesfolder. The pinned pilot validator (validate-sysml-batch examples/views-demo.sysml "internal/workspace/libs/stdlib/OpenSysML Libraries") resolvesOpenSysMLRenderings,asCaseDiagramandasMixedDiagramwith no errors. The pilot differential supplies that folder to the reference validator, so its baseline records no unresolved references for these names; relative todevelopit differs only in the examples and OpenSysML-library input digests and the library file count (14 to 15).Effective roles and containment. A case shows the actors, subjects and objectives it inherits from supertypes in the user model (
ActorsOf,SubjectsOf,ObjectivesOf). A redefined role is drawn once, and the implicit library rolesUseCases::UseCase::subj/objare not drawn. In mixed views, members nested under parts, requirements and other definitions stay inside their owner. Structures and connectors are built in one shared-ID pass, and included cases keep their package placement.Source links. With a link template (
link=<template>in the REPL,Options.Linksin the API), case and mixed diagrams link their elements to source in the same way as the other kinds: Mermaid emitsclicklines for drawn nodes, DOT addsURL/tooltip, and PlantUML adds[[url]]to use cases, actors, subjects, containers, mixed control circles and edges. A PlantUML objective note links each body line, since a Creole link cannot span lines. Blank documentation lines stay as unlinked paragraph gaps, and the bold title is written as**[[url objective]]**because PlantUML does not apply Creole bold inside a link label. Develop's pseudostate link suppression now applies only to the state-diagram dialect (state and action diagrams), because the pinned PlantUML keeps links oncircle … <<start>>in the rectangle dialect.Case
PlantUML:

Mermaid:

Graphviz DOT:

Graphviz DOT, Cameo style:

Mixed
PlantUML:

Graphviz DOT:

Mermaid:

The images are the committed goldens (
internal/ir/view/testdata/{case,mixed}.*.golden) rendered with the repo's pinned mermaid-cli, Graphvizdotand a PlantUML jar.WebAssembly engine size and dependencies
The case and mixed writers are linked into
sysml-engine, so its gzippedjsbuild grows. Its package list is unchanged, but the build now sits about 6 KB under the 7,500,000-byteengineGzipBudget. That budget was also the only guard against forbidden dependencies, so ordinary view-rendering growth would have looked like a forbidden link.TestEngineDependencies(tests/wasm/engine_test.go) runsgo list -deps ./cmd/sysml-engineforjsandwasip1through a helper it shares withTestCoreDependencies.internal/frontend/{engine,jsonrpc},internal/exec/runtime,internal/check/passesandinternal/workspace/libs.api/,google.golang.org/protobuf,google.golang.org/grpc,connectrpc.comand theinternal/frontend/{grpc,protoconv,stdiorpc,combined,lsp,repl}transports.internal/exec/{analysis,engines,smt,solve,fmi}),internal/doc/other thanqueryexec, the workspace pipeline (internal/workspace/{model,modeldoc,modelrt}) and every converter underinternal/translate/exceptrdf.internal/exec/{runtime,objref}, which the engine executes with;internal/doc/queryexec, whoseEventsFromTraceproducesExecuteState's run-trace events ondevelop. The document IR and backends stay forbidden;internal/exec/{hostcap,ingest,simresults}, small data and capability packages with no forbidden dependencies;internal/frontend/{core,symbolfacts,usage},internal/check/edit,internal/semantic/{query,highlight}andinternal/workspace/project, which have no protobuf dependency, are small, and could reasonably be shared with the engine.internal/exec/analysis, and separately anapi/protobuf package, intocmd/sysml-engine. Each made the check fail on both targets. I removed both imports afterwards.engineGzipBudgetrises to 7,700,000 and now limits only growth. Measured with Go 1.25 at gzip best compression, the build is 7,558,028 bytes with currentdevelopmerged in, against 7,452,257 bytes on thedevelopthe branch was first based on.Specification basis
SysML v2 §7.24 / §10.2: a view's rendering is tool-defined. The case kind draws the case family of SysML v2 §8.3.20 (
SubjectMembership,ActorMembership,StakeholderMembership,ObjectiveMembership,IncludeUseCaseUsage). Thedocs/project/spec-compliance.mdrendering rows now list both kinds and theOpenSysMLRenderingsselection. The design record is indocs/project/view-rendering-forms.md.How it was verified
views-demoviews.render asCaseDiagram,: CaseView,#case,#mixed), form refusal, the "holds no case" notice, kind-scoped shapes and edge labels, and objective documentation read without mutating the shared model.TestLinkedDiagramGoldens). The tests check that a case node, an actor and a mixed part each carry their link, that every Mermaidclicktargets a declared node, and that the PlantUML objective-note text and the mixed initial circle are wrapped in their own SVG anchors (pinned PlantUML jar).-render, REPL%render … link=…and LSPopensysml/renderwithlinkTemplate, converted to SVG with the pinned mermaid-cli, Graphviz and PlantUML. Each case node, actor, objective, mixed part and control circle carries an anchor inside its own SVG node. 633 URL-to-source-line checks matched. Clicking a Mermaid use case and a PlantUML objective in the browser opened the declaring line. Output without a template is byte-identical to the previous head. Graphviz 2.43.0 writes a raw&from a query-string template into SVGxlink:href, which affects every DOT kind ondevelop; the check used a template without&.-render, REPL%render, LSPopensysml/render, docplanDiagramblocks.OPENSYSML_REQUIRE_WASM=1 go test ./tests/wasmpasses, including the dependency checks and the size budget.go test ./...,go vet ./...,gofmt,make lint,go build ./...,make stdlib-snapshot-check,make docs-counts,make man-check,make self-modeland the changelog check, and regenerated the pilot differential.TestRenderViewRendersCaseAndMixedcovers declared case and mixed views and#case:<element>over gRPCRenderView.CaseView/MixedViewspecialization and pseudo-views in all four graph forms.-render-allincludes both kinds. Markdown/CSV/TSV are refused with a nonzero exit and empty stdout. A REPL session keeps objective documentation and switches forms. Six LSPopensysml/renderrequests passed. Markdown and HTMLDiagramblocks passed. Tree and interconnection output is byte-identical todevelopin all four forms. All generated Mermaid, Graphviz and PlantUML sources convert.Checklist
make testandmake lintpass locallychanges/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (compliance rows need nothing: the census is counted at docs build)F4,K5) in the body, docs, or changelogLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/1154c2f2d2a74812b6f5c10488906373
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/1154c2f2d2a74812b6f5c10488906373?variant=devin
Requested by: @HuiJun