Rule Reference
Documentation Rules
sphinx_module
Builds Sphinx-based HTML documentation from RST/MD source files. Supports cross-module dependencies and automatic HTML merging.
sphinx_module(
name = "my_docs",
srcs = glob(["docs/**/*.rst", "docs/**/*.md"]),
index = "docs/index.rst",
deps = ["@external_module//:docs"],
)
Attribute |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Target name; also the output directory prefix |
|
label list |
yes |
RST, MD, image, and PlantUML source files |
|
label |
yes |
Path to the root |
|
label list |
no |
Other |
|
bool |
no |
If |
|
— |
no |
Bazel visibility |
Generated targets:
<name>— HTML output underbazel-bin/<name>/html/; use indepsof othersphinx_moduletargets.<name>_needs—needs.jsonproduced by the needs builder; consumed transitively by downstream modules for cross-module{requirement:downstream-ref}resolution. See Two-phase Sphinx build for the full data-flow description.
filter_execpath
Advanced. Resolves a Sphinx -D command-line argument (such as a Doxygen
build output path) from a Bazel target’s outputs at analysis time, producing
a fully-qualified string that can be passed to sphinx_module.extra_opts_targets.
This is needed when a Sphinx extension (e.g. Breathe for Doxygen integration)
requires a path that is only known once the dependency has been built.
filter_execpath(
name = "breathe_project_path",
flag = "-Dbreathe_projects.MyLib",
target = "//doc:doxygen_build",
filter_pattern = "xml/index.xml",
)
sphinx_module(
name = "my_docs",
srcs = glob(["docs/**/*.rst"]),
index = "docs/index.rst",
extra_opts_targets = [":breathe_project_path"],
)
Attribute |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Target name |
|
string |
yes |
The Sphinx |
|
label |
yes |
Bazel target whose output files are searched |
|
string |
yes |
Substring used to identify the relevant output file within |
Provides: FilteredExecpathInfo — carries flag, resolved_path, and the combined arg string (flag=resolved_path). Consumed via sphinx_module.extra_opts_targets.
Artifact Rules
All artifact rules produce a SphinxSourcesInfo provider (documentation page)
and carry typed traceability information for downstream structural rules.
assumed_system_requirements
System-level requirements that the SEooC receives from its operational context. These are too broad to be assigned to a single component.
assumed_system_requirements(
name = "sys_req",
srcs = ["docs/assumed_system_requirements.trlc"],
)
Attribute |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Target name |
|
label list |
yes |
|
|
label list |
no |
Reserved for consistency; unused at root level (default |
|
label list |
no |
Image/diagram files ( |
|
— |
no |
Bazel visibility (default |
Generated targets: <name> (documentation), <name>_test (TRLC syntax/type validation)
feature_requirements
High-level requirements derived from AssumedSystemReq. Operate at the
integration level; can only be satisfied by multiple components working together.
feature_requirements(
name = "features",
srcs = ["docs/features.trlc"],
deps = [":sys_req"],
)
Attribute |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Target name |
|
label list |
yes |
|
|
label list |
no |
|
|
label list |
no |
Image/diagram files ( |
|
— |
no |
Bazel visibility (default |
Generated targets: <name> (documentation), <name>_test (TRLC validation including cross-reference checks)
component_requirements
Requirements assigned to exactly one component; directly implementable and testable within that component.
component_requirements(
name = "comp_req",
srcs = ["docs/requirements.trlc"],
deps = [":features"],
)
Attribute |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Target name |
|
label list |
yes |
|
|
label list |
no |
|
|
label list |
no |
Image/diagram files ( |
|
— |
no |
Bazel visibility (default |
Generated targets: <name> (documentation), <name>_test (TRLC validation)
A CompReq record’s derived_from field (CompReqSourceId) may also
reference an AoU received from another dependable element, alongside its usual
FeatReq/AssumedSystemReq references (e.g. [SampleType.SampleAoU@1]).
The element’s own AoUs are never a derived_from source. This requires
importing the AoU’s package and listing the
assumptions_of_use target that defines it directly in this target’s
deps — see Assumptions of Use.
assumptions_of_use
Conditions that the integrating project must fulfil when using this SEooC.
assumptions_of_use(
name = "aous",
srcs = ["docs/assumptions.trlc"],
)
Attribute |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Target name |
|
label list |
yes |
|
|
label list |
no |
Other requirement targets ( |
|
string |
no |
TRLC package prefix used for |
|
label |
no |
Advanced: override the Lobster YAML configuration for AoU traceability extraction (default: built-in S-CORE AoU config) |
|
— |
no |
Bazel visibility |
Generated targets: <name> (documentation), <name>_test (TRLC validation)
glossary
Collects glossary pages for Sphinx and forwards them to downstream
documentation assembly (for example through dependable_element).
glossary(
name = "project_glossary",
srcs = ["docs/glossary.rst"],
)
Example glossary source (.rst):
Glossary
========
.. glossary::
integrity level
ASIL rating (QM, A, B, C, D) indicating required safety rigor.
component
Software unit with defined interfaces, implementation, and tests.
Attribute |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Target name |
|
label list |
yes |
|
|
— |
no |
Bazel visibility |
Generated targets: <name> (documentation; no standalone test)
architectural_design
Bundles static, dynamic, public-API, and internal-API architecture views into a
single target. Provides ArchitecturalDesignInfo consumed by dependable_element
and safety_analysis.
architectural_design(
name = "arch",
static = ["docs/static_design.puml"],
dynamic = ["docs/sequence.puml"],
public_api = ["docs/public_api.puml"],
internal_api = ["docs/internal_api.puml"],
)
Attribute |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Target name |
|
label list |
no |
Static-view files – component/package diagrams only ( |
|
label list |
no |
Dynamic-view files; several sequence diagrams share a participant cast (see Multiple files in the other views) (default |
|
label list |
no |
Public-API diagram files ( |
|
label list |
no |
Internal-API diagram files ( |
|
string |
no |
|
|
— |
no |
Bazel visibility |
Generated targets: <name> (provides ArchitecturalDesignInfo; no standalone test — consistency is validated as part of bazel test //pkg:my_element)
Multiple static PlantUML files
static accepts more than one .puml file, all component diagrams. This
is intended for splitting a large architecture into a boundary overview
diagram (the SEooC and its public interfaces only) and one or more detail
diagrams that elaborate the internals, without repeating every relation and
nested entity in both places. (Class diagrams are never allowed in static
– put them in the elaborating unit’s own unit_design(static=[...])
instead.)
All .puml files passed to static are resolved
together, in one pass, instead of one file at a time — see
ComponentResolver::resolve_group. Once every file’s elements are known,
they’re merged by entity id (the full dot-path of parent names). Rules for
resolution and the merge:
Implicit reparenting: a top-level element with a body in one file that has the same name, element type and stereotype as a nested declaration in exactly one other file is implicitly reparented onto that declaration’s parent chain, instead of becoming a new top-level entity. Matching is by name, so the files may use different aliases for the same entity. This is what lets a detail file declare only a component’s children (no wrapper) while an overview file nests that same component under the SEooC boundary. A bodyless element (
component Xwithout{ ... }) and a rooted name (::X) are never reparented; they stay separate top-level entities. Reparenting is transitive: if the parent itself needs reparenting, that is resolved first (a cycle is anImplicitParentCycleerror). Matching nested declarations under more than one distinct parent is anAmbiguousImplicitParenterror rather than an arbitrary guess.A relation’s source must be declared (or reparented) in the file that writes it; only its target may resolve to another file in the same
staticgroup, written as the declaring file writes it (its alias, else its name). The group is consulted only when the target isn’t found locally; more than one other file resolving it is anAmbiguousReferenceerror. Referencing a source that isn’t local is aCrossFileRelationSourceerror – unless the relation is undirected (no arrowhead and no dependency-style decoration), in which case the two sides are swapped instead of erroring (the locally-declared endpoint becomes the source), since an undirected relation has no inherent direction to violate.Re-declaring the same entity (identical id) in more than one file is allowed as long as its
stereotypeand element type agree across files; their relations are unioned (duplicate relations are de-duplicated). This is what lets an overview file bare-declare a component or unit that a detail file elaborates further (whether by literally repeating the wrapper, or implicitly via reparenting above).Re-declaring the same id with a conflicting
stereotypeor element type across files is an error.A parent whose children are declared across more than one file is only allowed if a single file contains the full set of children (i.e. one file is the “home” file and the others only add a benign subset); if the children are genuinely split with no file containing all of them, this is reported as an error.
Re-nesting an entity under a different parent in another file is not detected as a same-entity conflict, because the id encodes the parent chain — a different parent means a different id, hence a different entity. Such “wrong nesting” mistakes are instead caught by the existing Bazel-vs-diagram comparison (an entity nested under the wrong parent shows up as an extra/missing entry there).
Multiple files in the other views
Every view (static, dynamic, public_api, internal_api; for
unit_design static and dynamic) is resolved as one group per
view: ids are shared inside a view, never across views. The files of a view
are split by diagram kind first (component, class, sequence, activity); a group
never mixes kinds. static of architectural_design is component-only.
The kind is detected per file, in the order component, activity, class,
sequence. Give each file a construct of its own kind: class (or a body with
members) for class diagrams, participant or activate for sequence
diagrams. package p { interface I } and a file of only a -> b : call()
are component diagrams.
Class diagrams (
public_api,internal_api,unit_designstatic): same implicit reparenting and peer references as the component rules above. A declaration without a body is a reference. Re-declaring one id merges the declarations: a bodyless one merges into the one with a body (members, type aliases or enum literals; relationships do not count and are united); two bodies areclass "<id>" is defined more than once; a different type or stereotype is a conflict. A namespace is defined only in files that own a defined child.Sequence diagrams (
dynamic,unit_designdynamic): no reparenting. A message endpoint orcreatetarget that the file does not declare resolves to the explicitparticipantdeclarations of the other files of the view, by alias, else by name. A local declaration wins; distinct uids from several files areAmbiguousParticipantReference.activate/deactivate/destroyandref overstay file-local.Activity diagrams carry no names and are independent per file.
See plantuml/parser/docs/element-identifiers.md (section 4) for examples.
unit_design
Attaches code-level design diagrams to a unit target. Accepts the same
file types as architectural_design but scoped to a single unit’s internal
implementation.
unit_design(
name = "my_unit_design",
static = ["class_diagram.rst", "class_diagram.puml"],
dynamic = ["sequence_diagram.puml"],
)
Attribute |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Target name |
|
label list |
no |
Static-view files (class diagrams, data-structure diagrams). When an |
|
label list |
no |
Dynamic-view files (sequence, state diagrams). Sequence diagrams resolve as one group; a shared cast file declares the participants, scenario files reference them (default |
|
— |
no |
Bazel visibility |
Generated targets: <name> (no standalone test; diagrams are consumed by the parent unit)
failure_modes
Stage 1 of the safety analysis: the FailureMode records. The
fault_trees diagrams reference them as tree top events (list the target in
fault_trees.deps); safety_analysis renders and traces them.
failure_modes(
name = "my_failure_modes",
srcs = ["docs/failure_modes.trlc"],
)
Attribute |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Target name |
|
label list |
yes |
|
|
label list |
no |
Targets providing |
|
label |
no |
lobster-trlc configuration for |
|
— |
no |
Bazel visibility |
Generated targets: <name>, <name>_test (TRLC validation)
fault_trees
Stage 2 of the safety analysis: the fault-tree root causes. Requirement
targets (assumptions_of_use, component_requirements) list it in
deps to reference the generated <fta_package>.<RootCause> records,
which breaks the dependency cycle between measures and analysis.
fault_trees(
name = "my_fault_trees",
srcs = ["docs/fta.puml"],
deps = [":my_failure_modes"],
)
Attribute |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Target name |
|
label list |
no |
FTA PlantUML diagram files ( |
|
label list |
no |
|
|
string |
no |
TRLC package name for the generated |
|
— |
no |
Bazel visibility |
Generated targets: <name> (generated fta_events.trlc and the root-cause lobster file; no standalone test)
safety_analysis
Stage 3 of the safety analysis: renders the FMEA page from the
failure_modes, a fault_trees target and the measures that address the
root causes.
safety_analysis(
name = "my_safety_analysis",
arch_design = ":arch",
failure_modes = [":my_failure_modes"],
fault_trees = ":my_fault_trees",
safety_measures = [":aous", "docs/mitigations.trlc"],
)
Attribute |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Target name |
|
label list |
no |
|
|
label |
yes |
|
|
label list |
no |
Measures addressing the root causes (default |
|
label |
yes |
|
|
— |
no |
Bazel visibility |
Generated targets: <name> (documentation; no standalone test — traceability validated via the parent dependability_analysis)
dependability_analysis
Wraps one or more safety_analysis targets into a complete safety-analysis package.
Running bazel test validates the full FMEA traceability chain.
dependability_analysis(
name = "analysis",
arch_design = ":my_arch",
safety_analysis = [":my_safety_analysis"],
)
Attribute |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Target name |
|
label list |
no |
|
|
label |
no |
Optional |
|
— |
no |
Bazel visibility |
Generated targets: <name> (build → documentation; bazel test //pkg:analysis → full FMEA traceability validation)
Structural Rules
unit
The smallest independently testable software element. Ties together
implementation targets, test targets, and an optional unit_design target.
The name must match the unit name used in the static architecture PlantUML
diagram.
unit(
name = "KeyValueStore",
unit_design = [":kvs_unit_design"],
implementation = [":kvs_lib"],
tests = [":kvs_unit_test"],
)
Attribute |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Target name; must match the |
|
string |
no |
Name to match against the static PlantUML diagram instead of |
|
label list |
yes |
|
|
label list |
yes |
Library or binary targets that implement this unit (e.g. |
|
label list |
yes |
Test targets that verify this unit (may be |
|
string list |
no |
Additional Bazel label strings, not already reachable through |
|
string |
no |
|
|
bool |
no |
If |
|
— |
no |
Bazel visibility |
Generated targets: <name> (provides UnitInfo; no standalone test — the listed tests run via bazel test //pkg:... directly)
component
Groups unit (and optionally nested component) targets into a logical
subsystem. Associates component-level requirements and integration tests.
The name must match the component name in the static architecture PlantUML
diagram.
component(
name = "KvsComponent",
requirements = [":comp_req"],
components = [":KeyValueStore", ":StorageBackend"],
tests = [],
)
Attribute |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Target name; must match the |
|
string |
no |
Name to match against the static PlantUML diagram instead of |
|
label list |
yes |
|
|
label list |
no |
Nested |
|
label list |
yes |
Integration test targets for the component as a whole (may be |
|
bool |
no |
If |
|
— |
no |
Bazel visibility |
Generated targets: <name> (provides ComponentInfo; no standalone test — the listed tests run via bazel test //pkg:... directly)
dependable_element
Assembles all process artefacts into a complete SEooC. Runs Sphinx to generate unified HTML documentation and enforces architecture consistency, traceability, and scope checks at build/test time.
dependable_element(
name = "my_seooc",
integrity_level = "B",
requirements = [":features"],
architectural_design = [":arch"],
dependability_analysis = [":analysis"],
components = [":kvs_component"],
tests = [],
)
Attribute |
Type |
Required |
Description |
|---|---|---|---|
|
string |
yes |
Target name; also becomes the SEooC documentation title |
|
string |
yes |
|
|
label list |
yes |
|
|
label list |
yes |
|
|
label list |
yes |
|
|
label list |
yes |
|
|
label list |
yes |
System-level test targets (may be |
|
label list |
no |
Additional |
|
label list |
no |
|
|
label list |
no |
Other |
|
label |
no |
Optional YAML file that selects which received AoUs to chain-forward to elements that depend on this one. Own AoUs (the forwarded_aous:
- aou_id: "Package.AOU_ID@1"
justification: >
Reason why this element cannot handle the AoU itself
and must forward it to its own integrators.
See requirements user guide for the full forwarding workflow. |
|
string |
no |
|
|
bool |
no |
If |
|
bool |
no |
If |
|
— |
no |
Bazel visibility |
Generated targets:
Target |
Purpose |
|---|---|
|
Main target: build runs Sphinx; |
|
Internal |
|
Internal artefact-collection and architecture-validation target |