refactor(request-id): align contracts and lock field names (#3454)

* refactor(request-id): align header log and trace contracts

* test(contract): lock external request-id field names

* chore(deps): drop unused rustfs-ecstore links

Co-Authored-By: heihutu <heihutu@gmail.com>
This commit is contained in:
houseme
2026-06-15 01:59:11 +08:00
committed by GitHub
parent efaf07d323
commit 036741cb1c
12 changed files with 226 additions and 65 deletions
+17
View File
@@ -124,6 +124,7 @@ pub struct QuotaErrorResponse {
pub message: String,
#[serde(rename = "Resource")]
pub resource: String,
// External quota error contract follows the existing PascalCase error schema.
#[serde(rename = "RequestId")]
pub request_id: String,
#[serde(rename = "HostId")]
@@ -168,6 +169,7 @@ impl QuotaErrorResponse {
#[cfg(test)]
mod tests {
use super::*;
use serde_json::Value;
/// Legacy format: quota, created_at, updated_at (no quota_type)
#[test]
@@ -217,4 +219,19 @@ mod tests {
assert_eq!(q.quota, Some(1073741824));
assert_eq!(q.quota_type, QuotaType::Hard);
}
#[test]
fn quota_error_response_serializes_request_id_as_pascal_case_contract() {
let response = QuotaErrorResponse::new(
&QuotaError::InvalidConfig {
reason: "bad quota".to_string(),
},
"req-quota-123",
"host-quota-1",
);
let value = serde_json::to_value(response).expect("quota error response should serialize");
assert_eq!(value["RequestId"], Value::String("req-quota-123".to_string()));
assert!(value.get("request_id").is_none(), "quota error contract must not expose request_id");
}
}