Repository navigation
fix: stop failing on rejected jobs and add skip_preflight (0.47.0) #356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
CyMule
wants to merge
7
commits into
main
Choose a base branch
from
nickfranck/dtpl-696-python-sdk-breaks-on-a-rejected-job-status-generator-no
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+676
−32
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
247170d
feat: tolerate REJECTED and unknown job statuses, add skip_preflight …
CyMule 5f6a6bc
fix: detect drift in inline property enums; simplify drift check
CyMule 39e4954
fix: open drift issues only for detected drift; serialize drift runs …
CyMule 2b0ee68
chore: Merge main and preserve SDK 0.47.0 metadata
CyMule 7d93f25
chore(sdk): Refresh preflight branch after keepalive release
CyMule 10d8d11
feat: expose preflight failure category and reason on JobNodeDetails …
CyMule 4aeb58a
chore: Merge main and preserve release metadata
CyMule File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| name: API spec drift | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: "0 13 * * 1" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| issues: write | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| check: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: astral-sh/setup-uv@v7 | ||
| - name: Set up Python 3.13 | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: "3.13" | ||
| - name: Install dependencies | ||
| env: | ||
| UV_LOCKED: "1" | ||
| UV_PYTHON: "3.13" | ||
| run: make install | ||
| - name: Check spec drift | ||
| id: drift | ||
| env: | ||
| UV_PYTHON: "3.13" | ||
| run: | | ||
| set -o pipefail | ||
| make check-spec-drift | tee drift.txt | ||
| - name: Report drift in an issue | ||
| if: failure() && steps.drift.outcome == 'failure' | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
| run: | | ||
| if ! grep -qE '^(New drift|Stale baseline):' drift.txt; then | ||
| echo "The check failed without reporting drift; see the previous step." | ||
| exit 0 | ||
| fi | ||
| title="SDK models have drifted from the API spec" | ||
| body="$(printf '%s\n\n```\n%s\n```\n\nSee CONTRIBUTING.md, \"Keeping models in sync with the API\".' "$RUN_URL" "$(cat drift.txt)")" | ||
| number="$(gh issue list --state open --search "in:title \"$title\"" --json number --jq '.[0].number')" | ||
| if [ -n "$number" ]; then | ||
|
cubic-dev-ai[bot] marked this conversation as resolved.
|
||
| gh issue comment "$number" --body "$body" | ||
| else | ||
| gh issue create --title "$title" --body "$body" | ||
| fi | ||
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| from scripts.check_spec_drift import find_drift | ||
|
|
||
|
|
||
| def _spec(schemas: dict) -> dict: | ||
| return {"components": {"schemas": schemas}} | ||
|
|
||
|
|
||
| def test_matching_spec_reports_no_drift(): | ||
| spec = _spec( | ||
| { | ||
| "JobStatus": {"type": "string", "enum": ["SCHEDULED", "REJECTED"]}, | ||
| "CreateWorkflow": { | ||
| "properties": { | ||
| "name": {"type": "string"}, | ||
| "schedule": {"anyOf": [{"type": "string", "enum": ["daily"]}, {"type": "null"}]}, | ||
| } | ||
| }, | ||
| } | ||
| ) | ||
| assert find_drift([spec]) == {} | ||
|
|
||
|
|
||
| def test_reports_missing_enum_values_and_properties(): | ||
| spec = _spec( | ||
| { | ||
| "JobStatus": {"type": "string", "enum": ["SCHEDULED", "PAUSED"]}, | ||
| "CreateWorkflow": {"properties": {"name": {}, "brand_new_field": {}}}, | ||
| "SomeSchemaTheSdkDoesNotModel": {"properties": {"x": {}}}, | ||
| } | ||
| ) | ||
| assert find_drift([spec]) == { | ||
| "CreateWorkflow": ["brand_new_field"], | ||
| "JobStatus": ["PAUSED"], | ||
| } | ||
|
|
||
|
|
||
| def test_reports_missing_values_of_an_inline_property_enum(): | ||
| spec = _spec( | ||
| { | ||
| "CreateWorkflow": { | ||
| "properties": { | ||
| "schedule": { | ||
| "anyOf": [ | ||
| {"type": "string", "enum": ["daily", "every 30 minutes"]}, | ||
| {"type": "null"}, | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ) | ||
| assert find_drift([spec]) == {"CreateWorkflow.schedule": ["every 30 minutes"]} |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.