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
+9 -8
View File
@@ -44,8 +44,9 @@ cannot be read; or when git cannot name the merge base or the diff.
"""
import sys
import time
import typing
from git_cli.git_repo import default_ref, git
from git_cli.git_repo import default_ref, git, Git
from failure import Failure
from plan_store.stores import store as plan_store
from touch_predictions.prediction import predicted, together, Touches
@@ -73,8 +74,8 @@ def main(argv: list[str]) -> int:
return 0
def recorded(config: ProjectConfig, ids: list[int]) -> str | Failure:
"""Appends the entry of the chunk that takes the items ids, and says so; or says that the project keeps no record."""
def recorded(config: ProjectConfig, ids: list[int], now: typing.Callable[[], float] = time.time, run: Git = git) -> str | Failure:
"""Appends the entry of the chunk that takes the items ids, stamped at now and read from the commits run shows, and says so; or says that the project keeps no record."""
store = touch_predictions_store(config)
if store is None:
return f"The project's config sets no `{TOUCH_PREDICTIONS}`, so nothing is recorded."
@@ -82,17 +83,17 @@ def recorded(config: ProjectConfig, ids: list[int]) -> str | Failure:
if isinstance(prediction, Failure):
return prediction
cwd = str(config.top)
default = default_ref(cwd)
base = default if isinstance(default, Failure) else git("merge-base", default, "HEAD", cwd=cwd)
head = base if isinstance(base, Failure) else git("rev-parse", "--short", "HEAD", cwd=cwd)
default = default_ref(cwd, run=run)
base = default if isinstance(default, Failure) else run("merge-base", default, "HEAD", cwd=cwd)
head = base if isinstance(base, Failure) else run("rev-parse", "--short", "HEAD", cwd=cwd)
if isinstance(base, Failure) or isinstance(head, Failure):
return head if isinstance(head, Failure) else base
# Every chunk writes the plan and the records, so they are left out of what a chunk touched.
skipped = {path for name in ("plan", *RECORDS, TOUCH_PREDICTIONS) if (path := config.tracked(name))}
touches = touched(base.strip(), "HEAD", cwd, skipped)
touches = touched(base.strip(), "HEAD", cwd, skipped, run)
if isinstance(touches, Failure):
return touches
failed = record.append(store, ids, record.entry(ids, utc(time.time()), head.strip(), prediction, touches))
failed = record.append(store, ids, record.entry(ids, utc(now()), head.strip(), prediction, touches))
return failed or f"Recorded what chunk {', '.join(map(str, ids))} was predicted to touch, and what it touched, in {store.label}."