Skip to content

revert: nested BaseModel coercion (#295) - #375

Merged
jbeckwith-oai merged 2 commits into
mainfrom
codex/revert-nested-model-coercion
Aug 13, 2026
Merged

revert: nested BaseModel coercion (#295)#375
jbeckwith-oai merged 2 commits into
mainfrom
codex/revert-nested-model-coercion

Conversation

@jbeckwith-oai

Copy link
Copy Markdown
Contributor

Summary

  • Reverts fix: coerce nested BaseModel fields #295 as a standalone mechanical revert.
  • Adds focused characterization tests for the published raw-request / parsed-response BaseModel contract.
  • Does not introduce a replacement union or discriminator design.

Commit structure

  1. b269a43e is the literal Git revert of merge commit e5152a92962251ce76ceb3d89ec0b6b37fa4efdb.
  2. 6e8650e1 adds only the compatibility test suite.

Keeping those changes separate makes the rollback itself directly auditable and the additional contract coverage independently reviewable.

Why

#295 globally coerced nested request-model values, changing the documented contract that BaseModel#[] and #to_h expose the raw values callers supplied. The broader conversion changes also interact unsafely with optional discriminators and schemas where multiple variants share the same discriminator.

The previous forward-fix PR #373 was closed rather than repurposed. Draft #370 was also closed; issue #287 remains open for a narrower streaming-scoped solution after the model system is redesigned from first principles.

Compatibility coverage

  • raw request identity through accessors, #[], #to_h, and #deep_to_h
  • idiomatic nested fetch chains such as params.to_h.fetch(:input).fetch(0).fetch(:type)
  • request serialization after in-place mutation of caller-owned hashes
  • parsed-model symbol access, equality, and hashing
  • response coercion retaining expected nested model objects

Generator scope

No Castiron change is required. Castiron intentionally excludes the SDK-owned lib/openai/internal/ runtime, its signatures, and the handwritten test tree, so generated output is unchanged.

Validation

  • focused BaseModel suite: 17 runs, 261 assertions
  • focused compatibility suite: 9 runs, 39 assertions
  • full suite via the canonical scripts/test entry point on Ruby 3.3.12, 3.4.10, and 4.0.6: 613 runs, 2,256 assertions on each
  • bundle exec rake lint: RuboCop, Sorbet, and 1,212 RBS files green
  • bundle exec rake build:gem
  • thermonuclear code-quality review: no findings

@jbeckwith-oai
jbeckwith-oai marked this pull request as ready for review August 12, 2026 22:54
@jbeckwith-oai
jbeckwith-oai requested a review from a team as a code owner August 12, 2026 22:54
@openai-sdks

openai-sdks Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

OkTest Summary

237/237 SDK tests passed in 8.914s for Ruby SDK PR #375.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 170ms
tests/chat-completions-create.test.ts ✅ Passed 256ms
tests/chat-completions-stream.test.ts ✅ Passed 141ms
tests/files-content-binary.test.ts ✅ Passed 235ms
tests/files-create-multipart.test.ts ✅ Passed 249ms
tests/files-list-pagination.test.ts ✅ Passed 193ms
tests/initialize-config.test.ts ✅ Passed 188ms
tests/instance-isolation.test.ts ✅ Passed 279ms
tests/models-list.test.ts ✅ Passed 203ms
tests/responses-background-lifecycle.test.ts ✅ Passed 242ms
tests/responses-body-method-errors.test.ts ✅ Passed 455ms
tests/responses-cancel-timeout.test.ts ✅ Passed 207ms
tests/responses-cancel.test.ts ✅ Passed 253ms
tests/responses-compact-retries.test.ts ✅ Passed 284ms
tests/responses-compact.test.ts ✅ Passed 212ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 135ms
tests/responses-create-advanced.test.ts ✅ Passed 162ms
tests/responses-create-disconnect.test.ts ✅ Passed 157ms
tests/responses-create-errors.test.ts ✅ Passed 293ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 132ms
tests/responses-create-retries.test.ts ✅ Passed 282ms
tests/responses-create-stream-failures.test.ts ✅ Passed 134ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 236ms
tests/responses-create-stream-wire.test.ts ✅ Passed 2.064s
tests/responses-create-stream.test.ts ✅ Passed 106ms
tests/responses-create-terminal-states.test.ts ✅ Passed 264ms
tests/responses-create-timeout.test.ts ✅ Passed 213ms
tests/responses-create.test.ts ✅ Passed 348ms
tests/responses-delete.test.ts ✅ Passed 301ms
tests/responses-input-items-errors.test.ts ✅ Passed 189ms
tests/responses-input-items-list.test.ts ✅ Passed 181ms
tests/responses-input-items-options.test.ts ✅ Passed 190ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 285ms
tests/responses-input-tokens-count.test.ts ✅ Passed 269ms
tests/responses-malformed-inputs.test.ts ✅ Passed 2.23s
tests/responses-not-found-errors.test.ts ✅ Passed 352ms
tests/responses-parse.test.ts ✅ Passed 209ms
tests/responses-retrieve-retries.test.ts ✅ Passed 287ms
tests/responses-retrieve.test.ts ✅ Passed 243ms
tests/responses-stored-method-errors.test.ts ✅ Passed 741ms
tests/retry-behavior.test.ts ✅ Passed 1.988s
tests/sdk-error-shape.test.ts ✅ Passed 381ms

View OkTest run #31648868996

SDK merge (c4d144d8860b) · head (6e8650e1408d) · base (919977919667) · OkTest (a845fa206fa4)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6e8650e140

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/openai/internal/type/union.rb
Comment thread lib/openai/internal/type/base_model.rb
Comment thread lib/openai/internal/type/union.rb
Comment thread lib/openai/internal/type/base_model.rb
Comment thread lib/openai/internal/type/array_of.rb
Comment thread lib/openai/internal/type/array_of.rb

Copy link
Copy Markdown
Contributor Author

Automated review identified six pre-#295 converter behaviors that this literal rollback intentionally restores. They are now tracked together in #376 with explicit regression-coverage requirements: union error isolation, nullable fields, strictness preservation, existing-model identity, collection error retention, and nullable collection matchers.

I replied to and resolved each inline thread as separately tracked follow-up work. No code was added to this PR because doing so would make #375 a partial model-conversion redesign rather than the standalone rollback requested here.

@jbeckwith-oai jbeckwith-oai added the generator Touches generated SDK files label Aug 12, 2026
@jbeckwith-oai
jbeckwith-oai added this pull request to the merge queue Aug 13, 2026
Merged via the queue into main with commit 65fa76e Aug 13, 2026
13 checks passed
@jbeckwith-oai
jbeckwith-oai deleted the codex/revert-nested-model-coercion branch August 13, 2026 15:53
@openai-sdks openai-sdks Bot mentioned this pull request Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

generator Touches generated SDK files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants