Validation Core
validation/core provides the shared Rust library and CLI used to validate
consistency between Bazel architecture data and PlantUML-derived models.
The package contains two public targets:
Target |
Kind |
Purpose |
|---|---|---|
|
|
Shared readers, models, and validators |
|
|
CLI entrypoint that dispatches the selected validation profile |
What It Validates
The current implementation supports these validation flows:
BazelComponent: compares the indexed Bazel build graph with the indexed PlantUML component-diagram structure.ComponentInternalApi: checks that every component-diagram interface is declared by the Internal API diagram.ComponentSequence: checks that component-diagram unit ids, shared interface relations, and sequence-diagram function-call connections stay in sync. Sequence participants are matched by uid.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.SequencePublicApi: checks that calls from an actor to the SEooC and callbacks to an actor use public API interfaces and methods.
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 available for those profile inputs.
Layering
The crate is intentionally split into three layers:
readers/: deserialize raw input files.models/: normalize those inputs into indexed structures used by validations.validators/: compare prepared model/index structures and accumulateErrors.
src/main.rs is the orchestration boundary. It reads CLI arguments, dispatches
to the selected profile, merges validator results, and optionally writes a
validation log.
This keeps validators focused on comparison logic instead of file loading or model construction.
Inputs
The CLI accepts a validation profile and a JSON input bundle:
--profile: validation scenario to run. Named profiles such asarchitectural-designselect validators in the Rust validation layer.--inputs: JSON file containing the input paths for the selected profile.
Supported profiles:
Profile |
Status |
Input schema |
Validation scope |
|---|---|---|---|
|
Supported |
|
Design consistency |
|
Supported |
|
Bazel architecture consistency |
|
Supported |
|
Unit design/implementation consistency |
Profile validators:
architectural-design:
validate_component_sequence
dependable-element:
validate_bazel_componentvalidate_component_class(pending)
unit:
validate_class_implementation
Each profile owns its own input schema.
dependable-element:
{
"architecture": "path/to/architecture.json",
"component_diagrams": ["path/to/component.fbs.bin"]
}
architectural-design:
{
"component_diagrams": ["path/to/component.fbs.bin"],
"sequence_diagrams": ["path/to/sequence.fbs.bin"],
"internal_api": ["path/to/internal_api.fbs.bin"],
"public_api": ["path/to/public_api.fbs.bin"]
}
unit:
{
"design_classes": ["path/to/design_class.fbs.bin"],
"design_sequences": ["path/to/design_sequence.fbs.bin"],
"implementation_classes": ["path/to/implementation_class.fbs.bin"],
"implementation_sequences": ["path/to/implementation_sequence.fbs.bin"]
}
Bazel rules declare the profile and provide the input bundle. The Rust validation layer decides which validators belong to the selected profile and maps the profile inputs to those validators.
The architecture JSON maps full Bazel labels to entries containing their own
required design_name and optional units and components lists. Child references
contain a label and design_name. Matching uses the entity design name and
the full parent design path. Duplicate sibling names are checked within each
actual parent target, identified by its label. A shared component is matched
under every containing design path. Conflicting component paths are excluded
from downstream matching diagnostics to avoid cascading errors. An entry without
its own design_name is rejected when reading the JSON.
Class Design Validation Semantics
For unit, the design constrains the implementation; this is not C++ call resolution.
See the class design implementation specification for detailed rules and current limitations.
Run
Build the CLI:
bazel build //validation/core:validation_cli
Run it directly:
bazel run //validation/core:validation_cli -- \
--profile dependable-element \
--inputs path/to/validation_inputs.json \
--output path/to/validation.log
Run unit tests:
bazel test //validation/core:validation_test
Architectural Overview
PlantUML source diagrams for the current design are stored in:
docs/assets/validation_core_overview.pumldocs/assets/validation_core_flow.puml
The first diagram shows the static module responsibilities. The second shows the runtime flow from CLI input parsing to validator execution and result aggregation.