Repository navigation
basou: Keep the order of imported Claude Code transcripts when their birth times change - #378
Merged
Merged
Conversation
…birth times change The import groups the transcripts of a conversation and lets the one whose file was created first keep the shared records. Birth times are read on every import, so when they changed after an import (a restore from a backup, a copy to another disk) and the order flipped, the session holding the shared records was re-derived without them, and the fork, whose session begins after its copies, did not take them back: they were counted in no session. The same happened between two forks when the earlier one grew after a later one had copied from it. The transcripts already imported now keep the order in which their sessions begin, in the places they hold by birth time. A transcript not imported yet is still placed by its birth time, unless it holds a copy of a record an imported fork's session counts: then it forked from that fork and goes after it, so a restore cannot place it where it would take that fork's records again. The session store is loaded before the conversations are indexed, still once per run. The spec and the changelog name the cases the order still cannot recover from the files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
basou import claude-codegroups the transcripts of a conversation by their first record and lets the one whose file was created first keep the shared records, importing each later one without them (#377). Birth times are read from the files on every import, and they can change after one (a restore from a backup, a copy to another disk). When they flipped:This change:
docs/spec/terminal-and-import.mdsection 14.2 and the Unreleased changelog entry describe the rule and the three cases the order still cannot recover from the files.No on-disk format change.
Tests
New cases in
packages/cli/src/commands/import.test.ts(forked transcripts):--forceafter the flip re-creates the sessions in the order they began;Checks run:
pnpm -r build,pnpm typecheck,pnpm lint,pnpm lint:lang,pnpm lint:paths,pnpm test,pnpm test:scripts.