Skip to content

Report Clairic schema drift as an issue and a pull request - #20

Merged
VianneyMI merged 1 commit into
mainfrom
schema-drift-report
Dec 4, 2026
Merged

VianneyMI merged 1 commit into
mainfrom
schema-drift-report

Conversation

@VianneyMI

@VianneyMI VianneyMI commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Why

Cloudflare changed the Clairic schemas between Nov 16 and Nov 23 without a changelog entry. The weekly drift check caught it, but all it produced was a red run and about 500 lines of raw diff, mixed with timestamps, in the job log. Some of those lines were fields that had only moved, not real changes.

What changes

A readable summary. scripts/check_schema_drift.py now compares the schemas property by property. It prints a Markdown summary first, then the full diff:

  • Paths read like the request and response: answers.*.span.type, fields.*.type.enum.
  • Changes are grouped under Removed, Changed, Added and Descriptions, so the ones most likely to break the SDK come first.
  • New enum members are listed one by one (for example fields.*.type.enum: new values compute, boolean).
  • --report PATH also writes the summary to a file.

For the current drift, that is about 65 lines instead of 500. #21 (stacked on this PR) shows the full output.

Automatic reporting. When the schemas change, .github/workflows/schema-drift.yml:

  1. Writes the summary at the top of the run page.
  2. Pushes the new copies to schema-drift/update and opens a pull request with the summary and a checklist.
  3. Opens an issue labelled schema-drift and preview-api, or comments on the open one. Merging the PR closes it.

If a drift PR is already open, the workflow adds a commit on top, so SDK fixes pushed there are kept. If nothing changed since the last report, it does nothing. A run that reports drift is now green: the issue is the alert, and the run only goes red if the check itself fails.

Before or after merging

GitHub currently blocks workflows from opening pull requests in this repo. To allow it, tick Settings → Actions → General → Workflow permissions → Allow GitHub Actions to create and approve pull requests. Without it, the workflow still pushes the branch and opens the issue, and adds a link to the issue for opening the PR by hand.

Testing

  • ruff, pyright (strict) and pytest pass, with 10 new tests in tests/test_check_schema_drift.py.
  • I ran the check against Cloudflare's live schemas.
  • I ran the workflow's shell steps against a local copy of the repo with a fake gh in four cases: first drift, drift while a fix PR is open (the fix commit is kept), no change since the last report, and PR creation refused.
  • Not yet run on GitHub itself. After merging, run gh workflow run schema-drift.yml to try it.

🤖 Generated with Claude Code

Cloudflare does not announce Clairic schema changes, and the weekly
check's only output was a 500-line diff in the job log.

- check_schema_drift.py compares the schemas property by property and
  prints a Markdown summary (removed, changed, added, descriptions)
  before the full diff; --report writes it to a file.
- The workflow shows the summary on the run page. When the schemas
  changed, it pushes the new copies to schema-drift/update, opens or
  updates a pull request, and opens or comments on a schema-drift
  issue. It builds on an open pull request instead of replacing it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@VianneyMI VianneyMI added the infrastructure CI, releases, repository setup label Nov 24, 2026
@VianneyMI VianneyMI self-assigned this Dec 4, 2026
@VianneyMI
VianneyMI merged commit 61e3f11 into main Dec 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure CI, releases, repository setup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant