Archive read path: tail reads, offset paging, and a readable mirror #54
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/claude-code-query!54
Loading…
Reference in a new issue
No description provided.
Delete branch "archive-read-path"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Acts on the consumer's session-history gap report (Gaps 1+2 of
docs/design/session-history-feedback-response.md, included here together with the resume-identity probe underdocs/design/probes/).What's here
archiveDir/<encoded-cwd>/<sid>.jsonl+ subagent tree (was flat; unreleased, so no migration).forSession/entries/subagentEntries/tail reads): acleanupPeriodDays-pruned session stays readable through the same API.SessionRecord.root: RecordRootexposes provenance (Vendor | Archive).mirrorwith the vendor tree absent is a no-op that never touches the archive (tested byte-identical),SessionNotFoundonly when neither root has the session.lastEntries(sessionId, limit)andentriesBefore(token, limit)returningEntryPage— backward block reads from EOF (pureBackwardLineReaderin core), opaquePageTokencarrying the resolved source + byte offset. Tokens survive file growth (append-only region reads); a token minted against a source that has since changed resolution fails with typedPageSourceMovedinstead of silently reading a different file at the same offset. Torn final line (live CLI append) is excluded by rule.Review cycle
Four-dimension review + adversarial verification: 4 confirmed findings, all fixed — three doc/PURPOSE precision items and one real correctness bug caught by review:
os.read.bytescan short-read mid-file, corrupting backward-scan offset math; fixed with a pureByteRangeReader.readFullyloop, TDD.Verification
__.fix --check,__.compile(zero warnings),__.test526/526,__.itest730/730 — including the real-CLI archive E2E (now also tail-reading the transcript the CLI wrote) and the new prune-simulation integration flow.🤖 Generated with Claude Code
Code review gate (iterative-works review-code): PASSED after fixes
Nine specialized reviewers over the diff: 1 critical, 14 warnings, ~10 suggestions → critical + all warnings + cheap suggestions fixed (9 commits); deferrals recorded. Full report + resolution:
project-management/reviews/review-pr54-2026-07-15.md.Highlights:
mirroritself — Archive-root resolution is a documented no-op, never a truncation.InvalidPageSizevalidation (max 10000), 32 MiB backward-scan budget with typedCorruptTranscriptoverflow, linear accumulation.PageTokenconstructor is private; minting lives in the pureTranscriptPage.fromTail(core), reusable by futuredirect/effectfuladapters.ArchiveMirrorextracted from the adapter; index throwaway-constructor coupling removed;ArchiveErrorTestadded with sanitization regressions (control-char filter widened to close a C1 gap).Final gates: scalafix, compile (zero warnings),
__.test526/526,__.itest730/730 incl. the real-CLI archive E2E (tail-reading the transcript the CLI wrote). CI green.🤖 Generated with Claude Code