Sort the new modules' imports, and test a reversal count where every chunk holds one
This commit is contained in:
@@ -8,11 +8,11 @@ import pathlib
|
|||||||
import typing
|
import typing
|
||||||
|
|
||||||
from claude_code.entries import AssistantTurn, Entry
|
from claude_code.entries import AssistantTurn, Entry
|
||||||
from claude_code.tokens import Tokens, tokens_of
|
|
||||||
from claude_code.transcript import read_transcript
|
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
from routing_figures.prices import PRICES
|
from routing_figures.prices import PRICES
|
||||||
|
from claude_code.transcript import read_transcript
|
||||||
from transcript_archive.outcomes import SPENT
|
from transcript_archive.outcomes import SPENT
|
||||||
|
from claude_code.tokens import Tokens, tokens_of
|
||||||
|
|
||||||
KINDS = "input, cache write 5m, cache write 1h, cache read, output"
|
KINDS = "input, cache write 5m, cache write 1h, cache read, output"
|
||||||
# Who spent, such as `worker`, `judge` or `Explore "Search the hooks"`, and the model they ran on.
|
# Who spent, such as `worker`, `judge` or `Explore "Search the hooks"`, and the model they ran on.
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
import json
|
import json
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
|
from transcript_archive.read import chunk_outcomes, finished_chunks
|
||||||
|
from transcript_archive.outcomes import CONFIG, reversals, workers
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
from score_outcomes.results import plural
|
from score_outcomes.results import plural
|
||||||
from transcript_archive.outcomes import CONFIG, reversals, workers
|
|
||||||
from transcript_archive.read import chunk_outcomes, finished_chunks
|
|
||||||
|
|
||||||
|
|
||||||
def reversal_lines(project_archive: pathlib.Path) -> list[str] | Failure:
|
def reversal_lines(project_archive: pathlib.Path) -> list[str] | Failure:
|
||||||
|
|||||||
@@ -505,6 +505,11 @@ class Reversals(unittest.TestCase):
|
|||||||
chunk_file(archive, "kept", ("2026-11-03T10:00:00Z", outcomes.finished('{"model": "m"}', "e", "j", record=outcomes.Record("c"))))
|
chunk_file(archive, "kept", ("2026-11-03T10:00:00Z", outcomes.finished('{"model": "m"}', "e", "j", record=outcomes.Record("c"))))
|
||||||
self.assertEqual(reversal_lines(archive), ["- 2026-11-02T12:00:00Z, item 7: 2 reversed", "- The other 1 finished chunk: none."])
|
self.assertEqual(reversal_lines(archive), ["- 2026-11-02T12:00:00Z, item 7: 2 reversed", "- The other 1 finished chunk: none."])
|
||||||
|
|
||||||
|
def test_adds_no_line_for_the_others_where_every_chunk_holds_a_reversal(self):
|
||||||
|
with tempfile.TemporaryDirectory() as root:
|
||||||
|
chunk_file(pathlib.Path(root), "a", ("2026-11-02T10:00:00Z", outcomes.finished('{"model": "m", "item": 7}', "e", "j", record=outcomes.Record("c", reversed="No."))))
|
||||||
|
self.assertEqual(reversal_lines(pathlib.Path(root)), ["- 2026-11-02T10:00:00Z, item 7: 1 reversed"])
|
||||||
|
|
||||||
def test_says_all_chunks_have_none_and_names_no_item_the_worker_line_lacks(self):
|
def test_says_all_chunks_have_none_and_names_no_item_the_worker_line_lacks(self):
|
||||||
with tempfile.TemporaryDirectory() as root:
|
with tempfile.TemporaryDirectory() as root:
|
||||||
archive = pathlib.Path(root)
|
archive = pathlib.Path(root)
|
||||||
|
|||||||
Reference in New Issue
Block a user