diff --git a/scripts/check_freshness.py b/scripts/check_freshness.py index 2a67030c..32cda9a4 100644 --- a/scripts/check_freshness.py +++ b/scripts/check_freshness.py @@ -1037,10 +1037,13 @@ def render(findings: list[Finding]) -> str: if not rows: continue lines.append(f"\n[{area}]") + # Columns are padded, never cut: the profile_sync row says in its + # local and remote values what to re-read, and lost the end of it. + local_width = min(max((len(f.local) for f in rows), default=0), 44) for f in rows: - cols = f" {f.status:7} {f.subject[:width]:{width}}" + cols = f" {f.status:7} {f.subject:{width}}" if f.local or f.remote: - cols += f" {f.local[:32]:32} -> {f.remote[:32]}" + cols += f" {f.local:{local_width}} -> {f.remote}" if f.detail: cols += f" {f.detail}" lines.append(cols.rstrip()) diff --git a/tests/test_check_freshness.py b/tests/test_check_freshness.py index eedf04a1..2fc1eb98 100644 --- a/tests/test_check_freshness.py +++ b/tests/test_check_freshness.py @@ -303,6 +303,14 @@ class RepositoryWiringTests(unittest.TestCase): self.assertIn("[ci]", text) self.assertIn("[data]", text) + def test_render_keeps_long_values_whole(self): + """The profile_sync row lost the end of its sentence at 32 characters.""" + local = "12 profiles behind upstream, 103 refs to re-read" + text = cf.render([cf.Finding("profiles", "profile_sync", cf.STALE, local=local, + remote="run profile_sync --all --triage")]) + self.assertIn(local, text) + self.assertIn("run profile_sync --all --triage", text) + class RepeatedDestinations(unittest.TestCase): def test_a_change_to_an_earlier_declaration_is_seen(self):