From a1ec38b9016f8310191a48bea8d6994faf2fb1da Mon Sep 17 00:00:00 2001 From: M3gA-Mind Date: Fri, 23 Oct 2026 05:10:23 +0530 Subject: [PATCH] test(cortex): pin that erasing only a proxied tenant's node never purges it On the proxied wire an erase of a tenant's user node purges the whole tenant only when it also reaches every descendant and every kind. The kinds case was tested; the exact-reach case was not, so dropping the descendants check went unnoticed. --- .../src/cortex/engine/mod_proxied_tests.rs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/crates/tinymemory-integrations/src/cortex/engine/mod_proxied_tests.rs b/crates/tinymemory-integrations/src/cortex/engine/mod_proxied_tests.rs index 8a0883f5..99fd0330 100644 --- a/crates/tinymemory-integrations/src/cortex/engine/mod_proxied_tests.rs +++ b/crates/tinymemory-integrations/src/cortex/engine/mod_proxied_tests.rs @@ -184,6 +184,28 @@ async fn a_narrower_erasure_forgets_each_scopes_events() { all_named(&proxy, "alice"); } +#[tokio::test] +async fn erasing_only_the_tenant_node_does_not_purge_the_tenant() { + let (endpoint, proxy) = proxied_double().await; + let engine = proxied_engine(&endpoint); + engine.store(learning("user:alice")).await.unwrap(); + engine + .store(learning("user:alice/agent:helper")) + .await + .unwrap(); + let alice = proxy.tenant("alice").unwrap(); + assert_eq!(alice.event_count(), 2); + engine + .erase(EraseRequest::new(Reach::exact( + "user:alice".parse().unwrap(), + ))) + .await + .unwrap(); + assert!(proxy.purged.lock().unwrap().is_empty(), "no tenant purge"); + assert_eq!(alice.event_count(), 1, "the agent's learning below is kept"); + all_named(&proxy, "alice"); +} + #[tokio::test] async fn erasing_the_whole_tree_names_no_tenant_and_is_refused() { let (endpoint, proxy) = proxied_double().await;