Skip to content

Add branch existence check for generated-diagrams (EDUENG-614)#23137

Open
ebembi-crdb wants to merge 1 commit intomainfrom
edueng-614-validate-branch-existence
Open

Add branch existence check for generated-diagrams (EDUENG-614)#23137
ebembi-crdb wants to merge 1 commit intomainfrom
edueng-614-validate-branch-existence

Conversation

@ebembi-crdb
Copy link
Copy Markdown
Contributor

Summary

Adds a script and daily GitHub Actions workflow to verify that every crdb_branch_name entry in versions.csv exists as a branch in cockroachdb/generated-diagrams.

Two failure modes caught:

  • branch_missing: the listed branch does not exist in generated-diagrams at all
  • branch_mismatch: a proper release-X.Y branch now exists in generated-diagrams but versions.csv still points to an older one (e.g. v26.2release-26.1 after release-26.2 is created)

Files added:

  • .github/scripts/validate_branch_existence.py — stdlib-only Python script, no pip installs required
  • .github/workflows/validate-branch-existence.yml — triggers on versions.csv changes in PRs and runs daily at 07:00 UTC

On PR failure: posts/updates a bot comment with details and blocks merge.
On scheduled failure: opens a GitHub issue (or updates an existing open one) with label sql-diagram-validation.

Context

Addresses EDUENG-614, part of the follow-up to the production build outage on 2026-01-29 discussed in #docs-site-status.

The anchor integrity check (EDUENG-613) is in a separate PR.

Test plan

  • Manually run python .github/scripts/validate_branch_existence.py from repo root and confirm it exits 0
  • Verify the workflow triggers on a versions.csv change in a test PR
  • Confirm the daily schedule appears in the Actions tab after merge

Adds a script and daily workflow that verify every crdb_branch_name entry in
versions.csv exists as a branch in cockroachdb/generated-diagrams, and flags
entries where a proper release-X.Y branch now exists but versions.csv still
points to an older one (e.g. v26.2 -> release-26.1 after release-26.2
is created).

Files added:
- .github/scripts/validate_branch_existence.py
- .github/workflows/validate-branch-existence.yml
@ebembi-crdb ebembi-crdb requested a review from a team as a code owner March 26, 2026 14:02
@github-actions
Copy link
Copy Markdown

Files changed:

  • .github/scripts/validate_branch_existence.py
  • .github/workflows/validate-branch-existence.yml

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 26, 2026

Deploy Preview for cockroachdb-interactivetutorials-docs canceled.

Name Link
🔨 Latest commit 01c8593
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-interactivetutorials-docs/deploys/69c53c6d51845e0007f030df

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 26, 2026

Deploy Preview for cockroachdb-api-docs canceled.

Name Link
🔨 Latest commit 01c8593
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-api-docs/deploys/69c53c6dbe61750008378fec

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 26, 2026

Netlify Preview

Name Link
🔨 Latest commit 01c8593
🔍 Latest deploy log https://app.netlify.com/projects/cockroachdb-docs/deploys/69c53c6d6b803f0008c45ca5
😎 Deploy Preview https://deploy-preview-23137--cockroachdb-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@@ -0,0 +1,189 @@
#!/usr/bin/env python3
"""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did we check the teamcity job ? How it's gonna affect if we have both the flows? As that teamcity job is still active?


def branch_exists(branch: str) -> bool:
if branch not in _cache:
result = _api_get(f"repos/{GENERATED_DIAGRAMS_REPO}/branches/{branch}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The code calls the API path /repos/{repo}/branches/{branch} with branch interpolated directly. If a branch name ever contains characters that require URL-encoding it would be safer to encode the branch name

# ---------------------------------------------------------------------------
# Output
# ---------------------------------------------------------------------------

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The PR includes a manual test plan — consider adding a lightweight unit test (or an integration mode that runs against a small sample versions.csv) to make local iteration faster.

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