Answer stability round 1: 0 🔴, 2 🟡 (0 misread); inject home into the goals file lookup and rename readme in ranking

This commit is contained in:
2026-11-13 00:29:22 +01:00
parent ad6118d19f
commit 7b6201cab6
27 changed files with 110 additions and 96 deletions
+10 -10
View File
@@ -49,17 +49,17 @@ class Scoring:
class Ranked:
text: str
under_bar: list[str]
# What ranking prints and --check does not: an old-shape table's call to reshape, a README that voids code health and marks no goal **Achieve:**, and each dropped blocker ID, since a mistyped ID drops the same way.
# What ranking prints and --check does not: an old-shape table's call to reshape, a goals file that voids code health and marks no goal **Achieve:**, and each dropped blocker ID, since a mistyped ID drops the same way.
notes: list[str]
def rank(text: str, readme: str, decisions: str, history: str) -> Ranked | Failure:
def rank(text: str, goals_text: str, decisions: str, history: str) -> Ranked | Failure:
lines = text.split("\n")
table = read_table(lines)
if isinstance(table, Failure):
return table
shape = shape_of(table.columns)
scoring = read_scoring(text, lines, readme, decisions, history, shape)
scoring = read_scoring(text, lines, goals_text, decisions, history, shape)
if isinstance(scoring, Failure):
return scoring
items = read_items(table, scoring)
@@ -121,8 +121,8 @@ def under_the_bar(item: Item, value: float, bar: float, items: list[Item]) -> st
return f"item {item.id} scores {value:.1f}, under the bar {bar:g}; delete it{blocked}, or mark it with a reason the bar does not apply"
def read_scoring(text: str, lines: list[str], readme: str, decisions: str, history: str, shape: Shape) -> Scoring | Failure:
goals = ranked_goals(readme, decisions)
def read_scoring(text: str, lines: list[str], goals_text: str, decisions: str, history: str, shape: Shape) -> Scoring | Failure:
goals = ranked_goals(goals_text, decisions)
if isinstance(goals, Failure):
return goals
formula = parse_formula(stated(text, "Score"), variables(shape))
@@ -140,12 +140,12 @@ def read_scoring(text: str, lines: list[str], readme: str, decisions: str, histo
return Scoring(shape, formula, bar, int(next_id), dict(goals), weights)
def ranked_goals(readme: str, decisions: str) -> list[tuple[str, Mark]] | Failure:
def ranked_goals(goals_text: str, decisions: str) -> list[tuple[str, Mark]] | Failure:
"""Every goal in rank order, each with its mark: code health first, unless the goals file voids it, then the goals file's goals in reading order. A **Void:** line other than `**Void:** code health, since <reason>.` fails, and so does a docs/decisions.md that opts out of the comprehension check where the goals file keeps code health, since the goal then has no signal."""
goals = readme_goals(readme)
goals = numbered_goals(goals_text)
if isinstance(goals, Failure):
return goals
voids = VOID.findall("".join(sections(readme).get("Goals", [])))
voids = VOID.findall("".join(sections(goals_text).get("Goals", [])))
if other := [void for void in voids if not void.startswith(f"{CODE_HEALTH}, since ")]:
if other[0].lower().startswith(CODE_HEALTH):
return Failure(f"the goals file's ## Goals voids code health as `{other[0]}`; spell the void exactly `**Void:** {CODE_HEALTH}, since <reason>.`")
@@ -248,9 +248,9 @@ def check_citations(items: list[Item], decisions: str) -> Failure | None:
return None
def readme_goals(readme: str) -> list[tuple[str, Mark]] | Failure:
def numbered_goals(goals_text: str) -> list[tuple[str, Mark]] | Failure:
"""The goals file's goals in reading order: each one's number, a sub-goal as 4.1, and its mark, Maintain, Achieve or None."""
found = sections(readme).get("Goals", [])
found = sections(goals_text).get("Goals", [])
if len(found) != 1:
return Failure(f"the goals file has ## Goals {len(found)} times; it needs it once")
goals: list[tuple[str, Mark]] = []