Skip to content

ci(quality): add OpenAPI breaking-change gate (oasdiff, advisory) + fix dangling $refs - #3951

Merged
diegosouzapw merged 1 commit into
release/v3.8.26from
ci/openapi-breaking-gate
Jun 16, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.26from
ci/openapi-breaking-gate

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Item (b) — adiciona o gate de breaking-change no contrato docs/reference/openapi.yaml via oasdiff (Fase 8 B.4, backlog opcional). Advisory-first.

O gate

scripts/check/check-openapi-breaking.mjs: faz git show <BASE_REF>:openapi.yaml → temp, roda oasdiff breaking vs HEAD, conta breaking changes (endpoint removido, param novo obrigatório, campo de response removido…). Advisory (exit 0 sempre nesta versão; reporta + promove a bloqueante depois). Skip-gracioso se oasdiff ausente / base não-resolvível.

  • Wirado no job quality-extended (advisory) com BASE_REF: ${{ github.base_ref }} + fetch-depth: 0 + oasdiff no install-step (gh release download).
  • 14 testes (parsing/contagem + skip binary-absent). Doc em QUALITY_GATES.md.

⭐ Defeito pré-existente corrigido (achado pelo oasdiff)

O openapi.yaml referenciava #/components/responses/{BadRequest,NotFound,InternalError} (14 usos em paths) mas nunca os definia — $refs pendurados. Os gates baseados em js-yaml nunca resolvem $ref → nunca pegaram. O oasdiff (loader estrito) recusava carregar o spec. Adicionadas as 3 components.responses como Response Objects próprios (description+content+schema→ApiErrorResponse+example), no mesmo estilo dos existentes (Unauthorized etc.). Aditivo, sem mudança de comportamento de path.

Validação (auditada por mim)

  • baseline=0 (HEAD==base) · detecção provada nos 2 sentidos (path removido / required-field add) · 14/14 testes.
  • oasdiff agora carrega o spec (antes recusava) · check-openapi-routes/coverage/security-tiers + docs-sync passam · os 3 Response Objects confirmados corretos.
  • 1ª PR: o gate dá SKIP (base ainda tem o defeito); produz números a partir da próxima PR (com o fix no base). Comportamento advisory correto.

Não gera versão.

New advisory gate (Fase 8 B.4) that diffs the public API contract
docs/reference/openapi.yaml against the base branch via oasdiff, surfacing
removed endpoints, newly-required params, removed response fields, etc.

- scripts/check/check-openapi-breaking.mjs: resolves base spec via
  git show <BASE_REF>:docs/reference/openapi.yaml to a temp file, runs
  oasdiff breaking --format json, parses+counts breaking changes, emits
  openapiBreaking=N (KEY=VALUE for collect-metrics). ADVISORY: exit 0 always;
  graceful SKIP when oasdiff is absent or the base spec can't be resolved.
- package.json: check:openapi-breaking script.
- .github/workflows/ci.yml (quality-extended, advisory): install oasdiff via
  gh release download, add the breaking-change step (BASE_REF via env, never
  shell-interpolated), fetch-depth: 0 so git show can read the base spec.
- tests/unit/build/check-openapi-breaking.test.ts: parser counting/grouping +
  binary-absent SKIP integration.
- docs/architecture/QUALITY_GATES.md: document the quality-extended job table.
- docs/reference/openapi.yaml: define the BadRequest/NotFound/InternalError
  response components that were referenced (14 call sites) but never defined —
  a pre-existing dangling-$ref defect that blocked oasdiff from loading the spec.
  No path behavior changes; purely additive to components.responses.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@diegosouzapw
diegosouzapw merged commit dbf9293 into release/v3.8.26 Jun 16, 2026
2 checks passed
diegosouzapw added a commit that referenced this pull request Jun 16, 2026
…drift) (#3962)

The main quality-gate failed on the forward-merge release->main (run 27593205254):
eslintWarnings 3769 > baseline 3760. Measured now on origin/release/v3.8.26
(273ecf7, all cycle merges) via quality:collect = 3769 — identical to CI. The
later gate PRs (#3947/#3949/#3951/#3956/#3961) did not change the count
(scripts/check/*.mjs are eslint-ignored; the new test files added no any/warnings).
The +9 is pre-existing release-wide drift from v3.8.26 feature/other-session merges,
not a product regression. Conscious re-baseline to the real measured value; tighten
via --require-tighten at cycle-end (consistent with prior _eslint_rebaseline notes).

Validated: ratchet passes with the real CI metrics (24 metrics OK, exit 0).
@diegosouzapw
diegosouzapw deleted the ci/openapi-breaking-gate branch June 17, 2026 00:54
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
…eaper-inference#3951)

New advisory gate (Fase 8 B.4) that diffs the public API contract
docs/reference/openapi.yaml against the base branch via oasdiff, surfacing
removed endpoints, newly-required params, removed response fields, etc.

- scripts/check/check-openapi-breaking.mjs: resolves base spec via
  git show <BASE_REF>:docs/reference/openapi.yaml to a temp file, runs
  oasdiff breaking --format json, parses+counts breaking changes, emits
  openapiBreaking=N (KEY=VALUE for collect-metrics). ADVISORY: exit 0 always;
  graceful SKIP when oasdiff is absent or the base spec can't be resolved.
- package.json: check:openapi-breaking script.
- .github/workflows/ci.yml (quality-extended, advisory): install oasdiff via
  gh release download, add the breaking-change step (BASE_REF via env, never
  shell-interpolated), fetch-depth: 0 so git show can read the base spec.
- tests/unit/build/check-openapi-breaking.test.ts: parser counting/grouping +
  binary-absent SKIP integration.
- docs/architecture/QUALITY_GATES.md: document the quality-extended job table.
- docs/reference/openapi.yaml: define the BadRequest/NotFound/InternalError
  response components that were referenced (14 call sites) but never defined —
  a pre-existing dangling-$ref defect that blocked oasdiff from loading the spec.
  No path behavior changes; purely additive to components.responses.
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
…drift) (cheaper-inference#3962)

The main quality-gate failed on the forward-merge release->main (run 27593205254):
eslintWarnings 3769 > baseline 3760. Measured now on origin/release/v3.8.26
(19b37e6, all cycle merges) via quality:collect = 3769 — identical to CI. The
later gate PRs (cheaper-inference#3947/cheaper-inference#3949/cheaper-inference#3951/cheaper-inference#3956/cheaper-inference#3961) did not change the count
(scripts/check/*.mjs are eslint-ignored; the new test files added no any/warnings).
The +9 is pre-existing release-wide drift from v3.8.26 feature/other-session merges,
not a product regression. Conscious re-baseline to the real measured value; tighten
via --require-tighten at cycle-end (consistent with prior _eslint_rebaseline notes).

Validated: ratchet passes with the real CI metrics (24 metrics OK, exit 0).
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.

1 participant