You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Render doc as compartment and support SysML v2 view conditions (filter) - #83
General views of fully documented models were unreadable: every doc was drawn as a separate floating note with a leader line. The first iteration of this PR hid doc and added a custom attribute showDocumentation = true; opt-in, which is not SysML v2.
Spec basis (SysML 2.1 Beta 2 / KerML 1.1 Beta 2)
KerML 7.2.4.2: Documentation is an owned member of its element, so expose P::**; (or P::X::*) exposes it; a bare membership expose P::X; does not (SysML 8.3.26.2–4).
SysML 7.26.2 / 8.3.26.11: exposed elements are rendered only if they satisfy all view conditions (filter …;), both owned and inherited from the view definition; expose filters expose P::**[expr]; apply per-expose. Metaclass tests such as @SysML::PartUsage (7.5.4; SysML publicly imports KerML).
SysML 8.2.3.4: documentation-compartment (doc) inside the owner's node; comment-node + annotation-link for comments.
Behavior
Exposed, unfiltered documentation is drawn as a word-wrapped doc compartment inside its owner's box (General View). Never a floating note.
Hide it the standard way: filter not @SysML::Documentation; (comments stay), or a positive filter such as filter @SysML::PartDefinition; (hides doc and comments), or expose P::**[not @SysML::Documentation];, or inherit the condition from a view def.
Explicit comment elements are still drawn as notes with annotation links, subject to the same conditions.
Interconnection and other view types never draw documentation (unchanged).
The showDocumentation attribute is removed.
Implementation
Language: SysmlViewNode.FilterExpressionTexts (all conditions) and ViewDefinitionName (view V : Def); ReferenceResolver resolves the latter into a Typing edge.
Core: ExposeScopeResolver.CollectViewConditions (own + inherited through Typing/Supertype), IsAnnotationExposed, ExposedScope.FilteredEntries; FilterExpressionEvaluator.EvaluateForMetaclass, KerML:: spelling, kernel metaclass lineage (Documentation → Comment → AnnotatingElement → Element; Package); GeneralViewLayoutStrategy applies every condition to definitions, docs, and comments.
Gallery 01 model/images regenerated; BatterySubsystemView demonstrates filter not @SysML::Documentation;.
Tests: doc compartment by default; filter not @SysML::Documentation hides it but keeps comment; positive filter hides it; inherited condition hides it; expose filter hides it; bare membership expose does not expose doc.
General views drew every comment and doc annotation as a floating note
with a leader line, which made views of fully documented models
unreadable.
- doc (Documentation) annotations are no longer drawn by any view type
by default; explicit comments are still drawn as attached notes.
- A view opts in with `attribute showDocumentation = true;` in its body
(captured by AstBuilder into SysmlViewNode.ShowDocumentation). The
General View then renders doc text as a word-wrapped "doc" compartment
inside the element's box.
- Interconnection view is unchanged (it never draws annotations).
- Requirements, design, verification, user guide, and the drone gallery
example/images updated.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A moderate active finding remains in AstBuilder.cs: nested view member bodies such as view def are misclassified, causing inner attributes to incorrectly update the outer view, and regression coverage is still needed.
This PR hides doc (Documentation) annotations by default in every view type. Explicit comment elements still draw as attached notes. A view can opt in with an owned attribute showDocumentation = true;. In an opted-in General View, each element's doc text is drawn as a word-wrapped doc compartment inside its box. The change keeps large, fully documented models such as ApiMark readable, and it adds requirements, tests, docs, and gallery updates to match.
Changes:
AstBuilder reads the showDocumentation = true opt-in from a view's own body into SysmlViewNode.ShowDocumentation.
GeneralViewLayoutStrategy draws doc text as a wrapped compartment only when opted in. Only comment annotations become notes.
The Interconnection view never draws documentation. Requirements, tests, design and verification docs, the user guide, and the gallery example are updated to match.
Replace the non-standard showDocumentation attribute with spec-aligned
behavior: documentation is an owned member (KerML 7.2.4.2), so it is
exposed with its owner's members and, when it satisfies the view's
conditions (SysML 7.26.2, 8.3.26.11), is drawn as a word-wrapped doc
compartment (8.2.3.4). Parse and evaluate all owned and inherited view
conditions and expose filters with @sysml::/@KerML:: metaclass tests,
including Documentation, Comment and Package. Comments stay as notes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Malcolmnixon
changed the title
Hide doc annotations by default; per-view opt-in doc compartment
Render doc as compartment and support SysML v2 view conditions (filter)
Nov 12, 2026
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved moderate findings leave nested usage documentation potentially undrawn and prevent typed views from inheriting their definition’s render target, while the API documentation also describes obsolete behavior.
A view typed by StandardViewDefinitions::GeneralView reached the
deserialized library view node, whose filter list may be null, and
crashed. Guard the list and edges, with a regression test.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Critical correctness gaps remain because filtered-out usages can still appear in compartments and non-General/typed views do not consistently apply or inherit the new conditions.
Conditions narrow defs only after CollectDefinitions has built each box's compartments from every owned feature. A usage removed by a condition, such as filter @SysML::PartDefinition;, therefore still appears as a row in its parent's parts compartment. The standalone filter had this gap before this PR, and the new conditions reuse the same path. Build compartments from the admitted children, or re-filter the rows once the final set is known, before constructing the boxes.
Apply view conditions across strategies or document General View scope
Only GeneralViewLayoutStrategy applies view conditions. Browser, Grid, Sequence, Action Flow, State Transition, and Interconnection views ignore them, so render asTreeDiagram; filter @SysML::PartDefinition; still draws non-matching elements. The standalone filter had this gap before this PR, but the user guide now describes view conditions without this limit. Either apply the conditions in the other strategies, or document that they apply to General View only.
MetaclassNameMatches accepts the KerML:: prefix for every metaclass, so @KerML::PartUsage or @KerML::PartDefinition wrongly match SysML elements. Accept KerML:: only for the kernel metaclasses in KernelMetaclassLineage (Documentation, Comment, AnnotatingElement, Element, Package, Namespace). Also update the summary above this method and the @KerML::… wording in docs/user_guide/introduction.md, which must match.
Remove unsupported rendering inheritance claim from ViewDefinitionName
ViewDefinitionName says the usage inherits the definition's rendering, but view routing never follows its Typing edge. DiagramTypeRouter checks only the usage's name, render target, and SupertypeNames, and a view usage does not populate SupertypeNames. So view V : InterconnectionView { ... } still routes to the general view. Correct the wording to cover view conditions only; the same claim appears in ReferenceResolver.cs:912-913 and the design doc for SysmlNode.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because the review identified multiple moderate inconsistencies in documented exposure and view-condition behavior, plus a code path that can suppress filter-related warnings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
General views of fully documented models were unreadable: every
docwas drawn as a separate floating note with a leader line. The first iteration of this PR hiddocand added a customattribute showDocumentation = true;opt-in, which is not SysML v2.Spec basis (SysML 2.1 Beta 2 / KerML 1.1 Beta 2)
expose P::**;(orP::X::*) exposes it; a bare membershipexpose P::X;does not (SysML 8.3.26.2–4).filter …;), both owned and inherited from the view definition; expose filtersexpose P::**[expr];apply per-expose. Metaclass tests such as@SysML::PartUsage(7.5.4; SysML publicly imports KerML).documentation-compartment(doc) inside the owner's node;comment-node+annotation-linkfor comments.Behavior
doccompartment inside its owner's box (General View). Never a floating note.filter not @SysML::Documentation;(comments stay), or a positive filter such asfilter @SysML::PartDefinition;(hides doc and comments), orexpose P::**[not @SysML::Documentation];, or inherit the condition from aview def.commentelements are still drawn as notes with annotation links, subject to the same conditions.showDocumentationattribute is removed.Implementation
SysmlViewNode.FilterExpressionTexts(all conditions) andViewDefinitionName(view V : Def);ReferenceResolverresolves the latter into aTypingedge.ExposeScopeResolver.CollectViewConditions(own + inherited through Typing/Supertype),IsAnnotationExposed,ExposedScope.FilteredEntries;FilterExpressionEvaluator.EvaluateForMetaclass,KerML::spelling, kernel metaclass lineage (Documentation → Comment → AnnotatingElement → Element; Package);GeneralViewLayoutStrategyapplies every condition to definitions, docs, and comments.BatterySubsystemViewdemonstratesfilter not @SysML::Documentation;.Validation
./build.ps1: 2752 tests passed, 0 failed (all TFMs)../lint.ps1: clean (includesreqstream --lint --enforce).filter not @SysML::Documentationhides it but keeps comment; positive filter hides it; inherited condition hides it; expose filter hides it; bare membership expose does not expose doc.