Generalise stability-replay to review-replay of any pass, and route each pass on its own rung so a replay may lower one pass alone
This commit is contained in:
@@ -5,8 +5,8 @@ import typing
|
||||
|
||||
# How Rung.__str__ spells a rung that names an effort, and Rung.parse reads it back.
|
||||
WORDING = re.compile(r"(?P<model>\S+) at (?P<effort>\S+) effort")
|
||||
# What a review launch reviews: a reviewer, a comprehension seat or the security pass.
|
||||
ReviewKind = typing.Literal["reviewer", "seat", "security"]
|
||||
# What a review launch reviews: a pass an agent under agents/ reviews, named as skills/larv-review/SKILL.md → "Passes" names it in lower case, a comprehension seat or the security pass.
|
||||
ReviewKind = typing.Literal["architecture", "principles", "overrides", "stability", "product-owner", "prose", "seat", "security"]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
@@ -63,6 +63,10 @@ LADDER = (
|
||||
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; an E + I under 5 steps none.
|
||||
REVIEW_STEPS = {5: 1, 6: 2, 7: 3, 8: 4}
|
||||
# Each pass an agent under agents/ reviews, in the order of that table in SKILL.md, and that agent.
|
||||
REVIEWERS: dict[ReviewKind, str] = {"architecture": "systems-architect", "principles": "principles-auditor", "overrides": "override-reviewer", "stability": "stability-reviewer", "product-owner": "product-owner-reviewer", "prose": "prose-reviewer"}
|
||||
# The rung a pass's replay chose for the projects on a model: docs/decisions.md → `routing: a review pass runs below the project's rung only on a rung that a replay of its rounds shows finding every 🔴 and 🟡 the project's rung finds`.
|
||||
REPLAYED: dict[tuple[ReviewKind, str], Rung] = {}
|
||||
|
||||
|
||||
def project_rung(model: str) -> Rung | None:
|
||||
@@ -96,14 +100,13 @@ def stepped_up(rung: Rung) -> Rung:
|
||||
|
||||
|
||||
def review_rungs(project: Rung, worker: Rung, escape_and_impact: int) -> dict[ReviewKind, Rung]:
|
||||
"""The rung each kind of review in a chunk runs on, where its worker runs on worker and its item has that E + I. The reviewers run on the higher of the worker's rung and review_floor's."""
|
||||
"""The rung each kind of review in a chunk runs on, where its worker runs on worker and its item has that E + I.
|
||||
|
||||
A pass's reviewer runs on the higher of the worker's rung and review_floor's. Where the E + I steps no review up, a pass whose replay chose a rung for the project's model runs on that rung instead, even below the worker's: the replay measured the project's rung, never a stepped one. A seat and the security pass run on the project's rung, so the seats score every chunk on one rung, and the security pass spends no more than the project chose.
|
||||
"""
|
||||
reviewers = highest(worker, review_floor(project, escape_and_impact))
|
||||
return {kind: review_rung(kind, project, reviewers) for kind in typing.get_args(ReviewKind)}
|
||||
|
||||
|
||||
def review_rung(kind: ReviewKind, project: Rung, reviewers: Rung) -> Rung:
|
||||
"""The rung a review of kind runs on: a reviewer on the reviewers' rung; a seat or the security pass on the project's, so the seats score every chunk on one rung, and the security pass spends no more than the project chose."""
|
||||
return reviewers if kind == "reviewer" else project
|
||||
replayed = {} if escape_and_impact in REVIEW_STEPS else {kind: rung for (kind, model), rung in REPLAYED.items() if model == project.model}
|
||||
return {**dict.fromkeys(REVIEWERS, reviewers), **replayed, "seat": project, "security": project}
|
||||
|
||||
|
||||
def highest(*rungs: Rung) -> Rung:
|
||||
|
||||
Reference in New Issue
Block a user