From fbdb6c9f086e1236ca8aba17bd5d9b70b4667a4d Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Thu, 22 Oct 2026 20:56:45 +0200 Subject: [PATCH] =?UTF-8?q?Answer=20principles=20round=202:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1;=20decide=20ships-alone=20in?= =?UTF-8?q?=20one=20predicate=20both=20modules=20call?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/chunk_preflight/facts.py | 4 ++-- bin/todo_table.py | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/chunk_preflight/facts.py b/bin/chunk_preflight/facts.py index 5bcbb8d7..4d8f172f 100644 --- a/bin/chunk_preflight/facts.py +++ b/bin/chunk_preflight/facts.py @@ -1,5 +1,5 @@ """The lines the preflight prints, stated from what it gathered.""" -from todo_table import BUNDLE_MAX_R, bundle_candidates, Item, version +from todo_table import BUNDLE_MAX_R, bundle_candidates, Item, ships_alone, version from failure import Failure from chunk_preflight.gathered import Forge, Gathered, ItemFacts, NamedPath, NoItem, Plan, Ran from chunk_pick import LastCut, unreleased_entries @@ -66,7 +66,7 @@ def open_pulls(stdout: str, forge: Forge, branch: str) -> list[str]: def bundled(plan: Plan) -> list[str]: first, candidates = plan.first, bundle_candidates(plan.items, plan.first) - if first.scores.get("R", 0) > BUNDLE_MAX_R: + if ships_alone(first): return [f"- Item {first.id} has R above {BUNDLE_MAX_R}, so it ships alone."] if not candidates: return [f"- No other item of release {version(first.release)} may join item {first.id}'s chunk."] diff --git a/bin/todo_table.py b/bin/todo_table.py index 8f849a7c..c96ea3cc 100644 --- a/bin/todo_table.py +++ b/bin/todo_table.py @@ -202,11 +202,16 @@ def renames(todo: str) -> set[tuple[int, int, int]] | Failure: return marked +def ships_alone(item: Item) -> bool: + """An item above BUNDLE_MAX_R joins no chunk, and none joins it.""" + return item.scores.get("R", 0) > BUNDLE_MAX_R + + 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.""" - 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: + """The items of first's release, in the table's order, that a chunk taking first may take too: those that do not ship alone, and do not wait once the chunk's own items count as done.""" + if ships_alone(first): return [] + chunk = {item.id for item in found if item.release == first.release and not ships_alone(item)} # Dropping an item that waits may make another wait on it, so drop until none waits. while waits := waiting(found, chunk) & chunk: chunk -= waits