File or refresh one comprehension-floor item whenever a scoring run is under 7.0

This commit is contained in:
2026-11-08 22:28:00 +01:00
parent 6091ae0dfc
commit bcbd9f455f
9 changed files with 77 additions and 33 deletions
+18
View File
@@ -1,6 +1,10 @@
import decimal
from review_rules.comprehension_history import DIMENSIONS, FLOOR
from release_plan.todo_table import Item
# plan.scoring_run_due keys on these words too, so the floor item filed calls its own scoring run.
FLOOR_ITEM = "comprehension floor"
def means(lines: list[list[str]]) -> list[decimal.Decimal]:
@@ -14,3 +18,17 @@ def mean(values: list[decimal.Decimal]) -> decimal.Decimal:
def under_floor(found: list[decimal.Decimal]) -> list[str]:
return [f"{name} {value}" for name, value in zip(DIMENSIONS, found) if value < FLOOR]
def floor_step(found: list[decimal.Decimal], plan: list[Item], ships: list[int]) -> str | None:
"""What a scoring run under the floor asks next, None when no mean is under it. It aims at the lowest of the four dimensions, each of them where they tie, since the lowest caps the overall. An item in plan naming the comprehension floor is open unless ships holds its ID: the chunk shipping it still asks for the next one."""
if not under_floor(found):
return None
dimensions = dict(zip(DIMENSIONS[:-1], found))
lowest = [name for name, value in dimensions.items() if value == min(dimensions.values())]
names = " and ".join(filter(None, [", ".join(lowest[:-1]), lowest[-1]]))
aim = f"{names}, the lowest dimension{'s' if len(lowest) > 1 else ''}"
rule = 'as larv-review §3 → "Floor item" says.'
if open_items := [item for item in plan if FLOOR_ITEM in item.tagline.lower() and item.id not in ships]:
return f"Next: refresh item {open_items[0].id}, which names the comprehension floor, to lift {aim}, with this run's places, and file no other, {rule}"
return f"Next: file one item naming the comprehension floor, a refactor lifting {aim}, to {FLOOR}, {rule}"