Skip to content

Commit 4499d69

Browse files
committed
🚧 remove pre-commit and vendored spec
1 parent 886cbb1 commit 4499d69

9 files changed

Lines changed: 247 additions & 82077 deletions
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Docs conformance: diffs the hand-written Fern spec (fern/openapi.yml)
2+
# against the upstream OpenAI spec. Runs on PRs that touch the spec and
3+
# weekly to surface upstream drift.
4+
5+
name: "API Conformance: Docs"
6+
7+
on:
8+
pull_request:
9+
paths:
10+
- "fern/openapi.yml"
11+
- "scripts/openai_coverage.py"
12+
13+
schedule:
14+
- cron: "23 9 * * 1"
15+
16+
workflow_dispatch:
17+
18+
permissions:
19+
contents: read
20+
21+
env:
22+
OASDIFF_VERSION: "1.23.0"
23+
24+
jobs:
25+
docs:
26+
name: fern/openapi.yml vs OpenAI spec
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
30+
with:
31+
persist-credentials: false
32+
33+
- name: Set up Python
34+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
35+
with:
36+
python-version: "3.12"
37+
38+
- uses: ./.github/actions/setup-uv
39+
- run: uv sync --locked --group dev
40+
41+
- name: Install oasdiff
42+
run: |
43+
go install github.com/oasdiff/oasdiff@v${{ env.OASDIFF_VERSION }}
44+
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
45+
46+
- name: Check for breaking changes
47+
if: github.event_name == 'pull_request'
48+
run: uv run --locked python scripts/openai_coverage.py --fetch --check-breaking
49+
50+
- name: Check conformance
51+
run: uv run --locked python scripts/openai_coverage.py --fetch
52+
53+
- name: Weekly drift summary
54+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
55+
run: |
56+
{
57+
echo "## Docs Conformance — Weekly Drift Check"
58+
echo '```'
59+
uv run --locked python scripts/openai_coverage.py --fetch 2>&1 || true
60+
echo '```'
61+
} >> "$GITHUB_STEP_SUMMARY"
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Implementation conformance: diffs the actual FastAPI contract (app.openapi())
2+
# against the upstream OpenAI spec. Catches schema drift introduced by
3+
# Pydantic model changes in nemoguardrails/server/.
4+
5+
name: "API Conformance: Implementation"
6+
7+
on:
8+
pull_request:
9+
paths:
10+
- "nemoguardrails/server/**"
11+
- "scripts/openai_coverage.py"
12+
13+
schedule:
14+
- cron: "37 9 * * 1"
15+
16+
workflow_dispatch:
17+
18+
permissions:
19+
contents: read
20+
21+
env:
22+
OASDIFF_VERSION: "1.23.0"
23+
24+
jobs:
25+
impl:
26+
name: app.openapi() vs OpenAI spec
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
30+
with:
31+
persist-credentials: false
32+
33+
- name: Set up Python
34+
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
35+
with:
36+
python-version: "3.12"
37+
38+
- uses: ./.github/actions/setup-uv
39+
- run: uv sync --locked --group dev
40+
41+
- name: Install oasdiff
42+
run: |
43+
go install github.com/oasdiff/oasdiff@v${{ env.OASDIFF_VERSION }}
44+
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
45+
46+
- name: Check conformance
47+
run: uv run --locked python scripts/openai_coverage.py --fastapi --fetch
48+
49+
- name: Weekly summary
50+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
51+
run: |
52+
{
53+
echo "## Implementation Conformance — Weekly"
54+
echo '```'
55+
uv run --locked python scripts/openai_coverage.py --fastapi --fetch 2>&1 || true
56+
echo '```'
57+
} >> "$GITHUB_STEP_SUMMARY"

.github/workflows/api-conformance.yml

Lines changed: 0 additions & 87 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
- uses: actions/checkout@v7.0.0
2323
with:
2424
persist-credentials: false
25-
fetch-depth: 2 # api-conformance hook needs HEAD~1
2625

2726
- name: Set up Python
2827
uses: actions/setup-python@v6

.pre-commit-config.yaml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ repos:
55
- id: check-yaml
66
- id: end-of-file-fixer
77
- id: trailing-whitespace
8-
exclude: ^schemas/openai-spec\.yml$
98

109
- repo: https://github.com/astral-sh/ruff-pre-commit
1110
# Ruff version.
@@ -40,16 +39,3 @@ repos:
4039
pass_filenames: false
4140
always_run: true
4241
require_serial: true
43-
- id: api-conformance
44-
name: OpenAI spec conformance
45-
entry: uv run --locked python scripts/openai_coverage.py --check-breaking --check-regression --update --quiet
46-
language: golang
47-
additional_dependencies:
48-
- github.com/oasdiff/oasdiff@v1.23.0
49-
pass_filenames: false
50-
require_serial: true
51-
verbose: true
52-
files: ^(fern/openapi\.yml|schemas/openai-(spec\.yml|conformance-baseline\.json)|scripts/openai_coverage\.py)$
53-
54-
ci:
55-
skip: [api-conformance]

schemas/README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
# schemas/
22

3-
**openai-spec.yml** — Vendored OpenAI API spec (v2.3.0, OpenAPI 3.1.0).
4-
Source: https://github.com/openai/openai-openapi
3+
This directory previously contained a vendored copy of the OpenAI API spec.
4+
The spec is now fetched at CI runtime from
5+
[openai/openai-openapi](https://github.com/openai/openai-openapi) to avoid
6+
carrying an 81k-line third-party blob in history.
57

6-
To update:
8+
Two CI workflows compare the upstream OpenAI spec against our API:
9+
10+
| Workflow | What it checks | Trigger |
11+
|---|---|---|
12+
| `api-conformance-impl.yml` | `app.openapi()` (the live FastAPI contract) | PR touching `nemoguardrails/server/` |
13+
| `api-conformance-docs.yml` | `fern/openapi.yml` (the hand-written docs spec) | PR touching `fern/openapi.yml` + weekly |
14+
15+
To run locally (requires `oasdiff` on `PATH`):
716

817
```bash
9-
curl -fsSL https://raw.githubusercontent.com/openai/openai-openapi/master/openapi.yaml -o schemas/openai-spec.yml
10-
python scripts/openai_coverage.py --update
18+
python scripts/openai_coverage.py --fastapi --fetch
19+
python scripts/openai_coverage.py --fetch
1120
```
12-
13-
**openai-conformance-baseline.json** — oasdiff changelog of path-level differences
14-
between the vendored OpenAI spec and our guardrails spec (`fern/openapi.yml`).
15-
Used for regression detection: if the number of differences grows, pre-commit fails.
16-
Auto-generated by `python scripts/openai_coverage.py --update`. Do not edit manually.

0 commit comments

Comments
 (0)