Append the reading-cost figure, refresh item 109, and read a todo.md from before C joined it
This commit is contained in:
@@ -2,7 +2,7 @@ import pathlib
|
||||
|
||||
from failure import Failure
|
||||
from larv_review.git import file_at, landed_since_release, top
|
||||
from todo_table import Item, items, ITEMS_HEADER
|
||||
from todo_table import Item, items, ITEMS_HEADER, LEGACY_HEADER
|
||||
|
||||
|
||||
def scoring_run_due(before: list[Item], after: list[Item], ships: list[int], landed: bool) -> list[str] | Failure:
|
||||
@@ -42,7 +42,7 @@ def plan_reasons(default: str, ids: list[int]) -> list[str] | Failure:
|
||||
except (OSError, UnicodeDecodeError) as failure:
|
||||
return Failure(f"could not read todo.md: {failure}")
|
||||
# While a chunk reshapes todo.md into one table, the default branch's todo.md has no items table.
|
||||
planned = items(before) if ITEMS_HEADER in before.splitlines() else []
|
||||
planned = items(before) if {ITEMS_HEADER, LEGACY_HEADER} & set(before.splitlines()) else []
|
||||
if isinstance(planned, Failure):
|
||||
return Failure(f"{default}'s todo.md: {planned.reason}")
|
||||
chunk = items(after)
|
||||
|
||||
@@ -192,6 +192,10 @@ class ScoringRunDue(unittest.TestCase):
|
||||
self.assertIsInstance(items("# todo\n"), Failure)
|
||||
self.assertIsInstance(items(todo("| 0 | 0.1.0 | | **Do it.** | 1 | 1 | 3 | 1 | 1 | 1 | 9.0 |")), Failure)
|
||||
|
||||
def test_reads_a_table_from_before_c_joined_it(self):
|
||||
legacy = "## Items\n\n| ID | Release | Exempt | Item | R | S | A | G | Goals | Score |\n|---|---|---|---|---|---|---|---|---|---|\n| 3 | 0.1.0 | | **Do it.** | 1 | 1 | 1 | 1 | 1 | 9.0 |\n"
|
||||
self.assertEqual(items(legacy), [Item(3, (0, 1, 0), "", "**Do it.**", {"R": 1, "S": 1, "A": 1, "G": 1}, ("1",))])
|
||||
|
||||
def test_is_due_for_an_item_naming_the_floor(self):
|
||||
plan = [item(1, (0, 1, 0), "**Lift the project to the Comprehension floor.**"), item(2, (0, 1, 0))]
|
||||
self.assertEqual(scoring_run_due(plan, plan, [1], True), ["ships item 1, which names the comprehension floor"])
|
||||
|
||||
+12
-6
@@ -27,13 +27,15 @@ class Table:
|
||||
|
||||
|
||||
def items(todo: str) -> list[Item] | Failure:
|
||||
"""Each row of a todo.md's items table."""
|
||||
table = table_rows(todo.splitlines(), ITEMS_HEADER)
|
||||
"""Each row of a todo.md's items table, or of one from before C joined it."""
|
||||
lines = todo.splitlines()
|
||||
legacy = LEGACY_HEADER in lines
|
||||
table = table_rows(lines, LEGACY_HEADER if legacy else ITEMS_HEADER)
|
||||
if isinstance(table, Failure):
|
||||
return table
|
||||
items = []
|
||||
for row in table.rows:
|
||||
item = parse_row(row)
|
||||
item = parse_row(row, legacy)
|
||||
if isinstance(item, Failure):
|
||||
return item
|
||||
items.append(item)
|
||||
@@ -57,11 +59,13 @@ 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) -> Item | Failure:
|
||||
"""An item row, every cell checked but the goals it cites."""
|
||||
found = cells(row, 11)
|
||||
def parse_row(row: str, legacy: bool = False) -> Item | Failure:
|
||||
"""An item row, every cell checked but the goals it cites; a legacy row has no C."""
|
||||
found = cells(row, 10 if legacy else 11)
|
||||
if isinstance(found, Failure):
|
||||
return found
|
||||
if legacy:
|
||||
found.insert(6, "")
|
||||
id_, release, exempt, tagline, r, s, c, a, g, goals, _ = found
|
||||
if not re.fullmatch(r"[0-9]+", id_) or int(id_) < 1:
|
||||
return Failure(f"the ID {id_!r} is not a positive whole number: {row}")
|
||||
@@ -73,6 +77,8 @@ def parse_row(row: str) -> Item | Failure:
|
||||
return Failure(f"item {id_}'s Item cell is not one bold tagline: {tagline}")
|
||||
scores = {}
|
||||
for name, value in zip("RSCAG", (r, s, c, a, g)):
|
||||
if legacy and name == "C":
|
||||
continue
|
||||
if not re.fullmatch(r"[0-9]+", value) or not 1 <= int(value) <= 10:
|
||||
return Failure(f"item {id_}'s {name} {value!r} is not a whole number from 1 to 10")
|
||||
scores[name] = int(value)
|
||||
|
||||
@@ -178,3 +178,20 @@ Read most (opens and searches):
|
||||
- `bin/loop_claude/loop/main.py` 1
|
||||
- `bin/loop_claude/test_loop_claude.py` 1
|
||||
- `docs/decisions.md` 1
|
||||
|
||||
## Reading cost, chunk 50e484d03614, finished 2026-10-13T09:11:18Z
|
||||
|
||||
61233 new input tokens before the first commit.
|
||||
|
||||
Read most (opens and searches):
|
||||
|
||||
- `agents/stability-reviewer.md` 2
|
||||
- `docs/decisions.md` 2
|
||||
- `principles/technical-principles.md` 2
|
||||
- `skills/larv-review/SKILL.md` 2
|
||||
- `todo.md` 2
|
||||
- `.gitignore` 1
|
||||
- `CHANGELOG.md` 1
|
||||
- `README.md` 1
|
||||
- `rules/decisions.md` 1
|
||||
- `rules/todo-items.md` 1
|
||||
|
||||
@@ -82,7 +82,7 @@ From its second round on, a pass reviews only how the chunk answered the round b
|
||||
|
||||
### 109. Lower the reading cost of the files a chunk reads most before its first commit.
|
||||
|
||||
`bin/reading-cost` found a rise: the last 5 chunks' median is 106562 new input tokens before their first commit, the 5 before them 56802. Files read most in those 5 chunks (opens and searches): `CLAUDE.md` 17, `todo.md` 16, `docs/decisions.md` 12, `README.md` 10, `bin/loop_claude/loop/main.py` 9, `CHANGELOG.md` 8, `skills/larv-review/SKILL.md` 8, `.gitignore` 5, `bin/loop_claude/test_loop_claude.py` 5, `AGENTS.md` 4. The chunk that ships this item runs `reading-cost --reset`.
|
||||
`bin/reading-cost` found a rise: the last 5 chunks' median is 106562 new input tokens before their first commit, the 5 before them 50762. Files read most in those 5 chunks (opens and searches): `CLAUDE.md` 17, `todo.md` 17, `docs/decisions.md` 11, `README.md` 10, `bin/loop_claude/loop/main.py` 9, `skills/larv-review/SKILL.md` 9, `CHANGELOG.md` 8, `.gitignore` 5, `agents/stability-reviewer.md` 5, `bin/loop_claude/test_loop_claude.py` 5. The chunk that ships this item runs `reading-cost --reset`.
|
||||
|
||||
### 93. Let a chunk's worker start below the project's model, once the archive shows chunks on a lower rung took no more review rounds than chunks on the project's model.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user