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
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
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,35 @@ 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 enclosing dependable_element's auto-generated
"<name>_received_aous" target to be listed in the CompReq
target's deps, exposing exactly the AoUs this element owns or
receives without creating a dependency cycle back through the
element's own requirements. 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
10 changes: 10 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,14 @@ testable within that component.

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

A ``CompReq`` record's ``derived_from`` field (``CompReqSourceId``) may also
reference AoUs received by the enclosing ``dependable_element`` 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 enclosing ``dependable_element``'s
auto-generated ``<name>_received_aous`` target in this target's ``deps`` —
see :doc:`user_guide/assumptions_of_use`.

.. _rule-assumptions-of-use:

assumptions_of_use
Expand Down Expand Up @@ -815,3 +823,5 @@ and scope checks at build/test time.
- Internal ``sphinx_module`` target; usable as ``deps`` in other Sphinx builds
* - ``<name>_index``
- Internal artefact-collection and architecture-validation target
* - ``<name>_received_aous``
- Exposes this element's own + received AoUs as typed TRLC references; add to a ``component_requirements`` target's ``deps`` to reference them from ``derived_from`` (see :doc:`user_guide/assumptions_of_use`)
86 changes: 77 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,80 @@ 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 enclosing dependable element's ``<name>_received_aous`` target
(auto-generated by every ``dependable_element``) in the
``component_requirements`` target's ``deps``. This target exposes exactly
the AoUs this element owns or receives -- it deliberately has no
``requirements`` input, since a ``CompReq`` cannot depend on its own
dependable element's ``_index`` target without creating a cycle.

- 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"],
# A dependable_element defaults to testonly = True, so its
# auto-generated "..._received_aous" target is testonly too --
# any component_requirements depending on it needs testonly = True
# as well, or Bazel rejects the dependency at analysis time.
testonly = True,
deps = [
":feature_requirements",
"@seooc//:safety_software_seooc_example_received_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 +172,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
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 @@ -34,11 +34,13 @@ feature_requirements(

component_requirements(
name = "component_requirements",
testonly = True,
srcs = [
"component_requirements.trlc",
],
visibility = ["//visibility:public"],
deps = [
":feature_requirements",
"@seooc//:safety_software_seooc_example_received_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
6 changes: 0 additions & 6 deletions bazel/rules/rules_score/lobster/config/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ filegroup(
# for source file lists. Used by rules_score to generate per-target configs
# via ctx.actions.expand_template() — only the source paths vary.
# ---------------------------------------------------------------------------
filegroup(
name = "lobster_component_template",
srcs = ["lobster_component.conf.tpl"],
visibility = ["//visibility:public"],
)

filegroup(
name = "lobster_de_template",
srcs = ["lobster_de.conf.tpl"],
Expand Down

This file was deleted.

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