From 57436839a8d02f4b35c1504d910d894c70518f04 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Tue, 27 Oct 2026 13:07:33 +0100 Subject: [PATCH] fix: start each open finding with a capital The statement of a finding follows a full stop on the Measurements page. --- scripts/sitemeasurements.py | 8 +++++++- tests/test_campaign.py | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/sitemeasurements.py b/scripts/sitemeasurements.py index bb30f12c0..ac420682f 100644 --- a/scripts/sitemeasurements.py +++ b/scripts/sitemeasurements.py @@ -180,6 +180,12 @@ def _plain(value: object) -> str: return "".join(_UNSAFE.get(char, char) for char in text) +def _sentence(value: object) -> str: + """A finding's statement as a sentence of the page: capital first.""" + text = _plain(value) + return text[:1].upper() + text[1:] + + def _code(value: object) -> str: """A value as code that cannot close its element or open an expression.""" return f"{_plain(value)}" @@ -227,7 +233,7 @@ def campaign_section(summary: dict | None) -> list[str]: lines += [ f"- **{_plain(item['emulator'])}**, {_code(item['file'])}, {_code(item['field'])} " f"({_plain(item['status'])}): the profile says {_value(item['profile_says'])}, the run " - f"shows {_value(item['run_shows'])}. {_plain(item['statement'])}. Records: {records}.", + f"shows {_value(item['run_shows'])}. {_sentence(item['statement'])}. Records: {records}.", "", ] return lines diff --git a/tests/test_campaign.py b/tests/test_campaign.py index 7b0b2c6cb..52da1cf43 100644 --- a/tests/test_campaign.py +++ b/tests/test_campaign.py @@ -859,7 +859,7 @@ class SitePage(unittest.TestCase): "failed": [{"emulator": "fake", "check": "fake/x/y/bench", "reason": "timeout"}]}, "passes": 1, "applied": 2, "open": [{"emulator": "fake", "file": "bios.bin", "field": "required", "status": "open", - "profile_says": True, "run_shows": False, "statement": "boots without it", + "profile_says": True, "run_shows": False, "statement": "the core boots without it", "evidence": ["2026-10-27-aaaaaaaaaaaa"], "links": ["https://x/l#L1"]}], } page = "\n".join(sitemeasurements.campaign_section(summary)) @@ -867,6 +867,7 @@ class SitePage(unittest.TestCase): self.assertIn("| standalone | 3 |", page) self.assertIn("the profile says true, the run shows false", page) self.assertIn("[2026-10-27-aaaaaaaaaaaa](https://x/l#L1)", page) + self.assertIn("false. The core boots without it. Records:", page) self.assertEqual(sitemeasurements.campaign_section({"last_run": None}), []) def test_observed_values_cannot_leave_their_place(self) -> None: