Standardize remaining API config mutation reload paths#1
Open
vsumner wants to merge 9 commits intofix/tests-and-panic-hardeningfrom
Open
Standardize remaining API config mutation reload paths#1vsumner wants to merge 9 commits intofix/tests-and-panic-hardeningfrom
vsumner wants to merge 9 commits intofix/tests-and-panic-hardeningfrom
Conversation
7965f74 to
6975662
Compare
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
Stacked follow-up (on top of spacedriveapp#141) to finish config-mutation consistency across API endpoints, harden config writes against races, improve backward compatibility for MCP config parsing, and ensure runtime reload signaling is consistent.
Changes
1) Locked + atomic config writes
ApiState(config_write_lock) to serialize concurrentconfig.tomlwrites.Configsnapshot2) Remaining API mutation paths standardized
src/api/mcp.rs(create_mcp_server,update_mcp_server,delete_mcp_server)src/api/settings.rs(update_global_settings,update_raw_config)src/api/agents.rs(create_agent,delete_agent)RuntimeConfiginstances3) MCP config schema alignment + compatibility
[[defaults.mcp]](the canonical runtime schema), instead of a disconnected top-level[[mcp_servers]]table.[[mcp_servers]]:defaults.mcpdefaults.mcpentries win on name conflicts4) Config reload event consistency
reload_all_runtime_configsnow emitsApiEvent::ConfigReloadedafter applying the new snapshot.update_agent_confignow also emitsApiEvent::ConfigReloaded(it mutates API state directly rather than going through the shared runtime reload helper).5) Raw config semantics tightened
update_raw_configreturns explicit failure response for invalid/unapplicable config content and avoids false-success messaging.6) Added mutation-path tests
src/api/settings.rssrc/api/mcp.rssrc/api/agents.rssrc/config.rs[[mcp_servers]]merges intodefaults.mcpand preserves canonical precedence7) Docs updates
README.mdMCP examples now use[[defaults.mcp]]and mention legacy compatibility.docs/design-docs/mcp.mdupdated to describe API CRUD behavior against[[defaults.mcp]]and backward compatibility for legacy[[mcp_servers]].Validation
cargo fmt --all -- --checkcargo test api::mcp::tests:: -- --nocapturecargo test api::agents::tests:: -- --nocapturecargo test api::settings::tests:: -- --nocapturecargo test config::tests::test_legacy_mcp_servers_table_migrates_into_defaults_mcp -- --nocapturecargo test