diff --git a/canon/core.md b/canon/core.md index 6904cf8..7367683 100644 --- a/canon/core.md +++ b/canon/core.md @@ -74,8 +74,8 @@ class (routine, ordinary, hard) by total cost: your cost to specify it, the work redo. Near-free routine models take anything specified exactly (files, change, a check that decides) and keep being tried on such work; judgement and design go to hard, because a cheap job redone is waste. Plan before any handoff: `sisi plan brief` goes to a hard worker, and `sisi plan --record FILE` keeps the -dependency graph: nodes with class, needs, branch, files and check, and one join that brings them back. -Nodes that can run together get their own worktrees and disjoint files. For each ready node `sisi pick +graph: many small exact nodes (class, needs, branch, files, quick check); joins merge and run slow checks. +Nodes that run together get their own worktrees and disjoint files. For each ready node `sisi pick --node ID` spins the wheel over that class and gives a worker and a header for the brief; dispatch every ready node in one message. sisi refuses a handoff outside the plan, out of order or to a worker it did not give you. The wheel keeps one most-efficient model per provider and class and spreads load so no plan's diff --git a/sisi/plan.py b/sisi/plan.py index db1759e..c6a299a 100644 --- a/sisi/plan.py +++ b/sisi/plan.py @@ -35,9 +35,10 @@ Answer with exactly one markdown table and nothing else: time must have disjoint files. - check: how its result is proven, a check that can fail. - why: a few words on the class choice, e.g. "exact spec, test decides" or "design judgement, redo costly". -Shape: maximize parallelism (as many nodes in each wave as the work allows); the smallest piece that can be released -on its own comes first; reviews are nodes of their own (a review needs the node it reviews); exactly one final node, -the join, needs everything and brings it back together. +Shape: maximize parallelism: prefer many small nodes, each specified so exactly that a near-free model does it well +and fast, to a few complex ones. A small node's check is the quick test of its own change; slow checks (the full +suite) wait for a join node downstream that merges its needs, runs them once and fixes what broke. The smallest +releasable piece comes first; a review is a node that needs the node it reviews; one final join needs everything. Class by total cost: the lead's cost to write a fully specified brief, plus the worker's cost, plus the expected redo. A cheap model's bad job that must be redone is waste; so is a top model on a mechanical job; so is the lead spending its own quota on meta work. The lead is almost always the most expensive model, so reading, searching and @@ -275,7 +276,7 @@ def for_pick(args, cwd=None): def header(p, i): return "\n".join(["paste at the top of the brief (its first line):", "sisi node: " + i, "branch: %s (its own worktree and build folder)" % (n := node(p, i))["branch"], "may change: " + (", ".join(n["files"]) or "nothing"), "check: " + n["check"], - "needs done: " + (", ".join("%s (%s)" % (x, p["state"].get(x, {}).get("evidence", "")) for x in n["needs"]) or "-")]) + "needs done: " + (", ".join("%s on %s (%s)" % (x, node(p, x)["branch"], p["state"].get(x, {}).get("evidence", "")) for x in n["needs"]) or "-")]) def start(s, i, worker, t): diff --git a/tests/test_plan.py b/tests/test_plan.py index 111d589..87ffe93 100644 --- a/tests/test_plan.py +++ b/tests/test_plan.py @@ -160,9 +160,20 @@ class Plan(unittest.TestCase): 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 |", - "Class by total cost", "routine nodes whenever their", "record (last 20 judged per class)"): + "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) + def test_a_mid_graph_join_takes_the_slow_check_and_its_header_names_the_branches_to_merge(self): + self.ready_plan(text=COLS + ( + "| a | routine | - | p-a | sisi/a.py | test a passes | exact spec |\n" + "| b | routine | - | p-b | sisi/b.py | test b passes | exact spec |\n" + "| merge | ordinary | a, b | p-m | sisi/a.py, sisi/b.py | full suite passes | merge, run once, fix |\n" + "| join | lead | merge | - | - | released | the lead releases |\n")) + for n in "ab": + self.assertEqual(self.sisi("plan", "--done", n, "test %s ok" % n, sid="s1")[0], 0) + self.assertIn("needs done: a on p-a (test a ok), b on p-b (test b ok)", self.pick("merge")) + def test_a_retro_clears_the_plan(self): self.ready_plan() self.assertEqual(self.sisi("retro", "--no-gap", "every check passed with the tests shown", *test_core.NG, sid="s1")[0], 0)