Answer principles round 1: 0 🔴, 4 🟡; one class per standing, cases in the table, test chunk_start's open session and the earlier-release case

This commit is contained in:
2026-10-18 10:53:12 +02:00
parent ab081dd33f
commit e9cc88ed27
9 changed files with 119 additions and 91 deletions
+3 -2
View File
@@ -1,7 +1,7 @@
"""Which ladder rung a chunk's worker and judge run on: docs/decisions.md → `routing:`."""
import dataclasses
from chunk_pick import chunk_item, LastCut
from chunk_pick import chunk_item, LastCut, Next
from model_routing.ladder import climbed, highest, LADDER, position, project_rung, review_floor, Rung, stepped_up, worker_rung
from failure import Failure
from todo_table import Item, items
@@ -19,7 +19,8 @@ def routed_item(todo: str, cut: LastCut) -> Item | Failure | None:
found = items(todo)
if isinstance(found, Failure):
return found
takes = chunk_item(found or [], cut).item
pick = chunk_item(found or [], cut)
takes = pick.item if isinstance(pick, Next) else None
return takes if takes and takes.likelihood and takes.escape_and_impact else None
+13
View File
@@ -960,6 +960,19 @@ class ChunkFacts(unittest.TestCase):
self.assertIn("yourself", said)
self.assertIn(why, said)
def test_runs_the_preflight_only_where_the_session_is_not_open(self):
with tempfile.TemporaryDirectory() as home:
opened = session.session_named("A proj loop-claude", pathlib.Path(home, "projects"))
fresh = FakeEffects(python=[ran("- A fact.\n")])
facts, _ = main.chunk_start(opened, self.PREFLIGHT, "/r", fresh.effects())
self.assertEqual((fresh.made("python"), "- A fact." in facts), ([(["/b/chunk-preflight"], "/r")], True))
transcript = pathlib.Path(home, "projects", "-fake", f"{opened.id}.jsonl")
transcript.parent.mkdir(parents=True)
transcript.write_text("")
resumed = FakeEffects()
facts, _ = main.chunk_start(opened, self.PREFLIGHT, "/r", resumed.effects())
self.assertEqual((resumed.made("python"), facts), ([], ""))
class PythonEffect(unittest.TestCase):
def test_runs_a_script_in_the_given_directory(self):