Avoid cloning ignored analytics notifications (#36020)

## What changed

- Pass server notifications to analytics tracking by reference.
- Clone only the notification variants that are recorded as analytics facts.

## Testing

- Add unit coverage that verifies a turn diff notification is enqueued and a command output delta notification is ignored.

GitOrigin-RevId: 2fa0711dbdcca33dce82c3ef78ee53a3f5a65bd9
This commit is contained in:
Charlie Marsh authored and copyberry committed 2026-07-29 20:09:41 +00:00
1 parent a5082373f1
commit 88d6c2b2b4
3 files changed
+43 -3

No files matched your search

+3 -2
View File
@@ -582,7 +582,8 @@ impl AnalyticsEventsClient {
});
}
pub fn track_notification(&self, notification: ServerNotification) {
/// Records analytics-relevant notifications without cloning ignored variants.
pub fn track_notification(&self, notification: &ServerNotification) {
if !matches!(
notification,
ServerNotification::TurnStarted(_)
@@ -595,7 +596,7 @@ impl AnalyticsEventsClient {
) {
return;
}
self.record_fact(AnalyticsFact::Notification(Box::new(notification)));
self.record_fact(AnalyticsFact::Notification(Box::new(notification.clone())));
}
}