fix(usage): preserve full bodies before queue truncation

This commit is contained in:
ZheFox
2026-09-16 13:10:40 +08:00
parent 72a4bf3408
commit 5842c7232e
6 changed files with 216 additions and 4 deletions
@@ -185,6 +185,10 @@ SELECT
usage_http_audits.provider_request_body_ref AS http_provider_request_body_ref,
usage_http_audits.response_body_ref AS http_response_body_ref,
usage_http_audits.client_response_body_ref AS http_client_response_body_ref,
usage_http_audits.request_body_state AS http_request_body_state,
usage_http_audits.provider_request_body_state AS http_provider_request_body_state,
usage_http_audits.response_body_state AS http_response_body_state,
usage_http_audits.client_response_body_state AS http_client_response_body_state,
usage_routing_snapshots.candidate_id AS routing_candidate_id,
usage_routing_snapshots.candidate_index AS routing_candidate_index,
usage_routing_snapshots.key_name AS routing_key_name,
@@ -3467,6 +3467,18 @@ fn usage_sql_reads_http_audits_for_single_record_fetches() {
assert!(super::FIND_BY_ID_SQL.contains("LEFT JOIN usage_http_audits"));
assert!(super::FIND_BY_REQUEST_ID_SQL.contains("http_request_body_ref"));
assert!(super::FIND_BY_ID_SQL.contains("http_client_response_body_ref"));
for sql in [super::FIND_BY_REQUEST_ID_SQL, super::FIND_BY_ID_SQL] {
for field in [
"request_body",
"provider_request_body",
"response_body",
"client_response_body",
] {
assert!(sql.contains(&format!(
"usage_http_audits.{field}_state AS http_{field}_state"
)));
}
}
}
#[test]