Skip to content

Track model conversion correctness after #295 rollback #376

Description

@jbeckwith-oai

Context

PR #375 intentionally reverts #295 to restore the published v0.78 raw-request / parsed-response BaseModel contract before redesigning nested coercion. The exact rollback also restores several pre-#295 converter behaviors that deserve independent investigation and regression coverage.

These concerns must not be fixed by widening global coercion or changing BaseModel#[] / #to_h away from raw caller-owned values. Each should be reproduced against the published contract and solved narrowly.

Follow-up behaviors

  • Isolate conversion errors between union variant attempts so a failed earlier variant cannot poison a later successful match (for example Realtime max_output_tokens: :inf).
  • Preserve explicitly allowed nil values without recording a conversion error; distinguish optional (omittable) from nil?: true (nullable) deliberately.
  • Preserve the incoming strictness state across the discriminated-union fast path before evaluating later fields.
  • Return an already-coerced instance of the target BaseModel unchanged, retaining identity and out-of-band state such as last_response.
  • Retain collection element conversion failures deterministically across ArrayOf and HashOf, independent of element order.
  • Make nullable ArrayOf / HashOf matchers agree with their coercion and generated type contracts.

Required coverage

For each behavior, add a minimal runtime-level regression and at least one representative generated-model test where applicable. Include order permutations for collection/union error state, symbol/string discriminator forms where relevant, and assertions covering raw request access separately from parsed response materialization.

Related

Metadata

Metadata

Assignees

Labels

generatorTouches generated SDK files

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions