Add state diagram form and representation contract parity

This commit is contained in:
2026-09-06 02:33:18 +03:00
parent 24595810a1
commit 53cd096a56
7 changed files with 737 additions and 38 deletions
+42 -6
View File
@@ -625,9 +625,10 @@ Studio profile; no running history state is persisted or synthesized.
``diagram`` has name, identity, alias, description, ``layer`` (Oa by default),
``projection`` (Overview by default), and ``routes`` (empty list by default).
Other projections are Decomposition,
Allocation, FunctionalDataflow, Capabilities, and Traceability. Traceability diagrams can show both layers;
other diagrams show their chosen layer.
The string projections are Overview, Decomposition, Allocation,
FunctionalDataflow, Capabilities, and Traceability. StateMachine is a payload
constructor with one required ``machine`` reference. Traceability diagrams
can show both layers; other diagrams show their chosen layer.
Allocation is an architecture view: it shows participants and work, nests
allocated work under its performer, and displays interactions, functional
@@ -635,9 +636,44 @@ exchanges and boundary exchanges. FunctionalDataflow shows the work hierarchy
and its exchanges. Capabilities shows participants, roles, missions and
capabilities with their involvement, exploitation, include, extend and
generalization links. Decomposition and Overview retain general containment;
Overview also exposes all relationships. Changing the projection hides
Overview also exposes all relationships. These string projections hide
inapplicable placements without deleting them or changing semantic records.
A StateMachine projection MUST reference an existing StateMachine in the
diagram's layer. Its placements MUST refer to that machine, its Regions, or
its state vertices, including nested Regions and vertices. Events, other
machines and their members, and unrelated semantic elements are not valid
placements in this view. Empty and partial state views are valid; neither
creating nor reading a view synthesizes semantic elements or placements.
Changing an existing diagram to StateMachine, or changing its machine, MUST
remove or relocate incompatible placements in the same transaction. Context
errors use ``state_diagram_context``; incompatible placements use
``state_diagram_member``. Neither case silently hides invalid members.
This complete source example places one state from an existing machine:
.. code-block:: text
arcadia 3;
project operating "Operating modes" {
oa_entity crew "Crew" {}
oa_state_machine modes "Modes" { parent @crew; }
oa_region main "Main region" { parent @modes; }
oa_state ready "Ready" { parent @main; }
diagram mode_view "Operating modes" {
layer Oa;
projection { StateMachine { machine @modes; }; };
}
node ready_view { diagram @mode_view; element @ready; }
}
The JSON projection is
``{"StateMachine":{"machine":"11111111-1111-4111-8111-111111111111"}}``,
where the UUID is the referenced machine's identity. A bare ``"StateMachine"``,
a missing or null ``machine``, an invalid UUID, or additional payload fields
is malformed. Existing projections retain their string representation, for
example ``"Overview"`` in JSON and ``projection Overview;`` in source.
Ports are boundary anchors of visible owners, with their existing
semantic identity. An explicitly placed port is not rendered as a separate
large node. Functional exchanges use their declared source/target ports;
@@ -655,8 +691,8 @@ allocation, or realization. Hiding an element from a diagram must remain
distinguishable from deleting it from the model.
Changing a node's diagram preserves the placement identity, alias, coordinates,
size, collapse state, manual port anchors, and attached artifacts. The destination
must accept the element's layer and must not already contain another placement
of that element.
must accept the element's layer, satisfy StateMachine membership when applicable,
and must not already contain another placement of that element.
Each ``port_anchors`` entry is a PortAnchor record with required ``port``
reference, ``side`` (Left, Right, Top, or Bottom), and ``offset`` (finite