GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Automation and CI / data-centres-gb / .github/workflows

OSM Data Centres Candidate Workflow and 5 more files

A GitHub Actions workflow in Data Centres GB that builds and publishes the site. Runs on push.

646 lines of YAML and Python from data-centres-gb, data-federation-map-for-globalgrid2050-all-repos, in 6 files. Topic: Automation and CI. Section 1694 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. OSM Data Centres Candidate Workflow automation · data-centres-gb / .github/workflows/202608281702-osm-data-centres-candidate.yml lines 1–231
  2. CI Workflow automation · data-centres-gb / .github/workflows/ci.yml lines 1–42
  3. Test Data Centres Intelligence test · data-centres-gb / tests/test_202608271727_data_centres_intelligence.py lines 1–130
  4. Spider Patch Po automation · data-federation-map-for-globalgrid2050-all-repos / .github/scripts/spider_patch_po.py lines 1–38
  5. Archive Spider Version Workflow automation · data-federation-map-for-globalgrid2050-all-repos / .github/workflows/archive_spider_version.yml lines 1–65
  6. Gridbot Declared Cartridges Workflow automation · data-federation-map-for-globalgrid2050-all-repos / .github/workflows/gridbot_declared_cartridges.yml lines 1–140

OSM Data Centres Candidate Workflow

A GitHub Actions workflow in Data Centres GB that builds and publishes the site. Runs on push.

automationdata-centres-gb / .github/workflows/202608281702-osm-data-centres-candidate.yml · lines 1–231 of 231 · version 2026-08-28 17:02 · 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).
Inputs & outputs
In: JSON file 202608281702-osm-overpass-indexed.json; JSON file failed-run.json; JSON file failed-job.json; JSON file overpass-fetch.json; JSON file overpass-fetch-failure.json; Parquet file osm-data-centre-elements-v1.parquet; Parquet file data-centre-company-relationships-v1.parquet; GeoJSON file 202608281053-osm-data-centres.geojson. 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 “· bytecode-clean indexed OSM candidate”; runs `build/python/202608281702-osm-overpass-indexed.py`.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
data-centres-gb · .github/workflows · workflow
Uses
none found
Used by
none found
Produces
none declared
Defines here
202608281801 · bytecode-clean indexed OSM candidate
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
data-centres-gb@12c24a653e9d4eb3507857fd6e6d169b2dd1ff63 .github/workflows/202608281702-osm-data-centres-candidate.yml:1-231 · blob 4f70bcd2ac67e4cf556cd5447f804bf5d038c487 · 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: "202608281801 · bytecode-clean indexed OSM candidate"

on:
  push:
    branches: [main]
    paths:
      - ".github/workflows/202608281702-osm-data-centres-candidate.yml"
      - "build/python/202608281702-osm-overpass-indexed.py"
      - "contracts/202608281702-osm-overpass-indexed.json"
      - "queries/202608281702-gb-data-centres-indexed.overpassql"
      - "tests/test_202608281702_osm_overpass_indexed.py"

permissions:
  actions: read
  contents: write

concurrency:
  group: data-centres-gb-${{ github.ref }}
  cancel-in-progress: false

env:
  GENERATION: "202608281053"
  DUCKDB_VERSION: "1.3.2"
  PYTHONDONTWRITEBYTECODE: "1"
  REPAIR_GENERATION: "202608281702"
  PARENT_COMMIT: "76cd675d8472d8bcf5ebc5e05b19eb9b7b321cef"
  FAILED_RUN_ID: "33188465561"
  FAILED_JOB_ID: "98907496991"
  CANDIDATE_BRANCH: "candidate/202608281053-osm-data-centres"

jobs:
  fetch-build-verify-quarantine:
    runs-on: ubuntu-24.04
    timeout-minutes: 25
    steps:
      - name: Check out exact source commit
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
        with:
          fetch-depth: 0

      - name: Set up pinned Python
        uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
        with:
          python-version: "3.12"

      - name: Install pinned build dependencies
        run: python -m pip install --disable-pip-version-check "duckdb==${DUCKDB_VERSION}" "requests==2.32.4"

      - name: Assert main, direct parent and exact repair boundary
        shell: bash
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          set -euo pipefail
          test "${GITHUB_REF}" = "refs/heads/main"
          test "$(git rev-parse HEAD)" = "${GITHUB_SHA}"
          read -r -a ancestry <<< "$(git rev-list --parents -n 1 "${GITHUB_SHA}")"
          test "${#ancestry[@]}" -eq 2
          test "${ancestry[1]}" = "${PARENT_COMMIT}"
          git diff --name-status --no-renames "${PARENT_COMMIT}" "${GITHUB_SHA}" | sort > "${RUNNER_TEMP}/actual"
          printf '%s\n' \
            $'M\t.github/workflows/202608281702-osm-data-centres-candidate.yml' | sort > "${RUNNER_TEMP}/expected"
          diff -u "${RUNNER_TEMP}/expected" "${RUNNER_TEMP}/actual"
          test -z "$(git status --porcelain=v1)"

          test "$(git rev-parse HEAD:.github/workflows/202608281626-osm-data-centres-candidate.yml)" = "4ee6aa598a0fd13eb2e2ac845302096b27e8548e"
          test "$(git rev-parse HEAD:build/python/202608281626-osm-overpass-retry.py)" = "1d4e0bbf58efc954f3d50cfe1c7d16a75c444dce"
          test "$(git rev-parse HEAD:contracts/202608281626-osm-overpass-retry-privacy.json)" = "d1952c80aed8e3407731bfe859c74f3ee15c9812"
          test "$(git rev-parse HEAD:tests/test_202608281626_osm_overpass_retry.py)" = "a353f217daff47ddf90aaffeb2bf6946939af0f5"
          test "$(git rev-parse HEAD:build/python/202608281702-osm-overpass-indexed.py)" = "36e77919584c5127775424989d6caf018586847b"
          test "$(git rev-parse HEAD:contracts/202608281702-osm-overpass-indexed.json)" = "0d21737d72151ada4c9507f6a5fb40a1c6d2515b"
          test "$(git rev-parse HEAD:queries/202608281702-gb-data-centres-indexed.overpassql)" = "050ee5bf7f3951ca1f73509dd32a8c0516b56e7b"
          test "$(git rev-parse HEAD:tests/test_202608281702_osm_overpass_indexed.py)" = "a77148572efb8d9af6914f2474af15b54fa47fe3"

          gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${FAILED_RUN_ID}" > "${RUNNER_TEMP}/failed-run.json"
          gh api "repos/${GITHUB_REPOSITORY}/actions/jobs/${FAILED_JOB_ID}" > "${RUNNER_TEMP}/failed-job.json"
          python - <<'PY'
          import json
          import os
          from pathlib import Path

          temp = Path(os.environ["RUNNER_TEMP"])
          run = json.loads((temp / "failed-run.json").read_text(encoding="utf-8"))
          job = json.loads((temp / "failed-job.json").read_text(encoding="utf-8"))
          assert run["id"] == int(os.environ["FAILED_RUN_ID"])
          assert run["head_sha"] == os.environ["PARENT_COMMIT"]
          assert run["conclusion"] == "failure"
          assert job["id"] == int(os.environ["FAILED_JOB_ID"])
          assert job["conclusion"] == "failure"
          failed = [
              step for step in job["steps"]
              if step["name"] == "Assert immutable output-only boundary"
          ]
          assert len(failed) == 1 and failed[0]["conclusion"] == "failure"
          passed = {step["name"]: step["conclusion"] for step in job["steps"]}
          for name in (
              "Fetch OpenStreetMap with indexed selectors and three bounded attempts",
              "Compile twice from the same retained response",
              "Verify both closures and byte parity",
              "Land only the complete candidate closure",
          ):
              assert passed.get(name) == "success"
          PY

          python build/python/202608281702-osm-overpass-indexed.py doctor --root .

      - name: Run offline hostile fixture, privacy and indexed-query suites
        shell: bash
        env:
          PYTHONPYCACHEPREFIX: ${{ runner.temp }}/pycache
        run: |
          set -euo pipefail
          python -m py_compile \
            app.py \
            build/python/202608281053-osm-data-centres.py \
            build/python/202608281626-osm-overpass-retry.py \
            build/python/202608281702-osm-overpass-indexed.py \
            tests/test_202608281053_osm_data_centres.py \
            tests/test_202608281626_osm_overpass_retry.py \
            tests/test_202608281702_osm_overpass_indexed.py
          python -m unittest -v \
            tests/test_202608281053_osm_data_centres.py \
            tests/test_202608281626_osm_overpass_retry.py \
            tests/test_202608281702_osm_overpass_indexed.py

      - name: Fetch OpenStreetMap with indexed selectors and three bounded attempts
        id: overpass
        shell: bash
        run: |
          set -euo pipefail
          python build/python/202608281702-osm-overpass-indexed.py fetch \
            --root . \
            --output "${RUNNER_TEMP}/overpass-fetch.json"
          test -s "${RUNNER_TEMP}/overpass-fetch.json"
          test ! -e "${RUNNER_TEMP}/overpass-fetch-failure.json"

      - name: Retain sanitised Overpass failure evidence
        if: failure() && steps.overpass.outcome == 'failure'
        uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
        with:
          name: overpass-indexed-fetch-failure-${{ env.REPAIR_GENERATION }}-${{ github.run_id }}
          path: ${{ runner.temp }}/overpass-fetch-failure.json
          if-no-files-found: error
          retention-days: 14
          compression-level: 9

      - name: Compile twice from the same retained response
        shell: bash
        run: |
          set -euo pipefail
          python build/python/202608281702-osm-overpass-indexed.py build \
            --root . \
            --input "${RUNNER_TEMP}/overpass-fetch.json" \
            --output-root "${RUNNER_TEMP}/candidate-a" \
            --source-commit "${GITHUB_SHA}"
          python build/python/202608281702-osm-overpass-indexed.py build \
            --root . \
            --input "${RUNNER_TEMP}/overpass-fetch.json" \
            --output-root "${RUNNER_TEMP}/candidate-b" \
            --source-commit "${GITHUB_SHA}"

      - name: Verify both closures and byte parity
        shell: bash
        run: |
          set -euo pipefail
          python build/python/202608281702-osm-overpass-indexed.py verify \
            --root "${RUNNER_TEMP}/candidate-a" \
            --source-root . \
            --input "${RUNNER_TEMP}/overpass-fetch.json" \
            --expected-source-commit "${GITHUB_SHA}"
          python build/python/202608281702-osm-overpass-indexed.py verify \
            --root "${RUNNER_TEMP}/candidate-b" \
            --source-root . \
            --input "${RUNNER_TEMP}/overpass-fetch.json" \
            --expected-source-commit "${GITHUB_SHA}"
          python build/python/202608281702-osm-overpass-indexed.py compare \
            --left "${RUNNER_TEMP}/candidate-a" \
            --right "${RUNNER_TEMP}/candidate-b"

      - name: Land only the complete candidate closure
        shell: bash
        run: |
          set -euo pipefail
          python build/python/202608281702-osm-overpass-indexed.py land \
            --candidate-root "${RUNNER_TEMP}/candidate-a" \
            --destination-root . \
            --source-commit "${GITHUB_SHA}"
          python build/python/202608281702-osm-overpass-indexed.py verify \
            --root . \
            --source-root . \
            --input "${RUNNER_TEMP}/overpass-fetch.json" \
            --expected-source-commit "${GITHUB_SHA}"

      - name: Assert immutable output-only boundary
        shell: bash
        run: |
          set -euo pipefail
          expected=(
            "data/facilities/generation=202608281053/source=OPENSTREETMAP/osm-data-centre-elements-v1.parquet"
            "data/relationships/generation=202608281053/data-centre-company-relationships-v1.parquet"
            "exports/202608281053-osm-data-centres.geojson"
            "reports/202608281053-osm-data-centres-audit.json"
          )
          mapfile -t expected_sorted < <(printf '%s\n' "${expected[@]}" | sort)
          mapfile -t actual < <(git status --porcelain=v1 --untracked-files=all | cut -c4- | sort)
          diff -u <(printf '%s\n' "${expected_sorted[@]}") <(printf '%s\n' "${actual[@]}")

      - name: Commit immutable quarantined candidate
        shell: bash
        run: |
          set -euo pipefail
          git add -- \
            data/facilities/generation=202608281053/source=OPENSTREETMAP/osm-data-centre-elements-v1.parquet \
            data/relationships/generation=202608281053/data-centre-company-relationships-v1.parquet \
            exports/202608281053-osm-data-centres.geojson \
            reports/202608281053-osm-data-centres-audit.json
          expected=(
            "data/facilities/generation=202608281053/source=OPENSTREETMAP/osm-data-centre-elements-v1.parquet"
            "data/relationships/generation=202608281053/data-centre-company-relationships-v1.parquet"
            "exports/202608281053-osm-data-centres.geojson"
            "reports/202608281053-osm-data-centres-audit.json"
          )
          mapfile -t expected_sorted < <(printf '%s\n' "${expected[@]}" | sort)
          mapfile -t staged < <(git diff --cached --name-only | sort)
          diff -u <(printf '%s\n' "${expected_sorted[@]}") <(printf '%s\n' "${staged[@]}")
          git config user.name "github-actions[bot]"
          git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
          export GIT_AUTHOR_DATE="2026-08-28T09:53:00Z"
          export GIT_COMMITTER_DATE="2026-08-28T09:53:00Z"
          git commit -m "202608281053: publish quarantined OSM data-centres candidate"
          git push origin "HEAD:refs/heads/${CANDIDATE_BRANCH}"

CI Workflow

A GitHub Actions workflow in Data Centres GB. Runs on push, on pull requests and by hand.

automationdata-centres-gb / .github/workflows/ci.yml · lines 1–42 of 42 · Entry point

What it does
It runs automated jobs on GitHub Actions. Side effects: starts processes.
Downstream impact
It is itself an entry point (workflow); no other file was found loading it.
What it achieves
Named “Validate API and data law”.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
data-centres-gb · .github/workflows · workflow
Uses
Data Centres GB — App (workflow run), Test OSM Data Centres (workflow run)
Used by
none found
Produces
none declared
Defines here
Validate API and data law
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
data-centres-gb@12c24a653e9d4eb3507857fd6e6d169b2dd1ff63 .github/workflows/ci.yml:1-42 · blob f6851b515e9c1ff02c3f63768853a7effbf7f6e0 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: unknown · users: none · canonical: supporting_data
name: Validate API and data law

on:
  push:
    branches-ignore:
      - "candidate/**"
  pull_request:
  workflow_dispatch:

permissions:
  contents: read

concurrency:
  group: data-centres-gb-${{ github.ref }}
  cancel-in-progress: false

jobs:
  validate:
    runs-on: ubuntu-24.04
    timeout-minutes: 15
    steps:
      - name: Check out repository
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

      - name: Set up pinned Python
        uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
        with:
          python-version: "3.12"
          cache: pip

      - name: Install pinned dependencies
        run: python -m pip install --disable-pip-version-check -r requirements.txt

      - name: Compile application and timestamped producer
        env:
          PYTHONPYCACHEPREFIX: ${{ runner.temp }}/pycache
        run: |
          python -m py_compile app.py build/python/202608281053-osm-data-centres.py tests/test_202608281053_osm_data_centres.py
          python -c "from app import app; print(app.title)"

      - name: Run offline fixture suite
        run: python -m unittest -v tests/test_202608281053_osm_data_centres.py

Test Data Centres Intelligence

A test in the tests folder of Data Centres GB. It sets up (`setUp`) and is built from the tear down helper (`tearDown`).

testdata-centres-gb / tests/test_202608271727_data_centres_intelligence.py · lines 1–130 of 130 · version 2026-08-27 17:27 · Entry point · pattern load_module (shared by 4 files)

What it does
It tests its inputs. Defines 9 functions or classes, including load_module, DataCentresIntelligenceCandidateTest, setUp, tearDown, test_two_builds_are_byte_identical_and_independently_verified. Uses libraries __future__, importlib.util, json, shutil, tempfile. Side effects: reads or writes files; uses storage (browser storage, DuckDB or Parquet).
Inputs & outputs
In: Parquet file obsolete.parquet; Parquet file escape.parquet. Out: Parquet file obsolete.parquet.
Downstream impact
Used directly by 1 file: Data Centres Intelligence Candidate Workflow (data-centres-gb).
What it achieves
Defines `load_module`, `DataCentresIntelligenceCandidateTest`, `setUp` and 6 more.
Why it matters
Run by Data Centres Intelligence Candidate Workflow.
Application
data-centres-gb · tests · test
Uses
__future__, importlib.util, json, shutil, tempfile, unittest, pathlib
Used by
run by Data Centres Intelligence Candidate Workflow (workflow run)
Produces
load_module, DataCentresIntelligenceCandidateTest
Defines here
load_module, DataCentresIntelligenceCandidateTest, setUp, tearDown, test_two_builds_are_byte_identical_and_independently_verified, test_export_is_ordered_and_keeps_usage_separate_from_source_rights, test_land_replaces_only_the_touched_partition, test_export_tamper_is_rejected, test_partition_escape_and_symlink_are_rejected
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
data-centres-gb@12c24a653e9d4eb3507857fd6e6d169b2dd1ff63 tests/test_202608271727_data_centres_intelligence.py:1-130 · blob 97975640fc21bc2a63889b53cc71ab8c26fb57a6 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem, storage · domain stage: unknown · users: none · canonical: supporting_data
from __future__ import annotations

import importlib.util
import json
import shutil
import tempfile
import unittest
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
SOURCE_COMMIT = "0939e3c735f4c9cacefb3acad00b35b6e07e62c2"


def load_module(name: str, path: Path):
    spec = importlib.util.spec_from_file_location(name, path)
    if spec is None or spec.loader is None:
        raise RuntimeError(f"Unable to import {path}")
    module = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(module)
    return module


BUILDER = load_module(
    "dcgb_builder_202608271727",
    ROOT / "build/python/202608271727-build-data-centres-intelligence.py",
)
VERIFIER = load_module(
    "dcgb_verifier_202608271727",
    ROOT / "build/python/202608271727-verify-data-centres-intelligence.py",
)


class DataCentresIntelligenceCandidateTest(unittest.TestCase):
    def setUp(self) -> None:
        self.temporary = tempfile.TemporaryDirectory(prefix="dcgb-1727-test-")
        self.temp_root = Path(self.temporary.name)
        self.first = self.temp_root / "first"
        self.second = self.temp_root / "second"
        BUILDER.build(ROOT, self.first, SOURCE_COMMIT)
        BUILDER.build(ROOT, self.second, SOURCE_COMMIT)

    def tearDown(self) -> None:
        self.temporary.cleanup()

    def test_two_builds_are_byte_identical_and_independently_verified(self) -> None:
        first = VERIFIER.verify(self.first, ROOT, SOURCE_COMMIT)
        second = VERIFIER.verify(self.second, ROOT, SOURCE_COMMIT)
        comparison = VERIFIER.compare(self.first, self.second)
        self.assertEqual(first["status"], "PASS")
        self.assertEqual(second["status"], "PASS")
        self.assertEqual(first["rows"], 3)
        self.assertEqual(first["rows"], first["distinct_record_ids"])
        self.assertEqual(first["null_record_ids"], 0)
        self.assertEqual(first["duplicate_record_id_groups"], 0)
        self.assertEqual(first["context_records_eligible_for_project_signal"], 0)
        self.assertEqual(first["compression_codecs"], ["ZSTD"])
        self.assertEqual(len(comparison["byte_identical_outputs"]), 3)

    def test_export_is_ordered_and_keeps_usage_separate_from_source_rights(self) -> None:
        export = json.loads((self.first / BUILDER.EXPORT_REL).read_text(encoding="utf-8"))
        records = export["records"]
        self.assertEqual(export["usage_context"], "NON_COMMERCIAL_OPEN_SOURCE")
        self.assertEqual(export["source_rights"]["repository_code_licence"], "MIT")
        self.assertEqual(
            export["source_rights"]["upstream_source_licence"],
            "NOT_DECLARED_IN_REPOSITORY",
        )
        self.assertNotEqual(
            export["source_rights"]["repository_code_licence"],
            export["source_rights"]["upstream_source_licence"],
        )
        self.assertEqual([record["display_rank"] for record in records], [1, 2, 3])
        self.assertEqual([record["value_min"] for record in records], [564.0, 125.0, 237500.0])
        self.assertEqual(records[2]["value_max"], 712500.0)
        self.assertTrue(all(record["eligible_for_project_signal"] is False for record in records))

        audit = json.loads((self.first / BUILDER.AUDIT_REL).read_text(encoding="utf-8"))
        schema = audit["landed_file_readback"]["schema"]
        self.assertEqual(len(schema), 23)
        self.assertTrue(all(column["logical_required"] is True for column in schema))
        self.assertTrue(all(column["parquet_repetition"] == "OPTIONAL" for column in schema))
        self.assertTrue(all(column["duckdb_describe_nullability"] == "YES" for column in schema))

    def test_land_replaces_only_the_touched_partition(self) -> None:
        destination = self.temp_root / "destination"
        old_partition = (destination / BUILDER.PARQUET_REL).parent
        old_partition.mkdir(parents=True)
        (old_partition / "obsolete.parquet").write_bytes(b"obsolete")
        sentinel = destination / "data/intelligence/generation=OTHER/section=DATA_CENTRES/keep.txt"
        sentinel.parent.mkdir(parents=True)
        sentinel.write_text("keep", encoding="utf-8")
        BUILDER.land_candidate(self.first, destination, SOURCE_COMMIT)
        self.assertFalse((old_partition / "obsolete.parquet").exists())
        self.assertEqual(sentinel.read_text(encoding="utf-8"), "keep")
        landed = VERIFIER.verify(destination, ROOT, SOURCE_COMMIT)
        self.assertEqual(landed["status"], "PASS")

    def test_export_tamper_is_rejected(self) -> None:
        tampered = self.temp_root / "tampered"
        shutil.copytree(self.first, tampered)
        export_path = tampered / BUILDER.EXPORT_REL
        export = json.loads(export_path.read_text(encoding="utf-8"))
        export["records"][0]["value_min"] = 999.0
        export_path.write_text(json.dumps(export), encoding="utf-8")
        with self.assertRaises(RuntimeError):
            VERIFIER.verify(tampered, ROOT, SOURCE_COMMIT)

    def test_partition_escape_and_symlink_are_rejected(self) -> None:
        guarded = self.temp_root / "guarded"
        guarded.mkdir()
        with self.assertRaises(RuntimeError):
            BUILDER.confined_output_path(guarded, Path("../escape.parquet"))

        outside = self.temp_root / "outside"
        outside.mkdir()
        (guarded / "data").symlink_to(outside, target_is_directory=True)
        with self.assertRaises(RuntimeError):
            BUILDER.build(ROOT, guarded, SOURCE_COMMIT)
        self.assertEqual(list(outside.iterdir()), [])

        land_destination = self.temp_root / "land-guarded"
        land_destination.mkdir()
        (land_destination / "data").symlink_to(outside, target_is_directory=True)
        with self.assertRaises(RuntimeError):
            BUILDER.land_candidate(self.first, land_destination, SOURCE_COMMIT)
        self.assertEqual(list(outside.iterdir()), [])


if __name__ == "__main__":
    unittest.main()

Spider Patch Po

A Python module in the scripts folder of Data Federation Map for GlobalGrid2050 All Repos.

automationdata-federation-map-for-globalgrid2050-all-repos / .github/scripts/spider_patch_po.py · lines 1–38 of 38 · Entry point · pattern patch (shared by 11 files)

What it does
It loads data. Defines patch. Uses libraries os, pathlib. Side effects: changes the web page (DOM); reads or writes files.
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).
Downstream impact
Used directly by 1 file: Spider Full Po Branch Build Workflow (data-federation-map-for-globalgrid2050-all-repos).
What it achieves
Defines `patch`.
Why it matters
Run by Spider Full Po Branch Build Workflow.
Application
data-federation-map-for-globalgrid2050-all-repos · .github/scripts · Python module
Uses
os, pathlib
Used by
run by Spider Full Po Branch Build Workflow (workflow run)
Produces
patch
Defines here
patch
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/scripts/spider_patch_po.py:1-38 · blob cbc590d4049c6f5bb426406531eaee31f184f984 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: agent_infra · users: ai_agent · canonical: supporting_data
import os
from pathlib import Path
GO='function goLabel(n){return action==="github"&&n.gh?"open ↗":action==="external"&&n.ext?"open ↗":"";}'
FOCUS_OLD='cardInner(focus,{center:true})'
FOCUS_NEW='cardInner(focus,{center:true,dim:!actionable(focus),go:goLabel(focus)})'
COL_OLD='overlay.appendChild(shell);}'
COL_NEW='overlay.appendChild(shell);shell.querySelector(".focuswrap .card").addEventListener("click",()=>handleTap(current));}'
SPI_OLD='canvas.appendChild(center);const nodes=S().nodes;'
SPI_NEW='canvas.appendChild(center);center.querySelector(".card").addEventListener("click",()=>handleTap(current));const nodes=S().nodes;'
GOLD='${relHTML}${contents}</div>`;}'
GNEW='${relHTML}${!rel&&opts.go?`<span class="go">${opts.go}</span>`:""}${contents}</div>`;}'

def patch(path, need_contents=False):
    p=Path(path); t=p.read_text(encoding='utf-8')
    if GO not in t:
        i=t.find('function cardInner(node,opts={})')
        if i<0: raise SystemExit(path+': no cardInner')
        j=t.find('\n',i)
        t=t[:j+1]+GO+'\n'+t[j+1:]
    if FOCUS_OLD in t: t=t.replace(FOCUS_OLD,FOCUS_NEW)
    if COL_NEW not in t:
        if t.count(COL_OLD)!=1: raise SystemExit(path+': column anchor count')
        t=t.replace(COL_OLD,COL_NEW)
    if SPI_NEW not in t:
        if t.count(SPI_OLD)!=1: raise SystemExit(path+': spider anchor count')
        t=t.replace(SPI_OLD,SPI_NEW)
    if GOLD in t: t=t.replace(GOLD,GNEW)
    if t.count(GO)!=1: raise SystemExit(path+': goLabel count')
    if t.count(FOCUS_NEW)<2: raise SystemExit(path+': focus card count')
    if t.count('handleTap(current)')<2: raise SystemExit(path+': handleTap current count')
    if need_contents:
        for s in ['const CONTENTS_BASE="../data/federation_map/contents/provenance=declared/repo=Ventusltd__globalgrid2050/";','async function loadContents()','await loadContents();']:
            if s not in t: raise SystemExit(path+': missing '+s)
    p.write_text(t,encoding='utf-8')

patch('dashboard/federation_radial.html', True)
if os.environ.get('INCLUDE_SANDBOX','true')=='true':
    patch('dashboard/sandbox/federation_radial_uniform.html', False)

Archive Spider Version 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/archive_spider_version.yml · lines 1–65 of 65 · Entry point

What it does
It runs automated jobs on GitHub Actions. Side effects: reads or writes files; starts processes.
Why it exists in the grid workflow
Domain stage experimental (path word 'archive'): 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
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
data-federation-map-for-globalgrid2050-all-repos · .github/workflows · workflow
Uses
none found
Used by
none found
Produces
none declared
Defines here
Archive Spider Version
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/archive_spider_version.yml:1-65 · blob 2083d976dedda8d61bfb3111b7f0213cc69365a5 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem, process · domain stage: experimental · users: none · canonical: supporting_data
name: Archive Spider Version

on:
  workflow_dispatch:
    inputs:
      source_path:
        description: Source HTML file to archive
        required: true
        default: dashboard/sandbox/spider_full_po_test.html
      version_name:
        description: Version filename without .html
        required: true
        default: v20260704_po3b_po3c_working
      note:
        description: Short version note
        required: false
        default: Working Spider recovery after PO 3B and PO 3C test

permissions:
  contents: write

jobs:
  archive:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: main
          fetch-depth: 0
      - name: Archive working Spider HTML
        run: |
          set -euo pipefail
          mkdir -p dashboard/sandbox/spider_versions
          SRC="${{ inputs.source_path }}"
          VERSION="${{ inputs.version_name }}"
          DEST="dashboard/sandbox/spider_versions/${VERSION}.html"
          cp "$SRC" "$DEST"
          BYTES=$(wc -c < "$DEST" | tr -d ' ')
          SHA=$(sha256sum "$DEST" | cut -d' ' -f1)
          {
            echo "version: ${VERSION}"
            echo "source_path: ${SRC}"
            echo "dest_path: ${DEST}"
            echo "bytes: ${BYTES}"
            echo "sha256: ${SHA}"
            echo "note: ${{ inputs.note }}"
            echo "created_utc: $(date -u +%Y-%m-%dT%H:%M:%SZ)"
          } > "dashboard/sandbox/spider_versions/${VERSION}.txt"
          node - <<'NODE'
          const fs=require('fs');
          const p=process.env.DEST;
          const s=fs.readFileSync(p,'utf8');
          const js=s.split('<script>')[1].split('</script>')[0];
          fs.writeFileSync('/tmp/spider-version.js',js);
          NODE
          node --check /tmp/spider-version.js
        env:
          DEST: dashboard/sandbox/spider_versions/${{ inputs.version_name }}.html
      - name: Commit archive
        run: |
          git config user.name "github-actions[bot]"
          git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
          git add dashboard/sandbox/spider_versions/
          git commit -m "dashboard: archive spider version ${{ inputs.version_name }}"
          git push

Gridbot Declared Cartridges 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/gridbot_declared_cartridges.yml · lines 1–140 of 140 · Entry point

What it does
It runs automated jobs on GitHub Actions. Side effects: starts processes; uses storage (browser storage, DuckDB or Parquet).
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
Runs Build Declared Cartridges (`scripts/build_declared_cartridges.py`).
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
Build Declared Cartridges (workflow run)
Used by
none found
Produces
none declared
Defines here
GridBot Declared Cartridges
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/gridbot_declared_cartridges.yml:1-140 · blob e55ec2be9c554eb611be01dbff1996906f1050c1 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: ingest · effects: process, storage · domain stage: unknown · users: none · canonical: supporting_data
name: GridBot Declared Cartridges

on:
  workflow_dispatch:
    inputs:
      target_ref:
        description: 'Branch containing the PO 1 script and PR work'
        type: string
        required: true
        default: 'po1-declared-cartridges'
      mode:
        description: 'audit writes reports only; apply writes declared cartridges after human approval'
        type: choice
        required: true
        default: audit
        options:
          - audit
          - apply
      commit_reports:
        description: 'Commit audit report evidence when mode=audit'
        type: choice
        required: true
        default: 'false'
        options:
          - 'true'
          - 'false'

permissions:
  contents: write

concurrency:
  group: gridbot-declared-cartridges
  cancel-in-progress: false

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

jobs:
  declared-cartridges:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    environment: ${{ inputs.mode == 'apply' && 'federation-apply' || 'federation-audit' }}

    steps:
      - name: Checkout target ref using GridBot PAT
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
          token: ${{ secrets.GRIDBOT_PAT }}
          ref: ${{ env.TARGET_REF }}

      - name: Enforce mode and target ref
        run: |
          set -euo pipefail
          echo "TARGET_REF=${TARGET_REF}"
          echo "RUN_MODE=${RUN_MODE}"
          echo "COMMIT_REPORTS=${COMMIT_REPORTS}"
          if [ "${RUN_MODE}" != "audit" ] && [ "${RUN_MODE}" != "apply" ]; then
            echo "Invalid mode: ${RUN_MODE}"
            exit 1
          fi
          if [ "${TARGET_REF}" = "main" ] && [ "${RUN_MODE}" = "apply" ]; then
            echo "Apply to main is not allowed by this runner. PO 1 target output must land on the PR branch first."
            exit 1
          fi

      - name: Sync target ref before processing
        run: git pull --ff-only origin "${TARGET_REF}"

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

      - name: Install build dependencies
        run: |
          set -euo pipefail
          python -m pip install --upgrade pip
          pip install duckdb

      - name: Build declared cartridges report
        run: |
          set -euo pipefail
          python scripts/build_declared_cartridges.py \
            --mode "${RUN_MODE}" \
            --repository "${GITHUB_REPOSITORY}"

      - name: Upload declared cartridge report
        uses: actions/upload-artifact@v4
        if: always()
        with:
          name: federation-declared-cartridges-report
          if-no-files-found: warn
          path: |
            reports/FEDERATION_CARTRIDGES_LATEST.md
            reports/json/FEDERATION_CARTRIDGES_LATEST.json
            data/federation_map/cartridges/provenance=declared

      - name: Commit declared cartridge audit evidence
        if: ${{ success() && env.RUN_MODE == 'audit' && env.COMMIT_REPORTS == 'true' }}
        run: |
          set -euo pipefail
          git config user.name "Gridbot"
          git config user.email "gridbot@users.noreply.github.com"
          git add \
            reports/FEDERATION_CARTRIDGES_LATEST.md \
            reports/json/FEDERATION_CARTRIDGES_LATEST.json
          if git diff --cached --name-only | grep -E '^(data/federation_map/cartridges/|data/federation_map/current/|dashboard/|live_sandbox/|homepage/)'; then
            echo "Audit commit attempted to stage target cartridges, base current store, or UI files."
            exit 1
          fi
          if git diff --cached --quiet; then
            echo "No declared cartridge audit evidence changes to commit."
          else
            git commit -m "data: declared-cartridges audit report"
            git push origin HEAD:${TARGET_REF}
          fi

      - name: Commit declared cartridge apply output
        if: ${{ success() && env.RUN_MODE == 'apply' }}
        run: |
          set -euo pipefail
          git config user.name "Gridbot"
          git config user.email "gridbot@users.noreply.github.com"
          git add \
            data/federation_map/cartridges/provenance=declared \
            reports/FEDERATION_CARTRIDGES_LATEST.md \
            reports/json/FEDERATION_CARTRIDGES_LATEST.json
          if git diff --cached --name-only | grep -E '^(data/federation_map/current/|dashboard/|live_sandbox/|homepage/)'; then
            echo "Apply commit attempted to stage base current store or UI files."
            exit 1
          fi
          if git diff --cached --quiet; then
            echo "No declared cartridge apply changes to commit."
          else
            git commit -m "data: declared-cartridges apply"
            git push origin HEAD:${TARGET_REF}
          fi