Add the project setting merge = "human", under which chunk-pr merge leaves the pull request ready and a do-epic chunk parks on your merge

This commit is contained in:
Lilleman
2026-11-19 15:51:44 +01:00
parent 017cf33611
commit e2f5661760
15 changed files with 240 additions and 58 deletions
+10
View File
@@ -33,6 +33,10 @@ Notifier = typing.Literal["mattermost", "slack"]
NOTIFIERS: tuple[Notifier, ...] = typing.get_args(Notifier)
# An optional boolean setting: whether `chunk-pr merge` waits for a human's approval of the pull request. False where left out.
WAIT_FOR_APPROVAL = "wait-for-approval"
# An optional setting: who merges a chunk's pull request, one of MERGERS. The chunk does where it is left out; under "human", `chunk-pr merge` leaves the pull request ready for a person to merge, for a team whose rules keep the merge with a person.
MERGE = "merge"
Merger = typing.Literal["chunk", "human"]
MERGERS: tuple[Merger, ...] = typing.get_args(Merger)
# An optional boolean setting: whether the loop may run the project's language runtime, package manager, tests and task runner on the host, for a project with no container setup. False where left out.
TOOLING_ON_HOST = "tooling-on-host"
# An optional number setting: the comprehension score under which code health is very important. A legacy project, whose code scores low, may lower it.
@@ -124,6 +128,7 @@ class ProjectConfig:
# The config's `env-file`, or None where it sets none.
env_file: pathlib.Path | None = None
wait_for_approval: bool = False
merge: Merger = "chunk"
tooling_on_host: bool = False
readability_floor: decimal.Decimal = DEFAULT_FLOOR
parallel_chunks: int = 1
@@ -265,6 +270,10 @@ def parallel_read(value: object) -> int | Unfit:
return value if type(value) is int and value >= 1 else Unfit(f"not a whole number of 1 or more, such as `{PARALLEL_CHUNKS} = 2`")
def merger_read(value: object) -> Merger | Unfit:
return next((name for name in MERGERS if name == value), None) or Unfit(f"not {' or '.join(f'"{name}"' for name in MERGERS)}")
def notifier_read(value: object) -> Notifier | Unfit:
return next((name for name in NOTIFIERS if name == value), None) or Unfit(f"not {' or '.join(NOTIFIERS)}")
@@ -341,6 +350,7 @@ def language_fault(value: object) -> str | None:
# Each one-value setting, in the order `project-config` lists them.
SCALARS = (
Scalar(WAIT_FOR_APPROVAL, "wait_for_approval", switch, lambda on: "true" if on else "false"),
Scalar(MERGE, "merge", merger_read),
Scalar(TOOLING_ON_HOST, "tooling_on_host", switch, lambda on: "true" if on else "false"),
Scalar(READABILITY_FLOOR, "readability_floor", floor_read),
Scalar(PARALLEL_CHUNKS, "parallel_chunks", parallel_read),