pub enum SearchAuditRecord {
Search {
agent: String,
agent_id: String,
lane: String,
query: String,
hit_count: Option<usize>,
latency_ms: u64,
at: DateTime<Utc>,
},
Recall {
agent: String,
agent_id: String,
query: String,
result_count: usize,
injected_count: usize,
at: DateTime<Utc>,
},
}Expand description
One row in a session’s RETAINED search/recall audit trail (issue #3072;
backs session.get_search_audit / GET /sessions/{id}/search-audit —
DOC-39 §4.7’s Search tab (10d) and the #3027 8b monitor card).
Why: Event::SearchPerformed/Event::MemoryRecalled are emitted only
on the SSE stream, so a client that attaches after either fired — or never
opens an SSE connection at all, per DOC-39 §2.1’s thin-REST-client
constraint — has no way to see search/recall history. This is the
per-record projection SessionRegistry::push_search_audit
(session::registry_search_audit) appends to SessionEntry::search_audit
from the SAME call record_search_performed/record_memory_recalled
already makes to emit the live event, so the retained list and the SSE
stream can never disagree about what happened. Retention is capped at
session::registry_search_audit::SEARCH_AUDIT_CAP records, oldest
dropped first — mirrors the ring buffer’s own eviction policy, so a
long-running session’s memory use stays bounded.
What: #[serde(tag = "kind", rename_all = "snake_case")] — Search
mirrors Event::SearchPerformed’s lane/query/hit_count/
latency_ms fields verbatim; per-hit path/score detail is deliberately
NOT retained here (hit_count already answers “how many” — carrying
every hit for up to SEARCH_AUDIT_CAP records would be unbounded per-hit
growth this audit trail does not need). Recall mirrors
Event::MemoryRecalled’s query, plus result_count/injected_count
folded from results (the recalled TEXT itself is likewise not retained,
same rationale). Both variants carry agent/agent_id (DOC-39 AC-13
attribution) and at — the wall-clock time the record was appended,
generated here because neither source event carries its own timestamp,
giving DOC-39 AC-7.2’s “age” column something to compute from.
Test: session::registry_search_audit::tests::*.
Variants§
Trait Implementations§
Source§impl Clone for SearchAuditRecord
impl Clone for SearchAuditRecord
Source§impl Debug for SearchAuditRecord
impl Debug for SearchAuditRecord
Source§impl<'de> Deserialize<'de> for SearchAuditRecord
impl<'de> Deserialize<'de> for SearchAuditRecord
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for SearchAuditRecord
impl PartialEq for SearchAuditRecord
Source§impl Serialize for SearchAuditRecord
impl Serialize for SearchAuditRecord
impl StructuralPartialEq for SearchAuditRecord
Auto Trait Implementations§
impl Freeze for SearchAuditRecord
impl RefUnwindSafe for SearchAuditRecord
impl Send for SearchAuditRecord
impl Sync for SearchAuditRecord
impl Unpin for SearchAuditRecord
impl UnsafeUnpin for SearchAuditRecord
impl UnwindSafe for SearchAuditRecord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more