Answer architecture round 1: 1 🔴, 8 🟡 (0 misread); one reader per message, prices and Spent block moved, one table of larv-review commands

This commit is contained in:
2026-11-12 20:05:52 +01:00
parent 9066f477a4
commit 5c37027046
28 changed files with 503 additions and 412 deletions
+12 -26
View File
@@ -5,7 +5,7 @@ import re
import shutil
from failure import Failure
from records.markdown_text import FENCE, listed
from records.markdown_text import FENCE, listed, section
from git_cli.git_repo import git
from review_rules.review_folder import made_review_folder, review_folder
@@ -23,26 +23,6 @@ FORBIDDEN_FILES = ("todo.md", "docs/decisions.md", "docs/comprehension-history.m
FORBIDDEN = "todo.md, docs/decisions.md, docs/comprehension-history.md or docs/reading-cost.md (the plan, the decision log, past panels' records and past chunks' reading cost)"
TEST_FILE = re.compile(r"(^|/)(tests?/|test_[^/]*$|[^/]*_test\.[^/]*$|[^/]*\.(test|spec)\.[^/]*$)")
TEST_FILES = "test files being `test_*`, `*_test.*`, `*.test.*`, `*.spec.*` and those under a `test` or `tests` folder"
HEADING = re.compile(r"^(#+)\s+(.*?)\s*$")
def section(text: str, title: str) -> list[str] | None:
"""The lines under the first heading whose text fullmatches the pattern title, up to the next heading of its level or above; None where none does."""
found: list[str] | None = None
level = 0
fenced = False
for line in text.splitlines():
if FENCE.match(line):
fenced = not fenced
heading = None if fenced else HEADING.match(line)
if found is None:
if heading and re.fullmatch(title, heading.group(2)):
found, level = [], len(heading.group(1))
elif heading and len(heading.group(1)) <= level:
break
else:
found.append(line)
return found
def bullets(lines: list[str]) -> list[list[str]]:
@@ -62,12 +42,18 @@ def bullets(lines: list[str]) -> list[list[str]]:
return groups
ANCHOR = re.compile(r"- \*\*\d+ — ")
DIMENSIONS = ("Navigation", "Locality", "Shape", "Self-sufficiency")
def score_bullets(skill: str) -> tuple[list[str], list[str]] | Failure:
"""The six anchor bullets and the four dimension bullets of SKILL.md → "The score", without bold, each on one line."""
groups = [[line.replace("**", "") for line in group] for group in bullets(section(skill, "The score") or [])]
if [len(group) for group in groups[:2]] != [6, 4]:
return Failure(f"{PANEL / 'SKILL.md'} → \"The score\" no longer opens with six anchor bullets and then four dimension bullets")
return groups[0], groups[1]
"""The six anchor bullets and the four dimension bullets of SKILL.md → "The score", without bold, each on one line. A bullet is one by how it opens, `- **<n> — ` or `- **<dimension>**`, so other bullets and their order in the section change nothing."""
lines = [line.replace("**", "") for group in bullets(section(skill, "The score") or []) for line in group if ANCHOR.match(line) or line.startswith(tuple(f"- **{name}**" for name in DIMENSIONS))]
anchors = [line for line in lines if line[2].isdigit()]
dimensions = [line for line in lines if not line[2].isdigit()]
if len(anchors) != 6 or [line.split(" — ")[0] for line in dimensions] != [f"- {name}" for name in DIMENSIONS]:
return Failure(f"{PANEL / 'SKILL.md'} → \"The score\" no longer holds six bullets opening `- **<n> — ` and four opening `- **<dimension>**` for Navigation, Locality, Shape and Self-sufficiency, in that order")
return anchors, dimensions
def project_values(text: str, source: str) -> dict[str, str] | Failure: