Answer stability round 1: refuse two more seats once the first two agree, compare scores as decimals, read only ASCII digits as item IDs, refuse a shallow clone's base search, and sort release candidates below their release; also holds product-owner round 1's fixes

This commit is contained in:
2026-10-09 01:32:19 +02:00
parent e2cb4a26f8
commit 56ac929634
7 changed files with 59 additions and 24 deletions
+3 -2
View File
@@ -1,4 +1,5 @@
import dataclasses
import decimal
import re
from failure import Failure
@@ -47,7 +48,7 @@ def report(text: str) -> Report | Failure:
elif seats and seats[-1].places and line.startswith(" "):
seats[-1].places[-1] += " " + line.strip()
else:
return Failure(f"the seats file has a line that is neither a seat's line nor one of its places: {line}")
return Failure(f"the seats file has a line that is neither a seat's line, opening with one of {', '.join((*SCORING_SEATS, MEAN))} and a colon, nor one of its places: {line}")
return Report(lines[0].strip(), seats)
@@ -59,7 +60,7 @@ def scores(seats: list[Seat]) -> dict[str, list[str]] | Failure:
for seat in seats:
if not (written := SCORES.fullmatch(seat.said)):
return Failure(f"{seat.name}'s line is not {', '.join(name + ' <score>' for name in DIMENSIONS)}: {seat.said}")
values = [float(value) for value in written.groups()]
values = [decimal.Decimal(value) for value in written.groups()]
if not all(1 <= value <= 10 for value in values):
return Failure(f"{seat.name}'s scores are not each from 1 to 10: {seat.said}")
if values[-1] > min(values[:-1]) + 1: