Merge branch 'reach-plan-col'

This commit is contained in:
swaits committed 2026-12-03 20:42:12 -07:00
commit 68e8acb544
2 files changed
+43 -7

No files matched your search

+34 -1
View File
@@ -12,6 +12,7 @@ TABLE = test_core.HEADER + (
"| beta | host subagent model `beta` | ordinary | free | edits | |\n"
"| gamma | host subagent model `gamma` | hard | per use | everything | |\n")
COLS = "| node | class | needs | branch | files | check | why |\n|---|---|---|---|---|---|---|\n"
REACH = "| node | class | needs | branch | files | check | reach | why |\n|---|---|---|---|---|---|---|---|\n"
PLAN = COLS + (
"| a | routine | - | p-a | sisi/a.py | test a passes | exact spec, test decides |\n"
"| b | ordinary | - | p-b | sisi/b.py | test b passes | some judgement |\n"
@@ -123,6 +124,38 @@ class Plan(unittest.TestCase):
out = self.ready_plan(text=six)
self.assertIn("wave 1: a (routine), b (ordinary)", out)
def test_a_reach_column_records_its_cell(self):
self.ready_plan(text=REACH + (
"| a | routine | - | p-a | sisi/a.py | test a passes | make this 100x faster | exact spec, test decides |\n"
"| b | ordinary | - | p-b | sisi/b.py | test b passes | | some judgement |\n"
"| join | lead | a, b | - | - | full suite passes | | the lead merges |\n"))
self.assertEqual([n["reach"] for n in self.state()["plan"]["nodes"]], ["make this 100x faster", "", ""])
def test_tables_without_the_reach_column_record_with_reach_empty(self):
six = "\n".join("|".join(l.split("|")[:-2]) + "|" if l.startswith("|") else l for l in PLAN.splitlines()) + "\n"
for sid, text in (("s1", PLAN), ("s2", six)):
self.ready_plan(sid=sid, text=text)
self.assertEqual({n["reach"] for n in self.state(sid)["plan"]["nodes"]}, {""})
def test_plan_brief_asks_for_the_reach_column_with_its_four_examples(self):
self.ready_plan()
out = self.sisi("plan", "brief", sid="s1")[1]
self.assertIn("| node | class | needs | branch | files | check | reach | why |", out)
for ex in ('"make this 100x faster"', '"delete half the codebase without breaking anything"',
'"turn every bug we\'ve ever fixed into a property test"',
'"find all implicit invariants, formally prove them or find counterexamples"'):
self.assertIn(ex, out)
def test_pick_node_prints_the_reach_and_the_reach_line(self):
from sisi import plan
self.ready_plan(text=REACH + (
"| a | routine | - | p-a | sisi/a.py | test a passes | make this 100x faster | exact spec |\n"
"| b | ordinary | - | p-b | sisi/b.py | test b passes | | some judgement |\n"
"| join | lead | a, b | - | - | full suite passes | | the lead merges |\n"))
out = self.pick("a")
self.assertIn("reach: make this 100x faster", out)
self.assertIn(plan.REACH_LINE, out)
def test_record_line_counts_the_last_twenty_judged_per_class(self):
self.table(TABLE)
line = lambda w, v: json.dumps({"ts": "2026-11-20T10:00:00", "worker": w, "verdict": v, "why": "did it fine"})
@@ -159,7 +192,7 @@ class Plan(unittest.TestCase):
rc, out, _ = self.sisi("plan", "brief", sid="s1")
self.assertEqual(rc, 0, out)
self.assertRegex(out.splitlines()[0], r"^sisi chore: plan [0-9a-f]{8}$")
for want in ("export every row without losing any", "1. row counts match", "| node | class | needs | branch | files | check | why |",
for want in ("export every row without losing any", "1. row counts match", "| node | class | needs | branch | files | check | reach | why |",
"Class by total cost", "routine nodes whenever their", "record (last 20 judged per class)",
"prefer many small nodes", "quick test of its own change", "merges its needs, runs them once and fixes what broke"):
self.assertIn(want, out)