Repository navigation
fix(sessions): move session search to a separate store so older writers can't corrupt it - #415
Merged
Merged
Conversation
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.
Session search now keeps its index in
.codegraph/sessions-v2.dbinstead ofsessions.db.Why
When a transcript changes, session search replaces that file's rows in the FTS table. Doing that by scanning prose is slow, so this change keeps a file-to-row mapping and replaces through it. An older CodeGraph executable that still writes
sessions.dbwould not update that mapping, and the new code would then replace the wrong rows. Moving to a new file keeps older writers and the new lookup apart.Behavior
sessions-v2.db, imports the remembered project roots fromsessions.db(read-only) and reindexes the transcripts that are still available.sessions.dbis never written, so older executables keep working against their own index. Passages from transcripts that no longer exist stay only in the old file.CODEGRAPH_SESSIONS_DIRoverride and SQLite durability settings are unchanged.Cost
Keeping both files uses extra disk space, and the first search after upgrading pays for a full transcript reindex.
The speed, disk and read-volume effects of this change were not measured. Attempts to run a before/after comparison on the shared development host kept being rejected by I/O stalls from other activity before they produced usable results, so this lands on correctness evidence only.
Checks
__tests__/sessions-storage.test.tscovers upgrading a version-4 index without changing it, importing roots without copying prose, legacy writes interleaved with replacement and deletion in every three-event order, rollback of a failed mapping insert or root import, and opening an initialized store while the other writer holds its lock.README rows checked: the session-search paragraph under "About this fork" and the
codegraph_sessionsrow in the MCP tools table now namesessions-v2.db. The docs site pagereference/mcp-server.mdis updated to match. No numbers quoted in the README change.Summary by CodeRabbit
New Features
Documentation