Answer principles round 1: 0 🔴, 2 🟡; state the R cap in chunk-preflight's help and output, correct the decision's I 4 claim, and pin the cap at 5 in tests
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
"""The lines the preflight prints, stated from what it gathered."""
|
"""The lines the preflight prints, stated from what it gathered."""
|
||||||
from todo_table import bundle_candidates, Item, version
|
from todo_table import BUNDLE_MAX_R, bundle_candidates, Item, version
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
from chunk_preflight.gathered import Forge, Gathered, ItemFacts, NamedPath, NoItem, Plan, Ran
|
from chunk_preflight.gathered import Forge, Gathered, ItemFacts, NamedPath, NoItem, Plan, Ran
|
||||||
from chunk_pick import LastCut, unreleased_entries
|
from chunk_pick import LastCut, unreleased_entries
|
||||||
@@ -66,6 +66,8 @@ def open_pulls(stdout: str, forge: Forge, branch: str) -> list[str]:
|
|||||||
|
|
||||||
def bundled(plan: Plan) -> list[str]:
|
def bundled(plan: Plan) -> list[str]:
|
||||||
first, candidates = plan.first, bundle_candidates(plan.items, plan.first)
|
first, candidates = plan.first, bundle_candidates(plan.items, plan.first)
|
||||||
|
if first.scores.get("R", 0) > BUNDLE_MAX_R:
|
||||||
|
return [f"- Item {first.id} has R above {BUNDLE_MAX_R}, so it ships alone."]
|
||||||
if not candidates:
|
if not candidates:
|
||||||
return [f"- No other item of release {version(first.release)} may join item {first.id}'s chunk."]
|
return [f"- No other item of release {version(first.release)} may join item {first.id}'s chunk."]
|
||||||
listed = [f" - item {item.id}, {levels(item)}, S {item.scores['S']}: {item.tagline}" for item in candidates]
|
listed = [f" - item {item.id}, {levels(item)}, S {item.scores['S']}: {item.tagline}" for item in candidates]
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ holds it, the plan loop-claude routes on. It prints:
|
|||||||
- the open pull requests whose head is the item's branch, each by its number and URL, as gh lists
|
- the open pull requests whose head is the item's branch, each by its number and URL, as gh lists
|
||||||
them on a github.com origin, and else as tea does. No title reaches the output;
|
them on a github.com origin, and else as tea does. No title reaches the output;
|
||||||
- the items of that release that a chunk taking the item may take too: those that are not
|
- the items of that release that a chunk taking the item may take too: those that are not
|
||||||
questions and that no item outside the chunk blocks;
|
questions, that have R 5 or less, and that no item outside the chunk blocks; none where the
|
||||||
|
item's own R is above 5;
|
||||||
- each file or folder git tracks that the item's tagline or detail names in backticks, with a
|
- each file or folder git tracks that the item's tagline or detail names in backticks, with a
|
||||||
file's lines or a folder's files, and the item's tagline and detail;
|
file's lines or a folder's files, and the item's tagline and detail;
|
||||||
- what `rank_todo.py --check todo.md`, `larv-review needs-scoring-run <ID>`, `reading-cost` and
|
- what `rank_todo.py --check todo.md`, `larv-review needs-scoring-run <ID>`, `reading-cost` and
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ TODO = """# todo
|
|||||||
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|
||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||
| 5 | 0.2.0 | | question | **Ask first.** | 1 | 1 | 1 | 1 | 1 | 1 by 9 | 90.0 |
|
| 5 | 0.2.0 | | question | **Ask first.** | 1 | 1 | 1 | 1 | 1 | 1 by 9 | 90.0 |
|
||||||
| 3 | 0.2.0 | | | **Do the next thing.** | 4 | 2 | 3 | 7 | 3 | 1 by 9 | 56.2 |
|
| 3 | 0.2.0 | | | **Do the next thing.** | 2 | 2 | 3 | 5 | 3 | 1 by 9 | 56.2 |
|
||||||
| 7 | 0.2.0 | 3 | | **Do the thing after.** | 1 | 1 | 1 | 1 | 1 | 1 by 1 | 10.0 |
|
| 7 | 0.2.0 | 3 | | **Do the thing after.** | 1 | 1 | 1 | 1 | 1 | 1 by 1 | 10.0 |
|
||||||
| 8 | 0.2.0 | 5 | | **Do the answered thing.** | 1 | 1 | 1 | 1 | 1 | 1 by 1 | 10.0 |
|
| 8 | 0.2.0 | 5 | | **Do the answered thing.** | 1 | 1 | 1 | 1 | 1 | 1 by 1 | 10.0 |
|
||||||
| 9 | 0.3.0 | | | **Do a later thing.** | 1 | 1 | 1 | 1 | 1 | 1 by 9 | 90.0 |
|
| 9 | 0.3.0 | | | **Do a later thing.** | 1 | 1 | 1 | 1 | 1 | 1 by 9 | 90.0 |
|
||||||
@@ -46,7 +46,7 @@ TODO = """# todo
|
|||||||
Change `src/app.py`'s `run` and the files under `src`, not `gone.py`.
|
Change `src/app.py`'s `run` and the files under `src`, not `gone.py`.
|
||||||
"""
|
"""
|
||||||
# The plan once item 3 has shipped: item 7 no longer waits, and its detail names the files.
|
# The plan once item 3 has shipped: item 7 no longer waits, and its detail names the files.
|
||||||
SHIPPED = TODO.replace("| 3 | 0.2.0 | | | **Do the next thing.** | 4 | 2 | 3 | 7 | 3 | 1 by 9 | 56.2 |\n", "").replace("| 7 | 0.2.0 | 3 |", "| 7 | 0.2.0 | |").replace("### 3. Do the next thing.", "### 7. Do the thing after.")
|
SHIPPED = TODO.replace("| 3 | 0.2.0 | | | **Do the next thing.** | 2 | 2 | 3 | 5 | 3 | 1 by 9 | 56.2 |\n", "").replace("| 7 | 0.2.0 | 3 |", "| 7 | 0.2.0 | |").replace("### 3. Do the next thing.", "### 7. Do the thing after.")
|
||||||
# The plan once release 0.2.0 has shipped all its items: only release 0.3.0's item 9 is left.
|
# The plan once release 0.2.0 has shipped all its items: only release 0.3.0's item 9 is left.
|
||||||
LATER = TODO[:TODO.index("| 5 |")] + "| 9 | 0.3.0 | | | **Do a later thing.** | 1 | 1 | 1 | 1 | 1 | 1 by 9 | 90.0 |\n"
|
LATER = TODO[:TODO.index("| 5 |")] + "| 9 | 0.3.0 | | | **Do a later thing.** | 1 | 1 | 1 | 1 | 1 | 1 by 9 | 90.0 |\n"
|
||||||
# An items table that holds no row.
|
# An items table that holds no row.
|
||||||
@@ -260,7 +260,7 @@ class ChunkPreflightTool(unittest.TestCase):
|
|||||||
done = repo.preflight(CHUNK_PREFLIGHT_TIMEOUT="1")
|
done = repo.preflight(CHUNK_PREFLIGHT_TIMEOUT="1")
|
||||||
self.assertEqual(done.returncode, 0, done.stderr)
|
self.assertEqual(done.returncode, 0, done.stderr)
|
||||||
self.assertIn("as last fetched", done.stdout)
|
self.assertIn("as last fetched", done.stdout)
|
||||||
self.assertIn("item 3, L 4, E + I 5", done.stdout)
|
self.assertIn("item 3, L 2, E + I 5", done.stdout)
|
||||||
self.assertIn("`reading-cost` exited 0", done.stdout)
|
self.assertIn("`reading-cost` exited 0", done.stdout)
|
||||||
|
|
||||||
def test_lists_the_open_pull_requests_with_gh_on_a_github_origin(self):
|
def test_lists_the_open_pull_requests_with_gh_on_a_github_origin(self):
|
||||||
@@ -313,8 +313,7 @@ def rendered(item, release=CUT, note=None):
|
|||||||
|
|
||||||
class Render(unittest.TestCase):
|
class Render(unittest.TestCase):
|
||||||
def test_states_the_earliest_releases_first_item_its_levels_and_detail_and_each_item_that_may_join_its_chunk(self):
|
def test_states_the_earliest_releases_first_item_its_levels_and_detail_and_each_item_that_may_join_its_chunk(self):
|
||||||
# At R 7, item 3 would ship alone; at R 5, item 7 may join it.
|
said = rendered(item_facts())
|
||||||
said = rendered(item_facts(TODO.replace("| 4 | 2 | 3 | 7 | 3 |", "| 2 | 2 | 3 | 5 | 3 |")))
|
|
||||||
self.assertIn("origin/main's todo.md: 0.2.0", said)
|
self.assertIn("origin/main's todo.md: 0.2.0", said)
|
||||||
self.assertIn("item 3, L 2, E + I 5", said)
|
self.assertIn("item 3, L 2, E + I 5", said)
|
||||||
self.assertIn("> Change `src/app.py`'s `run` and the files under `src`, not `gone.py`.", said)
|
self.assertIn("> Change `src/app.py`'s `run` and the files under `src`, not `gone.py`.", said)
|
||||||
@@ -330,8 +329,13 @@ class Render(unittest.TestCase):
|
|||||||
self.assertIn("No other item", said)
|
self.assertIn("No other item", said)
|
||||||
self.assertNotIn("item 7,", said)
|
self.assertNotIn("item 7,", said)
|
||||||
|
|
||||||
|
def test_states_that_an_item_above_r_5_ships_alone(self):
|
||||||
|
said = rendered(item_facts(TODO.replace("| 2 | 2 | 3 | 5 | 3 |", "| 3 | 2 | 3 | 6 | 3 |")))
|
||||||
|
self.assertIn("Item 3 has R above 5, so it ships alone.", said)
|
||||||
|
self.assertNotIn("item 7,", said)
|
||||||
|
|
||||||
def test_states_an_unscored_level_as_unscored(self):
|
def test_states_an_unscored_level_as_unscored(self):
|
||||||
unscored = TODO.replace("| L | E | I | R | S |", "| R | S |").replace("|---|---|---|---|---|---|---|---|---|---|---|---|", "|---|---|---|---|---|---|---|---|---|").replace("| 4 | 2 | 3 | 7 | 3 |", "| 7 | 3 |").replace("| 1 | 1 | 1 | 1 | 1 |", "| 1 | 1 |")
|
unscored = TODO.replace("| L | E | I | R | S |", "| R | S |").replace("|---|---|---|---|---|---|---|---|---|---|---|---|", "|---|---|---|---|---|---|---|---|---|").replace("| 2 | 2 | 3 | 5 | 3 |", "| 5 | 3 |").replace("| 1 | 1 | 1 | 1 | 1 |", "| 1 | 1 |")
|
||||||
self.assertIn("item 3, L unscored, E + I unscored", rendered(item_facts(unscored)))
|
self.assertIn("item 3, L unscored, E + I unscored", rendered(item_facts(unscored)))
|
||||||
|
|
||||||
def test_states_the_unreleased_entries_and_else_the_commits_since_the_last_cut(self):
|
def test_states_the_unreleased_entries_and_else_the_commits_since_the_last_cut(self):
|
||||||
@@ -411,7 +415,7 @@ class Plans(unittest.TestCase):
|
|||||||
self.assertIn("waits", waits.why)
|
self.assertIn("waits", waits.why)
|
||||||
self.assertIn("0.2.0", waits.why)
|
self.assertIn("0.2.0", waits.why)
|
||||||
self.assertIn("Permission denied", planned(Failure("Permission denied"), CUT, "origin/main").why)
|
self.assertIn("Permission denied", planned(Failure("Permission denied"), CUT, "origin/main").why)
|
||||||
self.assertIn("L 'x'", planned(TODO.replace("| 4 | 2 | 3 |", "| x | 2 | 3 |"), CUT, "origin/main").why)
|
self.assertIn("L 'x'", planned(TODO.replace("| 2 | 2 | 3 | 5 |", "| x | 2 | 3 | 5 |"), CUT, "origin/main").why)
|
||||||
self.assertIn("details cannot be read", planned(TODO + "```\n", CUT, "origin/main").text)
|
self.assertIn("details cannot be read", planned(TODO + "```\n", CUT, "origin/main").text)
|
||||||
|
|
||||||
def test_tells_a_plan_with_no_items_table_from_one_whose_table_holds_no_item(self):
|
def test_tells_a_plan_with_no_items_table_from_one_whose_table_holds_no_item(self):
|
||||||
|
|||||||
@@ -480,6 +480,9 @@ class Blockers(unittest.TestCase):
|
|||||||
self.assertNotIn(4, [item.id for item in todo_table.bundle_candidates(found, todo_table.next_item(found))])
|
self.assertNotIn(4, [item.id for item in todo_table.bundle_candidates(found, todo_table.next_item(found))])
|
||||||
self.assertIn(5, [item.id for item in todo_table.bundle_candidates(found, todo_table.next_item(found))])
|
self.assertIn(5, [item.id for item in todo_table.bundle_candidates(found, todo_table.next_item(found))])
|
||||||
self.assertEqual(todo_table.bundle_candidates(found, next(item for item in found if item.id == 4)), [])
|
self.assertEqual(todo_table.bundle_candidates(found, next(item for item in found if item.id == 4)), [])
|
||||||
|
# At R 6, item 3 ships alone too.
|
||||||
|
riskier = todo_table.items(TODO.replace("| 2 | 1 | 2 | 3 | 7 |", "| 3 | 2 | 3 | 6 | 7 |"))
|
||||||
|
self.assertNotIn(3, [item.id for item in todo_table.bundle_candidates(riskier, todo_table.next_item(riskier))])
|
||||||
|
|
||||||
def test_drops_a_blocker_the_table_no_longer_holds_as_finished(self):
|
def test_drops_a_blocker_the_table_no_longer_holds_as_finished(self):
|
||||||
finished = TODO.replace("| 4 | 0.1.0 | | security | **Rotate the leaked key.** | 3 | 3 | 5 | 9 | 2 | 2.1 by 1 | 0 |\n", "").replace("| 2 | 0.1.0 | |", "| 2 | 0.1.0 | 4 |")
|
finished = TODO.replace("| 4 | 0.1.0 | | security | **Rotate the leaked key.** | 3 | 3 | 5 | 9 | 2 | 2.1 by 1 | 0 |\n", "").replace("| 2 | 0.1.0 | |", "| 2 | 0.1.0 | 4 |")
|
||||||
|
|||||||
+2
-2
@@ -204,9 +204,9 @@ def renames(todo: str) -> set[tuple[int, int, int]] | Failure:
|
|||||||
|
|
||||||
def bundle_candidates(found: list[Item], first: Item) -> list[Item]:
|
def bundle_candidates(found: list[Item], first: Item) -> list[Item]:
|
||||||
"""The items of first's release, in the table's order, that a chunk taking first may take too: those that do not wait once the chunk's own items count as done. An item above BUNDLE_MAX_R ships alone."""
|
"""The items of first's release, in the table's order, that a chunk taking first may take too: those that do not wait once the chunk's own items count as done. An item above BUNDLE_MAX_R ships alone."""
|
||||||
if first.scores.get("R", 0) > BUNDLE_MAX_R:
|
|
||||||
return []
|
|
||||||
chunk = {item.id for item in found if item.release == first.release and item.scores.get("R", 0) <= BUNDLE_MAX_R}
|
chunk = {item.id for item in found if item.release == first.release and item.scores.get("R", 0) <= BUNDLE_MAX_R}
|
||||||
|
if first.id not in chunk:
|
||||||
|
return []
|
||||||
# Dropping an item that waits may make another wait on it, so drop until none waits.
|
# Dropping an item that waits may make another wait on it, so drop until none waits.
|
||||||
while waits := waiting(found, chunk) & chunk:
|
while waits := waiting(found, chunk) & chunk:
|
||||||
chunk -= waits
|
chunk -= waits
|
||||||
|
|||||||
+1
-1
@@ -388,4 +388,4 @@ Valid while the comprehension panel measures how hard a project is to read.
|
|||||||
|
|
||||||
2026-10-22, lilleman, through todo item 216. Serves goal 1.4: each review has a fixed cost, so more items per chunk cost less per item. Across the 165 finished chunks loop-claude archived up to that day, a chunk took a median of 1.30M tokens with one item and 1.33M with two, and three in four chunks shipped one item. The old rule also asked one PR title to state what the items achieve together; lilleman dropped it, since unrelated items that fire the same passes cost one review.
|
2026-10-22, lilleman, through todo item 216. Serves goal 1.4: each review has a fixed cost, so more items per chunk cost less per item. Across the 165 finished chunks loop-claude archived up to that day, a chunk took a median of 1.30M tokens with one item and 1.33M with two, and three in four chunks shipped one item. The old rule also asked one PR title to state what the items achieve together; lilleman dropped it, since unrelated items that fire the same passes cost one review.
|
||||||
|
|
||||||
The cap is 5, `bin/todo_table.py`'s `BUNDLE_MAX_R`, from the same chunks: by the highest R among a chunk's items, the median was 0.9M to 1.5M tokens at R 1 to 5, and 2.7M at R 6, with a 90th percentile of 8.8M. A risky item that runs long re-runs review over every item bundled with it. R 5 is also the least R an I 4 item gets, so no item that could take everything down shares a chunk unless both its L and E are 1. Valid while a review's cost is mostly fixed per chunk; revisit once 30 chunks have shipped bundles under it.
|
The cap is 5, `bin/todo_table.py`'s `BUNDLE_MAX_R`, from the same chunks: by the highest R among a chunk's items, the median was 0.9M to 1.5M tokens at R 1 to 5, and 2.7M at R 6, with a 90th percentile of 8.8M. A risky item that runs long re-runs review over every item bundled with it. R 5 is also the least R an I 4 item gets, so an item that could take everything down shares a chunk only where its L + E is 3 or less, and an irreversible I 5 item, at R 7 or more, never does. Valid while a review's cost is mostly fixed per chunk; revisit once 30 chunks have shipped bundles under it.
|
||||||
|
|||||||
Reference in New Issue
Block a user