Answer stability round 1: 1 🔴, 8 🟡; read each cycle's route from its own outcomes file, skip and name an unreadable chunk, and test the rungs, names, token edge cases, call boundaries, render order and stamps
This commit is contained in:
@@ -67,27 +67,37 @@ def last_measured(root: pathlib.Path) -> int | Failure:
|
||||
return int(found.group(1)) if found else 0
|
||||
|
||||
|
||||
def measure_archive(root: pathlib.Path, home: str, since: str) -> list[ChunkFigures] | Failure:
|
||||
"""The figures of each chunk that finished after since, measured one chunk at a time, since the archive outgrows memory."""
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Measured:
|
||||
"""skipped names each chunk folder that could not be read whole, such as one another loop is writing."""
|
||||
chunks: list[ChunkFigures]
|
||||
skipped: tuple[str, ...]
|
||||
|
||||
|
||||
def measure_archive(root: pathlib.Path, home: str, since: str) -> Measured | Failure:
|
||||
"""The figures of each chunk that finished after since, measured one chunk at a time, since the archive outgrows memory. Only an archive that cannot be listed fails."""
|
||||
try:
|
||||
projects = sorted({path.parent.parent for path in root.rglob("*.outcomes.md")})
|
||||
except OSError as failure:
|
||||
return Failure(f"could not read the archive {root}: {failure}")
|
||||
found = []
|
||||
skipped = []
|
||||
for project in projects:
|
||||
chunks = finished_chunks(project)
|
||||
if isinstance(chunks, Failure):
|
||||
return chunks
|
||||
skipped.append(str(project.relative_to(root)))
|
||||
continue
|
||||
for chunk in (chunk for chunk in chunks if chunk.finished > since):
|
||||
folder = project / chunk.folder
|
||||
try:
|
||||
kept = "\n".join(path.read_text(encoding="utf-8") for path in sorted(folder.glob("*.outcomes.md")))
|
||||
kept = [path.read_text(encoding="utf-8") for path in sorted(folder.glob("*.outcomes.md"))]
|
||||
subagents = [subagent(path) for path in chunk.subagents]
|
||||
worker = entries(chunk.transcript)
|
||||
except (OSError, UnicodeDecodeError) as failure:
|
||||
return Failure(f"could not read the chunk {folder}: {failure}")
|
||||
except (OSError, UnicodeDecodeError):
|
||||
skipped.append(str(folder.relative_to(root)))
|
||||
continue
|
||||
found.append(measured(Chunk(str(project.relative_to(root)), kept, worker, subagents), home))
|
||||
return found
|
||||
return Measured(found, tuple(skipped))
|
||||
|
||||
|
||||
def entries(path: pathlib.Path) -> list[dict]:
|
||||
|
||||
Reference in New Issue
Block a user