Answer principles round 2: 0 🔴, 3 🟡; cite item 171 in the figures decision, check a handed route's levels as a value, carry the item and levels in ArchivedWorker

This commit is contained in:
2026-10-16 12:56:20 +02:00
parent 50fdd9e66d
commit 24549589ec
7 changed files with 31 additions and 20 deletions
+3 -6
View File
@@ -58,13 +58,10 @@ def decoded_as(value: object, kind: typing.Any) -> typing.Any:
if not isinstance(value, dict) or not required <= value.keys() <= shape.keys():
return REJECTED
fields = {name: decoded_as(field, shape[name]) for name, field in value.items()}
if any(field in (REJECTED, RETIRED) for field in fields.values()):
return REJECTED
try:
return kind(**fields)
except ValueError:
# A dataclass that checks its fields, as Route does, refuses a handed state that breaks them.
# A dataclass that checks its fields, as Route does, names the check fits.
if any(field in (REJECTED, RETIRED) for field in fields.values()) or not getattr(kind, "fits", lambda _: True)(fields):
return REJECTED
return kind(**fields)
return value if type(value) is kind else REJECTED
+3
View File
@@ -908,6 +908,9 @@ class LoopRuns(unittest.TestCase):
self.assertIsNone(reload.decode_handed(json.dumps(handed), main.LoopRun))
del handed["route"]["rung"]
self.assertIsNone(reload.decode_handed(json.dumps(handed), main.LoopRun))
off_scale = dataclasses.asdict(state)
off_scale["route"]["likelihood"] = 9
self.assertIsNone(reload.decode_handed(json.dumps(off_scale), main.LoopRun))
def test_drops_a_route_an_older_loop_claude_handed_under_r_plus_c_so_the_chunk_routes_afresh(self):
older = {"cycle_number": 3, "root": "/r", "task": "do it", "unfinished_evidence": "", "route": {"rung": {"model": "claude-opus-5-5", "effort": "high"}, "item": 3, "risk_and_complexity": 11, "unfinished": 1}}