Timestamp app-server notifications at emission (#32905)

## What changed

- Add an optional `emittedAtMs` field to server notification envelopes and expose the envelope in the generated JSON and TypeScript schemas.
- Populate the Unix timestamp when app-server emits a notification, before transport routing, so every connection in a fan-out receives the same value.
- Keep the field optional for clients decoding notifications from older app-server versions.

## Testing

- Verify notification serialization includes `emittedAtMs`.
- Verify targeted fan-out reuses one timestamp across connections.

GitOrigin-RevId: b379cb11e8e91c558bcd3d46ce459311a6e81e54
This commit is contained in:
Owen Lin authored and copyberry committed 2026-07-14 00:38:04 +00:00
1 parent 7f3eb8a223
commit c39520f3d1
22 files changed
+400 -171

No files matched your search

@@ -1709,6 +1709,25 @@ server_notification_definitions! {
}
/// Server notification envelope sent over app-server transports.
///
/// `emitted_at_ms` records when app-server emitted the notification, before it
/// is fanned out to individual connections.
#[derive(Serialize, Deserialize, Debug, Clone, TS)]
#[serde(rename_all = "camelCase")]
pub struct ServerNotificationEnvelope {
#[serde(flatten)]
pub notification: ServerNotification,
/// Unix timestamp (in milliseconds) when app-server emitted this notification.
///
/// Optional so clients can decode notifications from older app-server
/// versions. Current app-server versions always populate it.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[ts(optional)]
#[ts(type = "number")]
pub emitted_at_ms: Option<i64>,
}
client_notification_definitions! {
Initialized,
}