Verdict floor: passed the check, no measured reach; closes the node like good, counts on the wheel like bad

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Haiku 5.5 committed 2026-12-03 20:41:41 -07:00
1 parent 361a850da5
commit 3fbf7376cb
3 files changed
+79 -6

No files matched your search

+72
View File
@@ -0,0 +1,72 @@
"""The floor verdict: a job that passed its check with no measured reach closes its node like good, and counts
on the wheel like bad (its minutes are no speed). Black-box CLI tests and in-process tests in a temporary home and store."""
import json, os, re, sys, unittest
try: # the modules, not their classes: their tests must not run twice
from tests import test_core, test_plan
except ImportError:
import test_core, test_plan
sys.path.insert(0, test_core.REPO)
class Floor(unittest.TestCase):
ENFORCE = True
setUp, project, sisi, hook, tool, done, table, state, read, write, in_process = (
test_core.Core.setUp, test_core.Core.project, test_core.Core.sisi, test_core.Core.hook, test_core.Core.tool, test_core.Core.done,
test_core.Core.table, test_core.Core.state, test_core.Core.read, test_core.Core.write, test_core.Core.in_process)
ready_plan, record, pick, agent, nodes = test_plan.Plan.ready_plan, test_plan.Plan.record, test_plan.Plan.pick, test_plan.Plan.agent, test_plan.Plan.nodes
def outcomes(self):
path = os.path.join(self.data, "outcomes.jsonl")
return [json.loads(l) for l in self.read(path).splitlines() if l.strip()] if os.path.exists(path) else []
def test_floor_closes_the_node_like_good_and_it_is_not_ready_again(self):
self.ready_plan()
self.pick("a")
self.assertEqual(self.agent("alpha", "sisi node: a\nbuild node a")[0], 0)
self.assertEqual(self.nodes()["a"], "running")
rc, out, _ = self.sisi("judge", "alpha", "floor", "passed the check and showed no reach attempt", "--node", "a")
self.assertEqual(rc, 0, out)
self.assertEqual(self.nodes()["a"], "done")
self.assertEqual(self.outcomes()[-1]["verdict"], "floor")
rc, out, _ = self.sisi("pick", "--node", "a")
self.assertEqual(rc, 1, out)
self.assertIn("already done", out)
def test_floor_closes_a_chore_job_and_is_refused_for_an_unknown_chore(self):
self.table(test_plan.TABLE)
self.hook("prompt", prompt="build it")
self.done()
rc, brief, err = self.sisi("plan", "brief")
self.assertEqual(rc, 0, brief + err)
cid = re.match(r"sisi chore: .+? ([0-9a-f]{8})\b", brief.splitlines()[0]).group(1)
rc, out, err = self.sisi("pick", "routine", "--not", "beta")
self.assertEqual(rc, 0, out + err)
prompt = "%s\nRun `sisi chore show %s` and do what it says." % (brief.splitlines()[0], cid)
self.assertEqual(self.tool("Agent", tool_input={"model": "alpha", "prompt": prompt}), (0, "", ""))
before = self.outcomes()
rc, out, _ = self.sisi("judge", "alpha", "floor", "passed the check and showed no reach attempt", "--chore", "deadbeef")
self.assertEqual(rc, 1, out)
self.assertEqual(self.outcomes(), before)
rc, out, _ = self.sisi("judge", "alpha", "floor", "passed the check and showed no reach attempt", "--chore", cid)
self.assertEqual(rc, 0, out)
self.assertEqual(self.state()["starts"].get("alpha"), [])
self.assertEqual(self.outcomes()[-1]["verdict"], "floor")
def test_floor_counts_on_the_wheel_like_bad_and_its_minutes_are_no_speed(self):
from sisi import models
path = os.path.join(self.data, "outcomes.jsonl")
def track(verdicts):
os.makedirs(self.data, exist_ok=True)
self.write(path, "".join(json.dumps({"worker": "alpha", "model": "alpha", "verdict": v, "minutes": m}) + "\n"
for v, m in verdicts))
return self.in_process(models.track)[0]
floor, bad = track([("good", 5), ("floor", 7)]), track([("good", 5), ("bad", 7)])
self.assertEqual(floor[1], bad[1], "a floor verdict must give the quality factor of a bad one")
self.assertEqual(floor[2], bad[2])
self.assertEqual(floor[0], {"alpha": [5]}, "a floor job's minutes must not enter speeds")
if __name__ == "__main__":
unittest.main()