Skip to content

fix: resolve allOf field types in OpenAPI compatibility guard - #512

Merged
petebacondarwin merged 1 commit into
mainfrom
codex/fix-openapi-flag-schema-guard
Nov 5, 2026
Merged

petebacondarwin merged 1 commit into
mainfrom
codex/fix-openapi-flag-schema-guard

Conversation

@petebacondarwin

Copy link
Copy Markdown
Collaborator

The Update OpenAPI workflow fails when refreshing #477 because Precursor's mode property now wraps its string schema in allOf: [$ref]. The temporary CLI flag guard only follows direct references, so it reports an undefined field type and stops generation. See the failed run.

Follow single-member allOf wrappers when checking field types, preserving --detection-mode and the existing checks for actual schema changes. Add regression coverage for inline, referenced, and nested wrappers, plus retyped and conflicting schemas.

Validation:

  • All 24 focused guard, generated-metadata, and renamed-flag tests pass against both the pinned and latest OpenAPI schemas.
  • Full root pnpm check passes against both schemas.

@petebacondarwin
petebacondarwin requested a review from a team as a code owner November 4, 2026 22:19
@pkg-pr-new

pkg-pr-new Bot commented Nov 4, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/cf@512

commit: faad071

@ask-bonk

ask-bonk Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@clanky-the-clanker clanky-the-clanker 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.

✅ Approved — This is a small, correct fix. The guard now follows single-member allOf wrappers to find a field's type, still treats multi-member allOf as ambiguous, and has regression tests. No issues found.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

📋 Code Quality: ✅ LGTM

fieldType follows single-member allOf wrappers through deref for up to 10 levels, the same limit deref uses.

  • A schema with more than one allOf member gives undefined. A conflicting schema therefore still stops generation with a clear staleness message.
  • When a schema has both type and allOf, the direct type wins. That matches what the guard did before this change.

The new tests cover inline, referenced and nested wrappers, a wrapped field whose type changed, and conflicting allOf members. Each test checks the exact staleness message or override result.

No changeset is needed because the change only touches the internal generator guard.


📝 Documentation: ✅ LGTM

No documentation changes are needed for this internal generator fix.


Reviewed commit: faad0713

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

cf --help startup

mean stddev min max
PR 180.2 ms 3.9 ms 173.2 ms 188.3 ms
base 183.5 ms 2.4 ms 176.8 ms 186.7 ms

Δ (PR vs base): ↓ -3.3 ms (-1.8%)

Measured with hyperfine on ubuntu-latest (3 warmup runs, 20 timed runs). CI numbers carry ±a few ms of runner jitter; treat small deltas as noise.

@petebacondarwin
petebacondarwin added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit 9a061fa Nov 5, 2026
12 checks passed
@petebacondarwin
petebacondarwin deleted the codex/fix-openapi-flag-schema-guard branch November 5, 2026 11:20
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.

2 participants