GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Automation and CI / globalgrid2050 / .github/workflows

GlobalGrid2050 Testcode Proof Workflow and 9 more files

A GitHub Actions workflow that builds and publishes the site. Runs on push and by hand.

680 lines of YAML from globalgrid2050, in 10 files. Topic: Automation and CI. Section 1732 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. GlobalGrid2050 Rollback V8 Battery Energy Storage System (BESS) V7 Frame Rebuild Workflow automation · globalgrid2050 / .github/workflows/rollback-v8-bess-v7-frame-rebuild.yml lines 1–35
  2. GlobalGrid2050 Run V2 Safe Patch Workflow automation · globalgrid2050 / .github/workflows/run_v2_safe_patch.yml lines 1–37
  3. GlobalGrid2050 Stamp Data Spine Doctrine Workflow automation · globalgrid2050 / .github/workflows/stamp_data_spine_doctrine.yml lines 1–81
  4. GlobalGrid2050 Star Checks Workflow automation · globalgrid2050 / .github/workflows/star-checks.yml lines 1–93
  5. GlobalGrid2050 Step1 Fetch Pvlive Solar Candidate V6 Workflow automation · globalgrid2050 / .github/workflows/step1_fetch_pvlive_solar_candidate_v6.yml lines 1–43
  6. GlobalGrid2050 Step2 Build Pvlive Solar Browser V6 Workflow automation · globalgrid2050 / .github/workflows/step2_build_pvlive_solar_browser_v6.yml lines 1–44
  7. GlobalGrid2050 Step3 Wire Pvlive Solar UI V6 Workflow automation · globalgrid2050 / .github/workflows/step3_wire_pvlive_solar_ui_v6.yml lines 1–39
  8. GlobalGrid2050 Testcode Dual Compute Workflow automation · globalgrid2050 / .github/workflows/testcode-202609150010-dual-compute.yml lines 1–27
  9. GlobalGrid2050 Testcode Proof Workflow automation · globalgrid2050 / .github/workflows/testcode-proof.yml lines 1–234
  10. GlobalGrid2050 Track Repository Size Workflow automation · globalgrid2050 / .github/workflows/track_repository_size.yml lines 1–47

GlobalGrid2050 Rollback V8 Battery Energy Storage System (BESS) V7 Frame Rebuild Workflow

A GitHub Actions workflow. Runs by hand.

automationglobalgrid2050 / .github/workflows/rollback-v8-bess-v7-frame-rebuild.yml · lines 1–35 of 35 · Entry point

What it does
It runs battery storage (BESS). Side effects: starts processes.
Why it exists in the grid workflow
Domain stage sub33kv_design (path word 'bess'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: battery storage (BESS).
Inputs & outputs
Out: commits pushed to the repository.
Downstream impact
It is itself an entry point (workflow); no other file was found loading it.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · .github/workflows · workflow
Uses
none found
Used by
none found
Produces
none declared
Defines here
Rollback V8 BESS V7 Frame Rebuild
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 .github/workflows/rollback-v8-bess-v7-frame-rebuild.yml:1-35 · blob 4bd1cf9931388926467f283e1939c436ae49edb7 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: unknown · effects: process · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
name: Rollback V8 BESS V7 Frame Rebuild

on:
  workflow_dispatch:
permissions:
  contents: write

jobs:
  rollback-v8-bess-v7-frame-rebuild:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          token: ${{ secrets.GRIDBOT_PAT }}
          fetch-depth: 0

      - name: Revert broken V8 BESS V7 frame rebuild commit
        env:
          PAT: ${{ secrets.GRIDBOT_PAT }}
        run: |
          git config --global user.name "gridbot"
          git config --global user.email "bot@globalgrid2050.com"

          git pull --rebase --autostash origin main

          if git log --oneline --max-count=80 | grep -q "94a2ed194df46e6619dfea2722c6650118a8d29b"; then
            git revert --no-edit 94a2ed194df46e6619dfea2722c6650118a8d29b
          else
            echo "Target rebuild commit not present in recent history. Nothing to revert."
            exit 0
          fi

          git push https://${PAT}@github.com/${{ github.repository }}.git HEAD:main

GlobalGrid2050 Run V2 Safe Patch Workflow

A GitHub Actions workflow. Runs by hand.

automationglobalgrid2050 / .github/workflows/run_v2_safe_patch.yml · lines 1–37 of 37 · Entry point

What it does
It runs automated jobs on GitHub Actions. Side effects: starts processes.
Inputs & outputs
Out: commits pushed to the repository.
Downstream impact
It is itself an entry point (workflow); no other file was found loading it.
What it achieves
Runs GlobalGrid2050 V2 Safe Patch (`scripts/v2_safe_patch.py`).
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · .github/workflows · workflow
Uses
GlobalGrid2050 V2 Safe Patch (workflow run)
Used by
none found
Produces
none declared
Defines here
run-v2-safe-patch
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 .github/workflows/run_v2_safe_patch.yml:1-37 · blob 4e5e1f627f0162ef1d25417e14dea663dff78d57 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: unknown · users: none · canonical: production_core
name: run-v2-safe-patch

on:
  workflow_dispatch:
permissions:
  contents: write

jobs:
  patch:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
          token: ${{ secrets.GRIDBOT_PAT }}

      - uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Run safe V2 patch
        run: python scripts/v2_safe_patch.py

      - name: Commit exact V2 files
        env:
          PAT: ${{ secrets.GRIDBOT_PAT }}
        run: |
          git config --global user.name "gridbot"
          git config --global user.email "bot@globalgrid2050.com"
          git add uk_energy_tracking_v2/index.md
          git add gridbot_reports/v2_safe_patch.md
          if [ -n "$(git status --porcelain)" ]; then
            git commit -m "Apply V2 safe patch"
            git push https://${PAT}@github.com/${{ github.repository }}.git HEAD:main
          else
            echo "No changes to commit"
          fi

GlobalGrid2050 Stamp Data Spine Doctrine Workflow

A GitHub Actions workflow. Runs by hand.

automationglobalgrid2050 / .github/workflows/stamp_data_spine_doctrine.yml · lines 1–81 of 81 · Entry point

What it does
It runs automated jobs on GitHub Actions. Side effects: starts processes.
Inputs & outputs
Out: commits pushed to the repository.
Downstream impact
It is itself an entry point (workflow); no other file was found loading it.
What it achieves
Runs `scripts/stamp_data_spine_doctrine.py`.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · .github/workflows · workflow
Uses
none found
Used by
none found
Produces
none declared
Defines here
Stamp Data Spine Doctrine
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 .github/workflows/stamp_data_spine_doctrine.yml:1-81 · blob dc392e460f5981f47268928387a3c5db28670a7d · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: unknown · users: none · canonical: production_core
name: Stamp Data Spine Doctrine

on:
  workflow_dispatch:
    inputs:
      mode:
        description: Run mode
        required: true
        default: audit
        type: choice
        options:
          - audit
          - apply
      commit_outputs:
        description: Commit stamped files and reports
        required: true
        default: 'true'
        type: choice
        options:
          - 'true'
          - 'false'
permissions:
  contents: write

concurrency:
  group: stamp-data-spine-doctrine
  cancel-in-progress: false

jobs:
  stamp-data-spine-doctrine:
    runs-on: ubuntu-latest
    timeout-minutes: 30

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Audit doctrine stamps
        if: github.event.inputs.mode == 'audit'
        run: python scripts/stamp_data_spine_doctrine.py

      - name: Apply doctrine stamps
        if: github.event.inputs.mode == 'apply'
        run: python scripts/stamp_data_spine_doctrine.py --apply

      - name: Upload stamp report
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: data-spine-stamp-report
          path: |
            data_science_protocol/audit_reports/DATA_SPINE_STAMP_LATEST.md
            data_science_protocol/audit_reports/json/DATA_SPINE_STAMP_LATEST.json

      - name: Commit stamped doctrine outputs
        if: github.event.inputs.commit_outputs == 'true'
        shell: bash
        run: |
          set -euo pipefail
          git config --global user.name "Gridbot"
          git config --global user.email "gridbot@globalgrid2050.com"
          git add ARCHITECTURE.md || true
          git add PHILOSOPHY.md || true
          git add data_science_protocol/DATA_STORAGE_DISCIPLINE_PROTOCOL.md || true
          git add data_science_protocol/DATA_SCIENCE_DISCIPLINE_CHANGELOG.md || true
          git add uk_energy_tracking_v6/V6_ARCHITECTURAL_INTEGRITY_PROTOCOL.md || true
          git add data_science_protocol/audit_reports/ || true
          if git diff --cached --quiet; then
            echo "No data spine stamp outputs to commit"
            exit 0
          fi
          git commit -m "docs: stamp data spine doctrine"
          git pull --rebase origin "${GITHUB_REF_NAME}"
          git push origin HEAD:"${GITHUB_REF_NAME}"

GlobalGrid2050 Star Checks Workflow

A GitHub Actions workflow. Runs on push, on pull requests and on a schedule.

automationglobalgrid2050 / .github/workflows/star-checks.yml · lines 1–93 of 93 · Entry point

What it does
It runs automated jobs on GitHub Actions. Side effects: reads or writes files; starts processes.
Inputs & outputs
In: JSON file star-checks-report.json.
Downstream impact
It is itself an entry point (workflow); no other file was found loading it.
What it achieves
Runs CI Star Checks (`testcode/ci/star_checks.py`).
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · .github/workflows · workflow
Uses
CI Test Star Checks (workflow run), CI Star Checks (workflow run)
Used by
none found
Produces
none declared
Defines here
Star publication checks
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 .github/workflows/star-checks.yml:1-93 · blob ab3fdc7cac3b74c91d23e27d59d195fc2d571a79 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem, process · domain stage: unknown · users: none · canonical: production_core
name: Star publication checks
on:
  schedule:
    - cron: '0 */2 * * *'
  workflow_dispatch:
  pull_request:
    paths: ['testcode/ci/star_checks.py', 'testcode/ci/test_star_checks.py', '.github/workflows/star-checks.yml']
  push:
    branches: [main]
    paths: ['testcode/ci/star_checks.py', 'testcode/ci/test_star_checks.py', '.github/workflows/star-checks.yml']
permissions:
  contents: read
jobs:
  unit:
    runs-on: ubuntu-latest
    timeout-minutes: 5
    steps:
      - uses: actions/checkout@v5
      # THE UNIT TESTS ARE NOT NIGHT WORK.
      # They were gated on the same NIGHT-UNTIL.txt as the network sweep, so on a
      # schedule or a dispatch after the cutoff this job installed nothing, ran
      # nothing and reported success. They are pure, they take seconds, they need
      # no window, and a green tick from a job that ran no tests is the exact
      # thing this repository is trying to stop producing.
      - uses: actions/setup-python@v6
        with:
          python-version: '3.12'
      - run: python -m unittest -v testcode/ci/test_star_checks.py
  sweep:
    if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
    needs: unit
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-python@v6
        with:
          python-version: '3.12'
      - name: Gate bounded night window
        id: gate
        run: |
          python - <<'PY'
          import os
          from pathlib import Path
          from testcode.ci.star_checks import window_open
          enabled = window_open(Path('testcode/ci/NIGHT-UNTIL.txt').read_text())
          with open(os.environ['GITHUB_OUTPUT'], 'a') as out:
              out.write('enabled=' + str(enabled).lower() + '\n')
          print('window_open=' + str(enabled).lower())
          PY
      - name: Check out reviewed Sun validator dependency closure
        if: steps.gate.outputs.enabled == 'true'
        uses: actions/checkout@v5
        with:
          repository: Ventusltd/star-solar-star
          ref: 8b930de59db7b7a6d332025da3eaf80ce8dcf9ab
          path: sun-owner
      # star_checks.py now states a verdict - PASS, FAIL or EXPIRED - and exits
      # 0, 1 or 3. The script is the judge; this step only turns its verdict into
      # something a reader of the runs page can see. An EXPIRED sweep stays green
      # because nobody should be paged for a window closing, but it is annotated
      # as EXPIRED and it is never reported as a pass.
      - name: Audit committed publication expectations and served Sun data
        if: steps.gate.outputs.enabled == 'true'
        run: |
          set +e
          python testcode/ci/star_checks.py --sun-root sun-owner --output star-checks-report.json
          code=$?
          set -e
          python - <<'PY'
          import json, os
          from pathlib import Path
          report = json.loads(Path('star-checks-report.json').read_text())
          verdict = report.get('verdict', 'FAIL')
          detail = report.get('detail') or f"{report.get('mismatches', '?')} mismatch(es)"
          summary = Path(os.environ['GITHUB_STEP_SUMMARY'])
          with summary.open('a', encoding='utf-8') as out:
              out.write(f'## Star publication checks: {verdict}\n\n{detail}\n')
          level = {'PASS': 'notice', 'EXPIRED': 'warning'}.get(verdict, 'error')
          print(f'::{level} title=Star publication checks::{verdict} - {detail}')
          assert verdict in {'PASS', 'EXPIRED'}, f'star checks verdict {verdict}: {detail}'
          assert report.get('pass') is not False, 'scoped publication checks did not pass'
          PY
          # exit 3 is EXPIRED and is not a failure; anything else the script
          # returns is.
          if [ "$code" != "0" ] && [ "$code" != "3" ]; then exit "$code"; fi
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: star-checks-${{ github.run_id }}
          path: star-checks-report.json
          if-no-files-found: ignore
          retention-days: 7

GlobalGrid2050 Step1 Fetch Pvlive Solar Candidate V6 Workflow

A GitHub Actions workflow. Runs by hand.

automationglobalgrid2050 / .github/workflows/step1_fetch_pvlive_solar_candidate_v6.yml · lines 1–43 of 43 · Entry point

What it does
It runs solar. Side effects: starts processes.
Why it exists in the grid workflow
Domain stage sub33kv_design (path word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: solar.
Inputs & outputs
Out: commits pushed to the repository.
Downstream impact
It is itself an entry point (workflow); no other file was found loading it.
What it achieves
Named “Step 1 Fetch PVLive Solar Candidate V6”; runs GlobalGrid2050 Fetch Pvlive Solar Candidate V6 (`scripts/fetch_pvlive_solar_candidate_v6.py`).
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · .github/workflows · workflow
Uses
GlobalGrid2050 Fetch Pvlive Solar Candidate V6 (workflow run)
Used by
none found
Produces
none declared
Defines here
Step 1 Fetch PVLive Solar Candidate V6
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 .github/workflows/step1_fetch_pvlive_solar_candidate_v6.yml:1-43 · blob 180d4e1ebb65bd65252d93410df505ca87f792a1 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
name: Step 1 Fetch PVLive Solar Candidate V6

on:
  workflow_dispatch:
    inputs:
      days:
        description: Number of recent days to fetch from PVLive
        required: false
        default: '30'
permissions:
  contents: write

jobs:
  fetch:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
          token: ${{ secrets.GRIDBOT_PAT }}
      - uses: actions/setup-python@v5
        with:
          python-version: '3.11'
      - name: Fetch PVLive solar candidate
        run: python scripts/fetch_pvlive_solar_candidate_v6.py --days "${{ github.event.inputs.days }}"
      - name: Commit PVLive candidate and audit
        env:
          PAT: ${{ secrets.GRIDBOT_PAT }}
        run: |
          set -e
          git config --global user.name "gridbot"
          git config --global user.email "bot@globalgrid2050.com"
          git add data/confirmed/pvlive_solar_daily_candidate.json
          git add data_science_protocol/audit_reports/PVLIVE_SOLAR_CANDIDATE_LATEST.md
          git add data_science_protocol/audit_reports/json/PVLIVE_SOLAR_CANDIDATE_LATEST.json
          if [ -n "$(git status --porcelain)" ]; then
            git commit -m "gridbot: fetch PVLive solar daily candidate"
            git pull --rebase https://${PAT}@github.com/${{ github.repository }}.git main
            git push https://${PAT}@github.com/${{ github.repository }}.git HEAD:main
          else
            echo "No PVLive solar candidate changes to commit"
          fi

GlobalGrid2050 Step2 Build Pvlive Solar Browser V6 Workflow

A GitHub Actions workflow. Runs by hand.

automationglobalgrid2050 / .github/workflows/step2_build_pvlive_solar_browser_v6.yml · lines 1–44 of 44 · Entry point

What it does
It runs solar. Side effects: starts processes.
Why it exists in the grid workflow
Domain stage sub33kv_design (path word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: solar.
Inputs & outputs
Out: commits pushed to the repository.
Downstream impact
It is itself an entry point (workflow); no other file was found loading it.
What it achieves
Named “Step 2 Build PVLive Solar Browser V6”; runs GlobalGrid2050 Build Pvlive Solar Browser V6 (`scripts/build_pvlive_solar_browser_v6.py`).
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · .github/workflows · workflow
Uses
GlobalGrid2050 Build Pvlive Solar Browser V6 (workflow run)
Used by
none found
Produces
none declared
Defines here
Step 2 Build PVLive Solar Browser V6
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 .github/workflows/step2_build_pvlive_solar_browser_v6.yml:1-44 · blob 5da0375ba9de5631014ff6c710d1622a02a41a4e · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
name: Step 2 Build PVLive Solar Browser V6

on:
  workflow_dispatch:
    inputs:
      max_bytes:
        description: Maximum browser solar JSON size in bytes
        required: false
        default: '500000'
permissions:
  contents: write

jobs:
  build:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
          token: ${{ secrets.GRIDBOT_PAT }}
      - uses: actions/setup-python@v5
        with:
          python-version: '3.11'
      - name: Build PVLive solar browser file
        run: python scripts/build_pvlive_solar_browser_v6.py --max-bytes "${{ github.event.inputs.max_bytes }}"
      - name: Commit PVLive browser file and audit
        env:
          PAT: ${{ secrets.GRIDBOT_PAT }}
        run: |
          set -e
          git config --global user.name "gridbot"
          git config --global user.email "bot@globalgrid2050.com"
          git add uk_energy_tracking_v6/generation_history/pvlive_solar_daily_browser.json
          git add uk_energy_tracking_v6/generation_history/manifests/pvlive_solar_daily_browser.manifest.json
          git add data_science_protocol/audit_reports/PVLIVE_SOLAR_BROWSER_LATEST.md
          git add data_science_protocol/audit_reports/json/PVLIVE_SOLAR_BROWSER_LATEST.json
          if [ -n "$(git status --porcelain)" ]; then
            git commit -m "gridbot: build PVLive solar browser file"
            git pull --rebase https://${PAT}@github.com/${{ github.repository }}.git main
            git push https://${PAT}@github.com/${{ github.repository }}.git HEAD:main
          else
            echo "No PVLive solar browser changes to commit"
          fi

GlobalGrid2050 Step3 Wire Pvlive Solar UI V6 Workflow

A GitHub Actions workflow. Runs by hand.

automationglobalgrid2050 / .github/workflows/step3_wire_pvlive_solar_ui_v6.yml · lines 1–39 of 39 · Entry point

What it does
It runs solar. Side effects: starts processes.
Why it exists in the grid workflow
Domain stage sub33kv_design (path word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary. Domain terms in the code: solar.
Inputs & outputs
Out: commits pushed to the repository.
Downstream impact
It is itself an entry point (workflow); no other file was found loading it.
What it achieves
Named “Step 3 Wire PVLive Solar UI V6”; runs GlobalGrid2050 Wire Pvlive Solar UI V6 (`scripts/wire_pvlive_solar_ui_v6.py`).
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · .github/workflows · workflow
Uses
GlobalGrid2050 Wire Pvlive Solar UI V6 (workflow run)
Used by
none found
Produces
none declared
Defines here
Step 3 Wire PVLive Solar UI V6
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 .github/workflows/step3_wire_pvlive_solar_ui_v6.yml:1-39 · blob 37c08bda72c74781c0d9a04ff9e212e14c4e359b · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
name: Step 3 Wire PVLive Solar UI V6

on:
  workflow_dispatch:
permissions:
  contents: write

jobs:
  wire:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
          token: ${{ secrets.GRIDBOT_PAT }}
      - uses: actions/setup-python@v5
        with:
          python-version: '3.11'
      - name: Wire PVLive solar into UI
        run: python scripts/wire_pvlive_solar_ui_v6.py
      - name: Commit PVLive UI wire and audit
        env:
          PAT: ${{ secrets.GRIDBOT_PAT }}
        run: |
          set -e
          git config --global user.name "gridbot"
          git config --global user.email "bot@globalgrid2050.com"
          git add uk_energy_tracking_v6/generation_history/live-config.js
          git add uk_energy_tracking_v6/generation_history/load_generation_history_data.js
          git add uk_energy_tracking_v6/generation_history/index.md
          git add uk_energy_tracking_v6/generation_history/PVLIVE_SOLAR_UI_WIRE_REPORT.md
          if [ -n "$(git status --porcelain)" ]; then
            git commit -m "gridbot: wire PVLive solar into generation history UI"
            git pull --rebase https://${PAT}@github.com/${{ github.repository }}.git main
            git push https://${PAT}@github.com/${{ github.repository }}.git HEAD:main
          else
            echo "No PVLive solar UI wire changes to commit"
          fi

GlobalGrid2050 Testcode Dual Compute Workflow

A GitHub Actions workflow. Runs by hand.

automationglobalgrid2050 / .github/workflows/testcode-202609150010-dual-compute.yml · lines 1–27 of 27 · version 2026-09-15 00:10 · Entry point

What it does
It runs automated jobs on GitHub Actions. Side effects: starts processes.
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Downstream impact
It is itself an entry point (workflow); no other file was found loading it.
What it achieves
Runs Concept Compute (`testcode/202609150010/concept_compute.py`).
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · .github/workflows · workflow
Uses
Test Dual Compute (workflow run), Concept Compute (workflow run)
Used by
none found
Produces
none declared
Defines here
testcode 202609150010 dual compute
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 .github/workflows/testcode-202609150010-dual-compute.yml:1-27 · blob d38f7cfb7ec9f3cf16a2efda7457452922b8a382 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: experimental · users: none · canonical: production_core
name: testcode 202609150010 dual compute

on:
  workflow_dispatch:

permissions:
  contents: read

jobs:
  compute:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - name: Run deterministic and fail-closed tests
        run: python -m unittest discover -s testcode/202609150010 -p "test_*.py" -v
      - name: Compute CI lane
        run: python testcode/202609150010/concept_compute.py --lane ci --output testcode/202609150010/runs/ci-result.json
      - name: Upload CI result
        uses: actions/upload-artifact@v4
        with:
          name: sun-star-ci-result
          path: testcode/202609150010/runs/ci-result.json
          if-no-files-found: error

GlobalGrid2050 Testcode Proof Workflow

A GitHub Actions workflow that builds and publishes the site. Runs on push and by hand.

automationglobalgrid2050 / .github/workflows/testcode-proof.yml · lines 1–234 of 234 · Entry point

What it does
It builds and publishes its content. Side effects: reads or writes files; starts processes.
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Inputs & outputs
In: JSON file publication.json; command-line arguments.
Downstream impact
It is itself an entry point (workflow); no other file was found loading it.
What it achieves
When a `testcode/` / folder is pushed to main, this job waits for Pages to deploy that exact commit and then proves the published folder from the outside.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · .github/workflows · workflow
Uses
CI Night Tests (workflow run)
Used by
none found
Produces
none declared
Defines here
Testcode proof
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 .github/workflows/testcode-proof.yml:1-234 · blob c5664581366c260743618eb8d4d7d6969dedf3c8 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem, process · domain stage: experimental · users: none · canonical: production_core
# Testcode proof
#
# When a testcode/<stamp>/ folder is pushed to main, this job waits for Pages to
# deploy that exact commit and then proves the published folder from the outside:
#
#   1. Served bytes — every file the folder's publication.json lists is fetched
#      from the live site and its sha256 compared. This is the strong check: it
#      proves what is served is what was published. Both publication.json shapes
#      are handled (files as an object keyed by path, or as an array).
#   2. The folder's index at 430x900 and 1440x1000 — HTTP 200, no uncaught page
#      errors, no console errors, and no horizontal overflow.
#   3. The folder's own proof/ci-checks.json, if it ships one: an array of
#      {name, must_contain[], must_not_contain[]} applied to the visible text.
#
# The checks themselves live in testcode/ci/night-tests.mjs, which the nightly
# job also uses; NIGHT_TESTS_STAMP puts it in single-stamp mode. There is no
# second copy of the logic.
#
# One neutral comment is posted on issue 37 per push, whether it passed or
# failed, and the reports are uploaded as an artifact.
#
# WHEN THERE IS NOTHING TO PROVE, THIS SAYS SO.
# The path filter is testcode/**, which includes testcode/ci/ - the harness
# itself. A push that edits the harness and no published folder finds no
# publication.json, so every later step is skipped and the job reports success.
# Run 34955380619 did exactly that on 75781be8 and is indistinguishable on the
# runs page from a run that proved a publication byte for byte. NOT_APPLICABLE
# is now stated in words, in the step summary and as an annotation, with the
# folders that were considered and why each was dropped.

name: Testcode proof

on:
  push:
    branches: [main]
    paths:
      - "testcode/**"
  workflow_dispatch:
    inputs:
      stamp:
        description: "testcode stamp to prove, e.g. 202609142202"
        required: true
        type: string

permissions:
  contents: read
  actions: read
  issues: write

concurrency:
  group: testcode-proof-${{ github.sha }}
  cancel-in-progress: false

jobs:
  prove:
    runs-on: ubuntu-latest
    timeout-minutes: 45
    steps:
      - name: Check out
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set up node
        uses: actions/setup-node@v4
        with:
          node-version: "20"

      - name: Which stamps
        id: stamps
        env:
          DISPATCH_STAMP: ${{ inputs.stamp }}
          BEFORE: ${{ github.event.before }}
        run: |
          set -u
          if [ -n "${DISPATCH_STAMP:-}" ]; then
            CANDIDATES="$DISPATCH_STAMP"
          else
            # An empty or all-zero "before" means there is no usable range
            # (first push, or a force push): fall back to this commit alone.
            if [ -z "${BEFORE:-}" ] || [ "${BEFORE:-}" = "0000000000000000000000000000000000000000" ] \
               || ! git cat-file -e "${BEFORE}^{commit}" 2>/dev/null; then
              RANGE_FILES="$(git show --name-only --pretty=format: "$GITHUB_SHA" -- testcode/)"
            else
              RANGE_FILES="$(git diff --name-only "$BEFORE" "$GITHUB_SHA" -- testcode/)"
            fi
            CANDIDATES="$(printf '%s\n' "$RANGE_FILES" \
              | sed -n 's|^testcode/\([^/]\{1,\}\)/.*$|\1|p' | sort -u)"
          fi

          # Keep only folders that actually carry a publication.json.
          STAMPS=""
          for s in $CANDIDATES; do
            if [ -f "testcode/$s/publication.json" ]; then
              STAMPS="$STAMPS $s"
            else
              echo "skipping $s: no testcode/$s/publication.json in the repository"
            fi
          done
          STAMPS="$(echo $STAMPS)"
          echo "stamps: ${STAMPS:-(none)}"
          echo "stamps=$STAMPS" >> "$GITHUB_OUTPUT"
          echo "candidates=$(echo $CANDIDATES)" >> "$GITHUB_OUTPUT"
          if [ -z "$STAMPS" ]; then echo "run=no" >> "$GITHUB_OUTPUT"; else echo "run=yes" >> "$GITHUB_OUTPUT"; fi

      # Stated before any work is attempted, so the record exists even if a later
      # step dies: this push carried nothing this workflow can prove.
      - name: Say that there is nothing to prove
        if: steps.stamps.outputs.run == 'no'
        env:
          CANDIDATES: ${{ steps.stamps.outputs.candidates }}
        run: |
          WHY="no testcode/<stamp>/publication.json in this push"
          if [ -n "${CANDIDATES:-}" ]; then
            WHY="folders touched: ${CANDIDATES}; none carries a publication.json"
          fi
          { echo "## Testcode proof: NOT_APPLICABLE"; echo; echo "$WHY"; } >> "$GITHUB_STEP_SUMMARY"
          echo "::notice title=Testcode proof::NOT_APPLICABLE - $WHY. No publication was checked; this green tick is not evidence."

      - name: Wait for Pages to deploy this commit
        if: steps.stamps.outputs.run == 'yes'
        env:
          GH_TOKEN: ${{ github.token }}
        run: |
          set -u
          DEADLINE=$(( $(date -u +%s) + 900 ))
          echo "waiting for \"Deploy GlobalGrid2050 Pages\" on $GITHUB_SHA (up to 15 minutes)"
          while [ "$(date -u +%s)" -lt "$DEADLINE" ]; do
            JSON="$(gh run list --workflow "Deploy GlobalGrid2050 Pages" --commit "$GITHUB_SHA" \
                     --json status,conclusion --limit 5 2>/dev/null || echo '[]')"
            STATE="$(node -p "const r=JSON.parse(process.argv[1]||'[]'); r.length? r[0].status+'/'+(r[0].conclusion||'') : 'none'" "$JSON")"
            echo "  $(date -u +%H:%M:%S) deploy run: $STATE"
            case "$STATE" in
              completed/success) echo "Pages deployed this commit."; exit 0 ;;
              completed/*)       echo "Pages deploy did not succeed ($STATE); checking the live site anyway — the served-bytes check is the judge."; exit 0 ;;
              none)              : ;;
              *)                 : ;;
            esac
            sleep 20
          done
          echo "No completed Pages deploy for this commit within 15 minutes; checking the live site anyway."

      - name: Install puppeteer and Chrome
        if: steps.stamps.outputs.run == 'yes'
        run: |
          mkdir -p "$RUNNER_TEMP/pptr"
          cd "$RUNNER_TEMP/pptr"
          npm init -y > /dev/null
          npm i puppeteer@23 --no-audit --no-fund
          ENTRY="$(node -p "require.resolve('puppeteer')")"
          echo "installed puppeteer $(node -p "require('puppeteer/package.json').version") at $ENTRY"
          echo "PUPPETEER_MODULE=$ENTRY" >> "$GITHUB_ENV"

      - name: Prove each stamp
        if: steps.stamps.outputs.run == 'yes'
        id: prove
        env:
          NIGHT_TESTS_BASE: https://globalgrid2050.com
          NIGHT_TESTS_LOAD_MS: "240000"
        run: |
          set -u
          mkdir -p reports
          FAILED=0
          WORST=0
          for s in ${{ steps.stamps.outputs.stamps }}; do
            echo "::group::testcode/$s"
            set +e
            NIGHT_TESTS_STAMP="$s" REPORT_PATH="$GITHUB_WORKSPACE/reports/report-$s.json" \
              node testcode/ci/night-tests.mjs
            code=$?
            set -e
            echo "::endgroup::"
            # night-tests.mjs exits 0 PASS, 1 FAIL, 2 INCOMPLETE, 3 EXPIRED,
            # 4 NOT_APPLICABLE. Only 1 fails this workflow; the others are stated
            # in words by the comment and the summary rather than swallowed.
            if [ "$code" = "1" ]; then FAILED=1; fi
            if [ "$code" -gt "$WORST" ]; then WORST=$code; fi
          done
          echo "failed=$FAILED" >> "$GITHUB_OUTPUT"
          echo "worst=$WORST" >> "$GITHUB_OUTPUT"

      - name: Upload reports
        if: always() && steps.stamps.outputs.run == 'yes'
        uses: actions/upload-artifact@v4
        with:
          name: testcode-proof-${{ github.run_id }}
          path: reports/
          if-no-files-found: ignore
          retention-days: 14

      - name: Comment on issue 37
        if: always() && steps.stamps.outputs.run == 'yes'
        env:
          GH_TOKEN: ${{ github.token }}
        run: |
          set -u
          RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
          node -e '
            const fs = require("fs");
            const stamps = process.argv[1].split(/\s+/).filter(Boolean);
            const sha = process.argv[2], runUrl = process.argv[3];
            const lines = [];
            let anyFail = false;
            for (const s of stamps) {
              const f = `reports/report-${s}.json`;
              if (!fs.existsSync(f)) {
                anyFail = true;
                lines.push(`- \`testcode/${s}\` — no report written; the check did not complete.`);
                continue;
              }
              const r = JSON.parse(fs.readFileSync(f, "utf8"));
              const sv = r.served || { ok: 0, bad: 0, total: 0 };
              const c = r.counts || { pass: 0, fail: 0, warn: 0, skip: 0, expired: 0, na: 0 };
              if (c.fail) anyFail = true;
              lines.push(
                `- \`testcode/${s}\` — ${r.verdict || 'UNKNOWN'} — served bytes: ${sv.ok} ok / ${sv.bad} bad of ${sv.total}; ` +
                `page checks: ${c.pass} passed, ${c.fail} failed, ${c.warn} warnings, ${c.skip} skipped, ${c.expired || 0} expired, ${c.na || 0} not-applicable.` +
                (r.failed && r.failed.length ? `\n  Failing: ${r.failed.join("; ")}` : "")
              );
            }
            const head = anyFail
              ? `Testcode proof: ${stamps.length} folder(s) checked, failures found.`
              : `Testcode proof: ${stamps.length} folder(s) checked, all checks passed.`;
            fs.writeFileSync("comment.md",
              `${head}\n\nCommit: ${sha}\n\n${lines.join("\n")}\n\nRun: ${runUrl}\n`);
          ' "${{ steps.stamps.outputs.stamps }}" "$GITHUB_SHA" "$RUN_URL"
          cat comment.md
          gh issue comment 37 --repo "${{ github.repository }}" --body-file comment.md

      - name: Fail if any check failed
        if: always() && steps.stamps.outputs.run == 'yes' && steps.prove.outputs.failed == '1'
        run: |
          echo "one or more testcode proofs failed"
          exit 1

GlobalGrid2050 Track Repository Size Workflow

A GitHub Actions workflow. Runs by hand.

automationglobalgrid2050 / .github/workflows/track_repository_size.yml · lines 1–47 of 47 · Entry point

What it does
It runs automated jobs on GitHub Actions. Side effects: starts processes.
Why it exists in the grid workflow
README: "It can be updated manually through the `Track Repository Size` GitHub Actions workflow and is scheduled to run once per month."
Inputs & outputs
Out: commits pushed to the repository.
Downstream impact
It is itself an entry point (workflow); no other file was found loading it.
What it achieves
Runs GlobalGrid2050 Track Repository Size (`scripts/track_repository_size.py`).
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · .github/workflows · workflow
Uses
GlobalGrid2050 Track Repository Size (workflow run)
Used by
none found
Produces
none declared
Defines here
Track Repository Size
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 .github/workflows/track_repository_size.yml:1-47 · blob fc6c4198b40c166cb29d28649e440d5e37083c4a · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: unknown · users: none · canonical: production_core
name: Track Repository Size

on:
  workflow_dispatch:
permissions:
  contents: write

concurrency:
  group: track-repository-size
  cancel-in-progress: true

jobs:
  track-repository-size:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Update repository size report
        env:
          GITHUB_TOKEN: ${{ github.token }}
        run: python scripts/track_repository_size.py

      - name: Commit report if changed
        env:
          GITHUB_TOKEN: ${{ github.token }}
        shell: bash
        run: |
          set -euo pipefail
          git config --global user.name "Gridbot"
          git config --global user.email "gridbot@ventus.com"
          git add REPOSITORY_SIZE_REPORT.md repository_size_history.csv
          if git diff --cached --quiet; then
            echo "No repository size report changes to commit"
            exit 0
          fi
          git commit -m "docs: monthly repository size report"
          git pull --rebase https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git main
          git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git HEAD:main