connector-reasoning-item fix: Refusal publishes as one flat string enum again; a test pins the shape
The doc comment on ForeignReasoningState made schemars emit a oneOf; a plain comment keeps the closed set one enum. Finding refusal-schema-split. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5762dabe79
commit
c3f503e160
3 changed files with 32 additions and 24 deletions
|
|
@ -540,8 +540,9 @@ pub enum Refusal {
|
|||
Indeterminate,
|
||||
ReplayConflict,
|
||||
Malformed,
|
||||
/// A `ReasoningState` of another provider sits in the in-flight tool
|
||||
/// exchange, where dropping it would break the provider's own rules.
|
||||
// A `ReasoningState` of another provider sits in the in-flight tool
|
||||
// exchange, where dropping it would break the provider's own rules. A plain
|
||||
// comment: a doc comment would split the published schema into a union.
|
||||
ForeignReasoningState,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,3 +98,18 @@ fn the_published_ciphertext_is_what_the_wire_sends() {
|
|||
.unwrap();
|
||||
assert!(matches!(wire, rmpv::Value::Binary(bytes) if bytes.len() == 40));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_refusal_schema_is_one_flat_string_enum() {
|
||||
let schema: serde_json::Value = serde_json::from_str(&render::<Refusal>()).unwrap();
|
||||
assert!(schema.get("oneOf").is_none(), "{schema}");
|
||||
assert_eq!(schema["type"], "string");
|
||||
let variants: Vec<&str> = schema["enum"]
|
||||
.as_array()
|
||||
.expect("a closed set of strings")
|
||||
.iter()
|
||||
.map(|value| value.as_str().unwrap())
|
||||
.collect();
|
||||
assert_eq!(variants.len(), 12);
|
||||
assert!(variants.contains(&"ForeignReasoningState"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,28 +38,20 @@
|
|||
]
|
||||
},
|
||||
"Refusal": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Expired",
|
||||
"IdentitySubstitution",
|
||||
"ProviderDigestSubstitution",
|
||||
"ModelNotAllowed",
|
||||
"OutputBound",
|
||||
"PayloadBound",
|
||||
"Capacity",
|
||||
"InFlight",
|
||||
"Indeterminate",
|
||||
"ReplayConflict",
|
||||
"Malformed"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "A `ReasoningState` of another provider sits in the in-flight tool\nexchange, where dropping it would break the provider's own rules.",
|
||||
"type": "string",
|
||||
"const": "ForeignReasoningState"
|
||||
}
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Expired",
|
||||
"IdentitySubstitution",
|
||||
"ProviderDigestSubstitution",
|
||||
"ModelNotAllowed",
|
||||
"OutputBound",
|
||||
"PayloadBound",
|
||||
"Capacity",
|
||||
"InFlight",
|
||||
"Indeterminate",
|
||||
"ReplayConflict",
|
||||
"Malformed",
|
||||
"ForeignReasoningState"
|
||||
]
|
||||
},
|
||||
"StopReason": {
|
||||
|
|
|
|||
Loading…
Reference in a new issue