feat(mcp): prefer pre-decrypted DB files in DBCache.get#145
Open
thedavidweng wants to merge 1 commit into
Open
feat(mcp): prefer pre-decrypted DB files in DBCache.get#145thedavidweng wants to merge 1 commit into
thedavidweng wants to merge 1 commit into
Conversation
When decrypted/<rel_path> already exists and opens cleanly, use it directly instead of re-decrypting from the encrypted db_storage copy. Falls back to the existing on-the-fly decrypt path when missing or corrupt.
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
DBCache.get()now checksdecrypted/<rel_path>first. If a pre-decrypted copy exists and opens cleanly (SELECT 1), MCP tools use it directly instead of decrypting fromdb_storageon every access.Falls back to the existing on-the-fly decrypt + WAL merge path when the decrypted file is missing or corrupt.
Motivation
Users who already ran
decrypt_db.pyhave plaintext copies underdecrypted/. Re-decrypting on each MCP query is slower and redundant.Test plan
decrypted/contact/contact.dbpresent, MCPget_contactsreturns results without touching encrypted DBdecrypted/missing or corrupt, behavior unchanged (falls back to decrypt path)