Answer architecture round 2: 0 🔴, 1 🟡; state the order-free waiting rule in routing: one ladder, name chained blocked items under the bar, fix rank_todo's help on old tables

This commit is contained in:
2026-10-15 23:11:28 +02:00
parent 157ca50733
commit 298096ea5f
4 changed files with 18 additions and 8 deletions
+14 -4
View File
@@ -53,8 +53,8 @@ A valid todo.md; ## Details and each item's detail are optional:
loop. An ID at or above Next ID fails; one below it that the table no longer holds was finished
or deleted, and is dropped.
- ## Items holds the table and nothing else: an order goes in the scores or the Blocked by column.
- The table holds the columns above, a table from before Blocked by or C joined read by column name;
a column this version does not know fails, rather than be dropped.
- The table holds the columns above. A table without Blocked by gains it; one without C fails, and so
does a column this version does not know, rather than be dropped.
Exit 1, saying why, on bad arguments, a file that cannot be read or written, a todo.md, README.md or
docs/decisions.md that breaks the rules above, an item that is not exempt scoring under the bar, or
@@ -191,6 +191,16 @@ def rank(text: str, readme: str, decisions: str) -> Ranked | Failure:
return Ranked(ranked, under_bar)
def blocked_through(id_: int, items: list[Item]) -> set[int]:
"""The IDs of the items id_ blocks, and of those they block in turn."""
found: set[int] = set()
reached = {id_}
while reached:
reached = {other.id for other in items if reached.intersection(other.blocked_by)} - found
found |= reached
return found
def ordered(items: list[Item], scoring: Scoring) -> list[tuple[Item, float]] | Failure:
"""Each item with its score, by release, then security first, then by score from highest, then by ID; then each blocker just above the first item it blocks."""
by_score = []
@@ -204,8 +214,8 @@ def ordered(items: list[Item], scoring: Scoring) -> list[tuple[Item, float]] | F
def under_the_bar(item: Item, value: float, bar: float, items: list[Item]) -> str:
blocks = [str(other.id) for other in items if item.id in other.blocked_by]
blocked = f" and the items it blocks, {', '.join(blocks)}" if blocks else ""
blocks = [str(id_) for id_ in sorted(blocked_through(item.id, items))]
blocked = f" and the items it blocks, directly or through another, {', '.join(blocks)}" if blocks else ""
return f"item {item.id} scores {value:.1f}, under the bar {bar:g}; delete it{blocked}, or mark it with a reason the bar does not apply"