Skip to content

fix: address upstream review feedback on multi-type union fix#7

Merged
ndreno merged 1 commit into
mainfrom
fix/upstream-pr1001-feedback
May 13, 2026
Merged

fix: address upstream review feedback on multi-type union fix#7
ndreno merged 1 commit into
mainfrom
fix/upstream-pr1001-feedback

Conversation

@ndreno
Copy link
Copy Markdown

@ndreno ndreno commented May 13, 2026

Summary

Upstream PR oxidecomputer/typify#1001 (Nicolas's re-submission of oxidecomputer#1000 against upstream `main`, carrying the same fix already shipped in v1.0.0 as commit `91580aa`) received `CHANGES_REQUESTED` from @ahl on 2026-04-24. We merged our equivalent commit before noticing the review, so this PR applies the same edits to the fork copy.

The match arm itself (`None | Some(SingleOrVec::Single(_))`) is unchanged — the actual oxidecomputer#954 fix is preserved.

Changes

  1. Drop the `SingleTypeOneOfArrayBranch` test case. The schema `{ type: "object", oneOf: [{...object}, {...array}] }` is contradictory: outer `type: object` makes the array branch unsatisfiable, yet our codegen still emits the unreachable `Array([String; 2])` variant. ahl flagged this as the test case generating the wrong type. The case was added as a "regression guard" for the pre-fix tolerant-but-wrong handling — keeping it would assert that the wrong output stays wrong.

  2. Trim `$comment` rationales in `type-array-with-subschemas.json`. The originals read like LLM-generated justifications (ahl: "are these LLM-written?"). Surviving comments are one line each and only retained where the case isn't self-explanatory.

  3. Shorten the match-arm comment in `convert.rs` per ahl's inline suggestion. Same intent, less narration.

Follow-up not in this PR

The underlying buggy behaviour — singleton outer `type` + conflicting subschema branch type isn't pruned — remains. Fixing it (filter out unsatisfiable branches before generating variants) is a real codegen change with broader fixture churn. Tracked as a follow-up; would land in 1.1.0.

Test plan

  • `cargo fmt --all -- --check`
  • `cargo clippy --workspace --all-targets --locked --exclude typify-test -- -D warnings`
  • `cargo test --workspace --locked` — all suites pass with the regenerated fixture
  • `cargo deny check advisories`

Upstream PR oxidecomputer#1001 (Nicolas's re-submission of oxidecomputer#1000
against upstream main, the same fix already shipped in v1.0.0 as
commit 91580aa) received CHANGES_REQUESTED feedback from @ahl. Applying
the same edits to the fork copy so the two stay aligned and the
fixture stops asserting on bad codegen.

Three changes:

1. Drop the `SingleTypeOneOfArrayBranch` test case. The schema
   `{ type: "object", oneOf: [{...object}, {...array}] }` is
   contradictory (outer `type: object` makes the array branch
   unsatisfiable), yet codegen was emitting the unreachable
   `Array([String; 2])` variant. The case was originally added as a
   "regression guard" for the pre-fix tolerant-but-wrong handling;
   keeping it would assert that the wrong output stays wrong. The
   underlying buggy behaviour (singleton outer type + conflicting
   branch type not pruned) is left as a follow-up — see TODO at the
   convert.rs match arm.

2. Trim `$comment` rationales in the JSON fixture. The originals read
   like LLM-generated test justifications; the surviving comments are
   one line each and only retained where the case isn't
   self-explanatory.

3. Replace the 6-line match-arm comment in convert.rs with @ahl's
   suggested 3-line version. Same intent, less narration.

The match arm itself (`None | Some(SingleOrVec::Single(_))`) is
unchanged — the actual fix from 91580aa is preserved.
@ndreno ndreno merged commit 92a00e0 into main May 13, 2026
8 checks passed
@ndreno ndreno deleted the fix/upstream-pr1001-feedback branch May 13, 2026 11:56
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