Reduce response serialization and rollout scan overhead (#36006)

## What changed

- Keep `ClientResponsePayload` typed through the app-server outgoing queue and serialize it at the transport boundary, avoiding an intermediate `serde_json::Value` while preserving the JSON-RPC wire shape.
- Return a JSON-RPC internal error when a response cannot be serialized, including over remote control, and skip unserializable analytics responses.
- Scan reverse JSONL input a chunk at a time with a larger buffer instead of processing each byte individually.

## Testing

- Cover typed response serialization and serialization failures for direct and remote-control transports.
- Cover filtering unserializable responses from analytics.

GitOrigin-RevId: cc4fd7a43461a273315bb95261bd1ae3ff65fbf7
This commit is contained in:
acrognale-oai authored and copyberry committed 2026-07-29 18:29:26 +00:00
1 parent 7579a2b413
commit c41a38dd10
14 files changed
+293 -132

No files matched your search

+7 -4
View File
@@ -485,7 +485,7 @@ impl AnalyticsEventsClient {
&self,
connection_id: u64,
request_id: RequestId,
response: ClientResponsePayload,
response: &ClientResponsePayload,
) {
self.track_response_inner(
connection_id,
@@ -499,7 +499,7 @@ impl AnalyticsEventsClient {
&self,
connection_id: u64,
request_id: RequestId,
response: ClientResponsePayload,
response: &ClientResponsePayload,
thread_originator: String,
) {
self.track_response_inner(connection_id, request_id, response, Some(thread_originator));
@@ -509,7 +509,7 @@ impl AnalyticsEventsClient {
&self,
connection_id: u64,
request_id: RequestId,
response: ClientResponsePayload,
response: &ClientResponsePayload,
thread_originator: Option<String>,
) {
if !matches!(
@@ -522,10 +522,13 @@ impl AnalyticsEventsClient {
) {
return;
}
if serde_json::to_writer(std::io::sink(), response).is_err() {
return;
}
self.record_fact(AnalyticsFact::ClientResponse {
connection_id,
request_id,
response: Box::new(response),
response: Box::new(response.clone()),
thread_originator,
});
}