-
Notifications
You must be signed in to change notification settings - Fork 21
feat(api-catalog): add drift guards for the embedded catalog (DEVX-549) #98
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
Merged
jpage-godaddy
merged 3 commits into
godaddy:rust-port
from
smukherjee-godaddy:DEVX-549-catalog-drift-guard
Jul 15, 2026
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
d13d995
feat(api-catalog): add drift guards for the embedded catalog (DEVX-549)
smukherjee-godaddy 8aa4afd
chore(api-catalog): address review nits (DEVX-549)
smukherjee-godaddy be0c1df
fix(api-catalog): enforce authoritative drift checks (DEVX-549)
smukherjee-godaddy 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,69 @@ | ||
| name: API catalog drift | ||
|
|
||
| # Regenerates the embedded API catalog from the upstream gdcorp-platform | ||
| # commerce.*-specification repos and fails if the committed catalog has drifted. | ||
| # This is the source-drift guard (catches per-operation / per-endpoint changes). | ||
| # The always-on structural guard (domains + endpoint counts vs the intentional | ||
| # list) lives in `cargo test` | ||
| # (committed_catalog_matches_expected_domains_and_manifest) and runs on every PR. | ||
| # | ||
| # Requires a token with read access to the gdcorp-platform spec repos, provisioned | ||
| # as the `CATALOG_SPEC_TOKEN` secret. The default GITHUB_TOKEN only reaches this | ||
| # repo, so the job no-ops when the secret is absent (e.g. on forks). | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: "17 6 * * 1" # Mondays ~06:17 UTC | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| drift: | ||
| runs-on: ubuntu-latest | ||
| # Guard against a hung network fetch to the spec repos burning runner minutes. | ||
| timeout-minutes: 20 | ||
| defaults: | ||
| run: | ||
| working-directory: rust | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
|
|
||
| - name: Check for spec token | ||
| id: token | ||
| working-directory: . | ||
| env: | ||
| CATALOG_SPEC_TOKEN: ${{ secrets.CATALOG_SPEC_TOKEN }} | ||
| run: | | ||
| if [ -n "$CATALOG_SPEC_TOKEN" ]; then | ||
| echo "present=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "present=false" >> "$GITHUB_OUTPUT" | ||
| echo "::notice::CATALOG_SPEC_TOKEN not set — skipping catalog drift check." | ||
| fi | ||
|
|
||
| - name: Install Rust toolchain | ||
| if: steps.token.outputs.present == 'true' | ||
| uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable | ||
|
|
||
| - name: Regenerate catalog from upstream specs | ||
| if: steps.token.outputs.present == 'true' | ||
| # Runs from the job-default working-directory (rust/) — cargo needs the workspace. | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.CATALOG_SPEC_TOKEN }} | ||
| run: cargo run -p generate-api-catalog | ||
|
|
||
| - name: Fail on drift | ||
| if: steps.token.outputs.present == 'true' | ||
| working-directory: . | ||
| run: | | ||
| # manifest.json carries a generated-at timestamp that changes every run; | ||
| # exclude it and compare only the domain schema files. | ||
| if ! git diff --quiet -- rust/schemas/api ':(exclude)rust/schemas/api/manifest.json'; then | ||
| echo "::error::Embedded API catalog is stale vs upstream commerce.*-specification repos. Regenerate with: (cd rust && GITHUB_TOKEN=<token> cargo run -p generate-api-catalog) and commit." | ||
| git diff --stat -- rust/schemas/api ':(exclude)rust/schemas/api/manifest.json' | ||
| exit 1 | ||
| fi | ||
| echo "API catalog is in sync with upstream specs." | ||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very specific, haha