Fix AST bugs and enhance Action Flow control-node rendering#31
Merged
Conversation
added 7 commits
July 12, 2026 14:50
…nce View item Investigation found actionBodyItem has the same combined-shape AST bug as stateBodyItem (fixed in #30): the compact 'action a; then b;' idiom drops both nodes, and fork/join/decide/merge/accept/send control nodes are entirely uncaptured. Scopes this branch to the AST correctness fix plus fork/join (thick bar) and decision/merge (diamond) rendering using existing Rendering-package BadgeShape primitives, explicitly deferring a true pentagon accept/send shape (needs an external Rendering package change), swim-lanes, and item-flow annotations. Split Sequence View dynamics into its own item since it is an unrelated subsystem.
- AstBuilder: add VisitActionBodyItem synthesizing SysmlTransitionNode(s) for the initialNodeMember/actionTargetSuccessionMember and actionBehaviorMember/ actionTargetSuccessionMember combined shapes, reusing the MultiNodeCapture sentinel; add BuildActionTargetSuccession covering targetSuccession/ guardedTargetSuccession/defaultTargetSuccession. - Add VisitMergeNode/VisitDecisionNode/VisitJoinNode/VisitForkNode/ VisitAcceptNode/VisitSendNode building minimal SysmlFeatureNodes via a shared BuildActionNodeFeature helper; anonymous control nodes get a synthesized internal \\$<keyword><n>\ name so their successions still wire correctly. - Add WorkspaceLoader and OMG corpus regression tests covering the compact action idiom, multiple attached successions, bare/attached first markers, anonymous/named control nodes, and guarded/default target successions.
…w View - ActionFlowViewLayoutStrategy: widen CollectActions/FindRoot to recognize the merge/decide/join/fork/accept/send FeatureKeyword values in addition to action; add ComputeActionSize/MakeActionNode routing so fork/join render as a LayoutBadge(BadgeShape.HorizontalBar), decision/merge as LayoutBadge(BadgeShape.Diamond), and accept/send keep the rounded-rectangle box shape but show their own Keyword instead of the hard-coded action text. - Blank rendered labels derived from AstBuilder-synthesized \\$\-prefixed internal names. - Ordinary-action rendering path left unchanged to avoid regressing existing gallery/test fixtures. - Add layout tests covering fork/join bars, decision/merge diamonds, accept/send boxes, synthetic-name blank labels, and the compact idiom.
- Add SysML2Tools-Language-Semantic-Model-AstBuilder-ActionBodyAttachedSuccession and -ActionControlNodes requirements with test traces. - Add SysML2Tools-Core-Layout-Internal-ActionFlowViewLayoutStrategy- ControlNodeShapes requirement with test traces. - Update AstBuilder and ActionFlowViewLayoutStrategy design docs' Key Methods/Data Model sections to describe the new visitors, synthetic-naming convention, and kind-routed badge/box construction. - Add Test Scenarios entries to the corresponding verification docs.
- 04-pipeline-action-flow.sysml: convert checkout/restoreDependencies to the compact 'action a; then b;' idiom, and replace the implicit dual-successor build branch with an explicit named fork/join pair (buildFork/testJoin) feeding parallel unitTest/securityScan branches that rejoin before qualityGate. - Regenerate PipelineActionFlowView.svg/.png; visually verified per diagram-quality.md's Agent Checklist (horizontal-bar badges at the fork/join positions, no overlaps). - Update the gallery README's caption for this example. - Mark the Action Flow View control-node/successor AST correctness item in ROADMAP.md as delivered, listing the pentagon accept/send shape, swim-lanes, item-flow annotations, assignment/terminate/if/while/for-loop node AST support, and actionUsage-level nested action bodies as explicitly deferred future work.
…n bodies - AstBuilder.VisitActionBodyItem now reads context.sourceSuccessionMember() in the actionBehaviorMember branch and synthesizes the implicit incoming SysmlTransitionNode when a preceding flow position is known. - Added CollectActionBodyChildren (parallel to CollectChildren, which stays untouched for state bodies) plus DetermineFlowPositionName and the _actionBodyPreviousNodeName field to track the current flow position while iterating an action body's actionBodyItems in source order. - VisitActionDefinition now calls CollectActionBodyChildren for action bodies. - Extended WorkspaceLoaderTests and OmgModelsTests to assert the previously missing incoming edges (a->f, TurnOn->\, J->F, start->continueCharging, continueCharging->monitor, monitor->\). - Updated ast-builder reqstream requirement, design doc, and verification doc to describe the new incoming-edge mechanism and note the two discovered but out-of-scope analogous gaps (nonBehaviorBodyItem structureUsageMember and VisitStateBodyItem) as known follow-ups.
BuildActionNodeFeature previously always set QualifiedName to null, even for explicitly named fork/join/merge/decide/accept/send nodes. This meant named control nodes were never registered in the symbol table and were not subject to expose-scope filtering in ActionFlowViewLayoutStrategy.CollectActions, unlike every other named feature in AstBuilder. Now, when a control node has an explicitly declared name, QualifiedName is populated via QualifyName (mirroring BuildStateActionFeatureNode); only the synthesized anonymous $<keyword><n> names keep QualifiedName = null.
Malcolmnixon
added a commit
that referenced
this pull request
Jul 13, 2026
* docs(roadmap): ground Annotating elements item in confirmed AST/render gaps Comment/doc annotation text is already captured semantically but never read by GeneralViewLayoutStrategy; enum literal values, constraint bodies, and requirement subject/constraints/doc are not captured in the AST at all yet. Cites the spec's stereotype-style compartment title conventions (subject, doc, constraint). * Capture enum literals, requirement subject/constraints, and standalone constraints in AstBuilder - Add nullable ExpressionText to SysmlFeatureNode, mirroring SysmlTransitionNode.Guard, for constraint-kind features' raw expression text. - VisitEnumerationDefinition: full body-collecting visitor via new CollectEnumerationBodyChildren helper, since enumerationBody uniquely alternates annotatingMember/enumerationUsageMember directly rather than wrapping them in a single rule. VisitEnumeratedValue builds an 'enum value'-keyword feature for each literal (bare, value-assignment, and redefinition-body forms). - VisitRequirementDefinition/VisitConcernDefinition: full body-collecting visitor (push-scope/CollectChildren(requirementBodyItem)/register), mirroring VisitStateUsage's established pattern. Also extend VisitRequirementUsage/VisitConcernUsage the same way, beyond a literal *Definition-only reading of the plan, because the dominant real OMG corpus idiom nests subject/assume constraint inside a requirement usage that specializes a def, not inside the def's own body. - New VisitSubjectUsage/VisitActorUsage/VisitStakeholderUsage (subject/actor/stakeholder keywords) and VisitRequirementConstraintMember/BuildConstraintFeatureNode (require constraint/assume constraint keywords, capturing raw expression text for both the reference and inline requirementConstraintUsage grammar alternatives). - New VisitConstraintUsage (previously entirely absent) and rewritten VisitConstraintDefinition, synthesizing a 'constraint'-keyword child feature carrying the raw calculationBody text. - New VisitRequirementVerificationMember/VisitFramedConcernMember returning null: once body-collection reaches requirementBodyItem, ANTLR's default dispatch would otherwise recurse into a nested verify/frame member's own body and incorrectly hoist its content onto the outer enclosing requirement. * Render annotation notes and new stereotype compartments in General View - Add DefBox.Annotations, threaded through CollectDefinitions. - New AddAnnotationNote/BuildNoteText/ComputeNoteBoxSize helpers: emit one BoxShape.Note box per annotated definition (concatenating multiple Documentation/Comment annotations into a single note), connected by a plain solid line with no end marker. Implemented as ordinary LayoutGraph nodes/edges added during the existing single-pass BuildGraph traversal, a documented deviation from a literal post-layout marker-decoration approach (this strategy has no equivalent decoration phase). - Pluralize: add guillemet stereotype titles for subject/assume constraint/require constraint/constraint compartments, reusing the pre-existing «allocate» edge-label convention. - FormatFeatureRow: render a constraint-kind feature's raw ExpressionText instead of the generic name : Type [multiplicity] row shape. * Add tests for enum/requirement/constraint capture and note/compartment rendering - WorkspaceLoaderTests: enum def bare/value-assignment literal capture, requirement def/usage subject+constraint capture, actor/stakeholder capture, standalone constraint usage/definition, and a verify-member no-hoist regression guard. - OmgModelsTests: regression fixtures against the real OMG corpus for enumeration definitions, requirement definitions/usages, and comment/documentation examples. - GeneralViewLayoutStrategyTests: note-box emission (including the no-note and multiple-annotations-combine-into-one cases), «subject» guillemet compartment title, constraint expression-text rows, and the enum values compartment title. * Document AstBuilder and GeneralViewLayoutStrategy annotation/compartment changes - ast-builder.md/general-view-layout-strategy.md design docs: describe the new visitor methods, the deliberate VisitRequirementUsage/VisitConcernUsage extension, the verify/frame null-suppression safeguard, and the AddAnnotationNote architectural deviation from a post-layout marker-decoration approach. - sysml-node.md: document the new SysmlFeatureNode.ExpressionText field. - Verification docs: add Test Scenarios entries for every new test. - Reqstream YAMLs: add new requirement IDs with test traces, following the shape established by PR #30/#31. * Add annotation, enum, and requirement compartments to gallery + mark roadmap item delivered - 01-drone-general.sysml: Battery gains a doc annotation, FlightMode is now an enum def with literal values, and FlightTimeRequirement gains a subject/require constraint body. - Regenerate DroneGeneralView/BatterySubsystemView SVG and PNG. - Update gallery README caption for the new content. - ROADMAP.md: mark 'Annotating elements & compartment depth' delivered. * test(semantic): add concern def/usage subject coverage; close traceability gap in ast-builder requirement The RequirementSubjectAndConstraints requirement in ast-builder.yaml claims coverage of both requirement and concern definition/usage paths (VisitConcernDefinition/VisitConcernUsage), but WorkspaceLoaderTests.cs only exercised requirement cases. - Add WorkspaceLoader_LoadAsync_ConcernDefinitionAndUsage_CapturesSubject to WorkspaceLoaderTests.cs, verifying that a concern def and a concern usage each capture their subject member as a Children entry. - Reference the new test in the RequirementSubjectAndConstraints requirement's tests list in docs/reqstream/sysml2-tools-language/semantic/model/ast-builder.yaml. - Add the corresponding row to docs/verification/sysml2-tools-language/semantic/model/ast-builder.md. --------- Co-authored-by: Malcolm Nixon <Malcolm.Nixon@hiarc.inc>
This was referenced Jul 13, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request delivers a significant enhancement to Action Flow View support, focused on correct AST synthesis for control nodes and their successors, as well as improved visual rendering of control-node types in diagrams. It also updates the CI/CD Pipeline gallery model to demonstrate these new features, clarifies the documentation, and adds requirements and tests to ensure correct rendering and AST behavior.
Action Flow View: Control Node AST and Rendering Improvements
AstBuildernow synthesizesSysmlTransitionNodeentries for both compact and explicit succession idioms in action bodies, ensuring that nodes and their attached successions are always correctly captured in the AST. Control nodes (merge,decide,join,fork,accept,send) are synthesized as minimalSysmlFeatureNodes with distinctFeatureKeywords and, for anonymous nodes, a unique internal name, fixing prior issues where successions or nodes were dropped. [1] [2]ActionFlowViewLayoutStrategyand its documentation now recognize and visually distinguish control nodes: fork/join nodes render as horizontal-bar badges, decision/merge as diamond badges, and accept/send as rounded rectangles with a distinct keyword label. Ordinary actions are unchanged. Sizing and label logic have been updated to support these distinctions and handle synthetic internal names gracefully. [1] [2] [3]Gallery Model and Docs Updates
docs/gallery/models/04-pipeline-action-flow.sysml) is updated to use the compact succession idiom and to explicitly include a named fork/join, demonstrating the new AST and rendering logic. The corresponding gallery documentation describes these changes and their visual effect. [1] [2] [3]Documentation and Roadmap Clarifications
Requirements and Test Coverage
These changes collectively ensure that Action Flow Views now correctly represent control-node-heavy flows both in the AST and visually, addressing prior gaps in both model fidelity and diagram clarity.