Answer stability round 1: 0 🔴, 3 🟡 (0 misread); drop the trials' patch of authored_by, test names that sort against times

This commit is contained in:
2026-11-10 10:43:43 +01:00
parent 62d1f5edd4
commit ba903c58d2
6 changed files with 9 additions and 20 deletions
+1 -1
View File
@@ -93,7 +93,7 @@ def lost_inputs(prompt: str, reports: str, held: typing.Callable[[str], bool]) -
def authored_by(log: list[tuple[str, float]], seconds: float) -> str | None:
"""The commit in log with the newest author time at or before seconds; the first in log order breaks a tie. A rebase keeps author times, so a merged branch's commits still say what it held. Log order alone would not do: a commit authored early but merged late, such as a dependency bump, sits high in it."""
"""The commit in log with the newest author time at or before seconds; the first in log order breaks a tie. The log lists commits newest first by when they were merged, so taking the first one authored by seconds would pick a commit authored early but merged late, such as a dependency bump, over the commits a round reviewed. A rebase keeps author times, so a merged branch's commits keep the times their author wrote them."""
return max(((commit, authored) for commit, authored in log if authored <= seconds), key=lambda listed: listed[1], default=(None, 0))[0]
+4 -4
View File
@@ -100,12 +100,12 @@ class AuthoredBy(unittest.TestCase):
self.assertIsNone(authored_by(log, 5))
def test_takes_the_newest_author_time_over_a_commit_authored_early_but_merged_late(self):
log = [("bump", 5), ("c3", 30), ("c2", 20)]
self.assertEqual(authored_by(log, 25), "c2")
self.assertEqual(authored_by(log, 10), "bump")
log = [("z-bump", 5), ("a-new", 30), ("m-mid", 20)]
self.assertEqual(authored_by(log, 25), "m-mid")
self.assertEqual(authored_by(log, 10), "z-bump")
def test_breaks_a_tie_by_log_order(self):
self.assertEqual(authored_by([("merged", 20), ("earlier", 20)], 25), "merged")
self.assertEqual(authored_by([("a-merged", 20), ("z-earlier", 20)], 25), "a-merged")
class Sample(unittest.TestCase):