Answer stability round 1: 1 🔴, 1 🟡 (0 misread); stamp deploy-release's trace in UTC, end a stopped run's trace, drop redundant assertions, and the product-owner and prose fixes

This commit is contained in:
2026-11-27 14:14:28 +01:00
parent 3eb57d44c6
commit 74066a3134
13 changed files with 107 additions and 77 deletions
+10 -8
View File
@@ -1,13 +1,15 @@
"""What a cut says as each step finishes: on stderr, and in a file of the run's own, so the steps outlast the terminal."""
import datetime
import pathlib
import time
import typing
from failure import Failure
from text_files import utc_stamp
# Says that one step of a cut finished, as `saying` makes it.
Say = typing.Callable[[str], None]
Clock = typing.Callable[[], datetime.datetime]
# The time now, in seconds since the epoch, as time.time gives it.
Clock = typing.Callable[[], float]
def trace_folder(env: typing.Mapping[str, str], home: pathlib.Path) -> pathlib.Path:
@@ -16,13 +18,13 @@ def trace_folder(env: typing.Mapping[str, str], home: pathlib.Path) -> pathlib.P
return pathlib.Path(state) / "deploy-release"
def run_name(began: datetime.datetime, pid: int) -> str:
"""The name of the files one run keeps, which sorts by when it began."""
return f"{began:%Y-%m-%dT%H-%M-%S}-{pid}"
def run_name(began: float, pid: int) -> str:
"""The name of the files one run keeps, which sorts by when it began: that time in UTC, with no colon, so the name is valid on every disk."""
return f"{time.strftime('%Y-%m-%dT%H-%M-%SZ', time.gmtime(began))}-{pid}"
def stamped(at: datetime.datetime, line: str) -> str:
return f"{at.isoformat(timespec='seconds')} {line}\n"
def stamped(at: float, line: str) -> str:
return f"{utc_stamp.utc(at)} {line}\n"
def started(folder: pathlib.Path, name: str, command: str, now: Clock) -> pathlib.Path | Failure:
@@ -37,7 +39,7 @@ def started(folder: pathlib.Path, name: str, command: str, now: Clock) -> pathli
def kept(trace: pathlib.Path | None, line: str, now: Clock, out: typing.TextIO) -> None:
"""Append line with its time to trace, where there is one. A trace that can't be written only warns on out, since the cut's own steps count."""
"""Append line with its time, in UTC, to trace, where there is one. A trace that can't be written only warns on out, since the cut's own steps count."""
if trace is None:
return
try: