Skip to content

chore: migrate to OpenAPI snapshot for schema drift detection#36

Merged
royklo merged 1 commit into
mainfrom
chore/openapi-drift-snapshot
Jul 6, 2026
Merged

chore: migrate to OpenAPI snapshot for schema drift detection#36
royklo merged 1 commit into
mainfrom
chore/openapi-drift-snapshot

Conversation

@royklo

@royklo royklo commented Jul 6, 2026

Copy link
Copy Markdown
Owner

How the flow works after merge

  1. 06:00 UTC nightly (dev): diffs live dev spec against this snapshot. If different → opens a PR with the updated snapshot. Otherwise silent.
  2. 07:00 UTC nightly (prod): only runs if a drift PR is open. If prod's spec now matches the PR's snapshot → adds production-ready label. Otherwise silent, retries tomorrow.
  3. When the drift PR carries production-ready, you merge it. The updated snapshot becomes the new baseline.

Test plan

  • Both openapi.json URLs reachable (dev + prod currently byte-identical, no servers/info divergence)
  • Script tested end-to-end with 18 scenarios (drift/no-drift/error paths)
  • 5 mutation scenarios (add endpoint, delete endpoint, add method, add schema property, change required[]) all detect correctly
  • Adversarial pass (4 parallel testers) found 5 real bugs — all fixed and re-verified
  • Multi-day lifecycle simulated: no more "same diff commented every night while PR sits open"
  • actionlint clean on both workflows

- Add docs/openapi-snapshot.json seeded from uk.dev.inforcerdev.net/openapi.json
- Remove docs/api-schema-snapshot.json (obsolete)

Paired with Powershell-Module-Automation switch from Test-ApiSchemaChanges.ps1
to compare-openapi.sh. The new nightly workflow diffs the published OpenAPI
spec directly instead of inferring schemas from live endpoint responses —
kills the false-positive drift PRs caused by response-data variance.
Copilot AI review requested due to automatic review settings July 6, 2026 19:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR replaces the prior custom “API schema snapshot” artifact with a committed OpenAPI (3.0.1) JSON snapshot intended to serve as the baseline for detecting API schema drift over time.

Changes:

  • Added docs/openapi-snapshot.json containing a full OpenAPI snapshot of the public API surface.
  • Removed docs/api-schema-snapshot.json, the previous derived schema snapshot format.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.

File Description
docs/openapi-snapshot.json Adds the OpenAPI JSON snapshot intended as the new drift-detection baseline and documentation source.
docs/api-schema-snapshot.json Removes the legacy schema snapshot artifact being replaced by the OpenAPI snapshot approach.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +4410 to +4414
"servers": [
{
"url": "http://localhost:7072/api"
}
],
Comment on lines +1 to +5
{
"components": {
"responses": {
"conflict": {
"content": {
Copilot AI review requested due to automatic review settings July 6, 2026 19:53
@royklo royklo force-pushed the chore/openapi-drift-snapshot branch from 0b9f444 to 40e58b0 Compare July 6, 2026 19:53
@royklo royklo merged commit 90c9e5b into main Jul 6, 2026
8 checks passed
@royklo royklo deleted the chore/openapi-drift-snapshot branch July 6, 2026 19:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.

Comment on lines +4410 to +4414
"servers": [
{
"url": "http://localhost:7072/api"
}
],
Comment on lines +1 to +3
{
"components": {
"responses": {
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