From cc082d6f5c9974c1e98ff51bb213d94dfe82c028 Mon Sep 17 00:00:00 2001 From: Naveena Panne Date: Mon, 2 Nov 2026 16:33:23 +0530 Subject: [PATCH 1/2] Requirement traceability is added to component example --- BUILD | 2 +- MODULE.bazel | 2 +- .../docs/architecture_modeling_example.rst | 21 +++++++++++++--- score/component_example/BUILD | 1 + score/component_example/docs/index.rst | 20 +++++++--------- .../docs/requirements/requirements.rst | 24 +++++++++---------- .../src/component_example.cpp | 1 + .../tests/component_example_test.cpp | 5 ++++ 8 files changed, 47 insertions(+), 29 deletions(-) diff --git a/BUILD b/BUILD index 42507311d..973c66fa1 100644 --- a/BUILD +++ b/BUILD @@ -53,7 +53,7 @@ docs( "mount_at": "examples", }, ], - data = [ + external_needs = [ "@score_process_description//:needs_json", ], project = "Module Template Project", diff --git a/MODULE.bazel b/MODULE.bazel index b19c2ec3b..3f3c40337 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -69,7 +69,7 @@ register_toolchains("@llvm_toolchain//:all") # tooling bazel_dep(name = "score_tooling", version = "1.3.1", dev_dependency = True) -bazel_dep(name = "aspect_rules_lint", version = "2.3.0", dev_dependency = True) +bazel_dep(name = "aspect_rules_lint", version = "2.5.0", dev_dependency = True) bazel_dep(name = "buildifier_prebuilt", version = "8.5.1.2", dev_dependency = True) #docs-as-code diff --git a/examples/docs/architecture_modeling_example.rst b/examples/docs/architecture_modeling_example.rst index ee513a58b..98d7d3dd3 100644 --- a/examples/docs/architecture_modeling_example.rst +++ b/examples/docs/architecture_modeling_example.rst @@ -29,7 +29,7 @@ Feature Architecture File .. feat:: Feature 1 :id: feat__mtef :security: YES - :safety: QM + :safety: ASIL_B :status: valid :version: 1 @@ -38,7 +38,7 @@ Feature Architecture File .. feat_arc_sta:: Feature 1 Static View :id: feat_arc_sta__example_feature__sta :security: YES - :safety: QM + :safety: ASIL_B :status: valid :version: 1 :includes: logic_arc_int__example_feature__if_1, logic_arc_int__example_feature__if_2, logic_arc_int__example_feature__if_3 @@ -243,6 +243,7 @@ Feature or Component Architecture File(s) :version: 1 :implements: logic_arc_int__example_feature__if_1 :consists_of: comp__mod_temp_archex_sub_component_1, comp__mod_temp_archex_sub_component_2, comp__mod_temp_archex_sub_component_3 + :fulfils: aou_req__example_feature__example_req :belongs_to: feat__mtef Example Component 1 description. @@ -251,6 +252,7 @@ Feature or Component Architecture File(s) :id: comp__mod_temp_component_example_2 :security: YES :safety: ASIL_B + :fulfils: aou_req__example_feature__example_req :status: valid :version: 1 :implements: logic_arc_int__example_feature__if_2 @@ -291,6 +293,7 @@ Feature or Component Architecture File(s) :status: valid :version: 1 :safety: ASIL_B + :fulfils: aou_req__example_feature__example_req :security: NO :uses: logic_arc_int__example_feature__if_2 :implements: logic_arc_int__example_feature__if_1 @@ -306,6 +309,7 @@ Feature or Component Architecture File(s) :status: valid :version: 1 :safety: ASIL_B + :fulfils: aou_req__example_feature__example_req :security: NO :uses: logic_arc_int__example_feature__if_2 :implements: logic_arc_int__example_feature__if_2 @@ -321,6 +325,7 @@ Feature or Component Architecture File(s) :status: valid :version: 1 :safety: ASIL_B + :fulfils: aou_req__example_feature__example_req :security: NO :belongs_to: feat__mtef @@ -361,6 +366,16 @@ Requirements for the Example The feature shall provide the functionality to .... +.. aou_req:: Example Assumption of Use Req + :id: aou_req__example_feature__example_req + :reqtype: Process + :security: YES + :safety: ASIL_B + :status: valid + :version: 1 + + The Component User shall use the feature within its specified operating conditions. + .. comp_req:: Example Component Req :id: comp_req__example_feature__example_req :reqtype: Functional @@ -369,6 +384,6 @@ Requirements for the Example :derived_from: feat_req__example_feature__example_req :status: valid :version: 1 - :satisfied_by: comp__mod_temp_component_example_2 + :satisfied_by: comp__mod_temp_component_example_1, comp__mod_temp_component_example_2, comp__mod_temp_archex_sub_component_1, comp__mod_temp_archex_sub_component_2, comp__mod_temp_archex_sub_component_3 The component shall provide the Logical Operation 4 to get the .. diff --git a/score/component_example/BUILD b/score/component_example/BUILD index fac890c2d..d37f1a65e 100644 --- a/score/component_example/BUILD +++ b/score/component_example/BUILD @@ -45,6 +45,7 @@ docs_bundle( code_targets = [ ":component_example", ], + primary_need_id = "comp__mod_temp_component_name_template", source_dir = "docs", visibility = ["//visibility:public"], ) diff --git a/score/component_example/docs/index.rst b/score/component_example/docs/index.rst index 92d0adc58..68f5bb553 100644 --- a/score/component_example/docs/index.rst +++ b/score/component_example/docs/index.rst @@ -24,20 +24,18 @@ :status: draft :version: 1 :safety: ASIL_B - :security: YES + :security: NO :realizes: wp__cmpt_request :tags: template -.. code-block:: rst - - .. comp:: Component Name - :id: comp__mod_temp_component_name_template - :security: YES - :safety: ASIL_B - :status: valid - :implements: logic_arc_int__example_feature__if_1 - :version: 1 - :belongs_to: feat__mtef +.. comp:: Component Name + :id: comp__mod_temp_component_name_template + :security: YES + :safety: ASIL_B + :status: valid + :implements: logic_arc_int__example_feature__if_1 + :version: 1 + :belongs_to: feat__mtef .. attention:: The above directives must be updated according to your Component. diff --git a/score/component_example/docs/requirements/requirements.rst b/score/component_example/docs/requirements/requirements.rst index f626e4109..362776df2 100644 --- a/score/component_example/docs/requirements/requirements.rst +++ b/score/component_example/docs/requirements/requirements.rst @@ -38,21 +38,19 @@ Functional Requirements ----------------------- -.. code-block:: rst - - .. comp_req:: Some Title - :id: comp_req__mod_temp_component_name__some_title - :reqtype: Process - :security: YES - :safety: ASIL_B - :derived_from: feat_req__example_feature__example_req - :status: valid - :version: 1 - :satisfied_by: comp__mod_temp_component_name_template +.. comp_req:: Some Title + :id: comp_req__mod_temp_component_name__some_title + :reqtype: Process + :security: YES + :safety: ASIL_B + :derived_from: feat_req__example_feature__example_req + :status: valid + :version: 1 + :satisfied_by: comp__mod_temp_component_name_template - The Component shall do xyz to another component to bring it to this condition at this time + The Component shall do xyz to another component to bring it to this condition at this time - Note: (optional, not to be verified) + Note: (optional, not to be verified) .. attention:: The above directive must be updated according to your component requirements. diff --git a/score/component_example/src/component_example.cpp b/score/component_example/src/component_example.cpp index a7e542d2e..24f0efd74 100644 --- a/score/component_example/src/component_example.cpp +++ b/score/component_example/src/component_example.cpp @@ -20,6 +20,7 @@ std::string make_hello() { return "Hello"; } +// req-traceability: comp_req__mod_temp_component_name__some_title std::string make_hello_message(const std::string& name) { return make_hello() + ", " + name + "!"; } diff --git a/score/component_example/tests/component_example_test.cpp b/score/component_example/tests/component_example_test.cpp index ba6ebcf06..290a08d27 100644 --- a/score/component_example/tests/component_example_test.cpp +++ b/score/component_example/tests/component_example_test.cpp @@ -21,6 +21,11 @@ namespace component_example { // Component Integration Test (CIT) for component_example component. TEST(ComponentExampleTest, MakeHelloMessageReturnsExpectedGreeting) { + RecordProperty("PartiallyVerifies", "comp_req__mod_temp_component_name__some_title"); + RecordProperty("TestType", "requirements-based"); + RecordProperty("DerivationTechnique", "requirements-analysis"); + RecordProperty("Description", "Verify make_hello_message returns the greeting for each name."); + EXPECT_EQ(make_hello_message("World"), "Hello, World!"); EXPECT_EQ(make_hello_message("SCORE"), "Hello, SCORE!"); } From 1606adaed2d80c6cd657b2e163f44fcd10a59480 Mon Sep 17 00:00:00 2001 From: naveena Date: Wed, 11 Nov 2026 11:02:52 +0530 Subject: [PATCH 2/2] fix: restrict satisfied_by to Interface 2 components and align requirement with greeting test --- examples/docs/architecture_modeling_example.rst | 2 +- score/component_example/docs/requirements/requirements.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/docs/architecture_modeling_example.rst b/examples/docs/architecture_modeling_example.rst index 98d7d3dd3..991a86a1a 100644 --- a/examples/docs/architecture_modeling_example.rst +++ b/examples/docs/architecture_modeling_example.rst @@ -384,6 +384,6 @@ Requirements for the Example :derived_from: feat_req__example_feature__example_req :status: valid :version: 1 - :satisfied_by: comp__mod_temp_component_example_1, comp__mod_temp_component_example_2, comp__mod_temp_archex_sub_component_1, comp__mod_temp_archex_sub_component_2, comp__mod_temp_archex_sub_component_3 + :satisfied_by: comp__mod_temp_component_example_2, comp__mod_temp_archex_sub_component_2 The component shall provide the Logical Operation 4 to get the .. diff --git a/score/component_example/docs/requirements/requirements.rst b/score/component_example/docs/requirements/requirements.rst index 362776df2..b57850f27 100644 --- a/score/component_example/docs/requirements/requirements.rst +++ b/score/component_example/docs/requirements/requirements.rst @@ -40,7 +40,7 @@ Functional Requirements .. comp_req:: Some Title :id: comp_req__mod_temp_component_name__some_title - :reqtype: Process + :reqtype: Functional :security: YES :safety: ASIL_B :derived_from: feat_req__example_feature__example_req @@ -48,7 +48,7 @@ Functional Requirements :version: 1 :satisfied_by: comp__mod_temp_component_name_template - The Component shall do xyz to another component to bring it to this condition at this time + The component shall return the greeting "Hello, !" for a given name through make_hello_message. Note: (optional, not to be verified)