Skip to content

Avoid subtracting disjoint oneOf branches with shared properties - #1086

Open
jmagar wants to merge 1 commit into
oxidecomputer:mainfrom
jmagar:fix/disjoint-oneof-shared-properties
Open

jmagar wants to merge 1 commit into
oxidecomputer:mainfrom
jmagar:fix/disjoint-oneof-shared-properties

Conversation

@jmagar

@jmagar jmagar commented Sep 24, 2026

Copy link
Copy Markdown

Problem

Codex App Server's McpServerElicitationRequestParams JSON Schema combines shared object properties with a oneOf whose branches are distinguished by disjoint mode values. Several branches also contain a wildcard (true) property schema. cargo typify 0.8.0 panics in merge_schema_not when it subtracts another branch that cannot match the already-merged branch.

This follows the shared-properties case in #272 and the not merge work in #829 / #831. The broader not handling issue remains #489.

Fix

Before subtracting another oneOf branch, check whether it can intersect the current merged branch. If the intersection is unsatisfiable, the branch is already excluded and no not schema is needed. Keep the existing subtraction path for overlapping branches.

Add a small schema fixture with the same shared-properties, disjoint-mode, and wildcard-property shape. The generated Rust snapshot verifies that both variants retain serverName, threadId, mode, requestedSchema, and _meta. A merge unit test checks those fields after the branch merge.

Verification

  • cargo test -p typify-impl --lib (114 passed)
  • cargo test -p typify --test schemas test_schemas (passed)
  • cargo fmt --all -- --check (passed)
  • Unmodified Codex CLI 0.156.0 McpServerElicitationRequestParams.json generates successfully with this change; it panics at merge.rs:426 on typify 0.8.0 without the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant