From 45129a86bfd8b6da7ccff9bc040567591468859d Mon Sep 17 00:00:00 2001 From: Kaxil Naik Date: Thu, 30 Apr 2026 01:57:19 +0100 Subject: [PATCH] Guard registry-build sync against partial extracts `aws s3 sync` exits 0 silently when its source directory is missing or empty, so a partial `breeze registry extract-data` failure (one provider errors mid-run, Eleventy still produces a tree, sync uploads stale or empty JSON) would currently report green while leaving the live registry in an inconsistent state. This adds the same pre-sync content guards `registry-backfill.yml` got in PR #66027: for incremental builds, assert each target provider's HTML directory + API directory + `versions.json` exist and are non-empty; for full builds, assert the top-level `index.html`, `api/providers.json` listing, and at least one provider subtree under `api/providers/` are present. Any missing artifact aborts the sync with `::error::` before S3 is touched. --- .github/workflows/registry-build.yml | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/.github/workflows/registry-build.yml b/.github/workflows/registry-build.yml index d6e323ae14232..5b9c89c1794ef 100644 --- a/.github/workflows/registry-build.yml +++ b/.github/workflows/registry-build.yml @@ -260,6 +260,52 @@ jobs: retention-days: 7 if-no-files-found: error + - name: "Verify build emitted expected content" + env: + PROVIDER: ${{ inputs.provider }} + run: | + # Guard against silent no-op syncs. `aws s3 sync` exits 0 when the + # source dir is missing or empty, so without this a partial build + # (e.g. extract_metadata.py errored mid-run) would report green + # while uploading nothing or stale state. Mirrors the per-provider + # guard in the "Sync backfilled version pages to S3" step in + # registry-backfill.yml. + if [[ -n "${PROVIDER}" ]]; then + # Incremental: verify each target provider's pages and versions JSON exist. + for pid in ${PROVIDER}; do + LOCAL_PROV_DIR="registry/_site/providers/${pid}/" + LOCAL_API_DIR="registry/_site/api/providers/${pid}/" + LOCAL_VERSIONS_JSON="${LOCAL_API_DIR}versions.json" + if [ ! -d "${LOCAL_PROV_DIR}" ] || [ -z "$(ls -A "${LOCAL_PROV_DIR}" 2>/dev/null)" ]; then + echo "::error::Build did not emit ${LOCAL_PROV_DIR} -- aborting sync." + exit 1 + fi + if [ ! -d "${LOCAL_API_DIR}" ] || [ -z "$(ls -A "${LOCAL_API_DIR}" 2>/dev/null)" ]; then + echo "::error::Build did not emit ${LOCAL_API_DIR} -- aborting sync." + exit 1 + fi + if [ ! -s "${LOCAL_VERSIONS_JSON}" ]; then + echo "::error::${LOCAL_VERSIONS_JSON} missing or empty -- aborting sync." + exit 1 + fi + done + else + # Full build: verify the top-level homepage and provider listing. + if [ ! -s "registry/_site/index.html" ]; then + echo "::error::Full build did not emit registry/_site/index.html -- aborting sync." + exit 1 + fi + if [ ! -s "registry/_site/api/providers.json" ]; then + echo "::error::registry/_site/api/providers.json missing or empty -- aborting sync." + exit 1 + fi + API_PROVIDERS_DIR="registry/_site/api/providers/" + if [ ! -d "${API_PROVIDERS_DIR}" ] || [ -z "$(ls -A "${API_PROVIDERS_DIR}" 2>/dev/null)" ]; then + echo "::error::${API_PROVIDERS_DIR} is missing or empty -- aborting sync." + exit 1 + fi + fi + - name: "Sync registry to S3" env: S3_BUCKET: ${{ steps.destination.outputs.bucket }}