Skip to content
Merged
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
1 change: 1 addition & 0 deletions bazel/rules/rules_score/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ py_binary(
main = "src/aou_forwarding_to_lobster.py",
visibility = ["//visibility:public"],
deps = [
"@lobster//lobster/common",
requirement("pyyaml"),
],
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
' *******************************************************************************
' 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
' *******************************************************************************

@startuml aou_forwarding_one_seooc

' One SEooC receiving AoUs from its own deps, handling one locally, chain-
' forwarding another, and still contributing its own AoU untouched.

skinparam linetype ortho
skinparam ArrowFontSize 10
skinparam ArrowColor #555555
skinparam defaultTextAlignment center

skinparam rectangle {
BackgroundColor<<dep>> #E3F2FD
BorderColor<<dep>> #1565C0
BackgroundColor<<seooc>> #FFF8E1
BorderColor<<seooc>> #F9A825
BackgroundColor<<received>> #ECEFF1
BorderColor<<received>> #455A64
BackgroundColor<<handled>> #E8F5E9
BorderColor<<handled>> #2E7D32
BackgroundColor<<forwarded>> #FCE4EC
BorderColor<<forwarded>> #AD1457
}

rectangle "dependency_a\ndefines AoU_1" <<dep>> as dep_a
rectangle "dependency_b\ndefines AoU_2" <<dep>> as dep_b

rectangle "one_seooc" <<seooc>> as seooc {
rectangle "received AoUs\n(each dep's own_aou_trlc +\nall_received_trlc, merged)" <<received>> as received
rectangle "AoU_1 -- handled locally\n(CompReq.derived_from)" <<handled>> as handled
rectangle "AoU_2 -- chain-forwarded\n(aou_forwarding.yaml)" <<forwarded>> as forwarded
rectangle "own AoU_3\n(auto-forwarded)" <<forwarded>> as own

received --> handled
received --> forwarded
}

rectangle "dependee" <<dep>> as dependee

dep_a --> seooc : deps (defines AoU_1)
dep_b --> seooc : deps (defines AoU_2)
seooc --> dependee : deps\n(forwards AoU_2 + AoU_3)

@enduml
72 changes: 72 additions & 0 deletions bazel/rules/rules_score/docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,78 @@ lacks full up/down traceability.
"Root Causes" -> "Control Measures";
}

Execution Overview (Current Behavior)
-------------------------------------

The table below summarizes how checks are currently executed in practice
(build-time action/analysis-time check vs. test-time executable).

.. list-table::
:header-rows: 1
:widths: 26 16 58

* - Check
- Trigger
- Current execution path
* - Requirements validation (TRLC + model)
- test
- Executed by generated ``<requirements_target>_test`` targets
(``trlc_requirements_test``); not run implicitly by building only the
enclosing ``dependable_element`` target.
* - Architecture consistency
- build
- Validation actions run in ``architectural_design``, ``unit``, and
``dependable_element`` index assembly; build fails on violations
(or warns in ``maturity = "development"``).
* - Certified scope
- build
- Checked during dependable-element index analysis/assembly by traversing
transitive implementation dependencies against declared certified scopes.
* - Integrity level
- build
- Checked during dependable-element index analysis: a dependable element
must not depend on a lower-integrity dependable element.
* - Test case coverage lock
- build
- Per-component build action runs when the component provides
``test_case_coverage_lock`` metadata; compares current gtest traceability
view against committed lock state.
* - Traceability report generation
- build
- LOBSTER config/report/RST artifacts are generated during build whenever
traceability inputs are present.
* - Traceability enforcement (``lobster-ci-report``)
- test
- Executed by ``bazel test`` on the dependable-element test target, using
the pre-built LOBSTER report.
* - Unit test execution used as traceability input
- build
- Unit test executables are run during build to collect gtest XML that is
converted into test traceability artifacts.

Provider/log propagation used by dependable_element
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- ``ArchitecturalDesignInfo.validation_logs``: architectural-design validation
logs are forwarded and re-exposed under the dependable-element validation
output directory.
- ``UnitInfo.validation_log``: per-unit validation logs are forwarded and
symlinked into dependable-element outputs.
- ``ComponentTestCaseCoverageInfo``: presence of coverage-lock metadata on a
component enables the dependable-element-level coverage-lock build action.
- ``OutputGroupInfo(debug)``: dependable-element collects validation logs into a
debug output group, while still wiring required validation artifacts into
normal build outputs.

Notes
~~~~~

- ``dependable_element(tests = [...])`` is currently a documented attribute,
but is not used to execute additional tests by the dependable-element rule
implementation.
- ``component(tests = [...])`` is currently declared, while traceability input
generation is driven by nested ``unit`` test artifacts.


Quick Reference
---------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ section "Tool Requirements" {
The dependable_element rule shall automatically include lobster
traceability entries for all assumptions of use defined by its
direct dependencies in the dependee's traceability report as
a "Forwarded AoUs" tier.
a "Received AoUs" tier.
'''
mitigates = [AoU_Silently_Dropped]
derived_from = [Forward_AoU_To_Dependees]
Expand Down Expand Up @@ -162,12 +162,32 @@ section "Tool Requirements" {
satisfied_by = Tools.Bazel
}

ToolQualification.ToolRequirement Cover_Received_AoU_Via_Component_Requirement {
description = '''
The CompReq requirement type's derived_from field
(CompReqSourceId) shall accept versioned, typed cross-module
TRLC references to AoU records alongside its usual FeatReq/
AssumedSystemReq references. Resolving an AoU reference shall
require the defining assumptions_of_use target to be listed
directly in the CompReq target's deps. The dependable_element
rule shall convert such references to lobster trace references
resolved against the "Received AoUs" tier, so a component
requirement can cover a received AoU it handles locally without
requiring that AoU to be chain-forwarded.
'''
mitigates = [AoU_Silently_Dropped]
derived_from = [Forward_AoU_To_Dependees, Gate_Traceability_At_Test_Time]
satisfied_by = Tools.Lobster
}

ToolQualification.ToolRequirement Include_Forwarded_AoUs_In_Traceability {
description = '''
The lobster traceability report of a dependee shall include
forwarded AoUs as traceable items so that the existing
lobster-ci-report test fails when forwarded AoUs are not
handled (linked to a requirement, test, or justification).
The lobster traceability report of a dependable element shall
require every item in its "Received AoUs" tier to be covered
by at least one of: a component requirement (via
derived_from) or a chain-forwarding entry (via
aou_forwarding), so that the existing lobster-ci-report test
fails when a received AoU is neither handled nor forwarded.
'''
mitigates = [AoU_Silently_Dropped]
derived_from = [Forward_AoU_To_Dependees, Gate_Traceability_At_Test_Time]
Expand Down
7 changes: 7 additions & 0 deletions bazel/rules/rules_score/docs/rule_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,13 @@ testable within that component.

**Generated targets:** ``<name>`` (documentation), ``<name>_test`` (TRLC validation)

A ``CompReq`` record's ``derived_from`` field (``CompReqSourceId``) may also
reference an AoU that this requirement implements, alongside its usual
``FeatReq``/``AssumedSystemReq`` references (e.g. ``[SampleType.SampleAoU@1]``).
This requires importing the AoU's package and listing the
``assumptions_of_use`` target that defines it directly in this target's
``deps`` — see :doc:`user_guide/assumptions_of_use`.

.. _rule-assumptions-of-use:

assumptions_of_use
Expand Down
82 changes: 73 additions & 9 deletions bazel/rules/rules_score/docs/user_guide/assumptions_of_use.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ or risk that is mitigated when this assumption is fulfilled.

Traceability to requirements is established at the Bazel level via the ``deps``
attribute on the ``assumptions_of_use`` rule — there is no TRLC ``derived_from``
or ``satisfies`` field on ``AoU``.
or ``satisfies`` field on ``AoU`` itself. A dependent component requirement can,
however, declare that it implements a received AoU by referencing it from its own
``derived_from`` field (see `AoU Forwarding`_ below).

.. code-block:: text
:caption: examples/seooc/docs/aous.trlc
Expand Down Expand Up @@ -83,15 +85,76 @@ is forwarded rather than handled locally:
calls to the library do not exceed the 10ms cycle time constraint
imposed by the underlying other_seooc dependency.

**Handling forwarded AoUs in the dependee**
Forwarded AoUs appear as a "Forwarded AoUs" tier in the dependee's lobster
traceability report. The dependee must handle each forwarded AoU by one of:
**Handling AoUs received in the dependee**
Every AoU a dependable element receives appears as
an item in a "Received AoUs" tier in the dependee's lobster traceability
report. Each received AoU must be covered by exactly one of:

- **Handling it locally**: a component requirement's ``derived_from`` field
references the AoU it implements (see below). This shows up as "Component
Requirements" coverage in the report.
- **Chain-forwarding it further** (with justification) via ``aou_forwarding``,
to be handled by this element's own dependees instead. This shows up as
"Forwarded AoUs" coverage in the report.

If a received AoU is neither handled nor forwarded, the ``bazel test``
traceability check fails.

A single dependable element can do all three at once — receive AoUs from its
own dependencies, handle some of them locally, chain-forward the rest, and
still contribute its own AoUs to the mix:

.. uml:: ../_assets/aou_forwarding_one_seooc.puml

**Handling a received AoU with a component requirement**
Add a typed, versioned reference to the AoU (``Package.RecordName@version``,
matching the upstream ``AoU`` TRLC record) to the ``derived_from`` field of
the ``CompReq`` that implements it, alongside any ``FeatReq``/
``AssumedSystemReq`` references — all three item kinds share the same field.
Two things are required for the reference to resolve:

1. ``import`` the AoU's package, same as any other TRLC cross-reference.
2. List the ``assumptions_of_use`` target that defines (or, for a received/
forwarded AoU, originally defined) the record in the
``component_requirements`` target's ``deps``. This target provides
TrlcProviderInfo, so it can be listed directly -- no intermediate wrapper
is needed.

- Linking it to a component requirement that addresses the assumption
- Linking it to a test that verifies the assumption is met
- Chain-forwarding it further (with justification) to its own dependees
.. code-block:: text
:caption: examples/integrator/docs/requirements/component_requirements.trlc

package IntegratorComponent

import ScoreReq
import Integrator
import SampleType

ScoreReq.CompReq COMP_INT_001 {
description = "The startup module shall call the SEooC initialization routine before entering the main loop"
safety = ScoreReq.Asil.B
derived_from = [Integrator.FEAT_INT_001@1, SampleType.SampleAoU@1]
version = 1
}

.. code-block:: starlark
:caption: examples/integrator/docs/requirements/BUILD

component_requirements(
name = "component_requirements",
srcs = ["component_requirements.trlc"],
testonly = True,
deps = [
":feature_requirements",
"@seooc//docs:sample_aous",
"@some_other_library//:other_library_aous",
],
)

If a forwarded AoU is not handled, the ``bazel test`` traceability check will fail.
Being a real TRLC reference, an AoU entry in ``derived_from`` is resolved (and
a typo or an AoU this element does not actually receive is rejected) by the
TRLC parser itself at build time, not by a later lobster-report matching step
-- while the resulting lobster item is still tagged and traced exactly as
before, so the coverage report is unaffected.

**Example: three-level forwarding chain** (the real working code for this
example lives in ``examples/some_other_library``, ``examples/seooc``, and
Expand All @@ -105,7 +168,8 @@ example lives in ``examples/some_other_library``, ``examples/seooc``, and
→ chain-forwards received TimingConstraint via aou_forwarding.yaml
↑ (deps)
integrator_seooc → receives SampleType.SampleAoU (auto-forwarded)
and OtherLibrary.TimingConstraint (chain-forwarded), must handle both
and OtherLibrary.TimingConstraint (chain-forwarded)
→ handles both locally via derived_from (no further dependees)

.. code-block:: starlark
:caption: examples/seooc/BUILD
Expand Down
4 changes: 2 additions & 2 deletions bazel/rules/rules_score/docs/user_guide/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ A *dependable element* is the top-level entity:
- Functional and safety requirements for this element
* - Assumptions of Use
- Conditions the integrating project must satisfy
* - Forwarded AoUs
- Assumptions of use received from dependencies that must be handled or forwarded further
* - Received AoUs
- Assumptions of use received from dependencies that must be handled locally or chain-forwarded further
* - Architectural Design
- Software Architectural Design in PlantUML
* - Software Units and Components
Expand Down
9 changes: 5 additions & 4 deletions bazel/rules/rules_score/examples/integrator/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
#
# Example: System integrator SEooC that depends on safety_software_seooc_example.
#
# This illustrates the full AoU forwarding chain:
# This illustrates the full AoU forwarding chain, and the two ways a
# dependable element can cover an AoU it receives:
#
# other_seooc defines AoU: OtherLibrary.TimingConstraint
# ↑ (deps)
Expand All @@ -22,9 +23,9 @@
# - chain-forwards OtherLibrary.TimingConstraint via aou_forwarding.yaml
# ↑ (deps)
# integrator_seooc (this target)
# - receives SampleType.SampleAoU (auto-forwarded from seooc)
# - receives OtherLibrary.TimingConstraint (chain-forwarded through seooc)
# - must handle both in its lobster traceability report
# - receives SampleType.SampleAoU (auto-forwarded from seooc)
# - receives OtherLibrary.TimingConstraint (chain-forwarded through seooc)
# - HANDLES both locally: COMP_INT_001 and COMP_INT_002
#

load(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,7 @@ component_requirements(
visibility = ["//visibility:public"],
deps = [
":feature_requirements",
"@seooc//docs:sample_aous",
"@some_other_library//:other_library_aous",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ package IntegratorComponent

import ScoreReq
import Integrator
import SampleType
import OtherLibrary

ScoreReq.CompReq COMP_INT_001 {
description = "The startup module shall call the SEooC initialization routine before entering the main loop"
safety = ScoreReq.Asil.B
derived_from = [Integrator.FEAT_INT_001@1]
derived_from = [Integrator.FEAT_INT_001@1, SampleType.SampleAoU@1]
version = 1
}

ScoreReq.CompReq COMP_INT_002 {
description = "The cyclic task shall invoke the validation interface every 10ms using a hardware timer interrupt"
description = "The cyclic task shall invoke the validation interface every 10ms using a hardware timer interrupt, satisfying the underlying library's timing constraint"
safety = ScoreReq.Asil.B
derived_from = [Integrator.FEAT_INT_002@1]
derived_from = [Integrator.FEAT_INT_002@1, OtherLibrary.TimingConstraint@1]
version = 1
}

Expand Down
1 change: 1 addition & 0 deletions bazel/rules/rules_score/examples/seooc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ component(
"//docs/requirements:component_requirements",
"//docs/requirements:component_requirements_extra",
"//docs/requirements:component_requirements_sub",
"//docs/requirements:feature_requirements",
],
tags = ["manual"],
test_case_coverage_lock = "test_case_coverage.lock.yaml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ architectural_design(
assumptions_of_use(
name = "other_library_aous",
srcs = ["aous.trlc"],
visibility = ["//visibility:public"],
)

unit(
Expand Down
2 changes: 2 additions & 0 deletions bazel/rules/rules_score/lobster/config/lobster_de.conf.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{FEAT_REQ_BLOCK}

{RECEIVED_AOU_BLOCK}

{FORWARDED_AOU_BLOCK}

{COMP_REQ_BLOCK}
Expand Down
Loading
Loading