GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Automation and CI / data-federation-map-for-globalgrid2050-all-repos / .github/workflows

Spider Maya Workflow and 4 more files

A GitHub Actions workflow in Data Federation Map for GlobalGrid2050 All Repos. Runs by hand.

605 lines of YAML and Python from data-federation-map-for-globalgrid2050-all-repos, data-gb-electricity, in 5 files. Topic: Automation and CI. Section 1696 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. Spider Maya Workflow automation · data-federation-map-for-globalgrid2050-all-repos / .github/workflows/spider_maya.yml lines 1–232
  2. Backfill History Workflow automation · data-gb-electricity / .github/workflows/backfill_history.yml lines 1–65
  3. Monthly Update Workflow automation · data-gb-electricity / .github/workflows/monthly_update.yml lines 1–184
  4. Refresh Price Decade Rollup Workflow automation · data-gb-electricity / .github/workflows/refresh_price_decade_rollup.yml lines 1–123
  5. Data GB Electricity — Tests test · data-gb-electricity / tests/__init__.py lines 1–1

Spider Maya Workflow

A GitHub Actions workflow in Data Federation Map for GlobalGrid2050 All Repos. Runs by hand.

automationdata-federation-map-for-globalgrid2050-all-repos / .github/workflows/spider_maya.yml · lines 1–232 of 232 · Entry point

What it does
It runs solar. Side effects: reads or writes files; starts processes.
Why it exists in the grid workflow
Domain stage agent_infra (path word 'spider'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief). Domain terms in the code: solar.
Inputs & outputs
In: JSON file SPIDER_MAYA_LATEST.json. 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 “Spider Maya Audit Process”.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
data-federation-map-for-globalgrid2050-all-repos · .github/workflows · workflow
Uses
none found
Used by
none found
Produces
none declared
Defines here
Spider Maya Audit Process
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
data-federation-map-for-globalgrid2050-all-repos@fffd624e77d820ebc04ab25f9d97871b254be61c .github/workflows/spider_maya.yml:1-232 · blob 1df17e89abc191a6a936cd9ad6fe4e52cafe2d0c · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem, process · domain stage: agent_infra · users: ai_agent · canonical: supporting_data
name: Spider Maya Audit Process

on:
  workflow_dispatch:
    inputs:
      mode:
        description: 'audit checks Spider Maya state; process writes the same reports with fix guidance only'
        type: choice
        required: true
        default: audit
        options:
          - audit
          - process
      commit_reports:
        description: 'Commit Spider Maya audit reports when checks pass'
        type: choice
        required: true
        default: 'false'
        options:
          - 'true'
          - 'false'

permissions:
  contents: write

concurrency:
  group: spider-maya-audit-process
  cancel-in-progress: false

env:
  RUN_MODE: ${{ inputs.mode }}
  COMMIT_REPORTS: ${{ inputs.commit_reports }}

jobs:
  spider-maya:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    environment: federation-audit

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

      - name: Sync latest main before processing
        run: git pull --ff-only origin main

      - name: Run Spider Maya audit process
        id: maya
        run: |
          set -euo pipefail
          python - <<'PY'
          from __future__ import annotations

          import datetime as dt
          import json
          import os
          import subprocess
          from pathlib import Path

          ROOT = Path.cwd()
          HTML = ROOT / "dashboard" / "federation_radial.html"
          CSS = ROOT / "dashboard" / "federation_radial.css"
          DNA = ROOT / "ventus_spider_dna_study" / "spider_solar_glint.md"
          REPORT_MD = ROOT / "reports" / "SPIDER_MAYA_LATEST.md"
          REPORT_JSON = ROOT / "reports" / "json" / "SPIDER_MAYA_LATEST.json"
          METHOD_VERSION = "spider_maya_audit_process_v2"
          SCHEMA_VERSION = "1.0"

          def now() -> str:
              return dt.datetime.now(dt.timezone.utc).isoformat(timespec="seconds").replace("+00:00", "Z")

          def git_sha() -> str:
              return subprocess.check_output(["git", "rev-parse", "HEAD"], text=True).strip()

          def rel(path: Path) -> str:
              return path.relative_to(ROOT).as_posix()

          def add_check(checks: list[dict[str, object]], name: str, passed: bool, detail: str) -> None:
              checks.append({"name": name, "passed": bool(passed), "detail": detail})

          run_mode = os.environ.get("RUN_MODE", "audit")
          generated = now()
          checks: list[dict[str, object]] = []
          warnings: list[str] = []

          html_text = HTML.read_text(encoding="utf-8") if HTML.exists() else ""
          css_text = CSS.read_text(encoding="utf-8") if CSS.exists() else ""
          dna_text = DNA.read_text(encoding="utf-8") if DNA.exists() else ""

          add_check(checks, "mode_is_audit_or_process", run_mode in {"audit", "process"}, f"mode={run_mode}")
          add_check(checks, "spider_html_exists", HTML.exists(), rel(HTML))
          add_check(checks, "spider_css_exists", CSS.exists(), rel(CSS))
          add_check(checks, "solar_glint_dna_exists", DNA.exists(), rel(DNA))

          css_linked = (
              "federation_radial.css" in html_text
              and ("rel=\"stylesheet\"" in html_text or "rel='stylesheet'" in html_text)
          )
          add_check(checks, "html_links_spider_maya_stylesheet", css_linked, "dashboard/federation_radial.html should load dashboard/federation_radial.css")

          gold_tokens = ["--gold", "--gold-hot", "--gold-glow", "solarGlint", "solarSweep", "viewbtn"]
          missing_gold_tokens = [token for token in gold_tokens if token not in css_text]
          add_check(checks, "solar_gold_tokens_present", not missing_gold_tokens, f"missing={missing_gold_tokens}")

          glint_present = "box-shadow" in css_text and "solarGlint" in css_text
          add_check(checks, "tiny_glint_beam_present", glint_present, "CSS should include a tiny solar-gold glint beam on the Spider control")

          snapshot_tag_present = "srcTag" in html_text and "snapshot" in html_text
          add_check(checks, "snapshot_truth_tag_still_present", snapshot_tag_present, "Spider must still declare snapshot/live state")

          dna_tokens = [
              "# The Gold Glint Is The Starting Gun",
              "| Genome entry | 1 |",
              "| Entry name | Solar Gold Glint |",
              "| Expression file | `dashboard/federation_radial.css` |",
              "| Workflow gate | `spider_maya.yml` |",
          ]
          missing_dna_tokens = [token for token in dna_tokens if token not in dna_text]
          add_check(checks, "solar_glint_dna_row_declared", not missing_dna_tokens, f"missing={missing_dna_tokens}")

          if "<style>" in html_text:
              warnings.append("Inline base style still exists in federation_radial.html. This workflow only checks the new Spider Maya stylesheet and link path; full CSS extraction can be a later cleanup.")

          if not css_linked:
              warnings.append("Maya remains: federation_radial.css exists but federation_radial.html does not yet read it. Add the stylesheet link after the inline style block.")

          passed = bool(checks) and all(bool(c["passed"]) for c in checks)
          report = {
              "schemaVersion": SCHEMA_VERSION,
              "generatedUTC": generated,
              "methodVersion": METHOD_VERSION,
              "mode": run_mode,
              "repository": os.environ.get("GITHUB_REPOSITORY", "Ventusltd/data-federation-map-for-globalgrid2050-all-repos"),
              "commitSHA": git_sha(),
              "target": {
                  "html": rel(HTML),
                  "css": rel(CSS),
                  "dna": rel(DNA),
              },
              "declaredChecks": checks,
              "warnings": warnings,
              "dataLawResult": "PASS" if passed else "FAIL",
              "rollbackMethod": "Revert the commit that changes dashboard/federation_radial.html, dashboard/federation_radial.css, or ventus_spider_dna_study/spider_solar_glint.md.",
              "nextAction": "If FAIL, read the failed checks and correct only the Spider Maya visual wiring before re-running audit.",
          }

          REPORT_MD.parent.mkdir(parents=True, exist_ok=True)
          REPORT_JSON.parent.mkdir(parents=True, exist_ok=True)
          REPORT_JSON.write_text(json.dumps(report, indent=2) + "\n", encoding="utf-8")

          lines = [
              "# Spider Maya Latest",
              "",
              f"Schema version: `{SCHEMA_VERSION}`",
              f"Generated UTC: `{generated}`",
              f"Method version: `{METHOD_VERSION}`",
              f"Mode: `{run_mode}`",
              f"Commit SHA: `{report['commitSHA']}`",
              "",
              "## Purpose",
              "",
              "Audit whether the Spider Maya solar-gold illumination layer exists, is declared in Spider DNA, and is wired into the Spider Sandbox without changing target UI files.",
              "",
              "## Declared checks",
              "",
              "| Check | Result | Detail |",
              "|---|---:|---|",
          ]
          for check in checks:
              result = "PASS" if check["passed"] else "FAIL"
              detail = str(check["detail"]).replace("\n", " ")
              lines.append(f"| `{check['name']}` | {result} | {detail} |")

          warning_lines = [f"- {warning}" for warning in warnings] if warnings else ["- None"]
          lines += [
              "",
              "## Warnings",
              "",
              *warning_lines,
              "",
              "## Data-law result",
              "",
              f"`{report['dataLawResult']}`",
              "",
              "## Rollback method",
              "",
              report["rollbackMethod"],
              "",
              "## Next action",
              "",
              report["nextAction"],
              "",
          ]
          REPORT_MD.write_text("\n".join(lines), encoding="utf-8")
          print(json.dumps(report, indent=2))
          raise SystemExit(0 if passed else 1)
          PY

      - name: Upload Spider Maya report
        uses: actions/upload-artifact@v4
        if: always()
        with:
          name: spider-maya-report
          if-no-files-found: warn
          path: |
            reports/SPIDER_MAYA_LATEST.md
            reports/json/SPIDER_MAYA_LATEST.json
            dashboard/federation_radial.css
            ventus_spider_dna_study/spider_solar_glint.md

      - name: Commit Spider Maya audit evidence
        if: ${{ success() && env.COMMIT_REPORTS == 'true' }}
        run: |
          set -euo pipefail
          git config user.name "Gridbot"
          git config user.email "gridbot@users.noreply.github.com"
          git add \
            .github/workflows/spider_maya.yml \
            reports/SPIDER_MAYA_LATEST.md \
            reports/json/SPIDER_MAYA_LATEST.json
          if git diff --cached --name-only | grep -E '^(dashboard/federation_radial\.html|dashboard/federation_radial\.css|ventus_spider_dna_study/spider_solar_glint\.md)$'; then
            echo "Audit evidence commit attempted to stage Spider Maya target files."
            exit 1
          fi
          if git diff --cached --quiet; then
            echo "No Spider Maya audit evidence changes to commit."
          else
            git commit -m "docs: spider-maya audit report"
            git push origin HEAD:${GITHUB_REF_NAME}
          fi

Backfill History Workflow

A GitHub Actions workflow in Data GB Electricity. Runs by hand.

automationdata-gb-electricity / .github/workflows/backfill_history.yml · lines 1–65 of 65 · Entry point

What it does
It runs automated jobs on GitHub Actions. Side effects: starts processes; uses storage (browser storage, DuckDB or Parquet).
Why it exists in the grid workflow
README: "The historical backfill workflow is `.github/workflows/backfill_history.yml`."
Inputs & outputs
In: DuckDB queries. 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 “Historical GB Electricity Parquet Backfill”; runs Port CSV to Parquet (`pipelines/port_csv_to_parquet.py`).
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
data-gb-electricity · .github/workflows · workflow
Uses
Port CSV to Parquet (workflow run)
Used by
none found
Produces
none declared
Defines here
Historical GB Electricity Parquet Backfill
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
data-gb-electricity@e888f35c1a65589b3eb7c78bcc542022bc707298 .github/workflows/backfill_history.yml:1-65 · blob 6bea6715e7ebaa4e35f72a5fae0482b39abe6925 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: ingest · effects: process, storage · domain stage: unknown · users: none · canonical: supporting_data
name: Historical GB Electricity Parquet Backfill

on:
  workflow_dispatch:
    inputs:
      confirmation:
        description: Type REBUILD_FROZEN_HISTORY to run the one-time full historical pathway.
        required: true
        default: ''

permissions:
  contents: write

jobs:
  backfill:
    if: github.event.inputs.confirmation == 'REBUILD_FROZEN_HISTORY'
    runs-on: ubuntu-latest
    timeout-minutes: 240
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-python@v5
        with:
          python-version: '3.11'
      - name: Install dependencies
        run: |
          set -euo pipefail
          python3 -m pip install --upgrade pip
          python3 -m pip install duckdb pyarrow
      - name: Clone source repo
        run: |
          set -euo pipefail
          git clone --depth 1 https://github.com/Ventusltd/globalgrid2050.git globalgrid2050
      - name: Build Parquet
        run: |
          set -euo pipefail
          python3 pipelines/port_csv_to_parquet.py --source-root globalgrid2050 --apply
      - name: Commit outputs
        run: |
          set -euo pipefail
          git config user.name "gridbot"
          git config user.email "bot@globalgrid2050.com"
          if [ -d generation ]; then
            git add generation/
          fi
          if [ -d prices ]; then
            git add prices/
          fi
          if [ -d reports ]; then
            git add reports/
          fi
          if git diff --cached --quiet; then
            echo "No changes to commit."
            exit 0
          fi
          git commit -m "data(gb-electricity): add verified historical Parquet backfill"
          if git push origin HEAD:"${GITHUB_REF_NAME}"; then
            echo "Pushed backfill outputs."
          else
            echo "Initial push rejected; rebasing once and retrying."
            git fetch origin "${GITHUB_REF_NAME}"
            git rebase "origin/${GITHUB_REF_NAME}"
            git push origin HEAD:"${GITHUB_REF_NAME}"
          fi

Monthly Update Workflow

A GitHub Actions workflow in Data GB Electricity. Runs on a schedule and by hand.

automationdata-gb-electricity / .github/workflows/monthly_update.yml · lines 1–184 of 184 · Entry point

What it does
It runs automated jobs on GitHub Actions. Side effects: reads or writes files; starts processes; uses storage (browser storage, DuckDB or Parquet).
Why it exists in the grid workflow
README: "The active monthly process is `pipelines/fetch_latest_month.py` plus `.github/workflows/monthly_update.yml`."
Inputs & outputs
In: JSON file bounded_growth_gate_latest.json; JSON file latest_parquet_audit.json; DuckDB queries. 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 “Monthly GB Electricity Parquet Update”; runs Fetch Latest Month (`pipelines/fetch_latest_month.py`) and Verify Bounded Growth (`pipelines/verify_bounded_growth.py`).
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
data-gb-electricity · .github/workflows · workflow
Uses
Test Price Daily Browser (workflow run), Test Price Rollup Parts (workflow run), Test Bounded Monthly Update (workflow run), Fetch Latest Month (workflow run), Verify Bounded Growth (workflow run)
Used by
none found
Produces
none declared
Defines here
Monthly GB Electricity Parquet Update
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
data-gb-electricity@e888f35c1a65589b3eb7c78bcc542022bc707298 .github/workflows/monthly_update.yml:1-184 · blob 33c0c07a5893fb79e4c8f9d391da6a9c78e735c3 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: ingest · effects: filesystem, process, storage · domain stage: unknown · users: none · canonical: supporting_data
name: Monthly GB Electricity Parquet Update

on:
  schedule:
    # Automatic monthly refresh: 06:17 UTC on the 2nd day of each month.
    # The script inspects the latest three closed months and fills gaps only.
    - cron: '17 6 2 * *'
  workflow_dispatch:
    inputs:
      start_date:
        description: Optional inspection/repair start date YYYY-MM-DD.
        required: false
        default: ''
      end_date:
        description: Optional inspection/repair end date YYYY-MM-DD.
        required: false
        default: ''
      refetch_months:
        description: Recent complete months to inspect for missing partitions. Existing months stay frozen.
        required: false
        default: '3'
      datasets:
        description: Space-separated list from fuelinst fuelhh prices.
        required: false
        default: 'fuelinst fuelhh prices'
      repair_existing:
        description: Replace existing history. Requires explicit start and end dates and remains bounded.
        required: false
        type: boolean
        default: false

permissions:
  contents: write

defaults:
  run:
    shell: bash

concurrency:
  group: monthly-gb-electricity-parquet-update
  cancel-in-progress: false

jobs:
  monthly-update:
    runs-on: ubuntu-latest
    timeout-minutes: 180
    env:
      START_DATE: ${{ github.event.inputs.start_date || '' }}
      END_DATE: ${{ github.event.inputs.end_date || '' }}
      REFETCH_MONTHS: ${{ github.event.inputs.refetch_months || '3' }}
      DATASETS: ${{ github.event.inputs.datasets || 'fuelinst fuelhh prices' }}
      REPAIR_EXISTING: ${{ github.event.inputs.repair_existing || 'false' }}
      MAX_DATASET_MONTHS: '9'
      MAX_NEW_ROWS: '2000000'
      MAX_NEW_PARQUET_FILES: '9'
      MAX_NEW_PARQUET_BYTES: '134217728'
      MAX_API_REQUESTS: '200'
      MAX_API_ATTEMPTS: '600'
    steps:
      - name: Checkout repo
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

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

      - name: Verify environment and install dependencies
        run: |
          set -euo pipefail
          git --version
          python3 --version
          python3 -m pip install --upgrade pip
          python3 -m pip install duckdb pyarrow
          python3 -c "import duckdb, pyarrow; print('ok')"

      - name: Prove bounded-growth policy
        run: |
          set -euo pipefail
          python3 -m unittest discover -s tests -v

      - name: Fetch latest month and write Parquet
        run: |
          set -euo pipefail
          if ! [[ "${REFETCH_MONTHS}" =~ ^[1-9][0-9]*$ ]]; then
            echo "refetch_months must be a positive integer" >&2
            exit 2
          fi
          read -r -a REQUESTED_DATASETS <<< "${DATASETS}"
          for dataset in "${REQUESTED_DATASETS[@]}"; do
            case "${dataset}" in
              fuelinst|fuelhh|prices) ;;
              *) echo "invalid dataset: ${dataset}" >&2; exit 2 ;;
            esac
          done
          ARGS=(
            --apply
            --datasets "${REQUESTED_DATASETS[@]}"
            --refetch-months "${REFETCH_MONTHS}"
            --max-dataset-months "${MAX_DATASET_MONTHS}"
            --max-new-rows "${MAX_NEW_ROWS}"
            --max-new-parquet-bytes "${MAX_NEW_PARQUET_BYTES}"
            --max-api-requests "${MAX_API_REQUESTS}"
            --max-api-attempts "${MAX_API_ATTEMPTS}"
          )
          if [ -n "${START_DATE}" ]; then ARGS+=(--start-date "${START_DATE}"); fi
          if [ -n "${END_DATE}" ]; then ARGS+=(--end-date "${END_DATE}"); fi
          if [ "${REPAIR_EXISTING}" = "true" ]; then ARGS+=(--repair-existing); fi
          printf 'fetch argument: %q\n' "${ARGS[@]}"
          python3 pipelines/fetch_latest_month.py "${ARGS[@]}"

      - name: Verify actual repository growth against the plan
        run: |
          set -euo pipefail
          python3 pipelines/verify_bounded_growth.py \
            --audit reports/fetch_latest_month_latest.json \
            --base HEAD \
            --max-new-parquet-files "${MAX_NEW_PARQUET_FILES}" \
            --max-new-parquet-bytes "${MAX_NEW_PARQUET_BYTES}"

      - name: Print audit summary
        if: always()
        run: |
          if [ -f reports/latest_parquet_audit.json ]; then
            cat reports/latest_parquet_audit.json
          else
            echo "reports/latest_parquet_audit.json not found"
          fi

      - name: Upload audit report
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: latest-parquet-audit
          path: |
            reports/latest_parquet_audit.json
            reports/fetch_latest_month_latest.json
            reports/bounded_growth_gate_latest.json

      - name: Commit Parquet outputs
        run: |
          set -euo pipefail
          CHANGED_PARQUET=$(python3 -c "import json; print(json.load(open('reports/bounded_growth_gate_latest.json'))['limits']['actualChangedParquetFiles'])")
          if [ "${CHANGED_PARQUET}" = "0" ]; then
            echo "The bounded plan produced no Parquet diff; audit artifact was uploaded, no repository commit needed."
            exit 0
          fi
          TARGET_MONTH=$(python3 - <<'PY'
          import json
          from pathlib import Path
          p = Path('reports/latest_parquet_audit.json')
          if p.exists():
              payload = json.loads(p.read_text())
              print('_'.join(payload.get('targetMonths', ['unknown'])))
          else:
              print('unknown')
          PY
          )
          git config user.name "gridbot"
          git config user.email "bot@globalgrid2050.com"
          if [ -d generation ]; then
            git add generation/
          fi
          if [ -d prices ]; then
            git add prices/
          fi
          if [ -d reports ]; then
            git add reports/
          fi
          if git diff --cached --quiet; then
            echo "No Parquet or audit changes to commit."
            exit 0
          fi
          git commit -m "data(gb-electricity): auto monthly fetch ${TARGET_MONTH}"
          if git push origin HEAD:"${GITHUB_REF_NAME}"; then
            echo "Pushed monthly outputs."
          else
            echo "Initial push rejected; rebasing once and retrying."
            git fetch origin "${GITHUB_REF_NAME}"
            git rebase "origin/${GITHUB_REF_NAME}"
            git push origin HEAD:"${GITHUB_REF_NAME}"
          fi

Refresh Price Decade Rollup Workflow

A GitHub Actions workflow in Data GB Electricity that builds and publishes the site. Runs on push, on pull requests and by hand.

automationdata-gb-electricity / .github/workflows/refresh_price_decade_rollup.yml · lines 1–123 of 123 · Entry point

What it does
It builds and publishes its content. Side effects: reads or writes files; starts processes; uses storage (browser storage, DuckDB or Parquet).
Why it exists in the grid workflow
Domain stage hv_procurement (path word 'price'): HV materials procurement, which Ventus Ltd states is within its commercial execution boundary.
Inputs & outputs
In: JSON file price-decade-rollup.json; DuckDB queries. 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
Keep the browser-sized price rollup in step with the Parquet.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
data-gb-electricity · .github/workflows · workflow
Uses
Test Price Daily Browser (workflow run), Test Price Rollup Parts (workflow run), Test Bounded Monthly Update (workflow run), Build Price Decade Rollup (workflow run), Verify Price Decade Rollup (workflow run), Price Daily Browser (workflow run)
Used by
none found
Produces
none declared
Defines here
Refresh the available-record price rollup
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
data-gb-electricity@e888f35c1a65589b3eb7c78bcc542022bc707298 .github/workflows/refresh_price_decade_rollup.yml:1-123 · blob 1ae6bf3dd3234370561ba3c3c501d17652e786af · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: ingest · effects: filesystem, process, storage · domain stage: hv_procurement · users: EPC_contractor, procurement_buyer · canonical: supporting_data
# Keep the browser-sized price rollup in step with the Parquet.
#
# WHY ONE WORKFLOW, AND WHY HERE
#
# globalgrid2050 carries 240 workflows and they were all frozen to manual
# dispatch because that had become unmanageable. Unfreezing them would rebuild
# the problem the freeze solved. So this is not a restart of anything: it is one
# small job, in the repository that owns the data, chained to the monthly update
# that is already running here.
#
# The chain it completes:
#
#   Elexon  ->  monthly_update.yml       (this repo, already scheduled)
#           ->  price-decade-rollup.json (this workflow)
#           ->  gb-electricity-ui        (charts)
#           ->  gridatlas                (a panel beside the map)
#
# Collection was never what broke. What broke is that nothing consumed the
# result any more, so the published figures stopped moving while the data kept
# arriving.
#
# It runs after monthly_update, not on a guessed clock: workflow_run means it
# fires when there is actually something new to aggregate, and never otherwise.

name: Refresh the available-record price rollup

on:
  workflow_dispatch:
  workflow_run:
    workflows: ["Monthly GB Electricity Parquet Update"]
    types: [completed]
  push:
    branches: [main]
    paths:
      - 'derived/build_price_decade_rollup.py'
      - 'derived/verify_price_decade_rollup.py'
      - 'derived/price_daily_browser.py'
      - 'pipelines/gb_calendar.py'
      - '.github/workflows/refresh_price_decade_rollup.yml'
  pull_request:
    paths:
      - 'derived/**'
      - 'tests/**'
      - 'pipelines/gb_calendar.py'
      - '.github/workflows/refresh_price_decade_rollup.yml'

permissions:
  contents: write

concurrency:
  group: price-decade-rollup
  cancel-in-progress: false

jobs:
  verify-pr:
    if: github.event_name == 'pull_request'
    permissions:
      contents: read
    runs-on: ubuntu-24.04
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - name: Install verification dependencies
        run: python -m pip install duckdb==1.3.2 pyarrow
      - name: Prove bounded updates and split-part regression cases
        run: python -B -m unittest discover -s tests -v
      - name: Rebuild and verify actual owner Parquet
        run: |
          python -B derived/build_price_decade_rollup.py
          python -B derived/verify_price_decade_rollup.py
          git diff --exit-code -- derived/price-decade-rollup.json
          python -B derived/price_daily_browser.py --verify

  rollup:
    # A failed update has nothing new to aggregate, and re-running the rollup
    # over unchanged Parquet would only add an empty commit.
    if: >-
      github.event_name != 'pull_request' &&
      (github.event_name != 'workflow_run' ||
       github.event.workflow_run.conclusion == 'success')
    runs-on: ubuntu-24.04
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@v4

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

      - name: DuckDB
        run: pip install --quiet duckdb==1.3.2

      - name: Aggregate the Parquet
        run: |
          python derived/build_price_decade_rollup.py
          python derived/verify_price_decade_rollup.py
          python -B derived/price_daily_browser.py
          python -B derived/price_daily_browser.py --verify

      # The product is arithmetic over the Parquet, so if the Parquet has not
      # moved neither has this. A run that changes nothing should say so and
      # leave no trace.
      - name: Commit only if it changed
        run: |
          set -euo pipefail
          git add -- derived/price-decade-rollup.json derived/price-daily-browser
          if git diff --cached --quiet -- derived/price-decade-rollup.json derived/price-daily-browser; then
            echo "the price products are unchanged; nothing to commit"
            exit 0
          fi
          git config user.name  "github-actions[bot]"
          git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
          SPAN=$(python -c "import json;d=json.load(open('derived/price-decade-rollup.json'));print('-'.join(d['price']['span']))")
          DAYS=$(python -c "import json;d=json.load(open('derived/price-decade-rollup.json'));print(d['derived_from']['included_days'])")
          git commit -m "Refresh historical price products: ${SPAN}, ${DAYS} included rollup days

          Derived from the Parquet in this repository by
          derived/build_price_decade_rollup.py and derived/price_daily_browser.py.
          Arithmetic aggregates only; raw history remains unchanged."
          git push

Data GB Electricity — Tests

A Python module.

testdata-gb-electricity / tests/__init__.py · lines 1–1 of 1 · Not reached from any entry point (candidate for review)

What it does
It tests its inputs.
What it achieves
Tests for the bounded monthly updater.
Why it matters
No other file in the estate was found to import it.
Application
data-gb-electricity · tests · Python module
Uses
none found
Used by
none found
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
data-gb-electricity@e888f35c1a65589b3eb7c78bcc542022bc707298 tests/__init__.py:1-1 · blob 67af75e5e55c106aad78ecdb67be3e378ef39dee · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: unknown · effects: none found · domain stage: unknown · users: none · canonical: unreached_review
"""Tests for the bounded monthly updater."""