From 3fb41451a7b7dae56f28d4629c1cfd3f96c725b7 Mon Sep 17 00:00:00 2001 From: Xian Gu Date: Thu, 21 May 2026 17:59:48 +0800 Subject: [PATCH] Extend Validation for Component vs Sequence Diagrams --- .../docs/specifications/component_sequence.md | 72 ++++++++++++++++--- 1 file changed, 64 insertions(+), 8 deletions(-) diff --git a/validation/core/docs/specifications/component_sequence.md b/validation/core/docs/specifications/component_sequence.md index b65ebd0..6f39820 100644 --- a/validation/core/docs/specifications/component_sequence.md +++ b/validation/core/docs/specifications/component_sequence.md @@ -15,11 +15,17 @@ ## Purpose -Define the intended consistency rules between component-diagram units and the -participants observed in sequence diagrams. +Define the intended consistency rules between component-diagram units, the +participants observed in sequence diagrams, and the internal interfaces used by +sequence-diagram function calls. -This validator checks whether unit aliases from component diagrams match the -set of used participants collected from sequence diagrams. +This validator checks whether: + +- unit aliases from component diagrams match the set of used participants + collected from sequence diagrams +- each function used in a sequence interaction is declared in an interface + associated with the caller and callee unit and available in the related + internal API diagram ## What is Validated @@ -27,6 +33,12 @@ Component-diagram units and sequence-diagram participants must match. The valida - unit aliases from the component diagram vs. participant aliases used in sequence diagrams - matching is case-sensitive +- interface connections in the static component diagram vs. function-call + connections between the corresponding units in sequence diagrams +- units connected by function calls in sequence diagrams vs. corresponding + interface connections in the static component diagram +- sequence function names used in interactions vs. method names declared in + interfaces referenced by the participating units in the component diagram ## Failure Cases @@ -35,22 +47,57 @@ Component-diagram units and sequence-diagram participants must match. The valida Validation fails when a unit alias defined in the component diagram does not appear among the participants used in the sequence diagrams. +### Missing sequence interaction for interface-connected units + +Validation fails when units are connected through an interface in the static +component diagram, but no corresponding function-call interaction between those +units is specified in the sequence diagram. + ### Unexpected sequence participant Validation fails when a sequence diagram uses a participant alias that does not correspond to any unit alias declared in the component diagram. +### Missing unit interface relation + +Validation fails when the caller unit or callee unit has no related interface +available for function-call validation. + +### Missing internal API interface + +Validation fails when an interface referenced by the caller or callee unit +cannot be found in the corresponding internal API diagram. + +### Method not found in related interfaces + +Validation fails when a function used in a sequence interaction is not declared +in the related interfaces defined for the caller and callee units. + +The validator reports an error when any of the following applies: + +- the function is declared only in interfaces related to the caller unit +- the function is declared only in interfaces related to the callee unit +- the function is declared on both sides, but not in a shared matching + interface +- the function is not declared in any related interface + ## Debug Output -The validator emits a debug view containing: +The validator emits debug output containing: - expected unit aliases - observed caller/callee participants +- observed sequence calls (`caller -> callee : method`) +- caller and callee interface targets derived from the component diagram +- interfaces checked in the internal API diagram ## Example If the component diagram defines the unit aliases `unit_1` and `unit_2`, then -the sequence diagrams must use the same participant aliases. +the sequence diagrams must use the same participant aliases. In addition, a +function call such as `unit_1 -> unit_2 : GetData(...)` must be backed by an +interface referenced by `unit_1` and `unit_2` in the component diagram, and +that interface must declare a `GetData` method in the internal API diagram. ```plantuml ' component diagram @@ -58,6 +105,10 @@ package "Package A" as package_a <> { component "Component A" as component_a <> { component "Unit 1" as unit_1 <> component "Unit 2" as unit_2 <> + + interface "InternalInterface" as InternalInterface + unit_1 --( InternalInterface + unit_2 )-- InternalInterface } } @@ -65,6 +116,11 @@ package "Package A" as package_a <> { participant "Unit 1" as unit_1 participant "Unit 2" as unit_2 -unit_1 -> unit_2 : SendSignal -unit_2 --> unit_1 : Ack +unit_1 -> unit_2 : GetData() +unit_2 --> unit_1 : return : Data* + +' internal_api diagram +interface "InternalInterface" as InternalInterface <>{ + {abstract} GetData(): Data* +} ```