Measure each chunk's reading cost from its transcript and keep it in the comprehension history

This commit is contained in:
2026-10-08 15:40:43 +02:00
parent cefb297e14
commit 1b8142e7e5
14 changed files with 400 additions and 12 deletions
+6 -2
View File
@@ -15,8 +15,7 @@ def archive(project_key: str, path: str, task: str, outcome: str, at: float, pat
try:
with open(path, "rb") as handle:
raw = handle.read()
# Each chunk's first timestamped line is its own: a finished chunk's session is deleted, so the next chunk's transcript starts afresh.
folder = paths.transcript_archive / project_key / hashlib.sha256(first_timestamped_line(raw)).hexdigest()
folder = paths.transcript_archive / project_key / chunk_of(raw)
make_private(folder)
except OSError as failure:
return unarchived(failure.filename, failure.strerror)
@@ -36,6 +35,11 @@ def archive(project_key: str, path: str, task: str, outcome: str, at: float, pat
return None
# Each chunk's first timestamped line is its own: a finished chunk's session is deleted, so the next chunk's transcript starts afresh.
def chunk_of(raw: bytes) -> str:
return hashlib.sha256(first_timestamped_line(raw)).hexdigest()
def unarchived(where: object, why: str | None) -> Failure:
return Failure(f"could not archive the transcript: {where}: {why}")