From bf538f10cc411d978bc30863085cd98c5ca18b14 Mon Sep 17 00:00:00 2001
From: cai <cai@nbcai.cc>
Date: Wed, 12 Aug 2026 14:56:28 +0800
Subject: [PATCH] test(helper): observe post-expiry attribute visibility

---
 src/service.rs |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/src/service.rs b/src/service.rs
index 65a8622..76e2627 100644
--- a/src/service.rs
+++ b/src/service.rs
@@ -1255,7 +1255,11 @@
         EventCallbackDispatch, deliver_event_callback_with, project_worker_stdout_event,
         run_event_callback_worker,
     };
-    use crate::controlled_fixture_probe_event;
+    use crate::{
+        CONTROLLED_FIXTURE_GENERATION, CONTROLLED_FIXTURE_PROBE_TTL,
+        ControlledFixtureVisibilityEvidence, PendingControlledFixtureProbe,
+        controlled_fixture_probe_event, controlled_fixture_visibility_event,
+    };
     use anyhow::Result;
     use serde_json::{Value, json};
     use std::{cell::RefCell, rc::Rc, sync::mpsc};
@@ -1301,6 +1305,31 @@
         ] {
             assert!(project_worker_stdout_event(call_id, &invalid.to_string()).is_none());
         }
+
+        let received_at = std::time::Instant::now();
+        let visibility = controlled_fixture_visibility_event(
+            call_id,
+            runtime_trace_id,
+            &PendingControlledFixtureProbe {
+                sender: livekit::prelude::ParticipantIdentity("user-1".to_string()),
+                call_id_hash: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+                    .to_string(),
+                call_trace_id_hash: trace_hash.to_string(),
+                generation: CONTROLLED_FIXTURE_GENERATION,
+                sequence: "fixture-01".to_string(),
+                received_at,
+                expires_at: received_at + CONTROLLED_FIXTURE_PROBE_TTL,
+            },
+            &ControlledFixtureVisibilityEvidence {
+                first_visible_bucket: "250_500ms",
+                visibility_source: "participant_attributes_poll",
+                binding_matched: true,
+            },
+        );
+        let projected = project_worker_stdout_event(call_id, &visibility.to_string())
+            .expect("post-expiry evidence must enter the production stdout projection");
+        assert_eq!(projected["extension"]["first_visible_bucket"], "250_500ms");
+        assert_eq!(projected["extension"]["binding_matched"], true);
     }
 
     #[test]

--
Gitblit v1.9.3