Answer architecture round 2: split record into its two commands, accept a dated first line only with a Mean line alone, read a default branch without a plan table as empty, and fetch where an answer needs origin as it is

This commit is contained in:
2026-10-09 01:24:48 +02:00
parent 05efbb1d8a
commit 9c2f982741
6 changed files with 108 additions and 57 deletions
+6 -4
View File
@@ -7,7 +7,7 @@ from larv_review.seats import ARCHITECT, DIMENSIONS, MEAN, Seat
from failure import Failure
from markdown_sections import sections
DATED = re.compile(r"^[0-9]{4}-[0-9]{2}-[0-9]{2}[^,]*, ")
DATED = re.compile(r"^[0-9]{4}-[0-9]{2}-[0-9]{2}(?:T[0-9]{2}:[0-9]{2}:[0-9]{2}Z)?, ")
DECIDED_BY = "decided by"
HARDEST_FIRST = "hardest first"
HEADING = re.compile(r"^([^,]+), (.+) at ([0-9a-f]{7,40})(?:, against ([0-9a-f]{7,40}))?$")
@@ -108,9 +108,11 @@ def resolved(places: list[Place], tracked: list[str]) -> tuple[list[Place], list
return found, dropped
def heading(at: float, read: str, paired: bool) -> re.Match[str] | Failure:
"""An entry's heading, matched by HEADING: when the seats finished, in UTC, and what they read; a read that opens with its own date, as a run moved from a decision entry does, keeps it."""
title = read if DATED.match(read) else f"{time.strftime(STAMP, time.gmtime(at))}, {read}"
def heading(at: float, read: str, paired: bool, moved: bool) -> re.Match[str] | Failure:
"""An entry's heading, matched by HEADING: when the seats finished, in UTC, and what they read. A run moved from a decision entry opens instead with the date or time that entry gives."""
if moved != bool(DATED.match(read)):
return Failure(f"only a seats file holding a {MEAN} line alone opens with a date or UTC time, then `, `: {read}")
title = read if moved else f"{time.strftime(STAMP, time.gmtime(at))}, {read}"
if (named := HEADING.match(title)) and bool(named.group(4)) == paired:
return named
return Failure(f"the seats file's first line is not `<PR or branch> at <commit>{', against <base>' if paired else ''}`: {read}")