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
16 changes: 14 additions & 2 deletions bazel/rules/rules_score/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ sphinx_module(
"docs/**/*.md",
],
allow_empty = True,
),
) + [
"//bazel/rules/rules_score/docs/requirements:requirements_rst",
"//bazel/rules/rules_score/docs/requirements:traceability_rst",
],
index = "docs/index.rst",
visibility = ["//visibility:public"],
)
Expand Down Expand Up @@ -176,13 +179,22 @@ filegroup(
srcs = glob(["*.bzl"]),
)

filegroup(
name = "py_srcs",
srcs = glob(["src/*.py"]),
)

lobster_linker(
name = "rules_score_impl",
srcs = [
":bzl_srcs",
":py_srcs",
"//bazel/rules/rules_score/private:bzl_srcs",
],
visibility = ["//docs/processes:__pkg__"],
visibility = [
"//bazel/rules/rules_score/docs/requirements:__pkg__",
"//docs/processes:__pkg__",
],
)

# ---------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions bazel/rules/rules_score/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ safety analysis to the top-level SEooC assembly.
integration_guide
user_guide/index
rule_reference
tool_qualification
quality_report
127 changes: 127 additions & 0 deletions bazel/rules/rules_score/docs/requirements/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# *******************************************************************************
# 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
# *******************************************************************************

load("@lobster//:lobster.bzl", "lobster_test", "lobster_trlc")
load("@trlc//:trlc.bzl", "trlc_requirements", "trlc_requirements_test", "trlc_rst")
load("//tools/lobster_rst_report:lobster_rst_report.bzl", "lobster_report_rst")

# ---------------------------------------------------------------------------
# TRLC Requirements
# ---------------------------------------------------------------------------

trlc_requirements(
name = "use_cases",
srcs = ["use_cases.trlc"],
spec = ["//bazel/rules/rules_score/trlc/config:qualification_model"],
deps = ["//bazel/rules/rules_score/trlc/config:tools"],
)

trlc_requirements(
name = "potential_errors",
srcs = ["potential_errors.trlc"],
spec = ["//bazel/rules/rules_score/trlc/config:qualification_model"],
deps = [":use_cases"],
)

trlc_requirements(
name = "tool_requirements",
srcs = ["tool_requirements.trlc"],
spec = ["//bazel/rules/rules_score/trlc/config:qualification_model"],
deps = [
":potential_errors",
":use_cases",
"//bazel/rules/rules_score/trlc/config:tools",
],
)

trlc_requirements_test(
name = "requirements_test",
reqs = [
":tool_requirements",
],
)

# ---------------------------------------------------------------------------
# TRLC → RST rendering (for inclusion in Sphinx documentation)
# ---------------------------------------------------------------------------

trlc_rst(
name = "requirements_rst",
reqs = [
":use_cases",
":potential_errors",
":tool_requirements",
],
visibility = ["//bazel/rules/rules_score:__pkg__"],
)

# ---------------------------------------------------------------------------
# Lobster traceability extraction
# ---------------------------------------------------------------------------

lobster_trlc(
name = "use_cases_lobster",
config = "//bazel/rules/rules_score/lobster/config/qualification:lobster_use_cases",
requirements = [":use_cases"],
)

lobster_trlc(
name = "potential_errors_lobster",
config = "//bazel/rules/rules_score/lobster/config/qualification:lobster_potential_errors",
requirements = [
":potential_errors",
":use_cases",
],
)

lobster_trlc(
name = "tool_requirements_lobster",
config = "//bazel/rules/rules_score/lobster/config/qualification:lobster_tool_requirements",
requirements = [
":tool_requirements",
":potential_errors",
":use_cases",
],
)

# ---------------------------------------------------------------------------
# Lobster traceability report
# ---------------------------------------------------------------------------

lobster_test(
name = "traceability_test",
config = "//bazel/rules/rules_score/lobster/config/qualification:lobster_conf",
inputs = [
":use_cases_lobster",
":potential_errors_lobster",
":tool_requirements_lobster",
"//bazel/rules/rules_score:rules_score_impl",
],
tags = ["manual"],
)

# ---------------------------------------------------------------------------
# Lobster RST report (for inclusion in Sphinx documentation)
# ---------------------------------------------------------------------------

lobster_report_rst(
name = "traceability_rst",
config = "//bazel/rules/rules_score/lobster/config/qualification:lobster_conf",
inputs = [
":use_cases_lobster",
":potential_errors_lobster",
":tool_requirements_lobster",
"//bazel/rules/rules_score:rules_score_impl",
],
visibility = ["//bazel/rules/rules_score:__pkg__"],
)
100 changes: 100 additions & 0 deletions bazel/rules/rules_score/docs/requirements/potential_errors.trlc
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/********************************************************************************
* 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
********************************************************************************/
package UseCases
import ToolQualification

section "Potential Errors" {

section "Documentation Build" {

ToolQualification.PotentialError Missing_Requirement_In_Output {
description = '''
A requirement defined in a TRLC source file is silently omitted
from the rendered RST output, causing the documentation to be
incomplete without any build error.
'''
impacts = ["Incomplete safety documentation delivered to assessor"]
affects = [Build_Traceable_Documentation]
impact_type = ToolQualification.Impact_Type.Safety
}

ToolQualification.PotentialError Broken_Cross_Reference {
description = '''
A cross-reference between requirements (e.g. derived_from) is
not resolved correctly in the rendered documentation, showing
a broken link or missing reference.
'''
impacts = ["Traceability information is incorrect in delivered documentation"]
affects = [Build_Traceable_Documentation, Validate_Requirement_Chains]
impact_type = ToolQualification.Impact_Type.Safety
}

}

section "Requirement Traceability" {

ToolQualification.PotentialError Undetected_Missing_Traceability {
description = '''
A component requirement that lacks a derived_from reference to
a feature requirement is not flagged as an error during the
build, allowing gaps in the traceability chain.
'''
impacts = ["Safety requirements may not be implemented"]
affects = [Validate_Requirement_Chains]
impact_type = ToolQualification.Impact_Type.Safety
}

ToolQualification.PotentialError Incorrect_Provider_Chain {
description = '''
The Bazel provider chain (TrlcProviderInfo, SphinxSourcesInfo)
is assembled incorrectly so that downstream rules receive stale
or incomplete requirement data.
'''
impacts = ["Traceability report based on outdated information"]
affects = [Validate_Requirement_Chains, Assemble_Dependable_Element]
impact_type = ToolQualification.Impact_Type.Safety
}

}

section "Safety Analysis" {

ToolQualification.PotentialError Missing_Failure_Mode_In_Render {
description = '''
A failure mode defined in TRLC is not rendered in the FMEA
documentation output, causing an incomplete safety analysis
artefact.
'''
impacts = ["Incomplete FMEA delivered as part of safety case"]
affects = [Render_Safety_Analyses, Assemble_Dependable_Element]
impact_type = ToolQualification.Impact_Type.Safety
}

}

section "Architecture" {

ToolQualification.PotentialError Silent_Diagram_Parse_Failure {
description = '''
A syntactically invalid PlantUML diagram is not rejected by
the parser, producing an incorrect or empty FlatBuffers output
that is consumed silently by downstream rules.
'''
impacts = ["Architecture verification based on incorrect model"]
affects = [Parse_Architectural_Diagrams, Assemble_Dependable_Element]
impact_type = ToolQualification.Impact_Type.Safety
}

}

}
126 changes: 126 additions & 0 deletions bazel/rules/rules_score/docs/requirements/tool_requirements.trlc
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/********************************************************************************
* 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
********************************************************************************/
package UseCases
import ToolQualification
import Tools

section "Tool Requirements" {

section "Requirements Rendering" {

ToolQualification.ToolRequirement Render_All_TRLC_Records {
description = '''
The trlc_rst renderer shall produce an RST output that contains
every requirement record present in the input TRLC source files.
'''
mitigates = [Missing_Requirement_In_Output]
derived_from = [Build_Traceable_Documentation]
satisfied_by = Tools.TRLC
}

ToolQualification.ToolRequirement Resolve_Derived_From_References {
description = '''
The rendered RST output shall contain working cross-references
for all derived_from fields, linking child requirements to their
parent requirements.
'''
mitigates = [Broken_Cross_Reference]
derived_from = [Build_Traceable_Documentation]
satisfied_by = Tools.TRLC
}

}

section "Requirement Validation" {

ToolQualification.ToolRequirement Validate_Traceability_Completeness {
description = '''
The build shall fail when a component requirement does not have
a derived_from reference to at least one feature requirement,
unless the requirement is explicitly marked as component-internal.
'''
mitigates = [Undetected_Missing_Traceability]
derived_from = [Validate_Requirement_Chains]
satisfied_by = Tools.Bazel
}

ToolQualification.ToolRequirement Emit_Correct_Provider_Info {
description = '''
The score_requirements_rule shall emit a TrlcProviderInfo
provider containing all own TRLC source files, the specification
RSL files, and all transitive dependency TRLC files.
'''
mitigates = [Incorrect_Provider_Chain]
derived_from = [Validate_Requirement_Chains]
satisfied_by = Tools.Bazel
}

ToolQualification.ToolRequirement Emit_Sphinx_Sources {
description = '''
The score_requirements_rule shall emit a SphinxSourcesInfo
provider containing the rendered RST file and all transitive
Sphinx source dependencies.
'''
mitigates = [Incorrect_Provider_Chain]
derived_from = [Build_Traceable_Documentation]
satisfied_by = Tools.Bazel
}

}

section "Safety Analysis Rendering" {

ToolQualification.ToolRequirement Render_All_Failure_Modes {
description = '''
The FMEA rule shall render every FailureMode record from the
input TRLC sources into the documentation output.
'''
mitigates = [Missing_Failure_Mode_In_Render]
derived_from = [Render_Safety_Analyses]
satisfied_by = Tools.Docs
}

}

section "Architecture Parsing" {

ToolQualification.ToolRequirement Reject_Invalid_PlantUML {
description = '''
The PlantUML parser shall exit with a non-zero return code when
the input diagram contains syntactical errors, preventing silent
production of incorrect output.
'''
mitigates = [Silent_Diagram_Parse_Failure]
note = "This requirement traces to the plantuml parser source (Rust)."
derived_from = [Parse_Architectural_Diagrams]
satisfied_by = Tools.PlantumlParser
}

}

section "Lobster Traceability" {

ToolQualification.ToolRequirement Extract_Lobster_From_Requirements {
description = '''
The requirements rule shall extract a lobster traceability file
from all TRLC requirement records using the configured lobster
extraction schema.
'''
mitigates = [Undetected_Missing_Traceability]
derived_from = [Validate_Requirement_Chains]
satisfied_by = Tools.Lobster
}

}

}
Loading
Loading