revert: nested BaseModel coercion (#295) - #375
Conversation
There was a problem hiding this comment.
💡 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".
|
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. |
Summary
BaseModelcontract.Commit structure
b269a43eis the literal Git revert of merge commite5152a92962251ce76ceb3d89ec0b6b37fa4efdb.6e8650e1adds 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_hexpose 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
#[],#to_h, and#deep_to_hparams.to_h.fetch(:input).fetch(0).fetch(:type)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
scripts/testentry point on Ruby 3.3.12, 3.4.10, and 4.0.6: 613 runs, 2,256 assertions on eachbundle exec rake lint: RuboCop, Sorbet, and 1,212 RBS files greenbundle exec rake build:gem