Score risk as L + E + I, and route a worker on its item's L and its reviewers on its E + I
This commit is contained in:
+24
-13
@@ -1,4 +1,4 @@
|
||||
"""The routing ladder, and the rung an R + C picks from the project's rung: docs/decisions.md → `routing:`."""
|
||||
"""The routing ladder, and the rungs a task's L and E + I pick from the project's rung: docs/decisions.md → `routing:`."""
|
||||
import dataclasses
|
||||
import re
|
||||
import typing
|
||||
@@ -59,9 +59,10 @@ LADDER = (
|
||||
Rung("claude-opus-5-5", "max"),
|
||||
Rung("claude-fable-5-1", "max"),
|
||||
)
|
||||
# (highest R + C in the band, rungs it steps from the project's rung); a higher R + C steps ABOVE_THE_BANDS.
|
||||
BANDS = ((4, -3), (6, -2), (8, -1), (10, 0), (12, 1), (14, 2), (16, 3))
|
||||
ABOVE_THE_BANDS = 4
|
||||
# The rungs a task's L steps its worker from the project's rung.
|
||||
WORKER_STEPS = {1: -2, 2: -1, 3: 0, 4: 1}
|
||||
# The rungs a task's E + I steps a review up from the project's rung; one under 5 steps none.
|
||||
REVIEW_STEPS = {5: 1, 6: 2, 7: 3, 8: 4}
|
||||
|
||||
|
||||
def project_rung(model: str) -> Rung | None:
|
||||
@@ -69,14 +70,19 @@ def project_rung(model: str) -> Rung | None:
|
||||
return next((rung for rung in LADDER if rung.model == model), None)
|
||||
|
||||
|
||||
def picked(anchor: Rung, risk_and_complexity: int) -> Rung:
|
||||
"""The rung a task's R + C picks from anchor, the project's rung, stopping at either end of the ladder."""
|
||||
return climbed(anchor, next((step for highest, step in BANDS if risk_and_complexity <= highest), ABOVE_THE_BANDS))
|
||||
def worker_rung(anchor: Rung, likelihood: int) -> Rung:
|
||||
"""The rung a task's L picks for its worker from anchor, the project's rung, stopping at either end of the ladder."""
|
||||
return climbed(anchor, WORKER_STEPS[likelihood])
|
||||
|
||||
|
||||
def floored(anchor: Rung, risk_and_complexity: int) -> Rung:
|
||||
"""The rung a task's R + C picks from anchor, the project's rung, never below anchor."""
|
||||
return highest(anchor, picked(anchor, risk_and_complexity))
|
||||
def floored(anchor: Rung, likelihood: int) -> Rung:
|
||||
"""The rung a task's L picks from anchor, the project's rung, never below anchor."""
|
||||
return highest(anchor, worker_rung(anchor, likelihood))
|
||||
|
||||
|
||||
def review_floor(anchor: Rung, escape_and_impact: int) -> Rung:
|
||||
"""The rung a task's E + I picks for a review from anchor, the project's rung, never below anchor. An E + I of 0, for no task, picks anchor."""
|
||||
return climbed(anchor, REVIEW_STEPS.get(escape_and_impact, 0))
|
||||
|
||||
|
||||
def stepped_up(rung: Rung) -> Rung:
|
||||
@@ -84,9 +90,14 @@ def stepped_up(rung: Rung) -> Rung:
|
||||
return climbed(rung, 1)
|
||||
|
||||
|
||||
def review_rung(kind: ReviewKind, project: Rung, worker: Rung) -> Rung:
|
||||
"""The rung a review runs on: a reviewer on the higher of the worker's rung and the project's; a seat or the security pass on the project's."""
|
||||
return highest(project, worker) if kind == "reviewer" else project
|
||||
def reviewers_rung(project: Rung, worker: Rung, escape_and_impact: int) -> Rung:
|
||||
"""The rung a chunk's reviewers run on: the higher of the worker's rung and the one its item's E + I picks, which is never below the project's."""
|
||||
return highest(worker, review_floor(project, escape_and_impact))
|
||||
|
||||
|
||||
def review_rung(kind: ReviewKind, project: Rung, reviewers: Rung) -> Rung:
|
||||
"""The rung a review runs on: a reviewer on reviewers, which reviewers_rung picks; a seat or the security pass on the project's."""
|
||||
return reviewers if kind == "reviewer" else project
|
||||
|
||||
|
||||
def highest(*rungs: Rung) -> Rung:
|
||||
|
||||
Reference in New Issue
Block a user