Repository navigation
Report Clairic schema drift as an issue and a pull request - #20
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.pynow compares the schemas property by property. It prints a Markdown summary first, then the full diff:answers.*.span.type,fields.*.type.enum.fields.*.type.enum: new valuescompute,boolean).--report PATHalso 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:schema-drift/updateand opens a pull request with the summary and a checklist.schema-driftandpreview-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) andpytestpass, with 10 new tests intests/test_check_schema_drift.py.ghin 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.gh workflow run schema-drift.ymlto try it.🤖 Generated with Claude Code