Skip to content

feat(view): add case and mixed rendering kinds - #871

Merged
HuiJun merged 38 commits into
developfrom
feature/view-case-mixed
Oct 6, 2026
Merged

HuiJun merged 38 commits into
developfrom
feature/view-case-mixed

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

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. Named case rather than usecase because SysML's CaseDefinition/CaseUsage is 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; an include that references an existing case is an «include» edge to it, and an include use case declaring 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, REPL minimal/full, LSP and engine ports): by default a part draws the ports its connectors end at, connectors end at those pins, and render data carries node ports and edge fromPort/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, declares asCaseDiagram, asMixedDiagram, view def CaseView and view def MixedView. A view asks for a kind with render asCaseDiagram; or by specializing CaseView. For case diagrams these are optional shorter forms: the standard route, a GeneralView filtered on case-family metaclasses, is added separately in #886. MixedView/asMixedDiagram stay extension vocabulary, since standard SysML has no mixed view. The pseudo-views #case, #mixed and #case:<element> work wherever pseudo-views already work: CLI -render, REPL %render, LSP opensysml/render, gRPC RenderView, and document Diagram blocks. No new flag is added.

Forms. PlantUML uses native usecase, actor, rectangle <<subject>> and note. In the mixed PlantUML form, control nodes are explicit circle elements, so no edge is dropped. Non-package containers (part, action and state definitions, connection definitions) nest their children and ports in a rectangle { … }. A usecase or actor cannot contain nodes, so its non-case children are drawn flat with a not represented: notice. In Mermaid, cases are stadiums, objectives are notch-rect and relationship kinds are named on the edge. In DOT, cases are shape=ellipse, objectives shape=note and specialization arrowhead=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/tsv are refused with WrongFormError, and so is the d2 form added on develop, whose writer has no case or mixed layout yet. The CLI, REPL, LSP and document Diagram blocks all report this refusal rather than writing an empty diagram. Pilot B&W, Cameo (uc frame) and the palettes apply to both kinds.

Validity in other tools. A model that uses OpenSysMLRenderings is valid SysML v2 that depends on a non-normative OpenSysML library. Other tools resolve it when given the OpenSysML Libraries folder. The pinned pilot validator (validate-sysml-batch examples/views-demo.sysml "internal/workspace/libs/stdlib/OpenSysML Libraries") resolves OpenSysMLRenderings, asCaseDiagram and asMixedDiagram with no errors. The pilot differential supplies that folder to the reference validator, so its baseline records no unresolved references for these names; relative to develop it 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 roles UseCases::UseCase::subj/obj are 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.Links in the API), case and mixed diagrams link their elements to source in the same way as the other kinds: Mermaid emits click lines for drawn nodes, DOT adds URL/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 on circle … <<start>> in the rectangle dialect.

Case

PlantUML:
case PlantUML

Mermaid:
case Mermaid

Graphviz DOT:
case DOT

Graphviz DOT, Cameo style:
case DOT Cameo

Mixed

PlantUML:
mixed PlantUML

Graphviz DOT:
mixed DOT

Mermaid:
mixed Mermaid

The images are the committed goldens (internal/ir/view/testdata/{case,mixed}.*.golden) rendered with the repo's pinned mermaid-cli, Graphviz dot and a PlantUML jar.

WebAssembly engine size and dependencies

The case and mixed writers are linked into sysml-engine, so its gzipped js build grows. Its package list is unchanged, but the build now sits about 6 KB under the 7,500,000-byte engineGzipBudget. 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) runs go list -deps ./cmd/sysml-engine for js and wasip1 through a helper it shares with TestCoreDependencies.
    • It requires internal/frontend/{engine,jsonrpc}, internal/exec/runtime, internal/check/passes and internal/workspace/libs.
    • It fails on api/, google.golang.org/protobuf, google.golang.org/grpc, connectrpc.com and the internal/frontend/{grpc,protoconv,stdiorpc,combined,lsp,repl} transports.
    • It also fails on the analysis framework and its engines (internal/exec/{analysis,engines,smt,solve,fmi}), internal/doc/ other than queryexec, the workspace pipeline (internal/workspace/{model,modeldoc,modelrt}) and every converter under internal/translate/ except rdf.
    • Matching stops at path boundaries.
  • Packages the check deliberately allows:
    • internal/exec/{runtime,objref}, which the engine executes with;
    • internal/doc/queryexec, whose EventsFromTrace produces ExecuteState's run-trace events on develop. 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} and internal/workspace/project, which have no protobuf dependency, are small, and could reasonably be shared with the engine.
  • To confirm the check works, I temporarily imported internal/exec/analysis, and separately an api/ protobuf package, into cmd/sysml-engine. Each made the check fail on both targets. I removed both imports afterwards.
  • engineGzipBudget rises 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 current develop merged in, against 7,452,257 bytes on the develop the 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). The docs/project/spec-compliance.md rendering rows now list both kinds and the OpenSysMLRenderings selection. The design record is in docs/project/view-rendering-forms.md.

How it was verified

  • Goldens for every form, plus Cameo DOT for both kinds and an Okabe–Ito palette for mixed. The in-test Mermaid/DOT/PlantUML syntax walkers cover them.
  • A test checks that both fixtures produce no error diagnostics.
  • Review-driven tests cover inherited and redefined roles, library-role suppression, nested members under structural owners, transitive includes, include targets that stay inside their package, nested behaviour under definitions, structures nested under deferred members, and connectors that cross them. A shared invariant checks that every edge endpoint exists in the node tree, applied to the goldens and the views-demo views.
  • Unit tests cover selection (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.
  • Linked goldens for case and mixed in Mermaid, DOT and PlantUML (TestLinkedDiagramGoldens). The tests check that a case node, an actor and a mixed part each carry their link, that every Mermaid click targets 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).
  • End to end, source links: case and mixed views through CLI -render, REPL %render … link=… and LSP opensysml/render with linkTemplate, 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 SVG xlink:href, which affects every DOT kind on develop; the check used a template without &.
  • Surface tests: CLI -render, REPL %render, LSP opensysml/render, docplan Diagram blocks.
  • OPENSYSML_REQUIRE_WASM=1 go test ./tests/wasm passes, including the dependency checks and the size budget.
  • Ran go test ./..., go vet ./..., gofmt, make lint, go build ./..., make stdlib-snapshot-check, make docs-counts, make man-check, make self-model and the changelog check, and regenerated the pilot differential.
  • With the training, pilot, pilot-library XMI and PSSM corpora downloaded and their require variables set, the corpus and identity gates pass. TestRenderViewRendersCaseAndMixed covers declared case and mixed views and #case:<element> over gRPC RenderView.
  • End to end with the built binaries: named views, CaseView/MixedView specialization and pseudo-views in all four graph forms. -render-all includes both kinds. Markdown/CSV/TSV are refused with a nonzero exit and empty stdout. A REPL session keeps objective documentation and switches forms. Six LSP opensysml/render requests passed. Markdown and HTML Diagram blocks passed. Tree and interconnection output is byte-identical to develop in all four forms. All generated Mermaid, Graphviz and PlantUML sources convert.

Checklist

  • make test and make lint pass locally
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (see CONTRIBUTING.md)
  • Changelog entry added as changes/unreleased/<slug>.<section>.md, not as an edit to CHANGELOG.md
  • baselines regenerated and make docs-counts run if a gate count moved (compliance rows need nothing: the census is counted at docs build)
  • No internal work-item labels (waves, slices, F4, K5) in the body, docs, or changelog

Link 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

devin-ai-integration Bot and others added 2 commits October 3, 2026 22:25
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

devin-ai-integration Bot and others added 3 commits October 3, 2026 22:55
@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review October 3, 2026 23:58
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration Bot and others added 2 commits October 4, 2026 01:04
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration Bot and others added 2 commits October 4, 2026 01:58
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration Bot and others added 5 commits October 4, 2026 02:12
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration Bot and others added 5 commits October 4, 2026 06:52
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>
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration Bot and others added 2 commits October 4, 2026 15:20
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Runtime check of the mixed-view port changes at 6a02af9be. This used the built CLI and LSP, the browser wasm engine, the VS Code extension and the pinned SVG converters.

  • Mixed PlantUML connectors meet the port squares in both displays. A flow between action pins attaches to those pins.
  • Under minimal, unconnected part ports are hidden, while the directed Check.request parameter is kept. Mermaid lists it in its pin(s) not drawn notice.
  • Mixed views carry node ports and edge fromPort/toPort that resolve to each other in LSP. The wasm RenderView results match LSP for the same selectors.
  • Case views carry no port fields.
  • Case and interconnection output is byte-identical to 2130b917c in all four forms and both displays.
  • One layout caveat: under full, the diagonal supply line in PlantUML overlaps part of the input port label.
PlantUML: supply between port squares Action flow attached to its pins
PlantUML port attachment Action pin flow

VS Code mixed ports

devin-ai-integration Bot and others added 5 commits October 4, 2026 17:46
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>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

This branch now conflicts with develop. Conflicting files, and the merged PRs that changed them:

To resolve: merge current develop into this branch with an ordinary merge commit (no rebase or force-push).
Don't hand-merge generated files: regenerate docs/project/pilot-differential-baseline.json with go run -C tools ./cmd/pilot-diff -update after the merge.

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 (go build ./..., go vet ./..., gofmt -l ., make lint, make docs-check, go test ./...) and wait for green CI before marking ready.

devin-ai-integration Bot and others added 6 commits October 5, 2026 00:33
…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>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Hold on pushes: please don't push to this branch, including develop merges or empty commits to retrigger CI, until a maintainer says the CI runners are free. Prepare the conflict resolution locally and push it then.

devin-ai-integration Bot and others added 5 commits October 5, 2026 22:25
…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>
@HuiJun
HuiJun merged commit f2de9ea into develop Oct 6, 2026
24 checks passed
@HuiJun
HuiJun deleted the feature/view-case-mixed branch October 6, 2026 16:55
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