diff, changelog and breaking overflow the stack on a spec with a callback cycle
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 72/100
Línea de trabajo
Start from the recursion path named in the issue: getCallbacksDiff → getCallbackDiff → getPathsDiff, and find where operations reach their callbacks again. Read the existing schema-diff cycle guard that keys on pairs of schema values, since the fix should mirror that pattern for callback (or path-item) pairs. Reproduce with oasdiff diff cb1.yaml cb1.yaml using the two yaml files from the payload; done means the four commands run to completion with no stack overflow and comparing a spec to itself yields no diff, plus a regression test.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
A spec whose callbacks form a cycle crashes oasdiff with fatal error: stack overflow. An operation carries a callback, the callback holds a path item, and that path item's operation carries the same callback, so the recursion never ends. The spec loads without complaint, so nothing warns the user before the crash.
This is independent of #1252 and predates it: the schema cycle guard applies to pairs of schemas, and the callback recursion has none.
Reproduce
cb1.yaml:
openapi: 3.0.3
info:
title: callback cycle
version: "1"
paths:
/x:
post:
description: before
responses:
'200':
description: ok
callbacks:
cb:
$ref: '#/components/callbacks/cb'
components:
callbacks:
cb:
'{$request.body#/u}':
post:
description: inner before
responses:
'200':
description: ok
callbacks:
cb:
$ref: '#/components/callbacks/cb'
cb2.yaml is the same file with before replaced by after.
oasdiff diff cb1.yaml cb2.yaml
Comparing the file with itself (oasdiff diff cb1.yaml cb1.yaml) crashes the same way, so a change is not needed to trigger it.
Observed
| Command | Result |
|---|---|
diff, changelog, breaking, summary |
fatal error: stack overflow, exit code 2 |
validate, flatten (single spec) |
no output, still running after 25s |
Every version tested behaves the same: v1.31.0, v1.32.0, v1.32.1 and v1.33.0-rc.1.
Where it comes from
The recursion runs through getCallbacksDiff to getCallbackDiff, which turns the callback into paths and calls getPathsDiff, which reaches the operations and their callbacks again. Nothing records which callback or path item is already being compared, so a cycle repeats forever. The guard that handles recursive schemas lives in the schema diff and keys on pairs of schema values, which this path never reaches.
Suggested direction
Guard the callback recursion the way schema pairs are guarded: record the pair of callbacks (or of path items) being compared and return no diff when the same pair is reached again while it is still in progress. Worth checking at the same time whether any other structure can recurse, for example a $ref between path items.
Reported from a review of the cyclic-schema work; the repro is synthetic, not from a user's spec.
- Lenguaje dominante
- Go
- Estrellas
- 1.4k
- Forks
- 109
- Merge medio
- 9 h 35 min
- PR fusionados (30 d)
- 31
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de oasdiff/oasdiff
-
Removing an alternative from the top-level security is reported at infoPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 3/5 Medio día Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
Los mantenedores suelen responder en 1 día
-
Changing the `type` of a security scheme in use (apiKey → http bearer) is reported at infoPosiblemente ocupada @reuvenharrison la tomó hace 5 días. Abierto
Dificultad 3/5 Medio día Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
Todos los issues de oasdiff/oasdiff
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
agent-review-finding bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
jordansmall/spindrift#5281 ·
Los mantenedores suelen responder en 1 día
-
Integer parameters equal to 2^63 pass the range check in toInt and wrap to a negative numberAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
github/github-mcp-server#3489 ·
Los mantenedores suelen responder en 4 días
-
L: java:gradle L: java:maven L: ruby:bundler T: bug 🐞
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
dependabot/dependabot-core#16547 ·
Los mantenedores suelen responder en 1 día
-
Docs/examples still create key ranges in ascending order, which fails in 3.1.0 (follow-up to #1754)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
pg-sharding/spqr#3083 ·
Los mantenedores suelen responder en 1 día