Skip to content

Draw exposed packages as package nodes; warn only when a view renders nothing - #82

Merged
Malcolmnixon merged 7 commits into
mainfrom
warn-empty-view
Nov 12, 2026
Merged

Malcolmnixon merged 7 commits into
mainfrom
warn-empty-view

Conversation

@Malcolmnixon

@Malcolmnixon Malcolmnixon commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

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 notation: an exposed package uses the package-node notation (SysML §8.2.3.5).

Behavior

  • General View: in an 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 lone expose 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's filter also applies to exposed packages.
  • Diagnostics (DiagramRenderer.RenderWorkspace(…, diagnostics)), located at the view's declaration:
    • warning — only when the diagram contains nothing renderable at all.
    • info — for a lone expose P; whose members are not exposed. It suggests expose P::**; without implying that the model is wrong.
  • render prints these diagnostics as file(line,col): warning|info: … and still writes every file. The exit code is unchanged.
  • lint is unchanged, because it does not lay out views. The user guide documents this.

Example

  design-views.sysml(6,4): info: View 'SoftwareStructureView': 'expose BuildMark;' exposes the package element itself, so it is drawn as a package node without contents; use 'expose BuildMark::**;' to also show the members.

Tests

  • expose forms in the General View: expose Pkg; draws an empty package node, expose Pkg::*; draws the members without a package node, and expose Pkg::**; draws the package node containing its members.
  • Diagnostics: a bare package produces a package node plus the info hint; a view with nothing renderable produces a warning.
  • Message wording and tool output: LayoutWarnings message tests; the tool prints the info: 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.
  • I viewed the rendered PNG of a lone expose P;: it shows a package node.

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>
Copilot AI lite review requested due to automatic review settings November 11, 2026 18:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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>
Copilot AI lite review requested due to automatic review settings November 11, 2026 21:26
@Malcolmnixon Malcolmnixon changed the title Warn when a rendered view resolves to nothing renderable Draw exposed packages as package nodes; warn only when a view renders nothing Nov 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Approval is blocked by active correctness and API-compatibility issues, including incorrect empty and nested package layout and a breaking public method signature change.

4 open issues

Review effort: Lite

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>
Copilot AI lite review requested due to automatic review settings November 12, 2026 04:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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>
Copilot AI lite review requested due to automatic review settings November 12, 2026 04:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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>
Copilot AI lite review requested due to automatic review settings November 12, 2026 05:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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>
Copilot AI lite review requested due to automatic review settings November 12, 2026 14:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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>
Copilot AI lite review requested due to automatic review settings November 12, 2026 15:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed because a moderate hidden diagnostic issue makes the change too complex to approve confidently.

No open issues 🎉

1 resolved since last review

Review effort: Lite

@Malcolmnixon
Malcolmnixon merged commit e7080dc into main Nov 12, 2026
10 checks passed
@Malcolmnixon
Malcolmnixon deleted the warn-empty-view branch November 12, 2026 15:33
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.

2 participants