Answer product-owner round 1: 0 🔴, 1 🟡 (0 misread); say when a joining item has no detail or the details cannot be read, and quote at most ten joiners' details, naming the rest

This commit is contained in:
2026-11-09 03:36:16 +01:00
parent 8812fae906
commit 301e403d02
4 changed files with 41 additions and 8 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ def planned(todo: str | Failure, cut: LastCut, default: str) -> Plan | NoItem:
return NoItem(f"every item of release {version(pick.release)} in {where} waits." if pick.release is not None else f"{where}'s items table holds no item.") return NoItem(f"every item of release {version(pick.release)} in {where} waits." if pick.release is not None else f"{where}'s items table holds no item.")
details = item_details(todo) details = item_details(todo)
detail = details.get(first.id, "") if isinstance(details, dict) else f"(todo.md's details cannot be read: {details.reason})" detail = details.get(first.id, "") if isinstance(details, dict) else f"(todo.md's details cannot be read: {details.reason})"
return Plan(found, first, f"{first.tagline}\n\n{detail}".strip(), details if isinstance(details, dict) else {}) return Plan(found, first, f"{first.tagline}\n\n{detail}".strip(), details)
def worktree_on(porcelain: str, branch: str) -> pathlib.Path | None: def worktree_on(porcelain: str, branch: str) -> pathlib.Path | None:
+21 -3
View File
@@ -4,12 +4,16 @@ from chunk_preflight.choices import cut_name, PULLS_LIST
from release_plan.release_standing import dated_cut, LastCut, unreleased_entries from release_plan.release_standing import dated_cut, LastCut, unreleased_entries
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 records.markdown_text import quoted from records.markdown_text import listed, quoted
from release_plan.release import version from release_plan.release import version
# CLAUDE.md → "Working loop" lets up to ten tiny items share a chunk, so a worker never needs more. A release with 24 joinable items would otherwise put about 155 lines of detail in every prompt.
JOINING_DETAILS = 10
def render(found: Gathered) -> list[str]: def render(found: Gathered) -> list[str]:
"""One `- ` line per fact, then the item's tagline and detail, and what each tool printed.""" """One `- ` line per fact, then the item's tagline and detail, the detail of each item that may join its chunk, and what each tool printed."""
note = [f"- {found.note}"] if found.note else [] note = [f"- {found.note}"] if found.note else []
head = [*note, f"- {last_release(found.default, found.cut)}"] head = [*note, f"- {last_release(found.default, found.cut)}"]
if isinstance(found.item, NoItem): if isinstance(found.item, NoItem):
@@ -42,11 +46,25 @@ def item_lines(default: str, item: ItemFacts) -> list[str]:
*bundled(item.plan), *bundled(item.plan),
*named_lines(item.named), *named_lines(item.named),
f"\nItem {first.id}'s tagline and detail:\n\n{quoted(item.plan.text)}", f"\nItem {first.id}'s tagline and detail:\n\n{quoted(item.plan.text)}",
*(f"\nItem {joining.id}'s detail:\n\n{quoted(item.plan.details[joining.id])}" for joining in bundle_candidates(item.plan.items, first) if item.plan.details.get(joining.id)), *joining_details(item.plan),
*(f"\n{printed(shown, done)}" for shown, done in item.tools), *(f"\n{printed(shown, done)}" for shown, done in item.tools),
] ]
def joining_details(plan: Plan) -> list[str]:
"""The detail of each of the first JOINING_DETAILS items that may join the chunk, in the table's order, and what the worker lacks: an item with no detail, the items left out, or details that cannot be read."""
joining = bundle_candidates(plan.items, plan.first)
if not joining:
return []
if isinstance(plan.details, Failure):
return [f"\nThe details of the items that may join cannot be read: {plan.details.reason}"]
shown, left = joining[:JOINING_DETAILS], joining[JOINING_DETAILS:]
lines = [f"\nItem {item.id}'s detail:\n\n{quoted(detail)}" if (detail := plan.details.get(item.id)) else f"\nItem {item.id} has no detail." for item in shown]
if left:
lines.append(f"\nThe details of items {listed([str(item.id) for item in left], 'and')} are not quoted: only the first {JOINING_DETAILS} are. Open `todo.md` for them.")
return lines
def pulls_text(pulls: tuple[Forge, Ran | Failure] | None, branch: str) -> str: def pulls_text(pulls: tuple[Forge, Ran | Failure] | None, branch: str) -> str:
"""Each open pull request from branch, by its number and URL, or why none can be listed. No title: on a public forge anyone may open one, and its title would reach the worker's prompt.""" """Each open pull request from branch, by its number and URL, or why none can be listed. No title: on a public forge anyone may open one, and its title would reach the worker's prompt."""
if pulls is None: if pulls is None:
+2 -2
View File
@@ -26,8 +26,8 @@ class Plan:
first: Item first: Item
# first's tagline and detail. # first's tagline and detail.
text: str text: str
# Every item's detail by its ID; empty where todo.md's details cannot be read. # Every item's detail by its ID, or why todo.md's details cannot be read.
details: dict[int, str] details: dict[int, str] | Failure
@property @property
def branch(self) -> str: def branch(self) -> str:
+17 -2
View File
@@ -345,8 +345,23 @@ class Render(unittest.TestCase):
self.assertIn("Item 7's detail:\n\n> Touch `src/other.py`.\n> \n> Run the e2e leg.", said) self.assertIn("Item 7's detail:\n\n> Touch `src/other.py`.\n> \n> Run the e2e leg.", said)
self.assertNotIn("Not quoted", said) self.assertNotIn("Not quoted", said)
def test_quotes_no_detail_for_a_joining_item_that_has_none(self): def test_states_that_a_joining_item_has_no_detail(self):
self.assertNotIn("Item 7's detail", rendered(item_facts())) said = rendered(item_facts())
self.assertIn("Item 7 has no detail.", said)
self.assertNotIn("Item 7's detail", said)
def test_states_that_the_joining_items_details_cannot_be_read(self):
said = rendered(item_facts(TODO + "\n```\nx\n```\n"))
self.assertIn("The details of the items that may join cannot be read: ## Details holds a fenced code block", said)
self.assertNotIn("has no detail", said)
def test_quotes_the_details_of_the_first_ten_joining_items_and_names_the_rest(self):
rows = "".join(f"| {id_} | 0.2.0 | | | **Do thing {id_}.** | 1 | 1 | 1 | 1 | 1 | 1 by 1 | 10.0 |\n" for id_ in range(20, 32))
details = "".join(f"\n### {id_}. Do thing {id_}.\n\nDetail {id_}.\n" for id_ in range(7, 8)) + "".join(f"\n### {id_}. Do thing {id_}.\n\nDetail {id_}.\n" for id_ in range(20, 32))
said = rendered(item_facts(TODO.replace("\n## Details", rows + "\n## Details") + details))
self.assertIn("> Detail 28.", said)
self.assertNotIn("Detail 29.", said)
self.assertIn("The details of items 29, 30 and 31 are not quoted: only the first 10 are. Open `todo.md` for them.", said)
def test_states_the_items_worktree_or_why_none_was_made(self): def test_states_the_items_worktree_or_why_none_was_made(self):
self.assertIn("/c/proj-item-3", rendered(item_facts())) self.assertIn("/c/proj-item-3", rendered(item_facts()))