Run a chunk's worker on the rung its item picks, below the project's too, with its reviewers kept on the project's rung

This commit is contained in:
2026-10-14 23:50:39 +02:00
parent 8f7b0c5ac7
commit b4e7dd9875
9 changed files with 52 additions and 31 deletions
+8 -6
View File
@@ -3,7 +3,7 @@ import dataclasses
import re
from failure import Failure
from model_routing.ladder import highest, picked, Rung, stepped_up
from model_routing.ladder import highest, LADDER, picked, Rung, stepped_up
from todo_table import Item, items
UNFINISHED_PER_STEP = 2
@@ -45,20 +45,22 @@ def routed_item(todo: str) -> Item | Failure | None:
def first_route(anchor: Rung, item: Item | None) -> Route:
"""The route a chunk starts on: the rung its item's R + C picks from anchor, the project's rung, never below it."""
"""The route a chunk starts on: the rung its item's R + C picks from anchor, the project's rung."""
if item is None:
return Route(anchor)
return Route(highest(anchor, picked(anchor, item.risk_and_complexity)), item.id, item.risk_and_complexity)
return Route(picked(anchor, item.risk_and_complexity), item.id, item.risk_and_complexity)
def kept(route: Route, anchor: Rung) -> bool:
"""Whether a route carries on from anchor, the project's rung: its rung is on the ladder at or above it."""
return highest(route.rung, anchor) == route.rung
"""Whether a route carries on from anchor, the project's rung: its rung is on the ladder at or above the one its item's R + C picks from anchor."""
return highest(route.rung, picked(anchor, route.risk_and_complexity) if route.item else anchor) == route.rung
def stepped(anchor: Rung, route: Route, bundled: int) -> Route:
"""The route after one more unfinished verdict; bundled is the highest R + C the judge saw the worker take into the chunk, 0 for none."""
rung = highest(route.rung, anchor, picked(anchor, bundled) if bundled else anchor)
# A rung an edit took off the ladder counts as the project's.
rung = route.rung if route.rung in LADDER else anchor
rung = highest(rung, picked(anchor, bundled)) if bundled else rung
if route.unfinished + 1 >= UNFINISHED_PER_STEP:
return dataclasses.replace(route, rung=stepped_up(rung), unfinished=0)
return dataclasses.replace(route, rung=rung, unfinished=route.unfinished + 1)