diff --git a/monitoring/uss_qualifier/reports/templates/tested_requirements/participant_tested_requirements.html b/monitoring/uss_qualifier/reports/templates/tested_requirements/participant_tested_requirements.html index af21eb3397..4aafd699d9 100644 --- a/monitoring/uss_qualifier/reports/templates/tested_requirements/participant_tested_requirements.html +++ b/monitoring/uss_qualifier/reports/templates/tested_requirements/participant_tested_requirements.html @@ -135,7 +135,7 @@

Test run

-
Artifact generated by {{ codebase_version }}
+
Artifact generated by {{ codebase_version }} with {{ config_source }}

Tested requirements

diff --git a/monitoring/uss_qualifier/reports/tested_requirements/data_types.py b/monitoring/uss_qualifier/reports/tested_requirements/data_types.py index f8617385fd..6214e9708a 100644 --- a/monitoring/uss_qualifier/reports/tested_requirements/data_types.py +++ b/monitoring/uss_qualifier/reports/tested_requirements/data_types.py @@ -195,3 +195,7 @@ class RequirementsVerificationReport(ImplicitDict): participant_verifications: Dict[ParticipantID, ParticipantVerificationInfo] """Information regarding verification of compliance for each participant.""" + + artifact_configuration: Optional[str] + """Name of the tested requirements artifact configuration from the test run configuration, or "post-hoc" if the + artifact configuration generating this verification report is not specified in the test run configuration.""" diff --git a/monitoring/uss_qualifier/reports/tested_requirements/generate.py b/monitoring/uss_qualifier/reports/tested_requirements/generate.py index 959093f087..552b3aeab6 100644 --- a/monitoring/uss_qualifier/reports/tested_requirements/generate.py +++ b/monitoring/uss_qualifier/reports/tested_requirements/generate.py @@ -35,6 +35,30 @@ def generate_tested_requirements( report: TestRunReport, config: TestedRequirementsConfiguration, output_path: str ) -> None: + # Determine where the configuration to generate these tested requirements originated + artifacts = report.configuration.v1.artifacts + if "tested_requirements" in artifacts and artifacts.tested_requirements: + i = ( + artifacts.tested_requirements.index(config) + if config in artifacts.tested_requirements + else -1 + ) + n = len(artifacts.tested_requirements) + if i < 0: + config_source = "custom post-hoc artifact configuration" + artifact_configuration = "post-hoc" + elif n == 1: + config_source = "test run artifact configuration" + artifact_configuration = config.report_name + else: + config_source = ( + f"test run artifact configuration {i + 1}/{n}: {config.report_name}" + ) + artifact_configuration = config.report_name + else: + config_source = "post-hoc artifact configuration" + artifact_configuration = "post-hoc" + req_collections: Dict[ TestedRequirementsCollectionIdentifier, Set[RequirementID] ] = {} @@ -72,7 +96,9 @@ def generate_tested_requirements( f.write(template.render(participant_ids=reported_participant_ids)) verification_report = RequirementsVerificationReport( - test_run_information=test_run, participant_verifications={} + test_run_information=test_run, + participant_verifications={}, + artifact_configuration=artifact_configuration, ) template = jinja_env.get_template( "tested_requirements/participant_tested_requirements.html" @@ -112,6 +138,7 @@ def generate_tested_requirements( system_version=system_version, ParticipantVerificationStatus=ParticipantVerificationStatus, codebase_version=get_code_version(), + config_source=config_source, ) )