Skip to content

Commit 224880a

Browse files
committed
Fixed: normalize ContextInfo telemetry in stream equivalence test
The run-event equivalence test compared ContextInfo byte/token counts verbatim. serdes-ai-agent derives them from the serialized request, and request part timestamps render with variable-width fractional seconds, so two otherwise identical streams could differ by a few bytes (258 vs 261) and fail the assert intermittently. Zero the telemetry in normalized_events; presence and ordering stay asserted.
1 parent 6e52f8e commit 224880a

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎src/reloaded-code-serdesai/src/agent_runtime/stream_events.rs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,12 @@ mod tests {
15671567

15681568
/// Replaces run ids with a placeholder so event sequences from
15691569
/// separate streams compare equal; run ids are random per run.
1570+
///
1571+
/// `ContextInfo` telemetry is zeroed too: the estimate serializes
1572+
/// wall-clock part timestamps, whose RFC 3339 fractional-second
1573+
/// width (0/3/6/9 digits) can differ between the two streams, so
1574+
/// byte counts drift by a few bytes between otherwise identical
1575+
/// requests.
15701576
fn normalized_events(events: &[RunEvent]) -> Vec<RunEvent> {
15711577
events
15721578
.iter()
@@ -1578,6 +1584,11 @@ mod tests {
15781584
run_id: "<run>".into(),
15791585
messages: messages.clone(),
15801586
},
1587+
RunEvent::ContextInfo { context_limit, .. } => RunEvent::ContextInfo {
1588+
estimated_tokens: 0,
1589+
request_bytes: 0,
1590+
context_limit: *context_limit,
1591+
},
15811592
other => other.clone(),
15821593
})
15831594
.collect()

0 commit comments

Comments
 (0)