feat(storage): implement storage layer with file and SQLite backends#7
Merged
Conversation
- Add storage traits for RecipesStorage, SignalStorage, KnowledgeStorage, SessionStorage - Implement file-based storage (JSONL/JSON) for all components - Add SQLite backend for recipes with FTS5 full-text search - Support config directory resolution via $DO_SOMETHING_CONFIG or ~/.do-something - Include comprehensive test coverage for all storage components
… only - Remove SearchIndex, PersistedIndex, and all index-related code from FileRecipesDb (recipes_db.rs) - Remove rebuild_index() from RecipesStorage trait - Rename SQLite rebuild_index to rebuild_fts_index as a struct method (not part of trait) - Add SQLite search_with_limit() for configurable result limits - Simplify FileRecipesDb to pure append-only JSONL with O(n) search - Fix OpenOptions import placement in signal_log.rs - Update module documentation to clarify backend differences - Add test for SQLite FTS rebuild
6df25e9 to
f31e5c1
Compare
Security fixes: - Add path traversal prevention in knowledge_store (domain, user_id) - Add path traversal prevention in session_store (session_id) - Validate inputs reject '/', '\', '..', and null bytes Bug fixes: - Fix race condition in FileRecipesDb with mutex lock - Add explicit flush for write durability in all file-based stores - Use transactions in SqliteRecipesDb for FTS consistency - Handle URL duplicates in SqliteRecipesDb (return existing ID) Code quality: - Make search consistent: now searches name AND ingredients - Add #[non_exhaustive] to StorageError enum - Improve SQLite row parsing with explicit types Tests: 75 tests passing (17 new tests for security and concurrency)
milarze
commented
Jul 2, 2026
- Move validate_path_component to shared file_utils module - Use DEFAULT_TOKEN_BUDGET const instead of magic number - Remove backend usage recommendations from docs - Handle mutex lock poisoning gracefully without unwrap - Add path validation documentation to signal_log - Add file_utils tests for path component validation
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.
Overview
Implements the storage layer as specified in
specifications/01-storage-layer.md. The storage layer provides file-based persistence for recipes, signals, knowledge, and session state, with SQLite support for recipes.Changes
RecipesStorage,SignalStorage,KnowledgeStorage,SessionStorage, and combinedStorageFileRecipesDb: Append-only JSONL with in-memory search indexFileSignalLog: Daily JSONL filesFileKnowledgeStore: JSON files for site configs, user models, patternsFileSessionStore: JSON files for session stateSqliteRecipesDbwith FTS5 full-text search~/.do-somethingTesting
-D warnings