Read the routing ladder from routing-ladder.json, which a project replaces with a file of its own in its config's folder
CI / tests (pull_request) Successful in 2m37s

This commit is contained in:
2026-11-15 18:51:59 +01:00
parent 9d0e2ad853
commit 0a20b6d4f6
42 changed files with 848 additions and 453 deletions
+4 -4
View File
@@ -6,7 +6,7 @@ import typing
from routing_figures.chunk import ChunkFigures, Reports
from routing_figures.dollars import DIMENSIONS, Dollars
from model_routing.ladder import position, Rung
from model_routing.ladder import Ladder, Rung
# A rung or a subagent type is compared only once this many of its chunks or subagents are measured, so a single odd chunk calls for no change.
MEASURED_AT_LEAST = 5
@@ -73,9 +73,9 @@ class Call:
return SENTENCES[self.kind].format(*self.subjects)
def calls(figures: Figures) -> list[Call]:
"""Each routing change the figures call for."""
compared = sorted((rung for rung, chunks in figures.routed.items() if len(chunks) >= MEASURED_AT_LEAST and position(rung) >= 0), key=position)
def calls(ladder: Ladder, figures: Figures) -> list[Call]:
"""Each routing change the figures call for, comparing the rungs on ladder, which is the shipped one: the figures span every project, and a project's own ladder ranks only its own chunks."""
compared = sorted((rung for rung, chunks in figures.routed.items() if len(chunks) >= MEASURED_AT_LEAST and ladder.position(rung) >= 0), key=ladder.position)
found = []
for lower, upper in zip(compared, compared[1:]):
measures: tuple[tuple[Kind, typing.Callable[[ChunkFigures], int]], ...] = (("rounds", lambda chunk: chunk.rounds_past_first), ("unfinished", lambda chunk: chunk.unfinished))