Repository navigation
Draw exposed packages as package nodes; warn only when a view renders nothing - #82
Conversation
A view such as `expose BuildMark;` exposes only the package element itself, so the rendered diagram was a blank canvas while lint and render both reported success. - DiagramRenderer.RenderWorkspace accepts an optional diagnostics collection and reports a located warning for each view whose LayoutTree is empty, suggesting `expose <Package>::**;` for each bare package expose. The empty view is still rendered. - SysmlViewNode records SourceFilePath/SourceLine/SourceColumn, captured by AstBuilder (WorkspaceLoader passes the file path). - render prints the warning in lint's `file(line,col): warning:` form; the exit code is unchanged. - Requirements, design, verification, and user guide updated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
A critical active finding remains because the public RenderWorkspace signature change can break already-compiled consumers with MissingMethodException, so the original four-argument overload must be preserved.
1 open issue
What changed in this PR
Adds non-fatal diagnostics for rendered views whose layouts contain no renderable nodes, helping users identify blank diagrams while preserving output generation and warning-only success. The change also records view declaration source locations for precise diagnostics.
Changes:
- Adds empty-view detection, located warnings, and recursive expose suggestions to the rendering pipeline.
- Captures view source locations and forwards diagnostics through the render command.
- Adds tests, user documentation, design documentation, verification records, and requirements traceability.
| File | Description |
|---|---|
| test/DemaConsulting.SysML2Tools.Tool.Tests/Render/RenderSubsystemTests.cs | Tests CLI warning output, generated files, and successful exit behavior for empty rendered views. |
| test/DemaConsulting.SysML2Tools.Tests/Semantic/WorkspaceLoaderTests.cs | Tests source-location capture for view declarations and usages. |
| test/DemaConsulting.SysML2Tools.Tests/Rendering/RenderIntegrationTests.cs | Tests renderer diagnostics for empty and non-empty views. |
| test/DemaConsulting.SysML2Tools.Tests/Layout/LayoutWarningsTests.cs | Tests recursive expose suggestions in empty-view warning messages. |
| src/DemaConsulting.SysML2Tools.Tool/Render/RenderCommand.cs | Collects and prints render warnings without changing warning-only exit behavior. |
| src/DemaConsulting.SysML2Tools.Language/Semantic/WorkspaceLoader.cs | Passes source paths into AST construction. |
| src/DemaConsulting.SysML2Tools.Language/Semantic/Model/SysmlNode.cs | Adds source-file, line, and column properties to view nodes. |
| src/DemaConsulting.SysML2Tools.Language/Semantic/Model/AstBuilder.cs | Captures view declaration source locations while building the AST. |
| src/DemaConsulting.SysML2Tools.Core/Rendering/DiagramRenderer.cs | Detects empty layouts and creates located warning diagnostics. |
| src/DemaConsulting.SysML2Tools.Core/Layout/Internal/LayoutWarnings.cs | Builds empty-view warning messages and corrective expose suggestions. |
| docs/verification/sysml2-tools-tool/render.md | Documents verification coverage for CLI empty-view warnings. |
| docs/verification/sysml2-tools-language/semantic/model/sysml-node.md | Documents verification coverage for view source locations. |
| docs/verification/sysml2-tools-language/semantic/model/ast-builder.md | Documents verification coverage for AST source-location capture. |
| docs/verification/sysml2-tools-core/rendering/diagram-renderer.md | Documents verification coverage for renderer warning behavior. |
| docs/verification/sysml2-tools-core/layout/internal/layout-warnings.md | Documents verification coverage for empty-view warning messages. |
| docs/user_guide/introduction.md | Explains empty-view warnings and corrective recursive expose syntax. |
| docs/reqstream/sysml2-tools-tool/render.yaml | Defines the render empty-view warning requirement. |
| docs/reqstream/sysml2-tools-language/semantic/model/sysml-node.yaml | Defines the view source-location requirement. |
| docs/reqstream/sysml2-tools-language/semantic/model/ast-builder.yaml | Defines the AST source-location requirement. |
| docs/reqstream/sysml2-tools-language/semantic/model.yaml | Links source-location requirements into the semantic model requirements. |
| docs/reqstream/sysml2-tools-core/rendering/diagram-renderer.yaml | Defines the renderer empty-view warning requirement. |
| docs/reqstream/sysml2-tools-core/rendering.yaml | Links the renderer warning requirement into the rendering requirements. |
| docs/reqstream/sysml2-tools-core/layout/internal/layout-warnings.yaml | Defines the layout warning message requirement. |
| docs/reqstream/sysml2-tools-core/layout/internal.yaml | Links the empty-view warning requirement into layout internals. |
| docs/design/sysml2-tools-tool/render.md | Documents render-command diagnostic collection and output behavior. |
| docs/design/sysml2-tools-language/semantic/model/sysml-node.md | Documents view source-location fields. |
| docs/design/sysml2-tools-language/semantic/model/ast-builder.md | Documents source-location capture during AST construction. |
| docs/design/sysml2-tools-core/rendering/diagram-renderer.md | Documents empty-layout detection and diagnostic generation. |
| docs/design/sysml2-tools-core/layout/internal/layout-warnings.md | Documents empty-view warning construction. |
Review effort: Lite
Per SysML 2.1 8.3.26.3/8.3.26.4 (KerML 8.3.2.4.4), `expose P;` exposes the package element P itself, `expose P::*;` only its members, and `expose P::**;` P and all members recursively. - General View: in an expose-scoped view, a package that is itself exposed is drawn as a package node (SysML 8.2.3.5) containing its exposed members - an empty package node for a lone `expose P;` - instead of an empty canvas; ancestor-only packages are still not drawn. The view's filter also applies to exposed packages. - DiagramRenderer: warning only when the diagram has nothing renderable; a lone `expose P;` yields an informational hint suggesting `expose P::**;`. render prints `file(line,col): info: ...`. - Requirements, design, verification, user guide updated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Combine exposed package nodes with view-condition evaluation (packages are narrowed by every condition) and keep view source location alongside the view conditions and view definition reference. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Approval is blocked by two moderate layout defects that mis-handle nested recursive package containment and empty packages at limited walk depth, with additional test and diagnostic-documentation gaps.
5 open issues
Review effort: Lite
…ckage node - Restore the original four-argument RenderWorkspace overload for binary compatibility; the diagnostics-aware overload is separate. - Document both diagnostic severities on the diagnostics parameter. - Handle an empty exposed package before depth truncation so DepthLimit 1 never shows '+0 more'. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Changes are still needed because exposed package filtering lacks regression coverage and nested exposed packages are currently placed as sibling rather than child nodes.
2 open issues
3 resolved since last review
Review effort: Lite
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
A moderate active finding shows recursive package exposure renders nested packages as separate root groups instead of preserving the required parent-child hierarchy.
1 open issue
1 resolved since last review
Review effort: Lite
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
An active moderate issue remains because the diagnostic message incorrectly claims every routed strategy renders an exposed package as a package node, producing misleading information for non-general layouts.
1 open issue
1 resolved since last review
Review effort: Lite
Only the general view draws an exposed package as a package node, so the informational hint is no longer reported for other layout strategies. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>



Problem
A design view such as
view SoftwareStructureView { expose BuildMark; }rendered an empty canvas without any message, so blank design diagrams went unnoticed for weeks.Spec basis (SysML v2.1 Beta 2 / KerML 1.1 Beta 2)
expose P;is a MembershipExpose (SysML §8.3.26.3; KerML §8.3.2.4.4 MembershipImport). It exposes the package element P itself, so it is valid and must render P, not nothing.expose P::*;is a NamespaceExpose (SysML §8.3.26.4). It exposes P's members, not P itself.expose P::**;exposes P and all of its members recursively.package-nodenotation (SysML §8.2.3.5).Behavior
expose-scoped view, a package that is itself exposed is drawn as a package node (tabbed folder) containing whichever of its members are also exposed. A loneexpose P;produces an empty package node with P's name. A package that is only an ancestor of exposed elements is still not drawn. The view'sfilteralso applies to exposed packages.DiagramRenderer.RenderWorkspace(…, diagnostics)), located at the view's declaration:expose P;whose members are not exposed. It suggestsexpose P::**;without implying that the model is wrong.renderprints these diagnostics asfile(line,col): warning|info: …and still writes every file. The exit code is unchanged.lintis unchanged, because it does not lay out views. The user guide documents this.Example
Tests
exposeforms in the General View:expose Pkg;draws an empty package node,expose Pkg::*;draws the members without a package node, andexpose Pkg::**;draws the package node containing its members.LayoutWarningsmessage tests; the tool prints theinfo:line and the exit code stays 0.Requirements, design (with spec clauses), verification and the user guide are updated.
Validation
./build.ps1: all tests pass on net8/9/10/11../lint.ps1: clean.reqstream --lint --enforce: clean.expose P;: it shows a package node.