From 6c8221f8523c48e77ce5de64a298c6acdfa5d6f4 Mon Sep 17 00:00:00 2001 From: masarray Date: Tue, 21 Jul 2026 18:38:16 +0700 Subject: [PATCH 1/7] Diagnose failing growth and measurement checks --- .../diagnose-red-growth-checks-temp.yml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/diagnose-red-growth-checks-temp.yml diff --git a/.github/workflows/diagnose-red-growth-checks-temp.yml b/.github/workflows/diagnose-red-growth-checks-temp.yml new file mode 100644 index 0000000..414bfa8 --- /dev/null +++ b/.github/workflows/diagnose-red-growth-checks-temp.yml @@ -0,0 +1,51 @@ +name: Diagnose failing growth checks + +on: + push: + branches: + - fix/ci-growth-measurement + +permissions: + actions: read + contents: read + +jobs: + diagnose: + runs-on: ubuntu-latest + steps: + - name: Collect latest failed push runs and logs + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + mkdir -p diagnostics + for workflow_id in 317000709 316621036; do + gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/${workflow_id}" > "diagnostics/workflow-${workflow_id}.json" + gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/${workflow_id}/runs?branch=main&event=push&per_page=10" > "diagnostics/runs-${workflow_id}.json" + run_id=$(python - "$workflow_id" <<'PY' + import json, sys + wid = sys.argv[1] + data = json.load(open(f'diagnostics/runs-{wid}.json', encoding='utf-8')) + failed = [r for r in data.get('workflow_runs', []) if r.get('conclusion') == 'failure'] + if not failed: + raise SystemExit(f'No failed main push run found for workflow {wid}') + print(failed[0]['id']) + PY + ) + gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}/jobs?per_page=100" > "diagnostics/jobs-${workflow_id}.json" + failed_job_ids=$(python - "$workflow_id" <<'PY' + import json, sys + wid = sys.argv[1] + data = json.load(open(f'diagnostics/jobs-{wid}.json', encoding='utf-8')) + print(' '.join(str(j['id']) for j in data.get('jobs', []) if j.get('conclusion') == 'failure')) + PY + ) + for job_id in $failed_job_ids; do + gh api "repos/${GITHUB_REPOSITORY}/actions/jobs/${job_id}/logs" > "diagnostics/job-${job_id}.log" + done + done + find diagnostics -maxdepth 1 -type f -print + - uses: actions/upload-artifact@v4 + with: + name: failing-growth-check-diagnostics + path: diagnostics From 25865a69a133ee2ebada633d0829a30524786a66 Mon Sep 17 00:00:00 2001 From: masarray Date: Tue, 21 Jul 2026 18:39:06 +0700 Subject: [PATCH 2/7] Run diagnostics on pull requests --- .github/workflows/diagnose-red-growth-checks-temp.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/diagnose-red-growth-checks-temp.yml b/.github/workflows/diagnose-red-growth-checks-temp.yml index 414bfa8..215820b 100644 --- a/.github/workflows/diagnose-red-growth-checks-temp.yml +++ b/.github/workflows/diagnose-red-growth-checks-temp.yml @@ -4,6 +4,9 @@ on: push: branches: - fix/ci-growth-measurement + pull_request: + paths: + - ".github/workflows/diagnose-red-growth-checks-temp.yml" permissions: actions: read From 1c2c6957f90aac13ae4422ae7ce534aa4a88d408 Mon Sep 17 00:00:00 2001 From: masarray Date: Tue, 21 Jul 2026 18:44:08 +0700 Subject: [PATCH 3/7] Apply deterministic release evidence fix --- .../diagnose-red-growth-checks-temp.yml | 128 ++++++++++++------ 1 file changed, 90 insertions(+), 38 deletions(-) diff --git a/.github/workflows/diagnose-red-growth-checks-temp.yml b/.github/workflows/diagnose-red-growth-checks-temp.yml index 215820b..3cedd2d 100644 --- a/.github/workflows/diagnose-red-growth-checks-temp.yml +++ b/.github/workflows/diagnose-red-growth-checks-temp.yml @@ -1,54 +1,106 @@ -name: Diagnose failing growth checks +name: Apply deterministic website evidence fix on: push: branches: - fix/ci-growth-measurement - pull_request: - paths: - - ".github/workflows/diagnose-red-growth-checks-temp.yml" permissions: - actions: read - contents: read + contents: write jobs: - diagnose: + apply: + if: github.actor != 'github-actions[bot]' runs-on: ubuntu-latest steps: - - name: Collect latest failed push runs and logs + - uses: actions/checkout@v4 + with: + ref: fix/ci-growth-measurement + fetch-depth: 0 + + - name: Remove mutable release-evidence dependency from website quality gates + shell: python + run: | + from pathlib import Path + + quality_old = ''' - name: Prepare stable release evidence env: GH_TOKEN: ${{ github.token }} + shell: bash run: | set -euo pipefail - mkdir -p diagnostics - for workflow_id in 317000709 316621036; do - gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/${workflow_id}" > "diagnostics/workflow-${workflow_id}.json" - gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/${workflow_id}/runs?branch=main&event=push&per_page=10" > "diagnostics/runs-${workflow_id}.json" - run_id=$(python - "$workflow_id" <<'PY' - import json, sys - wid = sys.argv[1] - data = json.load(open(f'diagnostics/runs-{wid}.json', encoding='utf-8')) - failed = [r for r in data.get('workflow_runs', []) if r.get('conclusion') == 'failure'] - if not failed: - raise SystemExit(f'No failed main push run found for workflow {wid}') - print(failed[0]['id']) - PY - ) - gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}/jobs?per_page=100" > "diagnostics/jobs-${workflow_id}.json" - failed_job_ids=$(python - "$workflow_id" <<'PY' - import json, sys - wid = sys.argv[1] - data = json.load(open(f'diagnostics/jobs-{wid}.json', encoding='utf-8')) - print(' '.join(str(j['id']) for j in data.get('jobs', []) if j.get('conclusion') == 'failure')) - PY - ) - for job_id in $failed_job_ids; do - gh api "repos/${GITHUB_REPOSITORY}/actions/jobs/${job_id}/logs" > "diagnostics/job-${job_id}.log" - done - done - find diagnostics -maxdepth 1 -type f -print - - uses: actions/upload-artifact@v4 + if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then + cp landing/latest.json /tmp/arsas-published.json + else + gh api "repos/$GITHUB_REPOSITORY/contents/published.json?ref=release-evidence" --jq .content | base64 -d > /tmp/arsas-published.json + fi +''' + insights_old = ''' - name: Prepare stable release evidence + env: + GH_TOKEN: ${{ github.token }} + shell: bash + run: gh api "repos/$GITHUB_REPOSITORY/contents/published.json?ref=release-evidence" --jq .content | base64 -d > /tmp/arsas-published.json +''' + replacement = ''' - name: Prepare deterministic stable release evidence + shell: bash + run: cp landing/latest.json /tmp/arsas-published.json +''' + + for filename in ('.github/workflows/search-growth.yml', '.github/workflows/site-measurement.yml'): + path = Path(filename) + text = path.read_text(encoding='utf-8') + if text.count(quality_old) != 1: + raise SystemExit(f'{filename}: expected one mutable quality evidence block, found {text.count(quality_old)}') + if text.count(insights_old) != 1: + raise SystemExit(f'{filename}: expected one mutable insights evidence block, found {text.count(insights_old)}') + text = text.replace(quality_old, replacement).replace(insights_old, replacement) + path.write_text(text, encoding='utf-8') + + Path('.github/workflows/diagnose-red-growth-checks-temp.yml').unlink() + + - name: Setup Python + uses: actions/setup-python@v5 with: - name: failing-growth-check-diagnostics - path: diagnostics + python-version: "3.12" + + - name: Validate search-growth quality path offline + run: | + set -euo pipefail + python -m pip install --disable-pip-version-check --quiet requests + cp landing/latest.json /tmp/arsas-published.json + python scripts/build-product-site.py --output _site_growth --release-evidence /tmp/arsas-published.json + python scripts/apply-search-authority.py _site_growth + python scripts/generate-privacy-pages.py --output _site_growth --release-evidence /tmp/arsas-published.json --measurement-id "" + python scripts/inject-site-measurement.py _site_growth --measurement-id "" + python scripts/validate-search-authority.py _site_growth + python scripts/check-site-health.py --site _site_growth --output _growth/health + python scripts/check-measurement-readiness.py --output _growth/readiness --strict + python scripts/build-search-growth-report.py --site _site_growth --output _growth/queue + + - name: Validate site-measurement quality path offline + run: | + set -euo pipefail + cp landing/latest.json /tmp/arsas-published.json + python scripts/build-product-site.py --output _site_measurement --release-evidence /tmp/arsas-published.json + python scripts/generate-privacy-pages.py --output _site_measurement --release-evidence /tmp/arsas-published.json --measurement-id "" + python scripts/inject-site-measurement.py _site_measurement --measurement-id "" + python scripts/stamp-site-build.py _site_measurement \ + --source-commit "$(git rev-parse HEAD)" \ + --source-ref "refs/heads/fix/ci-growth-measurement" \ + --commit-timestamp "$(git show -s --format=%cI HEAD)" \ + --workflow-run-id "$GITHUB_RUN_ID" \ + --workflow-run-attempt "$GITHUB_RUN_ATTEMPT" + python scripts/validate-site-measurement.py _site_measurement --measurement-id "" + python scripts/check-site-health.py --site _site_measurement --output _measurement + python scripts/check-measurement-readiness.py --output _measurement/readiness --strict + GOOGLE_SERVICE_ACCOUNT_JSON="" GOOGLE_APPLICATION_CREDENTIALS="" GA4_PROPERTY_ID="" GSC_SITE_URL="https://masarray.github.io/arsas/" PAGESPEED_URLS="" GITHUB_STEP_SUMMARY="" \ + python scripts/build-site-measurement-report.py --site _site_measurement --output _measurement/offline --days 7 + python scripts/validate-measurement-report.py --report _measurement/offline/measurement.json --readiness _measurement/readiness/readiness.json + + - name: Commit validated workflow correction + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add -A + git commit -m "Fix deterministic website quality evidence" + git push origin HEAD:fix/ci-growth-measurement From c8b6c5cfcb164957e1ce25a710c42d74d32e8260 Mon Sep 17 00:00:00 2001 From: masarray Date: Tue, 21 Jul 2026 18:46:48 +0700 Subject: [PATCH 4/7] Capture deterministic evidence patch failure --- .../diagnose-red-growth-checks-temp.yml | 124 +++++------------- 1 file changed, 31 insertions(+), 93 deletions(-) diff --git a/.github/workflows/diagnose-red-growth-checks-temp.yml b/.github/workflows/diagnose-red-growth-checks-temp.yml index 3cedd2d..6fd7482 100644 --- a/.github/workflows/diagnose-red-growth-checks-temp.yml +++ b/.github/workflows/diagnose-red-growth-checks-temp.yml @@ -1,106 +1,44 @@ -name: Apply deterministic website evidence fix +name: Diagnose deterministic evidence patch on: - push: - branches: - - fix/ci-growth-measurement + pull_request: + paths: + - ".github/workflows/diagnose-red-growth-checks-temp.yml" permissions: - contents: write + actions: read + contents: read jobs: - apply: - if: github.actor != 'github-actions[bot]' + diagnose: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - ref: fix/ci-growth-measurement - fetch-depth: 0 - - - name: Remove mutable release-evidence dependency from website quality gates - shell: python - run: | - from pathlib import Path - - quality_old = ''' - name: Prepare stable release evidence + - name: Capture latest patch workflow failure env: GH_TOKEN: ${{ github.token }} - shell: bash run: | set -euo pipefail - if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then - cp landing/latest.json /tmp/arsas-published.json - else - gh api "repos/$GITHUB_REPOSITORY/contents/published.json?ref=release-evidence" --jq .content | base64 -d > /tmp/arsas-published.json - fi -''' - insights_old = ''' - name: Prepare stable release evidence - env: - GH_TOKEN: ${{ github.token }} - shell: bash - run: gh api "repos/$GITHUB_REPOSITORY/contents/published.json?ref=release-evidence" --jq .content | base64 -d > /tmp/arsas-published.json -''' - replacement = ''' - name: Prepare deterministic stable release evidence - shell: bash - run: cp landing/latest.json /tmp/arsas-published.json -''' - - for filename in ('.github/workflows/search-growth.yml', '.github/workflows/site-measurement.yml'): - path = Path(filename) - text = path.read_text(encoding='utf-8') - if text.count(quality_old) != 1: - raise SystemExit(f'{filename}: expected one mutable quality evidence block, found {text.count(quality_old)}') - if text.count(insights_old) != 1: - raise SystemExit(f'{filename}: expected one mutable insights evidence block, found {text.count(insights_old)}') - text = text.replace(quality_old, replacement).replace(insights_old, replacement) - path.write_text(text, encoding='utf-8') - - Path('.github/workflows/diagnose-red-growth-checks-temp.yml').unlink() - - - name: Setup Python - uses: actions/setup-python@v5 + mkdir diagnostics + gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/317381483/runs?branch=fix%2Fci-growth-measurement&event=push&per_page=10" > diagnostics/runs.json + run_id=$(python - <<'PY' + import json + data = json.load(open('diagnostics/runs.json', encoding='utf-8')) + failed = [r for r in data.get('workflow_runs', []) if r.get('conclusion') == 'failure'] + if not failed: + raise SystemExit('No failed patch run found') + print(failed[0]['id']) + PY + ) + gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}/jobs?per_page=100" > diagnostics/jobs.json + for job_id in $(python - <<'PY' + import json + data = json.load(open('diagnostics/jobs.json', encoding='utf-8')) + print(' '.join(str(j['id']) for j in data.get('jobs', []) if j.get('conclusion') == 'failure')) + PY + ); do + gh api "repos/${GITHUB_REPOSITORY}/actions/jobs/${job_id}/logs" > "diagnostics/job-${job_id}.log" + done + - uses: actions/upload-artifact@v4 with: - python-version: "3.12" - - - name: Validate search-growth quality path offline - run: | - set -euo pipefail - python -m pip install --disable-pip-version-check --quiet requests - cp landing/latest.json /tmp/arsas-published.json - python scripts/build-product-site.py --output _site_growth --release-evidence /tmp/arsas-published.json - python scripts/apply-search-authority.py _site_growth - python scripts/generate-privacy-pages.py --output _site_growth --release-evidence /tmp/arsas-published.json --measurement-id "" - python scripts/inject-site-measurement.py _site_growth --measurement-id "" - python scripts/validate-search-authority.py _site_growth - python scripts/check-site-health.py --site _site_growth --output _growth/health - python scripts/check-measurement-readiness.py --output _growth/readiness --strict - python scripts/build-search-growth-report.py --site _site_growth --output _growth/queue - - - name: Validate site-measurement quality path offline - run: | - set -euo pipefail - cp landing/latest.json /tmp/arsas-published.json - python scripts/build-product-site.py --output _site_measurement --release-evidence /tmp/arsas-published.json - python scripts/generate-privacy-pages.py --output _site_measurement --release-evidence /tmp/arsas-published.json --measurement-id "" - python scripts/inject-site-measurement.py _site_measurement --measurement-id "" - python scripts/stamp-site-build.py _site_measurement \ - --source-commit "$(git rev-parse HEAD)" \ - --source-ref "refs/heads/fix/ci-growth-measurement" \ - --commit-timestamp "$(git show -s --format=%cI HEAD)" \ - --workflow-run-id "$GITHUB_RUN_ID" \ - --workflow-run-attempt "$GITHUB_RUN_ATTEMPT" - python scripts/validate-site-measurement.py _site_measurement --measurement-id "" - python scripts/check-site-health.py --site _site_measurement --output _measurement - python scripts/check-measurement-readiness.py --output _measurement/readiness --strict - GOOGLE_SERVICE_ACCOUNT_JSON="" GOOGLE_APPLICATION_CREDENTIALS="" GA4_PROPERTY_ID="" GSC_SITE_URL="https://masarray.github.io/arsas/" PAGESPEED_URLS="" GITHUB_STEP_SUMMARY="" \ - python scripts/build-site-measurement-report.py --site _site_measurement --output _measurement/offline --days 7 - python scripts/validate-measurement-report.py --report _measurement/offline/measurement.json --readiness _measurement/readiness/readiness.json - - - name: Commit validated workflow correction - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add -A - git commit -m "Fix deterministic website quality evidence" - git push origin HEAD:fix/ci-growth-measurement + name: deterministic-evidence-patch-diagnostics + path: diagnostics From 2b238e548c89bd8173f0dd368763ca662b7a93a4 Mon Sep 17 00:00:00 2001 From: masarray Date: Tue, 21 Jul 2026 18:49:36 +0700 Subject: [PATCH 5/7] Apply deterministic website evidence fix safely --- .../diagnose-red-growth-checks-temp.yml | 130 +++++++++++++----- 1 file changed, 96 insertions(+), 34 deletions(-) diff --git a/.github/workflows/diagnose-red-growth-checks-temp.yml b/.github/workflows/diagnose-red-growth-checks-temp.yml index 6fd7482..830f582 100644 --- a/.github/workflows/diagnose-red-growth-checks-temp.yml +++ b/.github/workflows/diagnose-red-growth-checks-temp.yml @@ -1,44 +1,106 @@ -name: Diagnose deterministic evidence patch +name: Apply deterministic website evidence fix on: - pull_request: - paths: - - ".github/workflows/diagnose-red-growth-checks-temp.yml" + push: + branches: + - fix/ci-growth-measurement permissions: - actions: read - contents: read + contents: write jobs: - diagnose: + apply: + if: github.actor != 'github-actions[bot]' runs-on: ubuntu-latest steps: - - name: Capture latest patch workflow failure - env: - GH_TOKEN: ${{ github.token }} + - uses: actions/checkout@v4 + with: + ref: fix/ci-growth-measurement + fetch-depth: 0 + + - name: Remove mutable release-evidence dependency + shell: python run: | - set -euo pipefail - mkdir diagnostics - gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/317381483/runs?branch=fix%2Fci-growth-measurement&event=push&per_page=10" > diagnostics/runs.json - run_id=$(python - <<'PY' - import json - data = json.load(open('diagnostics/runs.json', encoding='utf-8')) - failed = [r for r in data.get('workflow_runs', []) if r.get('conclusion') == 'failure'] - if not failed: - raise SystemExit('No failed patch run found') - print(failed[0]['id']) - PY - ) - gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}/jobs?per_page=100" > diagnostics/jobs.json - for job_id in $(python - <<'PY' - import json - data = json.load(open('diagnostics/jobs.json', encoding='utf-8')) - print(' '.join(str(j['id']) for j in data.get('jobs', []) if j.get('conclusion') == 'failure')) - PY - ); do - gh api "repos/${GITHUB_REPOSITORY}/actions/jobs/${job_id}/logs" > "diagnostics/job-${job_id}.log" - done - - uses: actions/upload-artifact@v4 + from pathlib import Path + + def replace_prepare_steps(filename: str) -> None: + path = Path(filename) + lines = path.read_text(encoding="utf-8").splitlines() + output = [] + replacements = 0 + index = 0 + while index < len(lines): + line = lines[index] + if line.strip() != "- name: Prepare stable release evidence": + output.append(line) + index += 1 + continue + + indent = line[: len(line) - len(line.lstrip())] + output.extend([ + f"{indent}- name: Prepare deterministic stable release evidence", + f"{indent} shell: bash", + f"{indent} run: cp landing/latest.json /tmp/arsas-published.json", + ]) + replacements += 1 + index += 1 + while index < len(lines): + candidate = lines[index] + if candidate.startswith(indent + "- name:"): + break + index += 1 + + if replacements != 2: + raise SystemExit(f"{filename}: expected 2 release-evidence steps, replaced {replacements}") + path.write_text("\n".join(output) + "\n", encoding="utf-8") + + replace_prepare_steps(".github/workflows/search-growth.yml") + replace_prepare_steps(".github/workflows/site-measurement.yml") + Path(".github/workflows/diagnose-red-growth-checks-temp.yml").unlink() + + - name: Setup Python + uses: actions/setup-python@v5 with: - name: deterministic-evidence-patch-diagnostics - path: diagnostics + python-version: "3.12" + + - name: Validate search-growth quality path offline + run: | + set -euo pipefail + python -m pip install --disable-pip-version-check --quiet requests + cp landing/latest.json /tmp/arsas-published.json + python scripts/build-product-site.py --output _site_growth --release-evidence /tmp/arsas-published.json + python scripts/apply-search-authority.py _site_growth + python scripts/generate-privacy-pages.py --output _site_growth --release-evidence /tmp/arsas-published.json --measurement-id "" + python scripts/inject-site-measurement.py _site_growth --measurement-id "" + python scripts/validate-search-authority.py _site_growth + python scripts/check-site-health.py --site _site_growth --output _growth/health + python scripts/check-measurement-readiness.py --output _growth/readiness --strict + python scripts/build-search-growth-report.py --site _site_growth --output _growth/queue + + - name: Validate site-measurement quality path offline + run: | + set -euo pipefail + cp landing/latest.json /tmp/arsas-published.json + python scripts/build-product-site.py --output _site_measurement --release-evidence /tmp/arsas-published.json + python scripts/generate-privacy-pages.py --output _site_measurement --release-evidence /tmp/arsas-published.json --measurement-id "" + python scripts/inject-site-measurement.py _site_measurement --measurement-id "" + python scripts/stamp-site-build.py _site_measurement \ + --source-commit "$(git rev-parse HEAD)" \ + --source-ref "refs/heads/fix/ci-growth-measurement" \ + --commit-timestamp "$(git show -s --format=%cI HEAD)" \ + --workflow-run-id "$GITHUB_RUN_ID" \ + --workflow-run-attempt "$GITHUB_RUN_ATTEMPT" + python scripts/validate-site-measurement.py _site_measurement --measurement-id "" + python scripts/check-site-health.py --site _site_measurement --output _measurement + python scripts/check-measurement-readiness.py --output _measurement/readiness --strict + GOOGLE_SERVICE_ACCOUNT_JSON="" GOOGLE_APPLICATION_CREDENTIALS="" GA4_PROPERTY_ID="" GSC_SITE_URL="https://masarray.github.io/arsas/" PAGESPEED_URLS="" GITHUB_STEP_SUMMARY="" \ + python scripts/build-site-measurement-report.py --site _site_measurement --output _measurement/offline --days 7 + python scripts/validate-measurement-report.py --report _measurement/offline/measurement.json --readiness _measurement/readiness/readiness.json + + - name: Commit validated workflow correction + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add -A + git commit -m "Fix deterministic website quality evidence" + git push origin HEAD:fix/ci-growth-measurement From 3dccc0db6cadaf7c69ca9d73f63de964c8f11992 Mon Sep 17 00:00:00 2001 From: masarray Date: Tue, 21 Jul 2026 18:51:17 +0700 Subject: [PATCH 6/7] Capture offline validation failure --- .../diagnose-red-growth-checks-temp.yml | 130 +++++------------- 1 file changed, 34 insertions(+), 96 deletions(-) diff --git a/.github/workflows/diagnose-red-growth-checks-temp.yml b/.github/workflows/diagnose-red-growth-checks-temp.yml index 830f582..220b335 100644 --- a/.github/workflows/diagnose-red-growth-checks-temp.yml +++ b/.github/workflows/diagnose-red-growth-checks-temp.yml @@ -1,106 +1,44 @@ -name: Apply deterministic website evidence fix +name: Diagnose offline validation failure on: - push: - branches: - - fix/ci-growth-measurement + pull_request: + paths: + - ".github/workflows/diagnose-red-growth-checks-temp.yml" permissions: - contents: write + actions: read + contents: read jobs: - apply: - if: github.actor != 'github-actions[bot]' + diagnose: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - ref: fix/ci-growth-measurement - fetch-depth: 0 - - - name: Remove mutable release-evidence dependency - shell: python - run: | - from pathlib import Path - - def replace_prepare_steps(filename: str) -> None: - path = Path(filename) - lines = path.read_text(encoding="utf-8").splitlines() - output = [] - replacements = 0 - index = 0 - while index < len(lines): - line = lines[index] - if line.strip() != "- name: Prepare stable release evidence": - output.append(line) - index += 1 - continue - - indent = line[: len(line) - len(line.lstrip())] - output.extend([ - f"{indent}- name: Prepare deterministic stable release evidence", - f"{indent} shell: bash", - f"{indent} run: cp landing/latest.json /tmp/arsas-published.json", - ]) - replacements += 1 - index += 1 - while index < len(lines): - candidate = lines[index] - if candidate.startswith(indent + "- name:"): - break - index += 1 - - if replacements != 2: - raise SystemExit(f"{filename}: expected 2 release-evidence steps, replaced {replacements}") - path.write_text("\n".join(output) + "\n", encoding="utf-8") - - replace_prepare_steps(".github/workflows/search-growth.yml") - replace_prepare_steps(".github/workflows/site-measurement.yml") - Path(".github/workflows/diagnose-red-growth-checks-temp.yml").unlink() - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - - name: Validate search-growth quality path offline - run: | - set -euo pipefail - python -m pip install --disable-pip-version-check --quiet requests - cp landing/latest.json /tmp/arsas-published.json - python scripts/build-product-site.py --output _site_growth --release-evidence /tmp/arsas-published.json - python scripts/apply-search-authority.py _site_growth - python scripts/generate-privacy-pages.py --output _site_growth --release-evidence /tmp/arsas-published.json --measurement-id "" - python scripts/inject-site-measurement.py _site_growth --measurement-id "" - python scripts/validate-search-authority.py _site_growth - python scripts/check-site-health.py --site _site_growth --output _growth/health - python scripts/check-measurement-readiness.py --output _growth/readiness --strict - python scripts/build-search-growth-report.py --site _site_growth --output _growth/queue - - - name: Validate site-measurement quality path offline + - name: Capture latest patch run logs + env: + GH_TOKEN: ${{ github.token }} run: | set -euo pipefail - cp landing/latest.json /tmp/arsas-published.json - python scripts/build-product-site.py --output _site_measurement --release-evidence /tmp/arsas-published.json - python scripts/generate-privacy-pages.py --output _site_measurement --release-evidence /tmp/arsas-published.json --measurement-id "" - python scripts/inject-site-measurement.py _site_measurement --measurement-id "" - python scripts/stamp-site-build.py _site_measurement \ - --source-commit "$(git rev-parse HEAD)" \ - --source-ref "refs/heads/fix/ci-growth-measurement" \ - --commit-timestamp "$(git show -s --format=%cI HEAD)" \ - --workflow-run-id "$GITHUB_RUN_ID" \ - --workflow-run-attempt "$GITHUB_RUN_ATTEMPT" - python scripts/validate-site-measurement.py _site_measurement --measurement-id "" - python scripts/check-site-health.py --site _site_measurement --output _measurement - python scripts/check-measurement-readiness.py --output _measurement/readiness --strict - GOOGLE_SERVICE_ACCOUNT_JSON="" GOOGLE_APPLICATION_CREDENTIALS="" GA4_PROPERTY_ID="" GSC_SITE_URL="https://masarray.github.io/arsas/" PAGESPEED_URLS="" GITHUB_STEP_SUMMARY="" \ - python scripts/build-site-measurement-report.py --site _site_measurement --output _measurement/offline --days 7 - python scripts/validate-measurement-report.py --report _measurement/offline/measurement.json --readiness _measurement/readiness/readiness.json - - - name: Commit validated workflow correction - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add -A - git commit -m "Fix deterministic website quality evidence" - git push origin HEAD:fix/ci-growth-measurement + mkdir diagnostics + gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/317381483/runs?branch=fix%2Fci-growth-measurement&event=push&per_page=10" > diagnostics/runs.json + run_id=$(python - <<'PY' + import json + data = json.load(open('diagnostics/runs.json', encoding='utf-8')) + failed = [r for r in data.get('workflow_runs', []) if r.get('conclusion') == 'failure'] + if not failed: + raise SystemExit('No failed patch run found') + print(failed[0]['id']) + PY + ) + gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}/jobs?per_page=100" > diagnostics/jobs.json + for job_id in $(python - <<'PY' + import json + data = json.load(open('diagnostics/jobs.json', encoding='utf-8')) + print(' '.join(str(j['id']) for j in data.get('jobs', []) if j.get('conclusion') == 'failure')) + PY + ); do + gh api "repos/${GITHUB_REPOSITORY}/actions/jobs/${job_id}/logs" > "diagnostics/job-${job_id}.log" + done + - uses: actions/upload-artifact@v4 + with: + name: offline-validation-failure + path: diagnostics From 54e36febc15baa13ab0681ded261564767aa9006 Mon Sep 17 00:00:00 2001 From: masarray Date: Tue, 21 Jul 2026 18:55:35 +0700 Subject: [PATCH 7/7] Fix deterministic website quality evidence --- .../diagnose-red-growth-checks-temp.yml | 44 ------------------- .github/workflows/search-growth.yml | 20 ++------- .github/workflows/site-measurement.yml | 20 ++------- 3 files changed, 8 insertions(+), 76 deletions(-) delete mode 100644 .github/workflows/diagnose-red-growth-checks-temp.yml diff --git a/.github/workflows/diagnose-red-growth-checks-temp.yml b/.github/workflows/diagnose-red-growth-checks-temp.yml deleted file mode 100644 index 220b335..0000000 --- a/.github/workflows/diagnose-red-growth-checks-temp.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Diagnose offline validation failure - -on: - pull_request: - paths: - - ".github/workflows/diagnose-red-growth-checks-temp.yml" - -permissions: - actions: read - contents: read - -jobs: - diagnose: - runs-on: ubuntu-latest - steps: - - name: Capture latest patch run logs - env: - GH_TOKEN: ${{ github.token }} - run: | - set -euo pipefail - mkdir diagnostics - gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/317381483/runs?branch=fix%2Fci-growth-measurement&event=push&per_page=10" > diagnostics/runs.json - run_id=$(python - <<'PY' - import json - data = json.load(open('diagnostics/runs.json', encoding='utf-8')) - failed = [r for r in data.get('workflow_runs', []) if r.get('conclusion') == 'failure'] - if not failed: - raise SystemExit('No failed patch run found') - print(failed[0]['id']) - PY - ) - gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}/jobs?per_page=100" > diagnostics/jobs.json - for job_id in $(python - <<'PY' - import json - data = json.load(open('diagnostics/jobs.json', encoding='utf-8')) - print(' '.join(str(j['id']) for j in data.get('jobs', []) if j.get('conclusion') == 'failure')) - PY - ); do - gh api "repos/${GITHUB_REPOSITORY}/actions/jobs/${job_id}/logs" > "diagnostics/job-${job_id}.log" - done - - uses: actions/upload-artifact@v4 - with: - name: offline-validation-failure - path: diagnostics diff --git a/.github/workflows/search-growth.yml b/.github/workflows/search-growth.yml index f98d0e9..a1f3aff 100644 --- a/.github/workflows/search-growth.yml +++ b/.github/workflows/search-growth.yml @@ -67,18 +67,9 @@ jobs: with: python-version: "3.12" - - name: Prepare stable release evidence - env: - GH_TOKEN: ${{ github.token }} + - name: Prepare deterministic stable release evidence shell: bash - run: | - set -euo pipefail - if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then - cp landing/latest.json /tmp/arsas-published.json - else - gh api "repos/$GITHUB_REPOSITORY/contents/published.json?ref=release-evidence" --jq .content | base64 -d > /tmp/arsas-published.json - fi - + run: cp landing/latest.json /tmp/arsas-published.json - name: Build product website run: python scripts/build-product-site.py --output _site --release-evidence /tmp/arsas-published.json @@ -158,12 +149,9 @@ jobs: create_credentials_file: true export_environment_variables: true - - name: Prepare stable release evidence - env: - GH_TOKEN: ${{ github.token }} + - name: Prepare deterministic stable release evidence shell: bash - run: gh api "repos/$GITHUB_REPOSITORY/contents/published.json?ref=release-evidence" --jq .content | base64 -d > /tmp/arsas-published.json - + run: cp landing/latest.json /tmp/arsas-published.json - name: Build current product website run: python scripts/build-product-site.py --output _site --release-evidence /tmp/arsas-published.json diff --git a/.github/workflows/site-measurement.yml b/.github/workflows/site-measurement.yml index ae93514..53e6b37 100644 --- a/.github/workflows/site-measurement.yml +++ b/.github/workflows/site-measurement.yml @@ -72,18 +72,9 @@ jobs: - name: Install offline report dependency run: python -m pip install --disable-pip-version-check --quiet requests - - name: Prepare stable release evidence - env: - GH_TOKEN: ${{ github.token }} + - name: Prepare deterministic stable release evidence shell: bash - run: | - set -euo pipefail - if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then - cp landing/latest.json /tmp/arsas-published.json - else - gh api "repos/$GITHUB_REPOSITORY/contents/published.json?ref=release-evidence" --jq .content | base64 -d > /tmp/arsas-published.json - fi - + run: cp landing/latest.json /tmp/arsas-published.json - name: Build deterministic website run: python scripts/build-product-site.py --output _site --release-evidence /tmp/arsas-published.json @@ -195,12 +186,9 @@ jobs: create_credentials_file: true export_environment_variables: true - - name: Prepare stable release evidence - env: - GH_TOKEN: ${{ github.token }} + - name: Prepare deterministic stable release evidence shell: bash - run: gh api "repos/$GITHUB_REPOSITORY/contents/published.json?ref=release-evidence" --jq .content | base64 -d > /tmp/arsas-published.json - + run: cp landing/latest.json /tmp/arsas-published.json - name: Build current website run: python scripts/build-product-site.py --output _site --release-evidence /tmp/arsas-published.json