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 @@ -46,9 +48,13 @@ rust_library(
"src/readers/sequence_diagram_reader.rs",
"src/validators/bazel_component_validator.rs",
"src/validators/component_class_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
30 changes: 19 additions & 11 deletions validation/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,26 @@ The package contains two public targets:

## What It Validates

The current implementation supports three validation flows:
The current implementation supports five validation flows:

1. `BazelComponent`: compares the indexed Bazel build graph with the indexed
PlantUML component-diagram structure.
2. `ComponentClass`: compares component-diagram unit IDs with enclosing
namespace IDs observed in class diagrams using boundary-aware suffix
matching.
3. `ComponentSequence`: checks that component-diagram unit aliases, shared
3. `ComponentInternalApi`: checks that every component-diagram interface is
declared by the Internal API diagram.
4. `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.
sync.
5. `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.

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.
Method-name validation requires component context. With only sequence plus
Internal API inputs, the weak method-existence check is not run.

The CLI inspects the provided inputs, determines which validations can run,
and executes all compatible checks in one pass.
Expand Down Expand Up @@ -70,17 +74,21 @@ The CLI accepts the following input families:
- `--component-fbs`: one or more component-diagram FlatBuffers files
- `--sequence-fbs`: one or more sequence-diagram FlatBuffers files
- `--class-fbs`: one or more class-diagram FlatBuffers files
- `--internal-api-fbs`: optional internal-API FlatBuffers files for the
`ComponentSequence` validator
- `--internal-api-fbs`: internal-API FlatBuffers files

The current inference rules are:

- `--architecture-json` + `--component-fbs` enables `BazelComponent`
- `--component-fbs` + `--class-fbs` enables `ComponentClass`
- `--component-fbs` + `--internal-api-fbs` enables `ComponentInternalApi`
- `--component-fbs` + `--sequence-fbs` enables `ComponentSequence`
- `--sequence-fbs` + `--internal-api-fbs` enables `SequenceInternalApi`

`--internal-api-fbs` is an optional additional input for
`ComponentSequence`. It does not enable a validator on its own.
When all three component, sequence, and Internal API inputs are present, the
CLI runs `ComponentSequence`, `ComponentInternalApi`, and
`SequenceInternalApi`. The `SequenceInternalApi` validator receives the
component input as optional context and runs the stronger related-interface
method check.

If multiple combinations are present, all compatible validators are executed.

Expand Down
22 changes: 21 additions & 1 deletion validation/core/docs/assets/validation_core_flow.puml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ 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 "ValidationContext" as context
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

cli -> cli: parse Args
Expand Down Expand Up @@ -52,6 +54,12 @@ opt class fbs provided
cli -> cli: to_class_diagram_index(&mut base_errors)
end

opt internal-api fbs provided
cli -> class_reader: read(paths)
class_reader --> cli: ClassDiagramInputs
cli -> cli: InternalApiIndex::build_index(&mut base_errors)
end

cli -> context: assemble ValidationContext
cli -> cli: resolve_validators(context)

Expand All @@ -67,6 +75,18 @@ opt component + sequence available
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

opt component + class available
cli -> class_validator: validate_component_class(..., Errors::default())
class_validator --> cli: Errors
Expand Down
20 changes: 17 additions & 3 deletions validation/core/docs/assets/validation_core_overview.puml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ rectangle "Input Artifacts" as Inputs {
file "*.component.fbs\n(PlantUML export)" as FComp
file "*.sequence.fbs\n(PlantUML export)" as FSeq
file "*.class.fbs\n(PlantUML export)" as FClass
file "*.internal_api.fbs\n(PlantUML export)" as FInternalApi
}

' ── validation/core library ───────────────────────────────────────────────────
Expand All @@ -46,13 +47,16 @@ package "validation/core" {
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 "InternalApiIndex\n(interface methods)" as MInternalApi
}

' Validators: stateless pure functions; auto-selected by available inputs
package "Validators [auto-selected by available inputs]" as ValLayer {
component "validate_bazel_component\nBuild graph ↔ Architecture diagram" as VBC
component "validate_component_class\nUnit IDs ↔ Namespace IDs" as VCC
component "validate_component_internal_api\nUnit interface refs ↔ Internal API" as VCIA
component "validate_component_sequence\nUnit aliases ↔ Sequence participants" as VCS
component "validate_sequence_internal_api\nSequence calls ↔ Internal API methods" as VSIA
}

component "Errors" as Err
Expand All @@ -71,25 +75,34 @@ FBazel --> BR
FComp --> CDR
FSeq --> SDR
FClass --> ClDR
FInternalApi --> ClDR

' Readers produce Models (parse + index)
BR --> MBazel
CDR --> MComp
SDR --> MSeq
ClDR --> MClass
ClDR --> MInternalApi

' Component diagram is the shared reference hub for all validators
' Models feed validators by required input combination
MBazel --> VBC
MComp --> VBC
MComp --> VCC
MComp --> VCIA
MComp --> VCS
MComp ..> VSIA : optional context
MClass --> VCC
MSeq --> VCS
MSeq --> VSIA
MInternalApi --> VCIA
MInternalApi --> VSIA

' Validators accumulate into Errors
VBC --> Err
VCC --> Err
VCIA --> Err
VCS --> Err
VSIA --> Err

' CLI orchestrates Readers and Validators
CLI ..> ReadLayer : drives
Expand All @@ -105,8 +118,9 @@ note right of ValLayer
end note

note right of MComp
ComponentDiagramArchitecture is the
shared reference across all three validators.
ComponentDiagramArchitecture is a required input
for component validators and optional context
for SequenceInternalApi method-name checks.
end note

@enduml
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
Loading
Loading