Resolve every name in a citation and pin the arrow spelling
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ Run it in a project checkout whose README.md has ## Goals and ## Audience, the p
|
||||
a worker runs the task; a judge then reads the transcript against them. A question only the human
|
||||
can answer, or a release ready to cut, is an interrupt: `claude --resume` on the terminal. An
|
||||
unfinished chunk resumes the same session next cycle; a finished one starts a fresh session. Cycles
|
||||
continue until that interrupt or Ctrl-C. Words: ~/.claude/CLAUDE.md, "Vocabulary".
|
||||
continue until that interrupt or Ctrl-C. Words: ~/.claude/CLAUDE.md → "Vocabulary".
|
||||
|
||||
Exit 1: no task, no premises, claude leaves no transcript, or the worker or the judge fails three
|
||||
times running, a verdict missing a field or quoting nothing in the transcript being a judge failure.
|
||||
|
||||
@@ -4,14 +4,18 @@ import subprocess
|
||||
import unittest
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
CITATION = re.compile(r'CLAUDE\.md`?[ ,→]+"([^"]+)"')
|
||||
CITATION = re.compile(r'`?CLAUDE\.md`? → ("[^"]+"(?:,? (?:and )?"[^"]+")*)')
|
||||
HEADING = re.compile(r"^#+ (.+?)(?: \(.*\))?$", re.MULTILINE)
|
||||
LEAD = re.compile(r"^(?:- )?\*\*(.+?)(?:\*\*|[:.]| —)", re.MULTILINE)
|
||||
NAME = re.compile(r'"([^"]+)"')
|
||||
|
||||
|
||||
class Citations(unittest.TestCase):
|
||||
def test_every_cited_heading_is_in_claude_md(self):
|
||||
headings = set(HEADING.findall((ROOT / "CLAUDE.md").read_text()))
|
||||
def test_every_citation_names_a_heading_then_headings_or_bold_leads_of_claude_md(self):
|
||||
text = (ROOT / "CLAUDE.md").read_text()
|
||||
headings = set(HEADING.findall(text))
|
||||
leads = headings | set(LEAD.findall(text))
|
||||
tracked = subprocess.run(["git", "ls-files", "-z"], capture_output=True, check=True, cwd=ROOT, text=True).stdout.split("\0")
|
||||
cited = [(path, heading) for path in filter(None, tracked) for heading in CITATION.findall((ROOT / path).read_text())]
|
||||
cited = [(path, NAME.findall(run)) for path in filter(None, tracked) for run in CITATION.findall((ROOT / path).read_text())]
|
||||
self.assertTrue(cited)
|
||||
self.assertEqual([f"{path}: {heading}" for path, heading in cited if heading not in headings], [])
|
||||
self.assertEqual([f"{path}: {names}" for path, names in cited if names[0] not in headings or set(names[1:]) - leads], [])
|
||||
|
||||
Reference in New Issue
Block a user