Answer architecture round 2: 0 🔴, 2 🟡 (0 misread); score_bullets reads the shared dimension names, every ladder model has a price
This commit is contained in:
@@ -4,6 +4,7 @@ import pathlib
|
||||
import re
|
||||
import shutil
|
||||
|
||||
from review_rules.comprehension_history import DIMENSIONS
|
||||
from failure import Failure
|
||||
from records.markdown_text import FENCE, listed, section
|
||||
from git_cli.git_repo import git
|
||||
@@ -18,6 +19,8 @@ SEATS = (
|
||||
("maintainability-senior", "Senior, maintainability", "Report: Junior A, Mid A and the maintainability senior"),
|
||||
("inherited-architect", "Architect, inherited", "Report: the inherited architect"),
|
||||
)
|
||||
# The dimensions a seat scores beside the overall, which comes last in DIMENSIONS.
|
||||
PANEL_DIMENSIONS = DIMENSIONS[:-1]
|
||||
VALUE_NAMES = ("language", "kind", "domain", "domain docs", "3am question")
|
||||
FORBIDDEN_FILES = ("todo.md", "docs/decisions.md", "docs/comprehension-history.md", "docs/reading-cost.md")
|
||||
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)"
|
||||
@@ -43,17 +46,17 @@ def bullets(lines: list[str]) -> list[list[str]]:
|
||||
|
||||
|
||||
ANCHOR = re.compile(r"- \*\*\d+ — ")
|
||||
DIMENSIONS = ("Navigation", "Locality", "Shape", "Self-sufficiency")
|
||||
DIMENSION = re.compile(r"- \*\*([^*]+)\*\* — ")
|
||||
|
||||
|
||||
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. 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
|
||||
"""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 `- **<name>** — `, so other bullets and their order in the section change nothing."""
|
||||
lines = [line for group in bullets(section(skill, "The score") or []) for line in group]
|
||||
anchors = [line.replace("**", "") for line in lines if ANCHOR.match(line)]
|
||||
dimensions = [(match[1], line) for line in lines if (match := DIMENSION.match(line))]
|
||||
if len(anchors) != 6 or tuple(name for name, _ in dimensions) != PANEL_DIMENSIONS:
|
||||
return Failure(f"{PANEL / 'SKILL.md'} → \"The score\" no longer holds six bullets opening `- **<n> — ` and one opening `- **<name>** — ` for each of {listed(list(PANEL_DIMENSIONS), 'and')}, in that order")
|
||||
return anchors, [line.replace("**", "") for _, line in dimensions]
|
||||
|
||||
|
||||
def project_values(text: str, source: str) -> dict[str, str] | Failure:
|
||||
|
||||
Reference in New Issue
Block a user