Skip to content

General view: nest packages in their owner frame and draw cross-package edges - #98

Merged
Malcolmnixon merged 4 commits into
mainfrom
nested-packages-cross-edges
Nov 15, 2026
Merged

Malcolmnixon merged 4 commits into
mainfrom
nested-packages-cross-edges

Conversation

@Malcolmnixon

Copy link
Copy Markdown
Member

Pull Request

Description

Makes the General view draw nested packages inside their owning package frame (SysML v2 §8.2.3.5 / Table 3) and draw edges between elements in different package frames. It also updates the layout engine to DemaConsulting.Rendering 0.3.0-beta.2, which adds cross-hierarchy edge support (demaconsulting/Rendering#47).

  • Package references: all five DemaConsulting.Rendering.* references move from 0.3.0-beta.1 to 0.3.0-beta.2.
  • GeneralViewLayoutStrategy:
    • Package folders are built parent-first, and a nested package's folder sits inside its owner's folder. Enclosing folders are created even when the parent package has no directly rendered items.
    • Edges are scoped to the lowest common ancestor container instead of an exact package-key match, so cross-package edges are routed to the actual nested elements.
    • --walk-depth truncation counts package nesting. Truncation labels are matched per scope rather than by engine box order.
    • Each folder's items are ordered in two passes by where their external edges lead. This avoids crossings the engine would otherwise force ([Feature]: Crossing minimization across containers for cross-hierarchy edges Rendering#48).
  • Docs: requirements, design, verification, user guide and ROADMAP are updated. The two known limitations (nested packages drawn flat, missing cross-package edges) are removed. The ROADMAP notes that the engine now supports cross-hierarchy edges, which enables future interconnection-view work.
  • Gallery: new example 11-nested-packages-general.sysml (README section 11).

What you get now

New example: nested packages with cross-package edges. Before, Powertrain, Body and Vehicle were drawn as three unrelated frames and every relationship between them was missing. After, Body and Powertrain sit inside Vehicle, and Hybrid→Engine (specialization), Engine→Car and Chassis→Car (part membership) are drawn between the actual elements.

Before/after: nested packages with cross-package edges

Existing MissionControl view. RadioNetwork is declared inside GroundSegment, but before it was drawn as a sibling frame. It is now drawn inside GroundSegment, and everything sits inside MissionControl.

Before/after: MissionControl general view

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code quality improvement

Related Issues

Closes #87

Pre-Submission Checklist

Before submitting this pull request, ensure you have completed the following:

Build and Test

  • Code builds successfully and all tests pass: pwsh ./build.ps1. Passed: 3237 tests, 0 failed.
  • Code produces zero warnings

Code Quality

  • New code has appropriate XML documentation comments
  • Static analyzer warnings have been addressed

Quality Checks

  • All linters pass: pwsh ./lint.ps1. Passed (exit 0).

Testing

  • Added unit tests for new functionality: nested folders, lowest-common-ancestor edge scope (siblings, nested vs outer, deeper nesting), walk-depth truncation with nested packages, truncation labels independent of box order, and zero crossings for the Vehicle example.
  • Updated existing tests if behavior changed
  • All tests follow the AAA (Arrange, Act, Assert) pattern
  • Test coverage is maintained or improved

Documentation

  • Updated README.md (if applicable). N/A.
  • Updated docs/ documentation (if applicable)
  • Added code examples for new features (if applicable): gallery example 11.
  • Updated requirements.yaml (if applicable): the reqstream files, including an OTS requirement pinning the engine's insertion-order contract.

Additional Notes

Malcolm Nixon and others added 3 commits November 15, 2026 15:47
…the General view (closes #87)

Bump DemaConsulting.Rendering.* to 0.3.0-beta.2. GeneralViewLayoutStrategy now builds package folders parent-first so a nested package is drawn inside its owner's folder (including enclosing folders with no direct items), declares every model edge in the lowest common ancestor scope so cross-package edges are routed to the actual endpoint boxes, counts package nesting in the depth limit, and pairs truncation labels with boxes by node identity instead of box order. Adds gallery example 11 and refreshes the stale gallery images; updates requirements, design, verification, user guide, and ROADMAP.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…o not cross (closes #87)

The layered engine places a package folder's contents without knowing where the
folder's relationships to the outside lead, and stacks unconnected groups by
insertion order, so declaration order could force connector crossings (Hybrid
declared after Chassis in the nested-package gallery model).

GeneralViewLayoutStrategy now lays out once, orders each folder's items by the
mean vertical center of the boxes their external relationships lead to
(barycenter, one refinement pass, no-op when no order changes), and lays out
again. The nested-package gallery image is re-rendered: Hybrid sits above
Chassis, no connectors cross or run in parallel. The 13 px spacing of the two
arrowheads at Engine's west face is an engine fallback and is documented as such.

Adds the ExternalEdgeOrdering requirement and an OTS requirement pinning the
engine's insertion-order behavior, with tests, design and verification updates.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings November 15, 2026 21:52

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

Two active findings remain in GeneralViewLayoutStrategy: nested-package relationships can be misclassified for ordering, and child-scope graphs may merge distinct parallel relationships, risking incorrect layout and lost connectors.

2 open issues
What changed in this PR

This pull request updates the General View layout to preserve nested package hierarchy and render relationships between definitions across package boundaries. It upgrades the DemaConsulting.Rendering dependencies to 0.3.0-beta.2 and adds corresponding tests, requirements, documentation, and gallery examples.

Changes:

  • Nests package folders and scopes cross-package edges to their lowest common layout container.
  • Adds package-aware depth truncation, truncation labeling, and external-edge ordering.
  • Updates rendering dependencies, verification materials, user documentation, requirements traceability, and gallery assets.
File Description
test/​DemaConsulting.SysML2Tools.Tests/​Layout/​GeneralViewLayoutStrategyTests.cs Adds regression coverage for nested packages, cross-package edges, truncation, ordering, and gallery behavior.
test/​DemaConsulting.SysML2Tools.Tests/​DemaConsulting.SysML2Tools.Tests.csproj Updates the test renderer package references to DemaConsulting.Rendering 0.3.0-beta.2.
src/​DemaConsulting.SysML2Tools.Tool/​DemaConsulting.SysML2Tools.Tool.csproj Updates the tool's SVG and CanvasNet renderer package references to 0.3.0-beta.2.
src/​DemaConsulting.SysML2Tools.Core/​Layout/​Internal/​GeneralViewLayoutStrategy.cs Implements nested package folders, lowest-common-scope edge routing, package-aware truncation, and external-edge ordering.
src/​DemaConsulting.SysML2Tools.Core/​DemaConsulting.SysML2Tools.Core.csproj Updates the core rendering dependency to DemaConsulting.Rendering 0.3.0-beta.2.
ROADMAP.md Records that the updated rendering engine enables cross-hierarchy edge support and future interconnection-view work.
docs/​verification/​sysml2-tools-core/​layout/​internal/​general-view-layout-strategy.md Documents verification criteria and scenarios for nested packages, cross-package edges, truncation, and ordering.
docs/​verification/​ots/​dema-rendering.md Documents the rendering-engine behavior required for cross-hierarchy routing and insertion ordering.
docs/​user_guide/​introduction.md Explains nested package rendering, cross-package connectors, and package-aware depth limits.
docs/​reqstream/​sysml2-tools-core/​layout/​internal/​general-view-layout-strategy.yaml Adds requirements covering nested folders, cross-container edges, ordering, and truncation decoration.
docs/​reqstream/​sysml2-tools-core/​layout/​internal.yaml Includes the revised General View requirements in the internal layout requirement set.
docs/​reqstream/​quality.yaml Adds the rendering-engine requirements to quality traceability.
docs/​reqstream/​ots/​dema-rendering.yaml Defines OTS requirements for cross-hierarchy routing and component insertion order.
docs/​gallery/​svg/​VehiclePackagesGeneralView.svg Adds the rendered nested-package vehicle diagram with cross-package connectors.
docs/​gallery/​svg/​MissionControlGeneralView.svg Refreshes the MissionControl General View diagram with nested package folders.
docs/​gallery/​svg/​GroundSegmentRecursiveView.svg Refreshes the recursive GroundSegment gallery rendering.
docs/​gallery/​svg/​GroundSegmentDirectChildrenView.svg Refreshes the direct-children GroundSegment gallery rendering.
docs/​gallery/​README.md Documents the updated package rendering behavior and adds the nested-package gallery example.
docs/​gallery/​models/​11-nested-packages-general.sysml Adds a model demonstrating nested packages and relationships across package boundaries.
docs/​design/​sysml2-tools-core/​layout/​internal/​general-view-layout-strategy.md Documents the revised package planning, edge scoping, truncation, and ordering design.

Review effort: Lite

…rdering with tests; clarify ExternalAnchor scope docs

Review follow-up for two Copilot comments: (1) MergeParallelEdges - it is set on the root graph and cascades to every nested package-folder and definition-container scope, now pinned by two tests; (2) ComputeItemOrder external-partner ordering for a definition whose partners are in sibling nested packages - pinned by a test, ExternalAnchor docs corrected. Neither reproduced as a defect, so no behavior change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings November 15, 2026 22:26

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

The change relies on beta.2 cross-hierarchy routing, insertion-order behavior, and a geometry-dependent two-pass heuristic alongside unresolved engine issues, so runtime visual validation is still required.

No open issues 🎉

2 resolved since last review

Review effort: Lite

@Malcolmnixon
Malcolmnixon merged commit 34624c7 into main Nov 15, 2026
10 checks passed
@Malcolmnixon
Malcolmnixon deleted the nested-packages-cross-edges branch November 15, 2026 22:47
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.

General view: draw nested packages inside their owning package frame

2 participants