diff --git a/crates/model-connector/src/contract.rs b/crates/model-connector/src/contract.rs index bb6459e..3062fe4 100644 --- a/crates/model-connector/src/contract.rs +++ b/crates/model-connector/src/contract.rs @@ -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, } diff --git a/crates/model-connector/tests/published_schemas.rs b/crates/model-connector/tests/published_schemas.rs index 4634280..8a1bf47 100644 --- a/crates/model-connector/tests/published_schemas.rs +++ b/crates/model-connector/tests/published_schemas.rs @@ -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::()).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")); +} diff --git a/schemas/transport_result.json b/schemas/transport_result.json index 25d97ab..acdf6b6 100644 --- a/schemas/transport_result.json +++ b/schemas/transport_result.json @@ -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": {