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:
@@ -73,11 +73,11 @@ def main(argv: list[str]) -> int:
|
||||
|
||||
|
||||
def update(record: RecordStore, archive: pathlib.Path, checkout: Checkout, home: str, reset_at: str | None) -> Updated | Failure:
|
||||
text = record.read()
|
||||
if isinstance(text, Failure):
|
||||
return text
|
||||
held = record.held()
|
||||
if isinstance(held, Failure):
|
||||
return held
|
||||
# An empty record starts with its title.
|
||||
text = text or "# Reading cost\n"
|
||||
text = held.text or "# Reading cost\n"
|
||||
figures = new_figures(text, archive, checkout, home)
|
||||
if isinstance(figures, Failure):
|
||||
return figures
|
||||
@@ -86,9 +86,8 @@ def update(record: RecordStore, archive: pathlib.Path, checkout: Checkout, home:
|
||||
readings = readings_of(text)
|
||||
if isinstance(readings, Failure):
|
||||
return readings
|
||||
if marks and (unwritten := record.write(text)):
|
||||
return unwritten
|
||||
return Updated(len(figures), readings)
|
||||
written = record.write(text, held.version) if marks else None
|
||||
return written if isinstance(written, Failure) else Updated(len(figures), readings)
|
||||
|
||||
|
||||
def new_figures(record: str, archive: pathlib.Path, checkout: Checkout, home: str) -> list[str] | Failure:
|
||||
|
||||
@@ -19,6 +19,7 @@ from reading_cost.measure import Checkout, Reading
|
||||
from failure import Failure
|
||||
from reading_cost import figures, main, measure
|
||||
from transcript_archive.read import finished_chunks, FinishedChunk
|
||||
from record_store.held import Held
|
||||
from test_env import isolated_env
|
||||
from record_store.fakes import MemoryStore
|
||||
from transcript_archive import outcomes
|
||||
@@ -237,7 +238,7 @@ class Located(unittest.TestCase):
|
||||
class Update(unittest.TestCase):
|
||||
def test_fails_where_the_record_refuses_the_write(self):
|
||||
class Unwritable(MemoryStore):
|
||||
def write(self, text: str) -> Failure | None:
|
||||
def write(self, text: str, over: str | None = None) -> Held | Failure:
|
||||
return Failure("the wiki is down")
|
||||
|
||||
archive = pathlib.Path(self.enterContext(tempfile.TemporaryDirectory()))
|
||||
|
||||
Reference in New Issue
Block a user