fix: preserve Console Notify ACK identity and request ID limits

This commit is contained in:
2026-10-30 00:00:05 +09:00
parent 87a1b6f1eb
commit c215c72873
14 changed files with 383 additions and 4 deletions
+13 -1
View File
@@ -1415,6 +1415,14 @@ fn authorize_runtime_protocol_method(
message,
..
} => protocol::Method::NotifyTracked {
receipt_scope: if matches!(
transport_source,
Some(protocol::AuthenticatedInputSource::Account { .. })
) {
protocol::NotificationReceiptScope::BrowserConsole
} else {
protocol::NotificationReceiptScope::Source
},
source: transport_source.cloned().unwrap_or_else(|| {
protocol::AuthenticatedInputSource::Backend {
operation_id: notification_request_id.clone(),
@@ -2985,6 +2993,7 @@ mod tests {
.unwrap()
.expect("account source header must resolve");
let wire = serde_json::to_string(&protocol::Method::NotifyTracked {
receipt_scope: protocol::NotificationReceiptScope::Source,
notification_request_id: "notification-1".into(),
message: "hello".into(),
source: protocol::AuthenticatedInputSource::Account {
@@ -2997,9 +3006,11 @@ mod tests {
assert!(matches!(
authorize_runtime_protocol_method(decoded, Some(&source)),
protocol::Method::NotifyTracked {
receipt_scope: protocol::NotificationReceiptScope::BrowserConsole,
notification_request_id,
source: protocol::AuthenticatedInputSource::Account { account_id },
..
} if account_id == "account-1"
} if account_id == "account-1" && notification_request_id == "notification-1"
));
}
@@ -5310,6 +5321,7 @@ mod ws_tests {
let (mut stream, _) = connect_async(request).await.unwrap();
let _ = next_frame(&mut stream).await;
let notification = protocol::Method::NotifyTracked {
receipt_scope: protocol::NotificationReceiptScope::Source,
notification_request_id: "notification-1".into(),
message: "hello".into(),
source: protocol::AuthenticatedInputSource::Account {
@@ -6540,6 +6540,7 @@ where
WorkerExecutionOperation::Input,
worker,
Method::NotifyTracked {
receipt_scope: protocol::NotificationReceiptScope::Source,
notification_request_id: notification_request_id.clone(),
message: input.content,
source: input.source.unwrap_or_else(|| {
@@ -91,6 +91,7 @@ mod notify_transport {
let mut events = lost_handle.subscribe();
lost_handle
.send(Method::NotifyTracked {
receipt_scope: protocol::NotificationReceiptScope::Source,
notification_request_id: "same-client-id".into(),
message: "human-notice-body".into(),
source: account,
@@ -100,6 +100,7 @@ mod restore_candidate {
let mut events = handle.subscribe();
let method = match source {
Some(source) => Method::NotifyTracked {
receipt_scope: protocol::NotificationReceiptScope::Source,
notification_request_id: NOTICE.into(),
message: NOTICE.into(),
source,