AppServices container for hot-swappable database connections#899
Conversation
#894) Refactor Tauri backend from write-once app.manage() state to a centralized AppServices container with Arc<RwLock<>> interior mutability, enabling database switching at runtime without app restart. - Add app_services.rs with AppServices container, accessor methods, and drain-then-replace switch_database() protocol - Update all 13 command files to use State<'_, AppServices> with async accessor pattern - Update db.rs to populate AppServices instead of individual app.manage() - Update settings.rs with hot-swap flow (select_new_database now switches live instead of requiring restart) - Update frontend to handle database-changed events without restart dialog - Document embedding sync boundaries in sync-protocol.md (local commit before sync, subtree atomic sync units) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code Review: PR #899 -- AppServices Container for Hot-Swappable Database ConnectionsReviewer: Pragmatic Code Review (Claude Opus 4.6) Overall AssessmentThis is a well-executed structural refactor that introduces a centralized The code is consistent, the drain-then-replace protocol in Requirements Validation (Issue #894 Acceptance Criteria)
Findings[Improvement] Tiered initialization not implemented in
|
malibio
left a comment
There was a problem hiding this comment.
Pragmatic Code Review complete. Recommendation: APPROVE with suggestions. See detailed review comment above. The only acceptance criterion not fully met is tiered initialization in init_services() (NodeService should work even if embedding model loading fails).
…without embeddings Three review findings addressed: 1. Tiered init inconsistency: init_services() now handles NLP failure gracefully (embedding_state = None) instead of killing the entire init, matching the pattern already used by switch_database_services(). 2. Duplicated service creation: Extracted create_service_bundle() helper in db.rs that both init_services() and switch_database_services() call, preventing divergence between the two code paths. 3. MCP server skipped without embeddings: Made embedding_service optional throughout the MCP stack (McpServices, McpServerService, handlers). MCP now starts even when embeddings fail — node CRUD tools work; semantic search returns a graceful error message. Co-Authored-By: Claude <noreply@anthropic.com>
Review Findings Addressed (df5f293)All three important findings from the code review have been addressed in a single commit: 1. Tiered init inconsistency (FIXED)
2. Duplicated service creation logic (FIXED)Extracted 3. MCP server skipped without embeddings (FIXED)Made
Skipped (per review)
Verification
|
* Implement AppServices container for hot-swappable database connections (#894) Refactor Tauri backend from write-once app.manage() state to a centralized AppServices container with Arc<RwLock<>> interior mutability, enabling database switching at runtime without app restart. - Add app_services.rs with AppServices container, accessor methods, and drain-then-replace switch_database() protocol - Update all 13 command files to use State<'_, AppServices> with async accessor pattern - Update db.rs to populate AppServices instead of individual app.manage() - Update settings.rs with hot-swap flow (select_new_database now switches live instead of requiring restart) - Update frontend to handle database-changed events without restart dialog - Document embedding sync boundaries in sync-protocol.md (local commit before sync, subtree atomic sync units) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Address PR #899 review: extract shared service init, tiered NLP, MCP without embeddings Three review findings addressed: 1. Tiered init inconsistency: init_services() now handles NLP failure gracefully (embedding_state = None) instead of killing the entire init, matching the pattern already used by switch_database_services(). 2. Duplicated service creation: Extracted create_service_bundle() helper in db.rs that both init_services() and switch_database_services() call, preventing divergence between the two code paths. 3. MCP server skipped without embeddings: Made embedding_service optional throughout the MCP stack (McpServices, McpServerService, handlers). MCP now starts even when embeddings fail — node CRUD tools work; semantic search returns a graceful error message. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Summary
AppServicescontainer withArc<RwLock<>>interior mutability, replacing write-onceapp.manage()state for all runtime servicesState<'_, AppServices>with async accessor pattern (services.node_service().await?)database-changedevents without restart dialogCloses #894
Test plan
cargo clippyclean (zero warnings)svelte-checkclean🤖 Generated with Claude Code