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
+14 -8
View File
@@ -10,6 +10,7 @@ from failure import Failure
from plan_store.stores import file_plan, store as plan_store
from larv_review.seats import FIRST_SEATS, scores, seats_file, SeatsFile
from larv_review.scoring import floor_step, means, under_floor
from record_store.held import Held
from project_config.main import located
from record_store.stores import RecordStore, store
from larv_review.scoring_setup import removed_setup
@@ -145,22 +146,27 @@ def read_agreement(home: pathlib.Path) -> str | Failure:
def history_file(home: pathlib.Path) -> tuple[RecordStore, str] | Failure:
"""The store the project's config names for its comprehension history, and the history's text, empty where there is none yet."""
held = held_history(home)
return held if isinstance(held, Failure) else (held[0], held[1].text)
def held_history(home: pathlib.Path) -> tuple[RecordStore, Held] | Failure:
"""The store the project's config names for its comprehension history, and the history as it stands, with the version a write over it names."""
config = located(None, home)
if isinstance(config, Failure):
return config
history = store(config, "comprehension-history")
text = history.read()
return text if isinstance(text, Failure) else (history, text)
held = history.held()
return held if isinstance(held, Failure) else (history, held)
def append(read: str, entry: str, home: pathlib.Path) -> str | Failure:
"""Appends entry and returns the line the tool prints; a Failure where the history already holds an entry on what the seats read."""
read_history = history_file(home)
read_history = held_history(home)
if isinstance(read_history, Failure):
return read_history
history, text = read_history
if recorded(text, read):
history, held = read_history
if recorded(held.text, read):
return Failure(f"{history.label} already holds an entry on {read}; record each ruling or run once")
if unwritten := history.write(appended(text, entry)):
return unwritten
return f"Appended to {history.label}."
written = history.write(appended(held.text, entry), held.version)
return written if isinstance(written, Failure) else f"Appended to {history.label}."
+2 -2
View File
@@ -1,7 +1,7 @@
import pathlib
import typing
from larv_review.plan import EMPTIED_WORDS, plan_reasons
from larv_review.plan import Emptied, plan_reasons
from review_rules.comprehension_history import entries
from failure import Failure
from git_cli.git_repo import file_at, git
@@ -49,7 +49,7 @@ def owed_scoring_run(default: str, home: pathlib.Path, warn: typing.Callable[[st
def shortfall(reasons: list[str], recorded: int) -> Failure | None:
"""Which scoring runs the plan's reasons call that recorded, the count the branch added to the history, leaves unrecorded; None where it holds them all."""
needed = 2 if any(reason.endswith(EMPTIED_WORDS) for reason in reasons) else 1
needed = 2 if any(isinstance(reason, Emptied) for reason in reasons) else 1
if recorded >= needed:
return None
return Failure(f"the chunk owes {needed} scoring run{'s' if needed > 1 else ''} and the branch's committed history records {max(recorded, 0)}: it {' and '.join(reasons)}. larv-review's SKILL.md → 'Scoring run' says how to run and record {'them' if needed > 1 else 'it'}{"; → 'Second run' says how the second is titled" if needed > 1 else ""}")
+6 -3
View File
@@ -14,10 +14,14 @@ from record_store import stores
from larv_review.unmeasured import unmeasured_cut
# The words that end the reason a chunk empties a release. Such a chunk is due two scoring runs; a chunk with any other reason, one.
# The words that end the reason a chunk empties a release; SKILL.md → "Second run" quotes them.
EMPTIED_WORDS = "with no plan item"
class Emptied(str):
"""The reason a chunk empties a release, which makes it due two scoring runs; a chunk with only other reasons is due one."""
def scoring_run_due(before: list[Item], after: list[Item], ships: list[int], landed_release: Release | None, renamed: frozenset[Release], unmeasured: str | None = None) -> list[str] | Failure:
"""Why the plan calls a scoring run, empty when it does not.
@@ -34,8 +38,7 @@ def scoring_run_due(before: list[Item], after: list[Item], ships: list[int], lan
reasons.append(f"follows {unmeasured}")
for release in emptied(before, after, shipped, renamed):
if work_landed(release, shipped, landed_release):
# SKILL.md → "Second run" keys on this wording.
reasons.append(f"leaves release {version(release)} {EMPTIED_WORDS}")
reasons.append(Emptied(f"leaves release {version(release)} {EMPTIED_WORDS}"))
return reasons
+5 -2
View File
@@ -15,7 +15,7 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from larv_review.agreement import agreement_report, ruling_agreement, run_agreement
from review_rules.comprehension_history import appended, entries, HistoryChange, latest_places, Place, recorded, ruling_entry, scoring_entry, ScoringRun, Seat
from larv_review.plan import checkout_plan, EMPTIED_WORDS, landed_towards, plan_reasons, scoring_run_due
from larv_review.plan import checkout_plan, Emptied, EMPTIED_WORDS, landed_towards, plan_reasons, scoring_run_due
from review_rules import comprehension_history
from project_config.test_project_config import configured
from larv_review.ruling import counted, ruling, split, surplus, votes
@@ -464,8 +464,11 @@ class Shortfall(unittest.TestCase):
self.assertIn(EMPTIED_WORDS, (pathlib.Path(__file__).resolve().parents[2] / "skills" / "larv-review" / "SKILL.md").read_text(encoding="utf-8"))
def test_a_chunk_that_empties_a_release_owes_two_runs_and_any_other_reason_one(self):
emptied = ["leaves release 0.1.0 with no plan item"]
emptied = [Emptied("leaves release 0.1.0 with no plan item")]
floor = ["ships item 2, a floor item"]
# The type, not the words, makes a reason call two runs.
self.assertIn("owes 1 scoring run and", shortfall(["leaves release 0.1.0 with no plan item"], 0).reason)
self.assertIsInstance(scoring_run_due([item(1, (0, 1, 0))], [], [], (0, 1, 0), set())[0], Emptied)
self.assertIn("owes 2 scoring runs and the branch's committed history records 1", shortfall(emptied + floor, 1).reason)
self.assertIn("owes 1 scoring run and", shortfall(floor, 0).reason)
self.assertIn("records 0:", shortfall(floor, -1).reason)