Pass over an item whose pull request awaits a person's merge, and hold a sentence about several named things to each
CI / tests (pull_request) Failing after 3m42s

This commit is contained in:
Lilleman
2026-11-19 21:54:43 +01:00
parent 06a1398196
commit 00975177ad
22 changed files with 312 additions and 27 deletions
+16 -3
View File
@@ -1,9 +1,11 @@
"""How the plan stands to the last release cut: the next release, whether work has landed towards it, and whether it is to be planned, reviewed or cut; and, from that standing, the item the next chunk takes first, with what the default branch holds for the pick."""
import dataclasses
from release_plan.awaiting_merge import awaiting, marked
from git_cli.git_repo import commits_since, file_at, git, Git
from plan.release import dated, dated_heading_pattern, newest_tag, parsed, Release, tagged, UNRELEASED_TITLE
from failure import Failure
from forge.commands import forge_of, Run
from plan.todo_table import Item, items, next_item, renames
from plan_store.plans import Plan
from plan_store import stores as plan_stores, plans
@@ -95,11 +97,22 @@ class DefaultPlan:
# The plan, a NoItemsTable where the branch holds none.
plan: Plan | Failure
cut: LastCut
# Why the pull requests that await a person's merge could not be read, so the plan passes over none of their items; None where they were read or not asked for.
merges_unread: Failure | None = None
def project_plan(config: ProjectConfig, ref: str, root: str, run: Git = git) -> DefaultPlan:
"""default_plan for the project config describes: its plan, its changelog and its title templates."""
return default_plan(root, ref, plan_stores.store(config), stores.store(config, "changelog"), config.titles, run)
def project_plan(config: ProjectConfig, ref: str, root: str, run: Git = git, forge_run: Run | None = None) -> DefaultPlan:
"""default_plan for the project config describes: its plan, its changelog and its title templates. With forge_run, which runs the forge's CLI in the checkout, and under `merge = "human"`, the plan's items that await a person's merge are marked so, as awaiting_merge says, and so wait."""
plan = plan_stores.store(config)
held = default_plan(root, ref, plan, stores.store(config, "changelog"), config.titles, run)
# A plan no commit holds is finished at once (chunk-pr merge --finish), so none of its items awaits a merge.
if forge_run is None or config.merge != "human" or plan.tracked is None or not isinstance(held.plan, Plan):
return held
origin = run("remote", "get-url", "origin", cwd=root)
awaited = origin if isinstance(origin, Failure) else awaiting(ref, plan, root, forge_of(origin), forge_run, run)
if isinstance(awaited, Failure):
return dataclasses.replace(held, merges_unread=awaited)
return dataclasses.replace(held, plan=marked(held.plan, awaited))
def default_plan(root: str, ref: str, plan: plans.PlanStore, changelog: stores.RecordStore, titles: templates.Titles, run: Git = git) -> DefaultPlan: