From 6322b3fd61ffdcc6395f456c839b10e87c5dbb98 Mon Sep 17 00:00:00 2001 From: ProofOfConcept Date: Sat, 28 Feb 2026 22:19:17 -0500 Subject: [PATCH] fix: persist categorizations to capnp log categorize() only updated the in-memory HashMap and state.json cache. When init appended new nodes to nodes.capnp (making it newer than state.json), the next load() would rebuild from capnp logs and lose all category assignments. Fix: append an updated node version to the capnp log when category changes, so it survives cache rebuilds. Co-Authored-By: Kent Overstreet --- src/capnp_store.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/capnp_store.rs b/src/capnp_store.rs index 6e16b8e..3761571 100644 --- a/src/capnp_store.rs +++ b/src/capnp_store.rs @@ -711,8 +711,16 @@ impl Store { pub fn categorize(&mut self, key: &str, cat_str: &str) -> Result<(), String> { let cat = Category::from_str(cat_str) .ok_or_else(|| format!("Unknown category '{}'. Use: core/tech/gen/obs/task", cat_str))?; - if let Some(node) = self.nodes.get_mut(key) { + let updated = if let Some(node) = self.nodes.get_mut(key) { node.category = cat; + node.version += 1; + Some(node.clone()) + } else { + None + }; + if let Some(node) = updated { + // Persist to capnp log so category survives cache rebuilds + self.append_nodes(&[node])?; Ok(()) } else { Err(format!("No node '{}'", key))