Skip to content

feat(api-catalog): add drift guards for the embedded catalog (DEVX-549)#98

Merged
jpage-godaddy merged 3 commits into
godaddy:rust-portfrom
smukherjee-godaddy:DEVX-549-catalog-drift-guard
Jul 15, 2026
Merged

feat(api-catalog): add drift guards for the embedded catalog (DEVX-549)#98
jpage-godaddy merged 3 commits into
godaddy:rust-portfrom
smukherjee-godaddy:DEVX-549-catalog-drift-guard

Conversation

@smukherjee-godaddy

@smukherjee-godaddy smukherjee-godaddy commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Problem

The Rust embedded API catalog was generated from internal specification repositories without one checked-in source list or a reliable drift check. TypeScript main contains 20 domains while rust-port contains 21, and the previous workflow could silently skip when its token was missing or overlook newly generated files.

Jira: DEVX-549 — Commerce catalog parity + drift guard

Fix

  • Added rust/api-catalog-sources.json as the authoritative catalog source manifest.
  • Reconciled the domain sets: the 20 remote domains match TypeScript; hosting-nodejs is the intentional Rust-only domain generated from the CLI's vendored public spec.
  • Updated the Rust generator and structural test to consume the manifest instead of duplicated hardcoded lists.
  • Made declared source clone/spec failures fatal so a partial catalog cannot be written successfully.
  • Rewrote SSH submodule URLs to authenticated HTTPS without placing the token in clone URLs or diagnostics.
  • Hardened the drift workflow:
    • missing CATALOG_SPEC_TOKEN fails instead of silently skipping,
    • staged comparison detects modified, removed, and untracked generated domains,
    • runs on pushes to rust-port and by manual dispatch,
    • weekly scheduling activates when rust-port becomes the default branch.
  • Regenerated the upstream catalog, updating Transactions from 7 to 17 endpoints.

Operations

Configure the repository secret CATALOG_SPEC_TOKEN with read access to the declared gdcorp-platform specification repositories. Until rust-port becomes the default branch, pushes to rust-port enforce upstream drift and workflow_dispatch provides on-demand checks.

Verification

  • Authenticated regeneration completed: 21 domains, 215 endpoints.
  • cargo check
  • cargo clippy -- -D warnings
  • cargo test — 230 passed
  • cargo fmt --check
  • Workflow YAML parsed successfully.

smukherjee-godaddy and others added 2 commits July 14, 2026 01:29
Two complementary guards so the embedded API catalog can't silently drift from
the upstream commerce.*-specification source of truth:

1. Always-on structural guard (cargo test, no network/credentials): a new
   EXPECTED_DOMAINS contract + committed_catalog_matches_expected_domains_and_manifest
   test asserts the committed catalog files and manifest.json match the intended
   domain set, and that each domain's endpoint count agrees between its file and
   the manifest. Adding/removing a domain now requires a deliberate list update.

2. Scheduled source-drift guard (.github/workflows/catalog-drift.yml): weekly (and
   on-demand) regenerates the catalog from the gdcorp-platform spec repos and fails
   if the committed domain schemas have drifted. Gated on a CATALOG_SPEC_TOKEN
   secret (the default GITHUB_TOKEN can't reach the spec org); no-ops without it.
   manifest.json's generated-at timestamp is excluded from the diff.

EXPECTED_DOMAINS is #[cfg(test)] since only the guard test consumes it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- guard test: fail loudly (panic with domain name) on a missing endpoints array
  or endpointCount instead of comparing two silent zeros
- catalog-drift workflow: add timeout-minutes: 20 to bound a hung spec fetch
- clarify the regen step uses the job-default rust/ working-directory

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread .github/workflows/catalog-drift.yml Outdated

on:
schedule:
- cron: "17 6 * * 1" # Mondays ~06:17 UTC

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Very specific, haha

@jpage-godaddy

Copy link
Copy Markdown
Collaborator

DEVX-549 doesn't seem related to this; that's for the Moon Unit project. Can you fix the title to link to the related Jira?

Make the reconciled source manifest drive generation and fail CI on partial or stale upstream catalogs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@smukherjee-godaddy

Copy link
Copy Markdown
Contributor Author

Verified the Jira reference again: DEVX-549 is currently Task 11 — Commerce catalog parity + drift guard, and its description/acceptance criteria match this PR. I kept the title on DEVX-549 and added the direct Jira link plus the completed implementation details to the PR description.

@jpage-godaddy
jpage-godaddy merged commit 3605d8e into godaddy:rust-port Jul 15, 2026
1 check passed
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