mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-06 16:06:08 +00:00
feat(provider): version provider observation metadata with schemaVersion
OpenAI and xAI now stamp provider_observation_json with schemaVersion: 1 so historical records can be decoded per version (missing version = v0). Per project-redundancy-boundary-audit DB-03. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1127,6 +1127,8 @@ impl OpenAiResponseObservationState {
|
||||
|
||||
fn provider_metadata(&self) -> Option<ProviderResponseMetadata> {
|
||||
let mut metadata = Map::new();
|
||||
// 观测对象版本信封:读取端按 schemaVersion 解码,缺失视为 v0(见 DB-03)。
|
||||
metadata.insert("schemaVersion".to_owned(), json!(1));
|
||||
let effective_model = self
|
||||
.response_metadata
|
||||
.effective_model
|
||||
|
||||
@@ -1543,6 +1543,8 @@ fn xai_transport_metadata(
|
||||
if metadata.is_empty() {
|
||||
return None;
|
||||
}
|
||||
// 观测对象版本信封:读取端按 schemaVersion 解码,缺失视为 v0(见 DB-03)。
|
||||
metadata.insert("schemaVersion".to_owned(), Value::from(1));
|
||||
ProviderResponseMetadata::new(serde_json::to_string(&Value::Object(metadata)).ok()?)
|
||||
}
|
||||
|
||||
|
||||
@@ -1012,6 +1012,7 @@ async fn execute_returns_cold_stream_and_records_selected_account() {
|
||||
assert_eq!(
|
||||
metadata,
|
||||
json!({
|
||||
"schemaVersion": 1,
|
||||
"clientCache": "miss",
|
||||
"dnsSource": "system",
|
||||
"dnsMs": 7,
|
||||
|
||||
Reference in New Issue
Block a user