fix(#1013): make write private — only set_groups and remove_agent are the write paths

This commit is contained in:
damocles 2026-06-01 22:01:24 +02:00
commit 93ecbcb879

View file

@ -56,10 +56,9 @@ pub fn groups_for(name: &str) -> Vec<String> {
} }
/// Persist the full tool-groups map. Sorted JSON output keeps diffs /// Persist the full tool-groups map. Sorted JSON output keeps diffs
/// minimal. Best-effort — returns `io::Error` so callers decide /// minimal. Use `set_groups` (or `remove_agent`) from outside this
/// whether to abort or log. Prefer `set_groups` over calling this /// module — they go through the validated write path.
/// directly — `set_groups` validates group names before writing. fn write(map: &BTreeMap<String, Vec<String>>) -> std::io::Result<()> {
pub fn write(map: &BTreeMap<String, Vec<String>>) -> std::io::Result<()> {
let path = tool_groups_path(); let path = tool_groups_path();
if let Some(parent) = path.parent() { if let Some(parent) = path.parent() {
std::fs::create_dir_all(parent)?; std::fs::create_dir_all(parent)?;