Skip to content

fix: refine OpenAPI semantic diff and adopt status JSON - #54

Merged
carlostasada merged 9 commits into
mainfrom
ctasada/openapi-classifier-status
Aug 13, 2026
Merged

fix: refine OpenAPI semantic diff and adopt status JSON#54
carlostasada merged 9 commits into
mainfrom
ctasada/openapi-classifier-status

Conversation

@carlostasada

@carlostasada carlostasada commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Expand the semantic diff for OAS 3.1 nullable / binary equivalents (including anyOf/oneOf + type: null, also with $ref siblings) and additive oneOf / anyOf members; added allOf members stay breaking.
  • Compare operation security after document-level inheritance: adding OR alternatives while keeping every previously accepted non-empty scheme set is additive (e.g. Market Data BasicAuth alongside API keys); removing/replacing schemes, AND-tightening, and optional/empty → required stay breaking.
  • Write build/openapi-adopt-status.json for machine-readable breaking / changed gating.
  • Adopt when pins differ structurally from upstream (not only when the semantic surface changes), so equivalent spellings still catch up; key-order-only churn does not.
  • Includes the one-PR drift workflow on bot/openapi-adopt (draft when breaking or adopt fails) with concurrency serialization.

Test plan

  • PYTHONPATH=. python -m unittest scripts.tests.test_openapi_tools scripts.tests.test_adopt_openapi
  • ./gradlew adoptOpenApiDryRun — Market Data inherit→BasicAuth OR widening is extended; crypto security: [] → required remains breaking
  • Confirm build/openapi-adopt-status.json is written on dry-run

carlostasada and others added 3 commits August 10, 2026 16:42
Treat additive enum widenings as non-breaking, and make failed adopt regeneration restore pins then regenerate from specs/ so partial syncs cannot leave pins and generated sources out of step.
Drop brokerSpec/dataSpec/tradingSpec when nesting generateApis after
adopt, and force pin paths so overrides cannot leave generated sources
out of sync with specs/.
Treat security-only ops, nullable/binary equivalents, and additive oneOf/anyOf
as non-breaking; keep allOf growth breaking. Write openapi-adopt-status.json and
adopt on structural pin drift so equivalent spellings still catch up.

Co-authored-by: Cursor <cursoragent@cursor.com>
@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown

Greptile Summary

The PR refines OpenAPI semantic comparison and adds machine-readable adoption status output.

  • Classifies operation-level security changes as breaking.
  • Normalizes equivalent nullable and binary schema representations.
  • Treats additive oneOf and anyOf members as non-breaking while preserving breaking treatment for allOf.
  • Adopts structurally changed pins even when the generated surface is equivalent.
  • Writes build/openapi-adopt-status.json for automated gating.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
scripts/openapi_tools.py Refines semantic normalization and composition matching, and now preserves operation authentication changes as breaking differences.
scripts/adopt_openapi.py Adds structural pin-drift detection and writes machine-readable adoption status before applying exit gating.
scripts/tests/test_openapi_tools.py Adds coverage for security changes, schema equivalences, and additive composition members.
scripts/tests/test_adopt_openapi.py Covers status JSON output, structural pin catch-up, and refusal of security-only breaking adoption.
GENERATION.md Documents structural pin adoption and the refined semantic change categories.
CHANGELOG.md Records the semantic-diff and structural pin-adoption behavior changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Load pinned and candidate specs] --> B[Normalize equivalent OpenAPI forms]
  B --> C[Compute semantic diff]
  A --> D[Compare structural fingerprints]
  C --> E{Breaking semantic change?}
  D --> F{Any structural drift?}
  E --> G[Write adoption report and status JSON]
  F --> G
  G --> H{Dry run or no change?}
  H -->|Yes| I[Exit without updating pins]
  H -->|No| J{Breaking change allowed?}
  J -->|No| K[Refuse adoption]
  J -->|Yes| L[Update pins and regenerate clients]
Loading

Reviews (2): Last reviewed commit: "fix: treat operation security requiremen..." | Re-trigger Greptile

Comment thread scripts/openapi_tools.py Outdated
Operation-level security feeds generated auth method names, so ignore it no longer during adopt classification.
@carlostasada

Copy link
Copy Markdown
Contributor Author

@greptileai

Comment thread scripts/tests/test_openapi_tools.py Outdated
Comment thread CHANGELOG.md Outdated
Comment thread scripts/openapi_tools.py
Base automatically changed from ctasada/openapi-adopt-recovery to main August 11, 2026 06:47
carlostasada and others added 4 commits August 11, 2026 08:48
* ci: open one OpenAPI adopt PR instead of breaking issues

Always adopt with --allow-breaking on the bot branch, publish a draft PR when
the classifier reports breaking changes or adopt fails, and ready PRs otherwise.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(ci): serialize openapi-drift runs on shared adopt PR

Prevent overlapping schedule and workflow_dispatch runs from interleaving force-pushes and PR draft/body/label updates on bot/openapi-adopt.

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Reconcile #53 pin-backup compile gating with classifier status JSON, structural
pin catch-up, and the single adopt-PR drift workflow.

Co-authored-by: Cursor <cursoragent@cursor.com>
Compare effective operation security after document inheritance: keep OR
alternative widenings additive, but treat empty→required, AND-tightening,
and replacements as breaking. Also fold titled null-union members and align
docs with the classifier.

Co-authored-by: Cursor <cursoragent@cursor.com>
@carlostasada
carlostasada requested a review from SpenserJ August 12, 2026 14:09
Comment thread scripts/tests/test_adopt_openapi.py
@carlostasada
carlostasada merged commit 009d680 into main Aug 13, 2026
8 checks passed
@carlostasada
carlostasada deleted the ctasada/openapi-classifier-status branch August 13, 2026 11:33
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