From ea68e94538bc281363093385aa7eeb7e5fe0374e Mon Sep 17 00:00:00 2001 From: "Gueth Jan (ETAS-ECM/XPC-Fe6)" Date: Thu, 6 Nov 2025 13:49:08 +0100 Subject: [PATCH 1/2] Remove id prefixes for mega-build (DR-004-Infra) - Remove all PROCESS_ prefixes from requirements and related files. - Eliminate id_prefix from external needs configuration and code. - Update tests and extensions to work without prefix logic. - Make id_prefix handling optional in score_source_code_linker. Why: S-CORE requires bi-directional traceability for compliance (see gd_req__req_traceability). Previously, modules used prefixes for external needs, but this breaks integration when building a single, unified documentation site ("mega-build"). This change implements "Option S: Single documentation build" from decision record DR-004-Infra: Bi-directional traceability in docs (https://eclipse-score.github.io/score/main/design_decisions/DR-004-infra.html). Option S was chosen because it enables quick integration and unified navigation, even though it results in longer build times and requires dropping prefixes. Since our id schemas already provide namespacing, removing prefixes does not risk id clashes. This refactoring aligns with the decision to prioritize integration speed and documentation consistency for releases. --- docs/requirements/process_overview.rst | 2 +- docs/requirements/requirements.rst | 164 +++++++++--------- .../score_metamodel/external_needs.py | 7 - .../test_attributes_external_prefix.rst | 15 +- .../rst/attributes/test_prohibited_words.rst | 2 +- .../score_metamodel/tests/rst/conf.py | 1 - .../score_source_code_linker/__init__.py | 3 +- 7 files changed, 94 insertions(+), 100 deletions(-) diff --git a/docs/requirements/process_overview.rst b/docs/requirements/process_overview.rst index 488411c6..93962313 100644 --- a/docs/requirements/process_overview.rst +++ b/docs/requirements/process_overview.rst @@ -18,7 +18,7 @@ The following table lists tool requirements from our process which are not satis results = [] for need in needs.filter_types(["gd_req"]): - if not need["id"].startswith("PROCESS_gd_req__tool_"): + if not need["id"].startswith("gd_req__tool_"): continue if len(need["satisfies_back"]) >= 1: continue diff --git a/docs/requirements/requirements.rst b/docs/requirements/requirements.rst index 6aa19ddb..1ded7531 100644 --- a/docs/requirements/requirements.rst +++ b/docs/requirements/requirements.rst @@ -56,10 +56,10 @@ This section provides an overview of current process requirements and their clar :implemented: YES :tags: Common Attributes :satisfies: - PROCESS_gd_req__req_attr_uid, - PROCESS_gd_req__tool_attr_uid, - PROCESS_gd_req__arch_attribute_uid, - PROCESS_gd_req__saf_attr_uid, + gd_req__req_attr_uid, + gd_req__tool_attr_uid, + gd_req__arch_attribute_uid, + gd_req__saf_attr_uid, :parent_covered: NO Docs-as-Code shall enforce that all Need IDs are globally unique across all included @@ -74,10 +74,10 @@ This section provides an overview of current process requirements and their clar :implemented: PARTIAL :tags: Common Attributes :satisfies: - PROCESS_gd_req__req_attr_uid, - PROCESS_gd_req__arch_attribute_uid, - PROCESS_gd_req__saf_attr_uid, - :parent_covered: NO: cannot check non-existent "doc__naming_conventions" in PROCESS_gd_req__req_attr_uid + gd_req__req_attr_uid, + gd_req__arch_attribute_uid, + gd_req__saf_attr_uid, + :parent_covered: NO: cannot check non-existent "doc__naming_conventions" in gd_req__req_attr_uid Docs-as-Code shall enforce that Need IDs follow the following naming scheme: @@ -98,8 +98,8 @@ This section provides an overview of current process requirements and their clar :implemented: YES :tags: Common Attributes :satisfies: - PROCESS_gd_req__req_attr_title, - PROCESS_gd_req__saf_attr_title, + gd_req__req_attr_title, + gd_req__saf_attr_title, :parent_covered: NO: Can not ensure summary Docs-as-Code shall enforce that all needs have titles and titles do not contain the following words: @@ -118,7 +118,7 @@ This section provides an overview of current process requirements and their clar :tags: Common Attributes :parent_covered: NO: Can not cover 'ISO/IEC/IEEE/29148' :implemented: YES - :satisfies: PROCESS_gd_req__req_attr_description + :satisfies: gd_req__req_attr_description Docs-as-Code shall enforce that each need of type :need:`tool_req__docs_req_types` has a description (content) @@ -128,7 +128,7 @@ This section provides an overview of current process requirements and their clar :tags: Common Attributes :implemented: YES :satisfies: - PROCESS_gd_req__req_desc_weak, + gd_req__req_desc_weak, :parent_covered: YES Docs-as-Code shall enforce that requirement descriptions do not contain the following weak words: @@ -150,8 +150,8 @@ This section provides an overview of current process requirements and their clar :implemented: YES :tags: Common Attributes :satisfies: - PROCESS_gd_req__req_attr_security, - PROCESS_gd_req__arch_attr_security, + gd_req__req_attr_security, + gd_req__arch_attr_security, Docs-as-Code shall enforce that the ``security`` attribute has one of the following values: @@ -176,8 +176,8 @@ This section provides an overview of current process requirements and their clar :implemented: YES :parent_covered: YES :satisfies: - PROCESS_gd_req__req_attr_safety, - PROCESS_gd_req__arch_attr_safety + gd_req__req_attr_safety, + gd_req__arch_attr_safety Docs-as-Code shall enforce that the ``safety`` attribute has one of the following values: @@ -202,9 +202,9 @@ This section provides an overview of current process requirements and their clar :implemented: YES :parent_covered: NO: gd_req__saf_attr_status has additional constraints :satisfies: - PROCESS_gd_req__req_attr_status, - PROCESS_gd_req__arch_attr_status, - PROCESS_gd_req__saf_attr_status, + gd_req__req_attr_status, + gd_req__arch_attr_status, + gd_req__saf_attr_status, Docs-as-Code shall enforce that the ``status`` attribute has one of the following values: @@ -228,7 +228,7 @@ Versioning :tags: Common Attributes :implemented: NO :parent_covered: NO: to be checked after demo - :satisfies: PROCESS_gd_req__req_attr_version + :satisfies: gd_req__req_attr_version Docs-As-Code shall enable and enforce a versioning attribute for all needs. @@ -242,7 +242,7 @@ Versioning :tags: Common Attributes :implemented: NO :parent_covered: NO: parent talks about setting covered to false, but we want to issue a build error. - :satisfies: PROCESS_gd_req__req_suspicious + :satisfies: gd_req__req_suspicious :status: invalid Docs-as-Code shall check if linked parent needs have different versions, compared to @@ -259,7 +259,7 @@ Versioning :tags: Documents :implemented: YES :parent_covered: YES - :satisfies: PROCESS_gd_req__doc_types + :satisfies: gd_req__doc_types Docs-as-Code shall support the following document types: @@ -272,9 +272,9 @@ Versioning :tags: Documents :implemented: NO :satisfies: - PROCESS_gd_req__doc_author, - PROCESS_gd_req__doc_approver, - PROCESS_gd_req__doc_reviewer, + gd_req__doc_author, + gd_req__doc_approver, + gd_req__doc_reviewer, :parent_covered: NO, process requirement has changed and we do not understand the new wording. :status: invalid @@ -290,7 +290,7 @@ Versioning :id: tool_req__docs_doc_attr_author_autofill :tags: Documents :implemented: NO - :satisfies: PROCESS_gd_req__doc_author + :satisfies: gd_req__doc_author :parent_covered: NO, process requirement has changed and we do not understand the new wording. :status: invalid @@ -308,7 +308,7 @@ Versioning :id: tool_req__docs_doc_attr_approver_autofill :tags: Documents :implemented: NO - :satisfies: PROCESS_gd_req__doc_approver + :satisfies: gd_req__doc_approver :parent_covered: NO, process requirement has changed and we do not understand the new wording. :status: invalid @@ -322,7 +322,7 @@ Versioning :id: tool_req__docs_doc_attr_reviewer_autofill :tags: Documents :implemented: NO - :satisfies: PROCESS_gd_req__doc_reviewer + :satisfies: gd_req__doc_reviewer :parent_covered: NO, process requirement has changed and we do not understand the new wording. :status: invalid @@ -340,7 +340,7 @@ Mapping :style: table :types: gd_req :columns: id;satisfies_back as "tool_req" - :filter: "PROCESS_gd_req__doc" in id + :filter: "gd_req__doc" in id πŸ“‹ Requirements @@ -354,7 +354,7 @@ Mapping :id: tool_req__docs_req_types :tags: Requirements :implemented: YES - :satisfies: PROCESS_gd_req__req_structure + :satisfies: gd_req__req_structure :parent_covered: YES: Together with tool_req__docs_linkage Docs-as-Code shall support the following requirement types: @@ -375,7 +375,7 @@ Mapping :tags: Requirements :implemented: YES :parent_covered: NO: Can not ensure correct reasoning - :satisfies: PROCESS_gd_req__req_attr_rationale + :satisfies: gd_req__req_attr_rationale Docs-as-Code shall enforce that each stakeholder requirement (stkh_req) contains a ``rationale`` attribute. @@ -383,7 +383,7 @@ Mapping :id: tool_req__docs_req_attr_reqtype :tags: Requirements :implemented: YES - :satisfies: PROCESS_gd_req__req_attr_type + :satisfies: gd_req__req_attr_type Docs-as-Code shall enforce that each need of type :need:`tool_req__docs_req_types` except process and tool requirements has a ``reqtype`` attribute with one of the @@ -398,7 +398,7 @@ Mapping :id: tool_req__docs_req_attr_reqcov :tags: Requirements :implemented: PARTIAL - :satisfies: PROCESS_gd_req__req_attr_req_cov + :satisfies: gd_req__req_attr_req_cov Docs as code shall shall enable marking requirements as covered by their linked children. @@ -414,7 +414,7 @@ Mapping :tags: Requirements :implemented: PARTIAL :parent_covered: YES - :satisfies: PROCESS_gd_req__req_attr_test_covered + :satisfies: gd_req__req_attr_test_covered :status: invalid Docs-As-Code shall allow for every need of type :need:`tool_req__docs_req_types` to @@ -432,7 +432,7 @@ Mapping :tags: Requirements :implemented: PARTIAL :parent_covered: YES - :satisfies: PROCESS_gd_req__req_validity + :satisfies: gd_req__req_validity :status: valid Docs-as-Code shall enforce that the ``valid_from`` and ``valid_until`` attributes of stakeholder and feature requirements are correct. @@ -445,7 +445,7 @@ Mapping :tags: Requirements :implemented: PARTIAL :parent_covered: YES - :satisfies: PROCESS_gd_req__req_validity + :satisfies: gd_req__req_validity :status: valid Docs-as-Code shall enforce that ``valid_from`` is before ``valid_until`` attribute in stakeholder and feature requirements. @@ -461,7 +461,7 @@ Mapping :id: tool_req__docs_req_link_satisfies_allowed :tags: Requirements :implemented: PARTIAL - :satisfies: PROCESS_gd_req__req_linkage, PROCESS_gd_req__req_traceability + :satisfies: gd_req__req_linkage, gd_req__req_traceability :parent_covered: YES :status: invalid @@ -490,7 +490,7 @@ Mapping :tags: Common Attributes :implemented: YES :parent_covered: YES - :satisfies: PROCESS_gd_req__req_linkage_safety + :satisfies: gd_req__req_linkage_safety QM requirements (safety == QM) shall not be linked to safety requirements (safety != QM) via the ``satisfies`` attribute. @@ -505,8 +505,8 @@ Mapping :id: tool_req__docs_arch_types :tags: Architecture :satisfies: - PROCESS_gd_req__arch_hierarchical_structure, - PROCESS_gd_req__arch_build_blocks, + gd_req__arch_hierarchical_structure, + gd_req__arch_build_blocks, :implemented: YES :parent_covered: NO :status: invalid @@ -528,8 +528,8 @@ Architecture Attributes :id: tool_req__docs_arch_attr_mandatory :tags: Architecture :satisfies: - PROCESS_gd_req__arch_attr_mandatory, - PROCESS_gd_req__arch_attr_fulfils, + gd_req__arch_attr_mandatory, + gd_req__arch_attr_fulfils, :implemented: PARTIAL :parent_covered: YES :parent_has_problem: YES: Metamodel & Process aren't the same. Some definitions are not consistent in Process @@ -553,10 +553,10 @@ Architecture Attributes :tags: Architecture :implemented: PARTIAL :satisfies: - PROCESS_gd_req__arch_linkage_requirement_type, - PROCESS_gd_req__arch_attr_fulfils, - PROCESS_gd_req__arch_traceability, - PROCESS_gd_req__req_linkage_fulfill + gd_req__arch_linkage_requirement_type, + gd_req__arch_attr_fulfils, + gd_req__arch_traceability, + gd_req__req_linkage_fulfill :parent_covered: YES Docs-as-Code shall enforce that linking via the ``fulfils`` attribute follows defined rules. @@ -582,7 +582,7 @@ Architecture Attributes :id: tool_req__docs_arch_link_safety_to_req :tags: Architecture :implemented: PARTIAL - :satisfies: PROCESS_gd_req__arch_linkage_requirement + :satisfies: gd_req__arch_linkage_requirement :parent_covered: YES Docs-as-Code shall enforce that architecture elements of type @@ -594,7 +594,7 @@ Architecture Attributes :id: tool_req__docs_arch_link_qm_to_safety_req :tags: Architecture :implemented: PARTIAL - :satisfies: PROCESS_gd_req__arch_linkage_requirement + :satisfies: gd_req__arch_linkage_requirement :parent_covered: YES Docs-as-Code shall enforce that architecture elements of type @@ -607,8 +607,8 @@ Architecture Attributes :tags: Architecture :implemented: PARTIAL :satisfies: - PROCESS_gd_req__arch_linkage_safety_trace, - PROCESS_gd_req__req_linkage_safety, + gd_req__arch_linkage_safety_trace, + gd_req__req_linkage_safety, :parent_covered: NO Docs-as-Code shall enforce that valid safety architectural elements (Safety != QM) can @@ -619,7 +619,7 @@ Architecture Attributes :tags: Architecture :implemented: NO :parent_covered: YES - :satisfies: PROCESS_gd_req__arch_linkage_security_trace + :satisfies: gd_req__arch_linkage_security_trace Docs-as-Code shall enforce that security relevant :need:`tool_req__docs_arch_types` (Security == YES) can only be linked against security relevant :need:`tool_req__docs_arch_types`. @@ -633,7 +633,7 @@ Architecture Attributes :tags: Architecture :implemented: YES :satisfies: - PROCESS_gd_req__arch_viewpoints, + gd_req__arch_viewpoints, :parent_covered: YES Docs-as-Code shall enable the rendering of diagrams for the following architecture views: @@ -663,8 +663,8 @@ Architecture Attributes :implemented: YES :parent_covered: NO: we only enable linking, we do not link :satisfies: - PROCESS_gd_req__req_attr_impl, - PROCESS_gd_req__impl_design_code_link, + gd_req__req_attr_impl, + gd_req__impl_design_code_link, Docs-as-Code shall allow source code to link to needs. @@ -678,12 +678,12 @@ Architecture Attributes :tags: Detailed Design & Code :implemented: NO :parent_covered: YES - :satisfies: PROCESS_gd_req__req_linkage_architecture_switch + :satisfies: gd_req__req_linkage_architecture_switch Docs-as-Code shall allow for a to-be-defined list of checks to be non-fatal for non release builds. These are typically better suited for metrics than for checks. - e.g. PROCESS_gd_req__req_linkage_architecture + e.g. gd_req__req_linkage_architecture .. tool_req:: Enable Creation of Dependency Graphs @@ -691,7 +691,7 @@ Architecture Attributes :tags: Detailed Design & Code :implemented: NO :parent_covered: YES - :satisfies: PROCESS_gd_req__impl_dependency_analysis + :satisfies: gd_req__impl_dependency_analysis :status: invalid Docs-As-Code shall support generation and rendering of dependency graphs for @@ -712,7 +712,7 @@ Testing :tags: Testing :implemented: PARTIAL :parent_covered: YES - :satisfies: PROCESS_gd_req__req_attr_testlink + :satisfies: gd_req__req_attr_testlink Docs-as-Code shall allow requirements of type :need:`tool_req__docs_req_types` to include a ``testlink`` attribute. @@ -725,7 +725,7 @@ Testing :tags: Testing :implemented: NO :parent_covered: NO - :satisfies: PROCESS_gd_req__verification_checks + :satisfies: gd_req__verification_checks Docs-as-Code shall ensure that each test case has TestType and DerivationTechnique set. @@ -734,7 +734,7 @@ Testing :tags: Testing :implemented: NO :parent_covered: NO - :satisfies: PROCESS_gd_req__verification_checks + :satisfies: gd_req__verification_checks :status: invalid Docs-as-Code shall ensure that each test case has a non empty description. @@ -746,7 +746,7 @@ Testing :tags: Testing :implemented: NO :parent_covered: NO - :satisfies: PROCESS_gd_req__verification_checks + :satisfies: gd_req__verification_checks :status: invalid Docs-as-Code shall ensure that test cases link to requirements on the correct level: @@ -766,7 +766,7 @@ Testing :tags: Tool Verification Reports :implemented: YES :parent_covered: YES - :satisfies: PROCESS_gd_req__tool_attr_safety_affected, PROCESS_gd_req__tool_check_mandatory + :satisfies: gd_req__tool_attr_safety_affected, gd_req__tool_check_mandatory Docs-as-Code shall enforce that every Tool Verification Report (`doc_tool`) includes a ``safety_affected`` attribute with one of the following values: @@ -779,7 +779,7 @@ Testing :tags: Tool Verification Reports :implemented: YES :parent_covered: YES - :satisfies: PROCESS_gd_req__tool_attr_security_affected, PROCESS_gd_req__tool_check_mandatory + :satisfies: gd_req__tool_attr_security_affected, gd_req__tool_check_mandatory Docs-as-Code shall enforce that every Tool Verification Report (`doc_tool`) includes a `security_affected` attribute with one of the following values: @@ -792,7 +792,7 @@ Testing :id: tool_req__docs_tvr_status :tags: Tool Verification Reports :implemented: YES - :satisfies: PROCESS_gd_req__tool_attr_status, PROCESS_gd_req__tool_check_mandatory + :satisfies: gd_req__tool_attr_status, gd_req__tool_check_mandatory :parent_covered: YES Docs-as-Code shall enforce that every Tool Verification Report (`doc_tool`) includes a @@ -835,8 +835,8 @@ Testing :implemented: NO :tags: Safety Analysis :satisfies: - PROCESS_gd_req__saf_structure, - PROCESS_gd_req__saf_attr_uid, + gd_req__saf_structure, + gd_req__saf_attr_uid, :parent_covered: YES Docs-As-Code shall support the following need types: @@ -852,9 +852,9 @@ Testing :implemented: NO :tags: Safety Analysis :satisfies: - PROCESS_gd_req__saf_attr_mitigated_by, - PROCESS_gd_req__saf_attr_requirements, - PROCESS_gd_req__saf_attr_requirements_check, + gd_req__saf_attr_mitigated_by, + gd_req__saf_attr_requirements, + gd_req__saf_attr_requirements_check, :parent_covered: YES Docs-As-Code shall enforce valid needs (`status` == `valid`) of type @@ -866,7 +866,7 @@ Testing :id: tool_req__docs_saf_attrs_mitigation_issue :implemented: NO :tags: Safety Analysis - :satisfies: PROCESS_gd_req__saf_attr_mitigation_issue + :satisfies: gd_req__saf_attr_mitigation_issue :parent_covered: NO Docs-As-Code shall allow needs of type :need:`tool_req__docs_saf_types` to have a @@ -877,7 +877,7 @@ Testing :id: tool_req__docs_saf_attrs_sufficient :implemented: NO :tags: Safety Analysis - :satisfies: PROCESS_gd_req__saf_attr_sufficient + :satisfies: gd_req__saf_attr_sufficient :parent_covered: YES Docs-As-Code shall enforce needs of type :need:`tool_req__docs_saf_types` to @@ -890,7 +890,7 @@ Testing :id: tool_req__docs_saf_attrs_sufficient_check :implemented: NO :tags: Safety Analysis - :satisfies: PROCESS_gd_req__saf_attr_sufficient + :satisfies: gd_req__saf_attr_sufficient :parent_covered: YES Docs-As-Code shall ensure needs of type :need:`tool_req__docs_saf_types` with @@ -901,7 +901,7 @@ Testing :id: tool_req__docs_saf_attrs_content :implemented: NO :tags: Safety Analysis - :satisfies: PROCESS_gd_req__saf_argument + :satisfies: gd_req__saf_argument :parent_covered: NO Docs-As-Code shall enforce needs of type :need:`tool_req__docs_saf_types` to have a @@ -914,8 +914,8 @@ Testing :implemented: NO :tags: Safety Analysis :satisfies: - PROCESS_gd_req__saf_linkage_check, - PROCESS_gd_req__saf_linkage, + gd_req__saf_linkage_check, + gd_req__saf_linkage, :parent_covered: YES Docs-As-Code shall enforce that needs of type :need:`tool_req__docs_saf_types` have a @@ -934,33 +934,33 @@ Testing :id: tool_req__docs_saf_attr_fmea_fault_id :implemented: NO :tags: Safety Analysis - :satisfies: PROCESS_gd_req__saf_attr_fault_id + :satisfies: gd_req__saf_attr_fault_id :parent_covered: NO Docs-As-Code shall enforce that needs of type DFA (see :need:`tool_req__docs_saf_types`) have a `fault_id` attribute. - Allowed values are listed as ID in tables at :need:`PROCESS_gd_guidl__dfa_failure_initiators`. + Allowed values are listed as ID in tables at :need:`gd_guidl__dfa_failure_initiators`. .. tool_req:: DFA: failure id attribute :id: tool_req__docs_saf_attr_dfa_failure_id :implemented: NO :tags: Safety Analysis - :satisfies: PROCESS_gd_req__saf_attr_failure_id + :satisfies: gd_req__saf_attr_failure_id :parent_covered: NO Docs-As-Code shall enforce that needs of type DFA (see :need:`tool_req__docs_saf_types`) have a `fault_id` attribute. - Allowed values are listed as ID in tables at :need:`PROCESS_gd_guidl__dfa_failure_initiators`. + Allowed values are listed as ID in tables at :need:`gd_guidl__dfa_failure_initiators`. .. tool_req:: Failure Effect :id: tool_req__docs_saf_attr_fmea_failure_effect :implemented: NO :tags: Safety Analysis - :satisfies: PROCESS_gd_req__saf_attr_feffect + :satisfies: gd_req__saf_attr_feffect :parent_covered: NO :status: invalid @@ -974,7 +974,7 @@ Mapping :style: table :types: gd_req :columns: id;satisfies_back as "tool_req" - :filter: "PROCESS_gd_req__saf" in id + :filter: "gd_req__saf" in id πŸ—ΊοΈ Full Mapping @@ -992,7 +992,7 @@ Overview of Tool to Process Requirements .. needtable:: :types: tool_req - :filter: any(s.startswith("PROCESS_gd_req") for s in satisfies) + :filter: any(s.startswith("gd_req") for s in satisfies) :columns: satisfies as "Process Requirement" ;id as "Tool Requirement";implemented;source_code_link :style: table diff --git a/src/extensions/score_metamodel/external_needs.py b/src/extensions/score_metamodel/external_needs.py index 9e0ecec8..d1bdd59c 100644 --- a/src/extensions/score_metamodel/external_needs.py +++ b/src/extensions/score_metamodel/external_needs.py @@ -183,18 +183,11 @@ def add_external_needs_json(e: ExternalNeedsSource, config: Config): assert isinstance(config.needs_external_needs, list) # pyright: ignore[reportUnknownMemberType] config.needs_external_needs.append( # pyright: ignore[reportUnknownMemberType] { - "id_prefix": needs_json_data["project_prefix"], "base_url": needs_json_data["project_url"] + "/main", # for now always "main" "json_path": json_file, } ) - # Making the prefixes uppercase here to match sphinx_needs, - # as it does this internally too. - assert isinstance(config.allowed_external_prefixes, list) # pyright: ignore[reportAny] - config.allowed_external_prefixes.append( # pyright: ignore[reportUnknownMemberType] - needs_json_data["project_prefix"].upper() # pyright: ignore[reportAny] - ) def connect_external_needs(app: Sphinx, config: Config): diff --git a/src/extensions/score_metamodel/tests/rst/attributes/test_attributes_external_prefix.rst b/src/extensions/score_metamodel/tests/rst/attributes/test_attributes_external_prefix.rst index a3df11b9..5ec9deeb 100644 --- a/src/extensions/score_metamodel/tests/rst/attributes/test_attributes_external_prefix.rst +++ b/src/extensions/score_metamodel/tests/rst/attributes/test_attributes_external_prefix.rst @@ -14,23 +14,24 @@ #CHECK: check_options -.. Cleaning of 'external prefix' before checking regex confirmity -#EXPECT-NOT tool_req__test_abcd.satisfies (PROCESS_doc_getstrt__req__process): does not follow pattern `^doc_.+$`. +.. Test: No external prefixes (single documentation mega-build) +.. Verifies links work when all needs are loaded in one Sphinx instance, without prefix logic. +#EXPECT-NOT tool_req__test_abcd.satisfies (doc_getstrt__req__process): does not follow pattern `^doc_.+$`. .. tool_req:: This is a test :id: tool_req__test_abcd - :satisfies: PROCESS_doc_getstrt__req__process + :satisfies: doc_getstrt__req__process This should not give a warning -.. Also make sure it works wit lists of links +.. Also make sure it works with lists of links -#EXPECT-NOT: tool_req__test_aaaa.satisfies (PROCESS_doc_getstrt__req__process): does not follow pattern `^doc_.+$`. -#EXPECT-NOT: tool_req__test_aaaa.satisfies (PROCESS_gd_guidl__req__engineering): does not follow pattern `^gd_.+$`. +#EXPECT-NOT: tool_req__test_aaaa.satisfies (doc_getstrt__req__process): does not follow pattern `^doc_.+$`. +#EXPECT-NOT: tool_req__test_aaaa.satisfies (gd_guidl__req__engineering): does not follow pattern `^gd_.+$`. .. tool_req:: This is a test :id: tool_req__test_aaaa - :satisfies: PROCESS_doc_getstrt__req__process;PROCESS_gd_guidl__req__engineering + :satisfies: doc_getstrt__req__process;gd_guidl__req__engineering This should give a warning diff --git a/src/extensions/score_metamodel/tests/rst/attributes/test_prohibited_words.rst b/src/extensions/score_metamodel/tests/rst/attributes/test_prohibited_words.rst index 240de822..40546c00 100644 --- a/src/extensions/score_metamodel/tests/rst/attributes/test_prohibited_words.rst +++ b/src/extensions/score_metamodel/tests/rst/attributes/test_prohibited_words.rst @@ -82,7 +82,7 @@ :tags: Common Attributes :implemented: YES :satisfies: - PROCESS_gd_req__req_desc_weak, + gd_req__req_desc_weak, :parent_covered: YES Docs-as-Code shall enforce that requirement descriptions do not contain the following weak words: diff --git a/src/extensions/score_metamodel/tests/rst/conf.py b/src/extensions/score_metamodel/tests/rst/conf.py index 69e04bf1..e68ed77c 100644 --- a/src/extensions/score_metamodel/tests/rst/conf.py +++ b/src/extensions/score_metamodel/tests/rst/conf.py @@ -25,6 +25,5 @@ { "base_url": "https://eclipse-score.github.io/process_description/main/", "json_url": "https://eclipse-score.github.io/process_description/main/needs.json", - "id_prefix": "process_", } ] diff --git a/src/extensions/score_source_code_linker/__init__.py b/src/extensions/score_source_code_linker/__init__.py index d8693500..a4fd1947 100644 --- a/src/extensions/score_source_code_linker/__init__.py +++ b/src/extensions/score_source_code_linker/__init__.py @@ -351,7 +351,8 @@ def inject_links_into_needs(app: Sphinx, env: BuildEnvironment) -> None: # For some reason the prefix 'sphinx_needs internally' is CAPSLOCKED. # So we have to make sure we uppercase the prefixes - prefixes = [x["id_prefix"].upper() for x in app.config.needs_external_needs] + # Only include prefixes if they are defined (for mega-builds, id_prefix is optional) + prefixes = [x["id_prefix"].upper() for x in app.config.needs_external_needs if "id_prefix" in x] for source_code_links in source_code_links_by_need: need = find_need(needs_copy, source_code_links.need, prefixes) if need is None: From 2ff94da9b57dc78616a325b2e61c36f66ab8e9f5 Mon Sep 17 00:00:00 2001 From: "Gueth Jan (ETAS-ECM/XPC-Fe6)" Date: Fri, 7 Nov 2025 12:15:31 +0100 Subject: [PATCH 2/2] Clean up remaining prefix-related unnecessary code Remove all remaining prefix configuration and logic that became unnecessary code after removing the PROCESS_ prefixes from requirements. Changes: - Remove project_prefix from docs/conf.py - Remove allowed_external_prefixes config value from score_metamodel - Simplify find_need() by removing prefix parameter and logic - Update tests to match new function signatures - Remove prefix-related test cases from test_codelink.py --- docs/conf.py | 1 - src/extensions/score_metamodel/__init__.py | 1 - .../score_metamodel/external_needs.py | 2 +- .../tests/test_check_options.py | 1 - .../score_source_code_linker/__init__.py | 25 ++------- .../tests/test_codelink.py | 54 ++----------------- 6 files changed, 8 insertions(+), 76 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 8cb2d195..fffe55be 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,7 +13,6 @@ project = "Score Docs-as-Code" project_url = "https://eclipse-score.github.io/docs-as-code/" -project_prefix = "DOCS_" version = "0.1" extensions = [ diff --git a/src/extensions/score_metamodel/__init__.py b/src/extensions/score_metamodel/__init__.py index 681d72c3..858a179e 100644 --- a/src/extensions/score_metamodel/__init__.py +++ b/src/extensions/score_metamodel/__init__.py @@ -230,7 +230,6 @@ def postprocess_need_links(needs_types_list: list[ScoreNeedType]): def setup(app: Sphinx) -> dict[str, str | bool]: app.add_config_value("external_needs_source", "", rebuild="env") - app.add_config_value("allowed_external_prefixes", [], rebuild="env") app.config.needs_id_required = True app.config.needs_id_regex = "^[A-Za-z0-9_-]{6,}" diff --git a/src/extensions/score_metamodel/external_needs.py b/src/extensions/score_metamodel/external_needs.py index d1bdd59c..43adf1d6 100644 --- a/src/extensions/score_metamodel/external_needs.py +++ b/src/extensions/score_metamodel/external_needs.py @@ -191,7 +191,7 @@ def add_external_needs_json(e: ExternalNeedsSource, config: Config): def connect_external_needs(app: Sphinx, config: Config): - extend_needs_json_exporter(config, ["project_url", "project_prefix"]) + extend_needs_json_exporter(config, ["project_url"]) external_needs = get_external_needs_source(app.config.external_needs_source) diff --git a/src/extensions/score_metamodel/tests/test_check_options.py b/src/extensions/score_metamodel/tests/test_check_options.py index 1814df40..5e81d64e 100644 --- a/src/extensions/score_metamodel/tests/test_check_options.py +++ b/src/extensions/score_metamodel/tests/test_check_options.py @@ -111,7 +111,6 @@ def test_unknown_option_present_in_neither_req_opt_neither_opt_opt(self): app = Mock(spec=Sphinx) app.config = Mock() app.config.needs_types = self.NEED_TYPE_INFO_WITH_OPT_OPT - app.config.allowed_external_prefixes = [] # Expect that the checks pass check_extra_options(app, need_1, cast(CheckLogger, logger)) diff --git a/src/extensions/score_source_code_linker/__init__.py b/src/extensions/score_source_code_linker/__init__.py index a4fd1947..876e4fcc 100644 --- a/src/extensions/score_source_code_linker/__init__.py +++ b/src/extensions/score_source_code_linker/__init__.py @@ -292,24 +292,11 @@ def setup(app: Sphinx) -> dict[str, str | bool]: } -def find_need( - all_needs: NeedsMutable, id: str, prefixes: list[str] -) -> NeedsInfoType | None: +def find_need(all_needs: NeedsMutable, id: str) -> NeedsInfoType | None: """ - Checks all possible external 'prefixes' for an ID - So that the linker can add the link to the correct NeedsInfoType object. + Finds a need by ID in the needs collection. """ - if id in all_needs: - return all_needs[id] - - # Try all possible prefixes - for prefix in prefixes: - prefixed_id = f"{prefix}{id}" - if prefixed_id in all_needs: - LOGGER.warning("linking to external needs is not supported!") - return all_needs[prefixed_id] - - return None + return all_needs.get(id) # re-qid: gd_req__req__attr_impl @@ -349,12 +336,8 @@ def inject_links_into_needs(app: Sphinx, env: BuildEnvironment) -> None: get_cache_filename(app.outdir, "score_scl_grouped_cache.json") ) - # For some reason the prefix 'sphinx_needs internally' is CAPSLOCKED. - # So we have to make sure we uppercase the prefixes - # Only include prefixes if they are defined (for mega-builds, id_prefix is optional) - prefixes = [x["id_prefix"].upper() for x in app.config.needs_external_needs if "id_prefix" in x] for source_code_links in source_code_links_by_need: - need = find_need(needs_copy, source_code_links.need, prefixes) + need = find_need(needs_copy, source_code_links.need) if need is None: # TODO: print github annotations as in https://github.com/eclipse-score/bazel_registry/blob/7423b9996a45dd0a9ec868e06a970330ee71cf4f/tools/verify_semver_compatibility_level.py#L126-L129 for n in source_code_links.links.CodeLinks: diff --git a/src/extensions/score_source_code_linker/tests/test_codelink.py b/src/extensions/score_source_code_linker/tests/test_codelink.py index 7bb3897c..9e360d1a 100644 --- a/src/extensions/score_source_code_linker/tests/test_codelink.py +++ b/src/extensions/score_source_code_linker/tests/test_codelink.py @@ -222,52 +222,11 @@ def test_find_need_direct_match(): "REQ_002": {"id": "REQ_002", "title": "Another requirement"}, } ) - result = find_need(all_needs, "REQ_001", []) + result = find_need(all_needs, "REQ_001") assert result is not None assert result["id"] == "REQ_001" -@add_test_properties( - partially_verifies=["tool_req__docs_dd_link_source_code_link"], - test_type="requirements-based", - derivation_technique="requirements-analysis", -) -def test_find_need_with_prefix(): - """Test finding a need with prefix matching.""" - - all_needs = make_needs( - { - "PREFIX_REQ_001": {"id": "PREFIX_REQ_001", "title": "Prefixed requirement"}, - "REQ_002": {"id": "REQ_002", "title": "Another requirement"}, - } - ) - result = find_need(all_needs, "REQ_001", ["PREFIX_"]) - assert result is not None - assert result["id"] == "PREFIX_REQ_001" - - -@add_test_properties( - partially_verifies=["tool_req__docs_dd_link_source_code_link"], - test_type="requirements-based", - derivation_technique="requirements-analysis", -) -def test_find_need_multiple_prefixes(): - """Test finding a need with multiple prefixes.""" - all_needs = make_needs( - { - "SECOND_REQ_001": { - "id": "SECOND_REQ_001", - "title": "Second prefixed requirement", - }, - "REQ_002": {"id": "REQ_002", "title": "Another requirement"}, - } - ) - - result = find_need(all_needs, "REQ_001", ["FIRST_", "SECOND_"]) - assert result is not None - assert result["id"] == "SECOND_REQ_001" - - @add_test_properties( partially_verifies=["tool_req__docs_dd_link_source_code_link"], test_type="requirements-based", @@ -281,7 +240,7 @@ def test_find_need_not_found(): } ) - result = find_need(all_needs, "REQ_999", ["PREFIX_"]) + result = find_need(all_needs, "REQ_999") assert result is None @@ -437,22 +396,15 @@ def test_group_by_need_and_find_need_integration( { "TREQ_ID_1": {"id": "TREQ_ID_1", "title": "Test requirement 1"}, "TREQ_ID_2": {"id": "TREQ_ID_2", "title": "Test requirement 2"}, - "PREFIX_TREQ_ID_200": { - "id": "PREFIX_TREQ_ID_200", - "title": "Prefixed requirement", - }, } ) # Test finding needs for each group for found_link in grouped: - found_need = find_need(all_needs, found_link.need, ["PREFIX_"]) + found_need = find_need(all_needs, found_link.need) if found_link.need in ["TREQ_ID_1", "TREQ_ID_2"]: assert found_need is not None assert found_need["id"] == found_link.need - elif found_link.need == "TREQ_ID_200": - assert found_need is not None - assert found_need["id"] == "PREFIX_TREQ_ID_200" @add_test_properties(