Skip to content

Commit bff44df

Browse files
authored
Update Tracing Policy of safety analysis (#174)
* [rules_score] update tracing policy in safety analysis * fix the ci
1 parent ef7659a commit bff44df

10 files changed

Lines changed: 61 additions & 19 deletions

File tree

.bazelignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
114
python_basics/integration_tests
215
starpls/integration_tests

.bazelrc.ai_checker

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
114
###############################################################################
215
## GitHub Copilot SDK - Environment (config:copilot)
316
###############################################################################

.pre-commit-config.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ repos:
2222
- id: check-executables-have-shebangs
2323
- id: check-added-large-files
2424
args: [--maxkb=100, --enforce-all] # increase or add git lfs if too strict
25-
exclude: org.eclipse.dash.licenses-1.1.0.jar|blanket_index.html$
25+
exclude: org.eclipse.dash.licenses-1.1.0.jar|blanket_index.html
2626
- repo: https://github.com/google/yamlfmt
2727
rev: 21ca5323a9c87ee37a434e0ca908efc0a89daa07 # v0.21.0
2828
hooks:
@@ -31,15 +31,14 @@ repos:
3131
rev: a1bb792acda6fd0724936b4ebbdbc8eceb9c0459 # v6.2.0
3232
hooks:
3333
- id: reuse-lint-file
34-
exclude: \.svg$
34+
exclude: \.(svg|tpl|txt|conf|lock|json|in)$
3535
- repo: local
3636
hooks:
3737
- id: copyright
3838
name: Check and fix copyright headers with cr_checker
39-
entry: cr_checker/tool/pre-commit_wrapper --extensions h hpp c cpp rs rst py sh bzl ini yml yaml BUILD bazel --fix
40-
exclude: \.svg$
39+
entry: cr_checker/tool/pre-commit_wrapper --extensions h hpp c cpp rs rst py sh bzl ini yml yaml trlc rsl puml svg BUILD bazel --fix
4140
# this would be the better language implementation, but struggle with python tooling
4241
# language: python
4342
language: script
4443
minimum_pre_commit_version: 3.2.0
45-
types_or: [python, yaml, ini, rst, sh, shell, bash, bazel, c, c++, rust]
44+
types_or: [python, yaml, ini, rst, sh, shell, bash, bazel, c, c++, rust, plantuml, svg]

.pre-commit-hooks.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
# *******************************************************************************
1313
- id: copyright
1414
name: Check and fix copyright headers with cr_checker
15-
entry: cr_checker/tool/pre-commit_wrapper --extensions h hpp c cpp rs rst py sh bzl ini yml yaml BUILD bazel --fix
15+
entry: cr_checker/tool/pre-commit_wrapper --extensions h hpp c cpp rs rst py sh bzl ini yml yaml trlc rsl puml svg BUILD bazel --fix
1616
# this would be the better language implementation, but struggle with python tooling
1717
# language: python
1818
language: script
1919
minimum_pre_commit_version: 3.2.0
20-
types_or: [python, yaml, ini, rst, sh, shell, bash, bazel, c, c++, rust]
20+
types_or: [python, yaml, ini, rst, sh, shell, bash, bazel, c, c++, rust, plantuml, svg]

bazel/rules/rules_score/examples/seooc/safety_analysis/assets/safety_analysis.puml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ object "Failure Mode" as FailureMode
3434
object "Root Cause" as RootCause
3535
object "Safety Goal" as SafetyGoal
3636
object "Measure" as Measure
37+
object "Control Measure" as ControlMeasure
3738
object "Assumption of Use\n(AoU)" as AoU
3839

3940
SafetyAnalysis <|-l- FMEA
@@ -49,8 +50,10 @@ SEooC "1" o-- "n" AoU
4950
FMEA ..> FailureMode : determine
5051
FTA ..> RootCause : determine
5152

52-
Measure <|-u- AoU
53-
RootCause <-l- Measure : mitigates
53+
Measure <|-- ControlMeasure
54+
Measure <|-- AoU
55+
RootCause <-l- ControlMeasure : same ID
56+
RootCause <-l- AoU : mitigates
5457

5558

5659

bazel/rules/rules_score/examples/seooc/safety_analysis/safety_analysis.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,26 @@ $BasicEvent("No More Coffee", "SampleLibrary.NoMoreCoffee", "AG2")
105105
![FTA Example](assets/fta_example.svg)
106106

107107
## Control Measures
108-
For each BasicEvent a Control Measure shall be derived. This will be performed again in TRLC. The Mapping between PlantUML and TRLC will be done again based on the ID. So for our case we will define a Control Measure for NoMoreCookies:
108+
For each BasicEvent a Control Measure shall be derived. This will be performed again in TRLC. The mapping between the FTA BasicEvent and the ControlMeasure is established by **using the same TRLC ID**: the `ControlMeasure` record name (combined with its package) must match the alias of the `$BasicEvent` in the FTA diagram.
109+
110+
For our case the BasicEvent is defined as:
111+
112+
```plantuml
113+
$BasicEvent("No More Cookies", "SampleLibrary.NoMoreCookies", "AG2")
114+
```
115+
116+
The corresponding ControlMeasure must therefore be named `NoMoreCookies` in package `SampleLibrary`:
109117

110118
```trlc
111-
ScoreReq.ControlMeasure SampleAoU{
119+
ScoreReq.ControlMeasure NoMoreCookies{
112120
safety = ScoreReq.Asil.B
113121
description = "We shall only order family size cookie jars"
114122
version = 1
115-
mitigates = "SampleLibrary.NoMoreCookies"
116123
}
117-
118124
```
119125

126+
The traceability link is established automatically via matching of the fully-qualified name `SampleLibrary.NoMoreCookies`.
127+
120128
## Traceability Report
121129

122130
The `dependability_analysis` rule wrapping the `fmea` target is a Bazel test rule that runs a [lobster](https://github.com/bmw-software-engineering/lobster) traceability report via `lobster-ci-report`.

bazel/rules/rules_score/examples/seooc/safety_analysis/sample_fmea_control_measures.trlc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,16 @@ ScoreReq.ControlMeasure JustBadLuck{
1818
safety = ScoreReq.Asil.B
1919
description = "Sometimes, the dark side wins. We shall be prepared for that."
2020
version = 1
21-
mitigates = "SampleLibrary.JustBadLuck"
2221
}
2322

2423
ScoreReq.ControlMeasure NoMoreCookies{
2524
safety = ScoreReq.Asil.B
2625
description = "We shall only order family size cookie jars"
2726
version = 1
28-
mitigates = "SampleLibrary.NoMoreCookies"
2927
}
3028

3129
ScoreReq.ControlMeasure NoMoreCoffee{
3230
safety = ScoreReq.Asil.B
3331
description = "We shall keep a coffee reserve for emergencies"
3432
version = 1
35-
mitigates = "SampleLibrary.NoMoreCoffee"
3633
}

bazel/rules/rules_score/trlc/config/score_requirements_model.rsl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,20 @@ type FailureMode extends ScoreReq.RequirementSafety {
104104
interface optional String
105105
}
106106

107-
type ControlMeasure extends ScoreReq.RequirementSafety {
108-
mitigates optional String
107+
abstract type Measure extends ScoreReq.RequirementSafety {
108+
}
109+
110+
type ControlMeasure extends Measure {
111+
}
112+
113+
type PreventiveMeasure extends Measure {
114+
}
115+
116+
type Mitigation extends Measure {
109117
}
110118

111119
type AoU extends ControlMeasure {
120+
mitigates optional String
112121
}
113122

114123
///////////////////////////////

cr_checker/tests/test_cr_checker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
13+
1314
# unit tests for the shebang handling in the cr_checker module
1415
from __future__ import annotations
1516

lobster_bazel/parse_source_files.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python3
21
# *******************************************************************************
32
# Copyright (c) 2026 Contributors to the Eclipse Foundation
43
#

0 commit comments

Comments
 (0)