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:
@@ -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}."
|
||||
|
||||
Reference in New Issue
Block a user