Answer principles round 1: 1 🔴, 7 🟡 (0 misread); every effect is handed in as an argument, no test patches a global, and the traces principle scopes tools that run on their user's machine
CI / tests (pull_request) Successful in 3m43s

This commit is contained in:
2026-11-19 12:42:03 +01:00
parent 8ca612b7a4
commit cb3135bc8c
124 changed files with 1437 additions and 793 deletions
+4 -3
View File
@@ -16,7 +16,7 @@ from transcript_archive.write import archive
from claude_code.entries import AssistantTurn
from project_config.templates import BRANCH
from reading_cost.measure import Checkout, Reading
from text_files import compressed
from text_files.doubles import compress
from failure import Failure
from reading_cost import figures, main, measure
from transcript_archive.read import finished_chunks, FinishedChunk
@@ -26,6 +26,7 @@ from record_store.fakes import MemoryStore
from transcript_archive import outcomes
from transcript_archive.location import project_archive
from reading_cost.shell_reads import Reads, shell_reads
from text_files.file_writes import replace_file
from project_config.doubles import write_config
TOOL = pathlib.Path(__file__).resolve().parents[1] / "reading-cost"
@@ -154,7 +155,7 @@ class ReadingCostTool(unittest.TestCase):
transcript.write_bytes(jsonl([{"timestamp": str(at)}, *worker]))
(transcript.with_suffix("") / "subagents" / "agent-a.jsonl").write_bytes(jsonl([said("1", "s1", tokens=1)]))
with contextlib.redirect_stderr(io.StringIO()):
self.assertIsNone(archive(self.archive, str(transcript), "Do it.", outcome("m", "merged", "j"), at))
self.assertIsNone(archive(self.archive, str(transcript), "Do it.", outcome("m", "merged", "j"), at, replace=replace_file))
def run_tool(self, cwd, *args):
return subprocess.run([sys.executable, str(TOOL), *args], capture_output=True, cwd=cwd, env=self.env, text=True)
@@ -177,7 +178,7 @@ class ReadingCostTool(unittest.TestCase):
def test_measures_a_chunk_whose_archived_transcripts_are_compressed(self):
self.archive_chunk(1790000000)
for copy in self.archive.rglob("*.jsonl"):
self.assertIsNone(compressed.compress(copy))
self.assertIsNone(compress(copy))
ran = self.run_tool(self.checkout)
self.assertEqual(ran.returncode, 0, ran.stderr)
self.assertIn("33 new input tokens before the first commit.", (self.checkout / "docs" / "reading-cost.md").read_text())