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"
+2 -2
View File
@@ -83,8 +83,8 @@ class Rank(unittest.TestCase):
def test_names_each_item_under_the_bar_that_is_not_exempt(self):
ranked = self.ranked(TODO.replace("`Bar = 9`", "`Bar = 11`"))
self.assertEqual(ranked.under_bar, ["item 2 scores 10.3, under the bar 11; delete it, or mark it with a reason the bar does not apply"])
blocking = self.ranked(TODO.replace("`Bar = 9`", "`Bar = 11`").replace("| 3 | 0.1.0 | |", "| 3 | 0.1.0 | 2 |"))
self.assertEqual(blocking.under_bar, ["item 2 scores 10.3, under the bar 11; delete it and the items it blocks, 3, or mark it with a reason the bar does not apply"])
blocking = self.ranked(TODO.replace("`Bar = 9`", "`Bar = 11`").replace("| 3 | 0.1.0 | |", "| 3 | 0.1.0 | 2 |").replace("| 5 | 0.1.0 | |", "| 5 | 0.1.0 | 3 |"))
self.assertEqual(blocking.under_bar, ["item 2 scores 10.3, under the bar 11; delete it and the items it blocks, directly or through another, 3, 5, or mark it with a reason the bar does not apply"])
self.assertEqual(self.ranked(ranked.text.replace("| 2 | 0.1.0 | | |", "| 2 | 0.1.0 | | principle |")).under_bar, [])
self.assertEqual(self.ranked(ranked.text.replace("| 2 | 0.1.0 | | |", "| 2 | 0.1.0 | | owner |")).under_bar, [])
+1 -1
View File
@@ -103,7 +103,7 @@ def cells(row: str, count: int) -> list[str] | Failure:
return found if len(found) == count else Failure(f"this row needs {count} cells: {row}")
def parse_row(row: str, columns: tuple[str, ...] = COLUMNS) -> Item | Failure:
def parse_row(row: str, columns: tuple[str, ...]) -> Item | Failure:
"""An item row under columns, every cell checked but the goals it cites."""
found = cells(row, len(columns))
if isinstance(found, Failure):