Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bazel/rules/rules_score/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ sphinx_docs_library(
strip_prefix = "validation/ai_checker/",
)

# Validation specifications — two files, same source dir, no rename needed.
# Validation specifications — same source dir, no rename needed.
sphinx_docs_library(
name = "validation_specs",
srcs = ["//validation/core:specifications"],
Expand Down
2 changes: 2 additions & 0 deletions bazel/rules/rules_score/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ safety analysis to the top-level SEooC assembly.
:caption: Validation

tool_reference/specs/bazel_component
tool_reference/specs/component_internal_api
tool_reference/specs/component_sequence
tool_reference/specs/sequence_internal_api

.. toctree::
:maxdepth: 2
Expand Down
6 changes: 6 additions & 0 deletions validation/core/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ filegroup(
name = "specifications",
srcs = [
"docs/specifications/bazel_component.md",
"docs/specifications/component_internal_api.md",
"docs/specifications/component_sequence.md",
"docs/specifications/sequence_internal_api.md",
],
visibility = ["//visibility:public"],
)
Expand All @@ -49,9 +51,13 @@ rust_library(
"src/readers/mod.rs",
"src/readers/sequence_diagram_reader.rs",
"src/validators/bazel_component_validator.rs",
"src/validators/component_internal_api_validator.rs",
"src/validators/component_sequence_validator.rs",
"src/validators/mod.rs",
"src/validators/sequence_internal_api_validator.rs",
"src/validators/test/component_internal_api_validator_test.rs",
"src/validators/test/component_sequence_validator_test.rs",
"src/validators/test/sequence_internal_api_validator_test.rs",
],
crate_root = "src/lib.rs",
visibility = ["//visibility:public"],
Expand Down
17 changes: 8 additions & 9 deletions validation/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ The current implementation supports these validation flows:

1. `BazelComponent`: compares the indexed Bazel build graph with the indexed
PlantUML component-diagram structure.

2. `ComponentSequence`: checks that component-diagram unit aliases, shared
2. `ComponentInternalApi`: checks that every component-diagram interface is
declared by the Internal API diagram.
3. `ComponentSequence`: checks that component-diagram unit aliases, shared
interface relations, and sequence-diagram function-call connections stay in
sync. When internal API diagrams are provided, it also checks that each
sequence function name is declared on a shared interface referenced by both
participating units.

Internal API diagrams are handled separately from regular class diagrams.
If no `--internal-api-fbs` inputs are provided, `ComponentSequence` still runs
the alias and interface-connection checks and skips method-level validation.
sync.
4. `SequenceInternalApi`: checks that Internal API methods are exercised by
sequence interactions. When component input is also available, it uses that
component context to check sequence function names against related shared
interfaces.

The CLI dispatches to the selected validation profile. Each profile owns its
input schema, reads the models it needs, and runs the validators that are
Expand Down
28 changes: 24 additions & 4 deletions validation/core/docs/assets/validation_core_flow.puml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ participant "CLI" as cli
participant "BazelReader" as bazel_reader
participant "ComponentDiagramReader" as component_reader
participant "SequenceDiagramReader" as sequence_reader
participant "ClassDiagramReader" as class_reader
participant "ClassDiagramReader\n(class + internal API)" as class_reader
participant "validate_bazel_component()" as bazel_validator
participant "validate_component_sequence()" as sequence_validator
participant "validate_component_class()" as class_validator
participant "validate_component_internal_api()" as component_internal_api_validator
participant "validate_sequence_internal_api()" as sequence_internal_api_validator
participant "Errors" as errors
participant "Report writer" as report_writer

Expand All @@ -43,10 +45,16 @@ alt architectural-design profile
cli -> cli: to_sequence_diagram_index(&mut errors)
end

opt internal_api or public_api provided (planned)
cli -> class_reader: read(internal_api + public_api)
opt internal_api provided
cli -> class_reader: read(internal_api)
class_reader --> cli: ClassDiagramInputs
cli -> cli: ClassDiagramIndex::build_index(&mut errors)
cli -> cli: InternalApiIndex::build_index(&mut errors)
end

opt public_api provided (planned)
cli -> class_reader: read(public_api)
class_reader --> cli: ClassDiagramInputs
cli -> cli: PublicApiIndex::build_index(&mut errors)
end

opt component + class available (planned)
Expand All @@ -61,6 +69,18 @@ alt architectural-design profile
cli -> errors: merge_errors(...)
end

opt component + internal API available
cli -> component_internal_api_validator: validate_component_internal_api(..., Errors::default())
component_internal_api_validator --> cli: Errors
cli -> errors: merge_errors(...)
end

opt sequence + internal API available
cli -> sequence_internal_api_validator: validate_sequence_internal_api(..., optional component, Errors::default())
sequence_internal_api_validator --> cli: Errors
cli -> errors: merge_errors(...)
end

else dependable-element profile
cli -> cli: read DependableElementInputs

Expand Down
17 changes: 14 additions & 3 deletions validation/core/docs/assets/validation_core_overview.puml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,17 @@ package "validation/core" {
component "BazelArchitecture\n(SEooC / component / unit sets)" as MBazel
component "ComponentDiagramArchitecture\n(entities by stereotype)" as MComp
component "SequenceDiagramIndex\n(used participant set)" as MSeq
component "ClassDiagramIndex\n(enclosing namespace set)" as MClass
component "ClassDiagramIndex (planned)\n(enclosing namespace set)" as MClass
component "InternalApiIndex\n(interface methods)" as MInternalApi
}

' Validators: compare domain models and return accumulated findings
package "Validator Layer" as ValidatorLayer {
component "validate_bazel_component()" as VBC
component "validate_component_class()" as VCC
component "validate_component_class() (planned)" as VCC
component "validate_component_internal_api()" as VCIA
component "validate_component_sequence()" as VCS
component "validate_sequence_internal_api()" as VSIA
}

' Reporting: collect findings and write validation reports
Expand All @@ -75,19 +78,27 @@ BR --> MBazel : converts
CDR --> MComp : converts
SDR --> MSeq : converts
ClDR --> MClass : converts
ClDR --> MInternalApi : converts

' Validator inputs: consume only the domain models required by each rule
MBazel --> VBC
MComp --> VBC
MComp --> VCC
MComp --> VCIA
MComp --> VCS
MComp ..> VSIA : optional context
MClass --> VCC
MSeq --> VCS
MSeq --> VSIA
MInternalApi --> VCIA
MInternalApi --> VSIA

' Findings: merge reader and validator findings into one report
VBC --> Err : findings
VCS --> Err : findings
VCC --> Err : findings
VCIA --> Err : findings
VCS --> Err : findings
VSIA --> Err : findings
ReaderLayer --> Err : parse/index findings
Err --> ReportWriter : final status
ReportWriter --> Report
Expand Down
44 changes: 35 additions & 9 deletions validation/core/docs/requirements/tool_requirements.trlc
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,47 @@ section "Tool Requirements" {
satisfied_by = Verifier
}

}

section "Sequence Internal API Validator" {

ToolQualification.ToolRequirement ComponentSequenceMethodNameConsistency {
description = '''When an internal API diagram is provided, the
validator shall report an error when a function used in a
sequence interaction is not declared in any shared interface
of the participating units as defined in the component
diagram.'''
description = '''When component, sequence, and internal API
diagrams are provided, the validator shall report an error
when a function used in a sequence interaction is not declared
in any shared interface of the participating units as defined
in the component diagram.'''
derived_from = [UseCases.Validate_Architecture_Specification_Documents]
satisfied_by = Verifier
}

ToolQualification.ToolRequirement SequenceInternalApiInterfaceCoverage {
description = '''When sequence and internal API diagrams are
provided, the validator shall report an error when a function
declared in an internal API interface is never called in any
sequence interaction. Self-calls count as valid usage.'''
derived_from = [UseCases.Validate_Architecture_Specification_Documents]
satisfied_by = Verifier
}

ToolQualification.ToolRequirement ComponentSequenceInterfaceCoverage {
description = '''When an internal API diagram is provided, the
validator shall report an error when a function declared in a
validated interface is never called in any sequence
interaction. Self-calls count as valid usage.'''
description = '''When component, sequence, and internal API
diagrams are provided, the validator shall report an error
when a function declared in a validated interface is never
called in any sequence interaction. Self-calls count as valid
usage.'''
derived_from = [UseCases.Validate_Architecture_Specification_Documents]
satisfied_by = Verifier
}

}

section "Component Internal API Validator" {

ToolQualification.ToolRequirement ComponentInternalApiInterfaceDeclarationConsistency {
description = '''The validator shall report an error when an
interface declared in the component diagram is not declared as
an interface in the internal API diagram.'''
derived_from = [UseCases.Validate_Architecture_Specification_Documents]
satisfied_by = Verifier
}
Expand Down
63 changes: 63 additions & 0 deletions validation/core/docs/specifications/component_internal_api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!-- ----------------------------------------------------------------------------
Copyright (c) 2026 Contributors to the Eclipse Foundation

See the NOTICE file(s) distributed with this work for additional
information regarding copyright ownership.

This program and the accompanying materials are made available under the
terms of the Apache License Version 2.0 which is available at
https://www.apache.org/licenses/LICENSE-2.0

SPDX-License-Identifier: Apache-2.0
----------------------------------------------------------------------------- -->

# Component Internal API Specification

## Purpose

This validator enforces consistency between two diagram types:

- **Component diagrams**
- **Internal API diagrams**

It shall make sure that every interface declared by the component design is
also declared by the internal API design.

## What is Validated

All comparisons are case-sensitive.

### Interface Declaration Consistency

Every interface declared in the component diagram must resolve to an interface
declared in the internal API diagram.
*(Requirement: {requirement:downstream-ref}`Tools.ComponentInternalApiInterfaceDeclarationConsistency`)*

```text
' component diagram
component "Unit 1" as unit_1 <<unit>>
interface "IData" as IData
unit_1 -( IData

' internal_api diagram
interface "IData" as IData <<interface>> {
{abstract} GetData(): Data*
}
```

The component interface is matched against the internal API interface ID. The
match is exact and case-sensitive. This check applies even when a component
interface is not referenced by a unit relation.

## Failure Cases

| Failure case | Validation rule |
|---|---|
| Missing internal API interface | Interface Declaration Consistency |

## Debug Output

The validator emits debug output containing:

- component interfaces checked against the internal API
- internal API interfaces available for component interfaces
58 changes: 2 additions & 56 deletions validation/core/docs/specifications/component_sequence.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,16 @@

## Purpose

This validator enforces consistency across entities in three diagram types:
This validator enforces consistency across entities in two diagram types:

- **Component diagrams**
- **Sequence diagrams**
- **Internal API diagrams**

It shall make sure that Architectural Elements are consistently named and related to each other.

## What is Validated

All comparisons are case-sensitive. Alias and interface-connection checks
always run. Method-name and interface-coverage checks run only when an
internal API diagram is provided.
All comparisons are case-sensitive.

### Alias Consistency

Expand Down Expand Up @@ -69,52 +66,6 @@ participant "Unit 2" as unit_2
unit_1 -> unit_2 : GetData()
```

### Method-Name Consistency

Every function used in a sequence interaction, including self-calls, must be
declared in a shared interface of the participating units as defined in the
component diagram.
*(Requirement: {requirement:downstream-ref}`Tools.ComponentSequenceMethodNameConsistency`)*

```text
' component diagram
component "Unit 1" as unit_1 <<unit>>
component "Unit 2" as unit_2 <<unit>>
interface "IData" as IData
unit_1 -( IData
unit_2 )- IData

' sequence diagram
participant "Unit 1" as unit_1
participant "Unit 2" as unit_2
unit_1 -> unit_2 : GetData()

' internal_api diagram
interface "IData" as IData <<interface>> {
{abstract} GetData(): Data*
}
```

### Interface Coverage

Every function declared in a validated interface must be called in at least one
sequence interaction. Self-calls count as valid usage.
*(Requirement: {requirement:downstream-ref}`Tools.ComponentSequenceInterfaceCoverage`)*

```text
' internal_api diagram
interface "IData" as IData <<interface>> {
{abstract} GetData(): Data*
{abstract} SetData(d: Data*): void
}

' sequence diagram
participant "Unit 1" as unit_1
participant "Unit 2" as unit_2
unit_1 -> unit_2 : GetData()
unit_1 -> unit_2 : SetData(d)
```

## Failure Cases

| Failure case | Validation rule |
Expand All @@ -124,9 +75,6 @@ unit_1 -> unit_2 : SetData(d)
| Missing sequence interaction for interface-connected units | Interface-Connection Consistency |
| Missing interface connection for sequence-connected units | Interface-Connection Consistency |
| Invalid consumer/provider roles | Interface-Connection Consistency |
| Missing internal API interface | Method-Name Consistency |
| Method not declared in related interface | Method-Name Consistency |
| Interface function not exercised | Interface Coverage |

## Debug Output

Expand All @@ -137,5 +85,3 @@ The validator emits debug output containing:
- observed sequence calls (`caller -> callee : method`)
- unit interface targets derived from the component diagram
- interface-connected unit pairs derived from the component diagram
- internal API interfaces found and checked for method validation, when
internal API input is present
Loading
Loading