From a55b9757439cd52b70e3e11a96d9ed1e8f68cd6f Mon Sep 17 00:00:00 2001 From: cyberpunk Date: Sat, 10 Oct 2026 15:01:02 -0700 Subject: [PATCH] test: bind discovery guard checks to shared snapshot constructor Signed-off-by: cyberpunk --- crates/buzz-db/tests/observability_source.rs | 30 +++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/crates/buzz-db/tests/observability_source.rs b/crates/buzz-db/tests/observability_source.rs index 65562b3030..9fb3421be5 100644 --- a/crates/buzz-db/tests/observability_source.rs +++ b/crates/buzz-db/tests/observability_source.rs @@ -718,14 +718,24 @@ fn event_write_paths_include_tenant_local_chokepoint_calls() { "parameterized replacements must include a tenant-local chokepoint call" ); - let channel_members = include_str!("../src/store/channel_members.rs"); - let snapshot_lock = channel_members - .split_once("pub async fn lock_member_snapshot(\n") - .expect("channel_members must expose lock_member_snapshot") - .1 - .split_once("/// Add a member to a channel.") - .expect("snapshot lock path must precede member add path") - .0; + let snapshots = include_str!("../src/store/channel_members/snapshot.rs"); + for entry in [ + "pub async fn lock_member_snapshot(", + "pub async fn lock_admin_snapshot(", + ] { + let route = function_slices(snapshots) + .into_iter() + .find(|function| function_header(function).starts_with(entry)) + .expect("discovery entry point must exist"); + assert!( + route.contains("lock_snapshot("), + "{entry} must use the admitted constructor" + ); + } + let snapshot_lock = function_slices(snapshots) + .into_iter() + .find(|function| function_header(function).starts_with("async fn lock_snapshot(")) + .expect("shared snapshot constructor must exist"); assert!( has_any_tenant_local_chokepoint(snapshot_lock), "snapshot publication locks must include a tenant-local chokepoint call" @@ -933,8 +943,8 @@ const GUARDED_WRITE_FUNCTION_EXCEPTIONS: [&str; 3] = [ ]; const GUARDED_TX_ADAPTER_METHOD_PINS: [(&str, &str); 1] = [( - "pub async fn replace_member_event(", - "pub async fn lock_member_snapshot(", + "pub async fn replace_discovery_event(", + "async fn lock_snapshot(", )]; fn production_contains_guarded_write(production_source: &str) -> bool {