fix: compare a citation without the spacing its author chose

A recale rewrites the located tokens and leaves the sentence alone, so a
prose run keeps `a.c:228, 1439-1443` while the rendered form drops the
space. Comparing the two literally made a run that had just been written
look unwritten, pending_recale counted it, and bump_commit refused for
ever.

mariani was held back by three of them: it recaled twenty-five refs and
could never advance its pin, which is the desync the all-or-nothing rule
forbids. 67 refs, all anchored.
This commit is contained in:
Abdessamad Derraz committed 2026-09-05 10:41:58 +02:00
1 parent 02edf40d8f
commit bc7f131b6f
3 files changed
+64 -25

No files matched your search

+28
View File
@@ -2160,6 +2160,34 @@ class TestWriteDryRun(unittest.TestCase):
self.assertEqual(self.path.read_text(), before)
class TestProseSpacingIsNotADifference(unittest.TestCase):
"""A recale keeps the author's spacing; the check has to allow for it.
_run_after_moves renders `a.c:228,1439-1443` while the writer leaves the
sentence as written, `a.c:228, 1439-1443`. Comparing the two literally
made the run look unwritten, so bump_commit refused for ever: mariani
was held back by three of them.
"""
def test_a_written_run_counts_as_written_whatever_the_spacing(self):
self.assertEqual(
profile_sync._citation_key("src/Harddisk.cpp:228, 1439-1443"),
profile_sync._citation_key("src/Harddisk.cpp:228,1439-1443"),
)
def test_different_citations_still_differ(self):
self.assertNotEqual(
profile_sync._citation_key("a.c:1, 2"),
profile_sync._citation_key("a.c:1, 3"),
)
def test_a_path_change_still_differs(self):
self.assertNotEqual(
profile_sync._citation_key("a.c:1"),
profile_sync._citation_key("src/a.c:1"),
)
class TestLargeFileCeiling(unittest.TestCase):
"""The fallback mapping bails above a ceiling, and it sits high enough.