Skip to content

Conversation

@cdoern
Copy link
Contributor

@cdoern cdoern commented Sep 23, 2025

What does this PR do?

diff the /v1/ routes that are OpenAI compatible against the OpenAI openAPI spec. This will of course only trigger on PRs where the spec is changed.

This will catch errors with new handwritten additions to our openAI compat routes.

Instead of fetching the OpenAPI spec from a dynamic URL, which could cause non-deterministic build failures,

this change uses a local copy stored at docs/static/openai-spec.yml.

This makes the conformance check fully reproducible and prevents CI failures caused by uncontrolled upstream changes.

I am marking this test with continue-on-error: true, until we get rid of all of the errors. Nevertheless, this is a nice utility to have so folks know if their spec changes introduce more breaking changes or fix breakages when comparing to the OpenAI openapi spec.

Test Plan

test should pass.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 23, 2025
@cdoern cdoern force-pushed the oasdiff-for-openai branch 10 times, most recently from 67b7c6e to b509e85 Compare September 24, 2025 14:49
@cdoern cdoern marked this pull request as ready for review September 24, 2025 14:51
key: openai-openapi.yml

# Cache oasdiff to avoid checksum failures and speed up builds
- name: Cache oasdiff
Copy link
Contributor

Choose a reason for hiding this comment

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

we should probably also support a force no-cache conformance check as well - we should probably run it at the time of release.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, but should I make this a separate action so it can be triggered by maintainers manually?

@cdoern cdoern force-pushed the oasdiff-for-openai branch 4 times, most recently from da078af to c5bd55e Compare September 27, 2025 19:19
@cdoern cdoern requested a review from raghotham September 27, 2025 19:20
Copy link
Collaborator

@leseb leseb left a comment

Choose a reason for hiding this comment

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

I think this action could result in a "badge" on the repo once we feel confident, having the compatibility ratio again openai is very important :)

@cdoern cdoern force-pushed the oasdiff-for-openai branch 3 times, most recently from d7e8b77 to 5e68691 Compare October 3, 2025 15:52
@cdoern
Copy link
Contributor Author

cdoern commented Oct 3, 2025

this now checks all of our APIs against all of the openAI apis. The removal of /v1/openai/v1/ makes this kind of difficult

@cdoern cdoern force-pushed the oasdiff-for-openai branch 2 times, most recently from f423104 to d9abb2e Compare October 3, 2025 16:48
@ashwinb
Copy link
Contributor

ashwinb commented Nov 6, 2025

@cdoern do you plan to pick this up?

@cdoern
Copy link
Contributor Author

cdoern commented Nov 6, 2025

yes @ashwinb I can get back on this today/tomorrow. thanks for the reminder!

@cdoern
Copy link
Contributor Author

cdoern commented Nov 7, 2025

@ashwinb this should be set now for review

After my last commit, I realized that while the oasdiff command was working, our CI was still vulnerable to upstream changes in the OpenAI spec since we were fetching it live on every run.

My initial thought was to find a permanent, version-locked URL to pin against, but after some investigation, it turns out there isn't a stable, versioned URL available for the exact spec we need, openai only published the most recent one to a stainless URL.

To guarantee build stability and make our conformance test fully hermetic, I've changed my approach to vendor the OpenAI spec directly into our repository at docs/static/openai-spec.yml.

@cdoern cdoern force-pushed the oasdiff-for-openai branch from 867e0a4 to a8928b6 Compare November 7, 2025 20:15
Copy link
Collaborator

@leseb leseb left a comment

Choose a reason for hiding this comment

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

Thanks!

info:
title: OpenAI API
description: The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
version: 2.3.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm wondering if we should either:

  • put this into a 2.3.0 directory
  • or add -2.3.0 to the file name

Or perhaps, are we always replacing / overwritting with a new spec?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think naming -2.3.0 is good! I only think we should overwrite this file when we choose to bump to a different version of the OpenAI spec, it'll likely be a losing battle to constantly be targeting the newest version of the spec.

@cdoern cdoern force-pushed the oasdiff-for-openai branch from a8928b6 to 061422c Compare November 14, 2025 17:00
@ashwinb
Copy link
Contributor

ashwinb commented Nov 14, 2025

image

Looks like it is erroring?

diff the `/v1/` routes that are OpenAI compatible against the OpenAI openAPI spec. This will of course only trigger on PRs where the spec is changed.

This will catch errors with new handwritten additions to our openAI compat routes.

Instead of fetching the OpenAPI spec from a dynamic URL, which could cause non-deterministic build failures,

this change uses a local copy stored at `docs/static/openai-spec-2.3.0.yml`.

This makes the conformance check fully reproducible and prevents CI failures caused by uncontrolled upstream changes.

Signed-off-by: Charlie Doern <cdoern@redhat.com>
@cdoern cdoern force-pushed the oasdiff-for-openai branch from 061422c to 2b187cb Compare November 17, 2025 14:56
@cdoern
Copy link
Contributor Author

cdoern commented Nov 17, 2025

the spec was incomplete (I must have not copied it all the first time) which is why the test was erroring, updated it!

@cdoern cdoern requested a review from leseb November 18, 2025 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants