Class Design Sequence Specification

Purpose

This validator enforces consistency between the class model in the unit design and the interactions modeled in sequence diagrams.

It shall make sure that the runtime interactions declared in sequence diagrams are supported by the designed classes and methods.

The validator is intentionally design-level. It validates that the sequence is compatible with the class design contract; it does not try to prove full runtime behavior or implementation control flow.

What is Validated

All comparisons are case-sensitive unless otherwise stated by the sequence parser or the class-model normalizer.

The validator compares two indexed design inputs:

Input

Source

Meaning

design_classes

unit_design class diagram FlatBuffers

Required structural design model

sequence_diagrams

sequence diagram FlatBuffers

Required runtime interaction model

Participant-Class Consistency

Every sequence participant that represents a designed runtime element must map to exactly one class in the design class model. (Requirement: Tools.ClassDesignSequenceParticipantClassConsistency)

This check validates that the sequence does not reference unknown or ambiguous classes. Actors and <<external>> participants are not classes of the unit and are skipped, as are messages sent to them.

Participant resolution matches the participant uid against class ids:

  1. A qualified uid (containing . or ::) must equal a class id exactly.

  2. A single-segment uid is a leaf reference: it matches the class whose id ends in that segment. It must match exactly one class; several matches are reported as an ambiguous participant. Write the qualified path as the participant label to disambiguate, for example participant "unit_2::Controller" as controller.

The alias of a participant does not take part in matching. The uid is the participant’s name as an identifier path.

' class diagram
class Controller
class Repository

' sequence diagram
participant Controller
participant Repository
Controller -> Repository : FindById(id)

Message-Operation Consistency

Every message sent to a participant must correspond to an operation on the target class. The validator should match at least the operation name and may optionally compare parameter arity and normalized parameter types when that information is available in both diagrams. (Requirement: Tools.ClassDesignSequenceMessageOperationConsistency)

This includes both cross-class messages and self-calls. Operation lookup may resolve either on the target class itself or on inherited operations available through its base classes or interfaces. The sequence may only invoke behavior that the class design actually declares or inherits.

Operation lookup shall follow these rules:

  1. Check the target class itself for a method with the requested name.

  2. If not found locally, traverse outgoing Inheritance and Implementation relations recursively.

  3. Track visited class ids while traversing to avoid infinite recursion caused by cycles in the resolved relationship graph.

  4. Treat inherited private methods as not accessible to the target class.

  5. Treat inherited non-private methods as valid matches.

As a result, a sequence call is valid when the target class declares the method itself or inherits an accessible method from a base class or implemented interface. A method that exists only as a private inherited member shall not be accepted as a valid target operation.

' class diagram
class Repository {
  + FindById(id: Id) : Entity
}

' sequence diagram
participant Controller
participant Repository
Controller -> Repository : FindById(id)
' class diagram
class Controller {
  + Execute()
  - Validate()
}

' sequence diagram
participant Controller
Controller -> Controller : Validate()

Failure Cases

Failure case

Validation rule

Sequence participant has no matching design class

Participant-Class Consistency

Sequence participant matches multiple design classes ambiguously

Participant-Class Consistency

Sequence message targets a class that does not declare or accessibly inherit the called operation

Message-Operation Consistency

Sequence self-call targets a class that does not declare or accessibly inherit the called operation

Message-Operation Consistency

Sequence message targets a method that exists only as a private inherited operation

Message-Operation Consistency

Debug Output

The validator should emit debug output containing:

  • resolved design classes

  • observed sequence participants

  • participant-to-class mapping decisions

  • observed sequence messages (caller -> callee : method)

  • matched and unmatched class operations