Answer principles round 1: 2 🔴, 9 🟡 (0 misread); explicit record versions in place of the Confluence store's hidden state, the routing ruling filed as item 393 for 0.12.0, rule-hook catching heavy runs through uv, poetry, sudo and doas, one unreleased heading, one owner of the no-item message, typed Jira issues, a turn that gives its failure as a value, outcome tests for the Atlassian client, an Emptied reason type, an injected clock and git in touch-predictions, and paired record names

This commit is contained in:
2026-11-16 16:12:36 +01:00
parent a60bfdbc1c
commit ba21a1efcd
41 changed files with 406 additions and 280 deletions
+3 -2
View File
@@ -2,10 +2,11 @@
import re
from failure import Failure
from plan.release import UNRELEASED_HEADING
UNRELEASED = "## Unreleased"
# The changelog's section for news not yet released: ## Unreleased, or a release heading such as `## 0.6.0 (unreleased)`.
UNRELEASED_SECTION = re.compile(r"^## .*unreleased.*\n+", re.M | re.I)
# UNRELEASED_HEADING with the blank lines below it, after which a bullet goes first.
UNRELEASED_SECTION = re.compile(UNRELEASED_HEADING.pattern + r"\n+", UNRELEASED_HEADING.flags)
def with_bullet(changelog: str, bullet: str) -> str | Failure:
+9 -7
View File
@@ -81,9 +81,9 @@ import typing
from plan.todo_table import BLOCKED_BY, MOVES
from failure import Failure
from project_config.main import located
from plan_store.plans import no_item, 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
@@ -203,7 +203,7 @@ def show(args: argparse.Namespace, plan: PlanStore) -> str | Failure:
if isinstance(read, Failure):
return read
found = next((item for item in read.items if item.id == args.id), None)
return Failure(f"{plan.label} holds no item {args.id}") if found is None else f"From {plan.label}:\n\n{shown(found)}"
return Failure(no_item(plan.label, args.id)) if found is None else f"From {plan.label}:\n\n{shown(found)}"
def edit(args: argparse.Namespace, plan: PlanStore, text: str) -> str | Failure:
@@ -218,9 +218,10 @@ def edit(args: argparse.Namespace, plan: PlanStore, text: str) -> str | Failure:
def finish(args: argparse.Namespace, plan: PlanStore, changelog: RecordStore) -> str | Failure:
news = changelog.read()
if isinstance(news, Failure):
return Failure(f"not finished: {news.reason}")
held = changelog.held()
if isinstance(held, Failure):
return Failure(f"not finished: {held.reason}")
news = held.text
if news and args.changelog is None and not args.no_changelog:
return Failure(f"not finished: {changelog.label} exists; pass --changelog <bullet>, or --no-changelog where the repo doesn't publish anything or no chunk built the item")
# The bullet is checked before the plan changes: where finish refuses the bullet, the plan and the changelog stay as they were.
@@ -228,6 +229,7 @@ def finish(args: argparse.Namespace, plan: PlanStore, changelog: RecordStore) ->
if isinstance(added, Failure):
return Failure(f"not finished: {added.reason}")
done = reported(plan.finish(args.id), "not finished", lambda written: f"Finished item {written.id} in {plan.label}.")
if not isinstance(done, Failure) and added is not None and (unwritten := changelog.write(added)):
return Failure(f"{unwritten.reason}; the plan no longer holds item {args.id}, so add its bullet by hand")
written = changelog.write(added, held.version) if not isinstance(done, Failure) and added is not None else None
if isinstance(written, Failure):
return Failure(f"{written.reason}; the plan no longer holds item {args.id}, so add its bullet by hand")
return done