Skip to content

fix(bb): TRA-743 — check-deploy-lag.sh compares against preview, not main#160

Merged
mikestankavich merged 1 commit into
mainfrom
worktree-tra-743-deploy-lag-preview-ref
May 16, 2026
Merged

fix(bb): TRA-743 — check-deploy-lag.sh compares against preview, not main#160
mikestankavich merged 1 commit into
mainfrom
worktree-tra-743-deploy-lag-preview-ref

Conversation

@mikestankavich
Copy link
Copy Markdown
Contributor

TRA-743 — fix two bugs in check-deploy-lag.sh (introduced in PR #158).

Bug 1: wrong branch

Cloudflare Pages deploys docs.preview.trakrf.id from the preview branch (force-pushed by .github/workflows/sync-preview.yml = main + all open non-draft PRs). The script was comparing the deployed docs commit against origin/main — the merge target, not the ref preview actually serves.

In practice the deployed commit usually leads origin/main (since preview carries open-PR work too). So the inequality check would silently pass even when CF Pages was lagging behind the latest preview tip.

Verified on the previous merge: after PR #158 landed, docs.preview.trakrf.id/health.json reported commit: "7ec727c" while origin/main was b76860d and origin/preview was 7ec727c. The right ref was preview.

Bug 2: required a local docs checkout

The script used git fetch origin main + git rev-parse origin/main. But bb_cycle copies tests/blackbox/ to /tmp/bb-N/ for the BB session — /tmp has no git context, so the script would silently exit 2 if run from there.

The retired check-spec-sync.sh queried the GitHub public API for the branch tip instead — location-independent, and trakrf/docs is public so no auth needed.

Fix

Ported the GitHub-API-based check from the retired predecessor. Kept the graceful WARN-and-skip fallback for GitHub rate limits / network blips (exit 0 with a warning rather than fail-closed — the script's job is to fail-fast on real deploy lag, not on its own observability gap).

Test plan

  • Live smoke: API_TEST_DOCS_URL=https://docs.preview.trakrf.id bash tests/blackbox/check-deploy-lag.sh returns OK: preview docs on 4d213d3 (matches preview@4d213d3).
  • bash scripts/test_bb_cycle.sh — 8/8 pass (the BB_SKIP_PREFLIGHT=1 test path is unaffected)
  • Next merge: confirm the preflight catches preview lag correctly (script returns exit 4 with the branch-tip vs deployed-commit gap printed)

🤖 Generated with Claude Code

…t `main`

Two bugs in the script as shipped in PR #158:

1. **Wrong branch.** Cloudflare Pages deploys `docs.preview.trakrf.id` from
   the `preview` branch (force-pushed by `.github/workflows/sync-preview.yml`
   = main + all open non-draft PRs). The script was comparing the deployed
   docs commit against `origin/main`, which is the merge target, not the
   ref preview actually serves. With work in flight on PR branches synced
   to `preview`, the deployed commit would normally lead `origin/main` and
   the check would (silently) pass even when preview lagged behind newer
   PR work.

2. **Required a local docs checkout.** Used `git fetch origin main` +
   `git rev-parse origin/main`. `bb_cycle` copies `tests/blackbox/` to
   `/tmp/bb-N/` for the BB session — `/tmp` has no git context, so the
   script would silently exit 2 if ever run from there. The retired
   `check-spec-sync.sh` queried the GitHub public API for the branch tip
   instead; that pattern is location-independent and `trakrf/docs` is
   public so no auth needed.

Switched to the GitHub-API-based check from the retired predecessor.
Kept the graceful WARN-and-skip fallback for GitHub rate limits / network
blips (exit 0 with a warning rather than fail-closed — the script's job
is to fail-fast on real deploy lag, not on its own observability gap).

Verified against live preview: `4d213d3` (deployed) matches `preview@4d213d3`
(GitHub branch tip).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

🚀 Preview Deployment Update

✅ This PR has been successfully merged into the preview branch.

The preview environment will update shortly at: https://docs.preview.trakrf.id

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 16, 2026

Deploying docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1617067
Status: ✅  Deploy successful!
Preview URL: https://570a41c5.docs-4n7.pages.dev
Branch Preview URL: https://preview.docs-4n7.pages.dev

View logs

@mikestankavich mikestankavich merged commit e344cd9 into main May 16, 2026
2 checks passed
@mikestankavich mikestankavich deleted the worktree-tra-743-deploy-lag-preview-ref branch May 16, 2026 15:17
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.

1 participant