Answer architecture round 1: 2 🔴, 4 🟡 (0 misread); one branch_chunks reader with a pure fix rule, routed chunks matched by item
This commit is contained in:
@@ -2,17 +2,19 @@
|
||||
import contextlib
|
||||
import dataclasses
|
||||
import fcntl
|
||||
import functools
|
||||
import json
|
||||
import pathlib
|
||||
import re
|
||||
import typing
|
||||
|
||||
from transcript_archive.read import archived_outcomes, chunk_outcomes, finished_chunks
|
||||
from branch_chunks.read import branch_chunks
|
||||
from branch_chunks.cut import BranchChunk
|
||||
from project_key import checkout_of
|
||||
from routing_figures.measure import Chunk, ChunkFigures, measured, MEASURED_AT, Subagent
|
||||
from git_repo import default_ref
|
||||
from git_repo import default_ref, Git
|
||||
from failure import Failure
|
||||
from score_outcomes.later_fixes import Landed, later_fixes
|
||||
from claude_code.entries import parse_entry
|
||||
from file_writes import replace_file
|
||||
from utc_stamp import STAMPED
|
||||
@@ -83,7 +85,7 @@ class Measured:
|
||||
unread: tuple[str, ...] = ()
|
||||
|
||||
|
||||
def measure_archive(root: pathlib.Path, home: str, since: str) -> Measured | Failure:
|
||||
def measure_archive(root: pathlib.Path, home: str, since: str, git: Git) -> Measured | Failure:
|
||||
"""The figures of each chunk that finished after since, measured one chunk at a time because the archive outgrows memory. Only an archive that cannot be listed fails."""
|
||||
listed = archived_outcomes(root)
|
||||
if isinstance(listed, Failure):
|
||||
@@ -99,7 +101,7 @@ def measure_archive(root: pathlib.Path, home: str, since: str) -> Measured | Fai
|
||||
skipped.append(key)
|
||||
continue
|
||||
chunks = [chunk for chunk in chunks if chunk.finished > since]
|
||||
history = branch_history(checkout_of(key, pathlib.Path(home))) if chunks else None
|
||||
history = branch_history(checkout_of(key, pathlib.Path(home)), git) if chunks else None
|
||||
if isinstance(history, Failure):
|
||||
unread.append(f"{key}: {history.reason}")
|
||||
history = None
|
||||
@@ -116,10 +118,10 @@ def measure_archive(root: pathlib.Path, home: str, since: str) -> Measured | Fai
|
||||
return Measured(found, tuple(skipped), tuple(unread))
|
||||
|
||||
|
||||
def branch_history(checkout: str) -> list[Landed] | Failure:
|
||||
def branch_history(checkout: str, git: Git) -> list[BranchChunk] | Failure:
|
||||
"""The chunks on the checkout's default branch as last fetched, read guarded, since the checkout's config may name a program."""
|
||||
ref = default_ref(checkout, GIT_TIMEOUT, guarded=True)
|
||||
return ref if isinstance(ref, Failure) else later_fixes(ref, cwd=checkout, guarded=True, timeout=GIT_TIMEOUT)
|
||||
ref = default_ref(checkout, GIT_TIMEOUT, guarded=True, git=git)
|
||||
return ref if isinstance(ref, Failure) else branch_chunks(ref, functools.partial(git, cwd=checkout, timeout=GIT_TIMEOUT, guarded=True))
|
||||
|
||||
|
||||
def entries(path: pathlib.Path) -> list[dict]:
|
||||
|
||||
Reference in New Issue
Block a user