Gzip loop-claude's archive and the review folders 30 days after each file was last written, and read gzipped files by their plain name
CI / tests (pull_request) Failing after 2m59s

This commit is contained in:
2026-11-17 02:00:32 +01:00
parent 7b0e4d013e
commit b9876c17fe
23 changed files with 467 additions and 18 deletions
+3 -2
View File
@@ -3,6 +3,7 @@ import contextlib
import dataclasses
import fcntl
import functools
import io
import json
import pathlib
import typing
@@ -15,6 +16,7 @@ from routing_figures.chunk import Chunk, chunk_figures, ChunkFigures, Subagent
from git_cli.git_repo import default_ref, Git
from claude_code.entries import Entry, parse_entry
from failure import Failure
from text_files.compressed import read_stored
from text_files.file_writes import replace_file
from project_config.main import title_templates
from project_config.templates import Titles
@@ -115,8 +117,7 @@ def branch_history(checkout: str, home: pathlib.Path, titles: Titles, git: Git)
def entries(path: pathlib.Path) -> list[Entry]:
with open(path, "rb") as handle:
return [entry for line in handle if (entry := parse_entry(line))]
return [entry for line in io.BytesIO(read_stored(path)) if (entry := parse_entry(line))]
def subagent(transcript: pathlib.Path) -> Subagent:
@@ -19,6 +19,7 @@ from project_config.templates import BARE, Titles
from branch_chunks.cut import BranchChunk
from routing_figures.calls import Call, calls, totals
from routing_figures.chunk import Chunk, chunk_figures, ChunkFigures, Reports, Subagent
from text_files import compressed
from project_config.test_project_config import configured, write_config
from routing_figures.state import due
from claude_code.entries import entry_from
@@ -352,6 +353,13 @@ class Archive(unittest.TestCase):
self.assertEqual(found.chunks[0].dollars["subagent type"], {"worker": 2.0, "Explore": 2.0})
self.assertEqual(archive.measure_archive(self.root, "/h", "2026-10-14T10:00:00Z", no_checkout), archive.ArchiveChunks([], ()))
def test_measures_a_chunk_whose_transcripts_are_compressed(self):
self.chunk("home/x", "c1", stamped("2026-10-14T10:00:00Z", outcomes.finished(LOW_ROUTE, "m", "j")), [message("m1", "2026-10-14T09:00:00Z", call("Agent", "a1", subagent_type="Explore"))], ({"agentType": "Explore", "toolUseId": "a1"}, [message("s1", "2026-10-14T09:00:01Z")]))
for copy in self.root.rglob("*.jsonl"):
self.assertIsNone(compressed.compress(copy))
found = archive.measure_archive(self.root, "/h", "", no_checkout)
self.assertEqual(found.chunks[0].dollars["subagent type"], {"worker": 2.0, "Explore": 2.0})
def test_counts_each_chunks_later_fixes_from_its_projects_checkout(self):
home = self.root / "home"
env = {**isolated_env(), "GIT_CONFIG_GLOBAL": os.devnull, "HOME": str(home)}