RFC: add member indexing role for one-writer shared snapshots - #275
Draft
hyein-cbio wants to merge 1 commit into
Draft
RFC: add member indexing role for one-writer shared snapshots#275hyein-cbio wants to merge 1 commit into
hyein-cbio wants to merge 1 commit into
Conversation
Allow a per-process COCOINDEX_CODE_INDEXING_ROLE=member runtime to search a published target_sqlite.db without starting or refreshing indexes. Default remains leader so existing users are unchanged. Member MCP sessions skip background indexing, ignore refresh_index, and open the mapped snapshot read-only. Explicit ccc index, search --refresh, and reset are rejected in that process. A matching DB path mapping is required so members cannot fall back to a local index. This is an RFC for a one-writer team snapshot workflow. Incremental state stays on the leader; only a completed SQLite snapshot is published.
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
This is an RFC / draft for an experimental one-writer team snapshot workflow.
Some teams do not want every developer machine to incrementally re-index. The intended model is:
target_sqlite.dbThe new process-local setting is:
COCOINDEX_CODE_INDEXING_ROLE=member # default: leaderleaderremains the default, so existing users are unchanged.Why this is an RFC
CocoIndex does not recommend sharing live LMDB/SQLite databases over a mounted filesystem. This PR does not do that. Instead it keeps incremental state (
cocoindex.db) on the leader and publishes only a completed SQLite snapshot.Still, this is a new usage model:
I would like maintainer feedback on whether this direction is acceptable before treating it as merge-ready.
Behavior
When
COCOINDEX_CODE_INDEXING_ROLE=member:searchnever refreshes or triggers load-time indexing, even ifrefresh_index=trueccc index,ccc search --refresh, andccc resetare rejected in that processCOCOINDEX_CODE_DB_PATH_MAPPINGis required; local index fallback is refusedThe role is process-local. Setting it in
.mcp.jsonaffects the MCP process only. The bundledSessionStarthook skipsccc indexwhen the parent process already hasCOCOINDEX_CODE_INDEXING_ROLE=member.Example member MCP config
{ "mcpServers": { "cocoindex-code": { "command": "ccc", "args": ["mcp"], "env": { "COCOINDEX_CODE_INDEXING_ROLE": "member", "COCOINDEX_CODE_DB_PATH_MAPPING": "/Users/bob/src/myrepo=/Volumes/team/ccc-indexes/myrepo" } } } }Leader workflow: index locally, then
sqlite3.Connection.backup()the completedtarget_sqlite.dband atomicallyos.replace()it onto the share. Do not publishcocoindex.db.Non-goals
.cocoindex_code/settings.ymlTest plan
prek run --all-filesindexccc index/search --refresh/resetare rejectedFeedback especially welcome on:
COCOINDEX_CODE_INDEXING_ROLEis the right knobccccommand