Answer architecture round 1: 4 🔴, 5 🟡 (0 misread); one-way plan packages with a plan core and an Atlassian client, one parse and print of an item's cells, a pure chunk-start decision, a settings table, one plan read and one standing per pick, one config load in chunk-pr, notifier backends in notifier, and the bin regroup filed as item 392

This commit is contained in:
2026-11-16 14:47:46 +01:00
parent 3f7d85c48e
commit f58250d0ce
103 changed files with 1299 additions and 1044 deletions
+4 -3
View File
@@ -78,11 +78,12 @@ import pathlib
import sys
import typing
from release_plan.todo_table import BLOCKED_BY, MOVES
from plan.todo_table import BLOCKED_BY, MOVES
from failure import Failure
from project_config.main import located
from release_plan.release import parsed, Release, version as release_version
from plan_store.stores import store as plan_store, PlanStore, TAGLINE, Written
from plan.release import parsed, Release, version as release_version
from plan_store.stores import store as plan_store
from plan_store.plans import PlanStore, TAGLINE, Written
from record_store.stores import RecordStore, store
from todo_item.table import shown, table
from todo_item.edits import with_bullet
+5 -16
View File
@@ -1,28 +1,17 @@
"""How todo-item prints items: as rows of the table `rank_todo.py --help` shows, whatever backend holds the plan, without the Score a markdown plan alone has."""
from release_plan.todo_table import BLOCKED_BY, Item, OLD_SHAPE, SHAPE, Shape
from release_plan.release import version
from plan.todo_table import detail_heading, Item, items_shape, row_cells, tagline_text
def table(items: list[Item]) -> str:
"""A markdown table of items, in their order."""
shape = shape_of(items)
shape = items_shape(items)
columns = [column for column in shape.columns if column != "Score"]
return "\n".join(["| " + " | ".join(columns) + " |", "|" + "---|" * len(columns), *(row(item, shape) for item in items)])
def shape_of(items: list[Item]) -> Shape:
"""OLD_SHAPE where an item holds a score only that shape has, as a plan not yet reshaped does."""
return OLD_SHAPE if any(set(item.scores) - set(SHAPE.score_columns) for item in items) else SHAPE
def row(item: Item, shape: Shape) -> str:
named = {"ID": item.id, "Release": version(item.release), BLOCKED_BY: ", ".join(str(id_) for id_ in item.blocked_by), "Exempt": item.exempt, "Item": item.tagline, shape.goals_column: shape.write_goals(item.moves), **item.scores}
return "| " + " | ".join(str(named.get(column, "")) for column in shape.columns if column != "Score") + " |"
rows = [row_cells(item, shape) for item in items]
return "\n".join(["| " + " | ".join(columns) + " |", "|" + "---|" * len(columns), *("| " + " | ".join(row.get(column, "") for column in columns) + " |" for row in rows)])
def shown(item: Item) -> str:
"""item's row under the table's header, then its detail under the heading a markdown plan gives it; the row alone where it has no detail."""
if not item.detail:
return table([item])
tagline = item.tagline.removeprefix("**").removesuffix("**").replace("\\|", "|")
return f"{table([item])}\n\n### {item.id}. {tagline}\n\n{item.detail}"
return f"{table([item])}\n\n{detail_heading(item.id, tagline_text(item.tagline))}\n\n{item.detail}"
+9 -8
View File
@@ -8,14 +8,15 @@ import unittest
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent.parent))
from project_config.test_project_config import configured
from release_plan.test_ranking import DECISIONS, README, TODO
from plan.test_ranking import DECISIONS, README, TODO
from project_config.settings import DEFAULT_FLOOR
from todo_item import edits, main
from failure import Failure
from plan_store.stores import file_plan
from project_config.main import located
from plan_store.fakes import MemoryPlan
from release_plan import plan_file, ranking
from plan_store.stores import plan_of
from plan_store.todo_md import plan_of
from plan import ranking
from todo_item.table import table
ADD = ["add", "--release", "0.1.0", "--l", "1", "--e", "1", "--i", "1", "--s", "1", "--moves", "1 by 9", "Count the `a | b` runs."]
@@ -58,7 +59,7 @@ class TodoItem(unittest.TestCase):
return raised.exception.code
def assert_ranked(self):
self.assertEqual(plan_file.check_failures(self.todo, located(str(self.folder), pathlib.Path.home())), [])
self.assertEqual(file_plan(located(str(self.folder), pathlib.Path.home()), self.todo).check(), [])
def details(self):
text = self.todo.read_text()
@@ -457,7 +458,7 @@ class Move(TodoItem):
def test_writes_nothing_where_it_refuses(self):
before = self.todo.read_text()
self.assertEqual(self.run_main("move", "3", "--release", "soon"), (1, "", "not moved: item 3's release 'soon' is not a semver version\n"))
self.assertEqual(self.run_main("move", "3", "--release", "soon"), (1, "", "not moved: item 3's Release 'soon' is not a semver version, such as 1.2.0\n"))
self.assertEqual(self.run_main("move", "99", "--release", "0.2.0"), (1, "", f"not moved: {self.todo} holds no item 99\n"))
self.assertEqual(self.todo.read_text(), before)
@@ -467,9 +468,9 @@ class OtherFile(TodoItem):
config = located(str(self.folder), pathlib.Path.home())
other = self.folder / "other.md"
other.write_text("not a plan\n")
self.assertNotEqual(plan_file.check_failures(other, config), [])
self.assertIsInstance(plan_file.rank_file(other, config), Failure)
self.assertEqual(plan_file.check_failures(self.todo, config), [])
self.assertNotEqual(file_plan(config, other).check(), [])
self.assertIsInstance(file_plan(config, other).rank(), Failure)
self.assertEqual(file_plan(config, self.todo).check(), [])
class Table(unittest.TestCase):