GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Maps, GIS and field navigation / data-centres-gb / tests

Test OSM Overpass Retry and 3 more files

A test in the tests folder of Data Centres GB. It sets up (`setUp`) and is built from the fake response class (`FakeResponse`) and the overpass retry tests class (`OverpassRetryTests`).

672 lines of Python and HTML and CSS from data-centres-gb, data-federation-map-for-globalgrid2050-all-repos, in 4 files. Topic: Maps, GIS and field navigation. Section 471 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. Test OSM Overpass Retry test · data-centres-gb / tests/test_202608281626_osm_overpass_retry.py lines 1–269
  2. Test OSM Overpass Indexed test · data-centres-gb / tests/test_202608281702_osm_overpass_indexed.py lines 1–102
  3. Federation Radial render · data-federation-map-for-globalgrid2050-all-repos / dashboard/federation_radial.css lines 1–94
  4. Federation Radial render · data-federation-map-for-globalgrid2050-all-repos / dashboard/federation_radial.html lines 1–207

Test OSM Overpass Retry

A test in the tests folder of Data Centres GB. It sets up (`setUp`) and is built from the fake response class (`FakeResponse`) and the overpass retry tests class (`OverpassRetryTests`).

testdata-centres-gb / tests/test_202608281626_osm_overpass_retry.py · lines 1–269 of 269 · version 2026-08-28 16:26 · Entry point · pattern FakeResponse (shared by 2 files)

What it does
It tests its inputs. Defines 13 functions or classes, including FakeResponse, __init__, json, raise_for_status, OverpassRetryTests. Uses libraries __future__, copy, importlib.util, json, subprocess. Side effects: reads or writes files; makes network requests; starts processes; uses storage (browser storage, DuckDB or Parquet).
Why it exists in the grid workflow
Domain stage site_feasibility (topic 'maps-gis'): substation-to-site feasibility (terrain, LiDAR and connection evidence before design), a journey named in Ventus Ltd's brief.
Inputs & outputs
In: JSON file overpass-fetch.json; JSON file hostile.json; DuckDB queries.
Downstream impact
It is itself an entry point (test); no other file was found loading it.
What it achieves
Defines `FakeResponse`, `json`, `raise_for_status` and 9 more.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
data-centres-gb · tests · test
Uses
__future__, copy, importlib.util, json, subprocess, sys, tempfile, unittest
Used by
none found
Produces
FakeResponse, OverpassRetryTests
Defines here
FakeResponse, __init__, json, raise_for_status, OverpassRetryTests, setUp, test_remarked_response_is_retried_then_valid_response_lands, test_repeated_remarks_fail_closed_with_sanitised_receipt, test_retryable_http_then_valid_response_lands, test_network_exception_then_valid_response_lands, test_private_and_unverified_party_strings_never_reach_outputs, test_hostile_build_duckdb_and_geojson_readback_are_privacy_safe, test_malformed_empty_and_missing_provenance_never_land
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_202608281626_osm_overpass_retry.py:1-269 · blob a353f217daff47ddf90aaffeb2bf6946939af0f5 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem, network, process, storage · domain stage: site_feasibility · users: IPP_developer, landowner_planner · canonical: supporting_data
from __future__ import annotations

import copy
import importlib.util
import json
import subprocess
import sys
import tempfile
import unittest
from pathlib import Path
from unittest import mock

import requests


ROOT = Path(__file__).resolve().parents[1]
MODULE_PATH = ROOT / "build/python/202608281626-osm-overpass-retry.py"
SPEC = importlib.util.spec_from_file_location("osm_overpass_retry_202608281626", MODULE_PATH)
assert SPEC and SPEC.loader
MODULE = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(MODULE)


class FakeResponse:
    def __init__(self, status: int, payload: object | None = None, raw: bytes | None = None):
        self.status_code = status
        self._payload = payload
        self.content = raw if raw is not None else json.dumps(payload).encode("utf-8")
        self.headers = {"Content-Type": "application/json"}

    def json(self):
        if self._payload is None:
            raise ValueError("not json")
        return copy.deepcopy(self._payload)

    def raise_for_status(self) -> None:
        if self.status_code >= 400:
            raise requests.HTTPError(f"HTTP {self.status_code}")


class OverpassRetryTests(unittest.TestCase):
    def setUp(self) -> None:
        fixture = MODULE.BASE.load_json(ROOT / MODULE.BASE.FIXTURE_REL)
        self.valid_payload = fixture["payload"]

    def test_remarked_response_is_retried_then_valid_response_lands(self) -> None:
        remarked = {"remark": "runtime error: query timed out", "elements": []}
        responses = [FakeResponse(200, remarked), FakeResponse(200, self.valid_payload)]
        with tempfile.TemporaryDirectory() as temporary:
            output = Path(temporary) / "overpass-fetch.json"
            with mock.patch.object(MODULE.requests, "post", side_effect=responses) as post, mock.patch.object(
                MODULE.time, "sleep"
            ) as sleep:
                result = MODULE.fetch(ROOT, output)
            self.assertEqual(post.call_count, 2)
            sleep.assert_called_once_with(30)
            self.assertEqual(result["status"], "PASS")
            self.assertEqual(result["network_request_attempts"], 2)
            self.assertTrue(output.is_file())
            envelope = MODULE.BASE.load_json(output)
            self.assertEqual(envelope["network_request_attempts"], 2)
            self.assertEqual(envelope["network_successful_requests"], 1)
            self.assertFalse(MODULE.failure_evidence_path(output).exists())

    def test_repeated_remarks_fail_closed_with_sanitised_receipt(self) -> None:
        remark = "runtime error: query timed out"
        responses = [
            FakeResponse(200, {"remark": remark, "elements": []}),
            FakeResponse(200, {"remark": remark, "elements": []}),
            FakeResponse(200, {"remark": remark, "elements": []}),
        ]
        with tempfile.TemporaryDirectory() as temporary:
            output = Path(temporary) / "overpass-fetch.json"
            with mock.patch.object(MODULE.requests, "post", side_effect=responses), mock.patch.object(
                MODULE.time, "sleep"
            ):
                with self.assertRaises(RuntimeError):
                    MODULE.fetch(ROOT, output)
            self.assertFalse(output.exists())
            evidence = MODULE.BASE.load_json(MODULE.failure_evidence_path(output))
            self.assertEqual(evidence["status"], "FAILED")
            self.assertEqual(evidence["attempts_performed"], 3)
            self.assertEqual(
                [attempt["classification"] for attempt in evidence["attempts"]],
                ["OVERPASS_REMARK", "OVERPASS_REMARK", "OVERPASS_REMARK"],
            )
            self.assertEqual(evidence["attempts"][0]["remark"], remark)
            self.assertFalse(evidence["attempts"][0]["response_body_retained"])
            self.assertFalse(evidence["raw_overpass_response_landed"])
            self.assertNotIn("payload", evidence)

    def test_retryable_http_then_valid_response_lands(self) -> None:
        responses = [FakeResponse(429, {"error": "busy"}), FakeResponse(200, self.valid_payload)]
        with tempfile.TemporaryDirectory() as temporary:
            output = Path(temporary) / "overpass-fetch.json"
            with mock.patch.object(MODULE.requests, "post", side_effect=responses), mock.patch.object(
                MODULE.time, "sleep"
            ):
                result = MODULE.fetch(ROOT, output)
            self.assertEqual(result["network_request_attempts"], 2)
            self.assertTrue(output.is_file())

    def test_network_exception_then_valid_response_lands(self) -> None:
        responses = [requests.Timeout("timed out"), FakeResponse(200, self.valid_payload)]
        with tempfile.TemporaryDirectory() as temporary:
            output = Path(temporary) / "overpass-fetch.json"
            with mock.patch.object(MODULE.requests, "post", side_effect=responses), mock.patch.object(
                MODULE.time, "sleep"
            ):
                result = MODULE.fetch(ROOT, output)
            self.assertEqual(result["network_request_attempts"], 2)
            self.assertTrue(output.is_file())

    def test_private_and_unverified_party_strings_never_reach_outputs(self) -> None:
        envelope = MODULE.BASE.load_json(ROOT / MODULE.BASE.FIXTURE_REL)
        tags = envelope["payload"]["elements"][0]["tags"]
        tags.update(
            {
                "name": "Private Person",
                "operator": "Private Person",
                "owner": "Private Person",
                "operator:wikidata": "Q123456",
                "building": "Private Person",
                "contact:email": "private@example.invalid",
                "description": "Private Person private@example.invalid",
                "phone": "+44 0000 000000",
                "input:electricity": "Private Person",
                "user": "Private Person",
                "ref": "private-reference",
                "ref:GB:uprn": "private-property-reference",
                "wikidata": "Q654321",
            }
        )
        elements, relationships = MODULE.privacy_normalise(envelope, ROOT)
        element_index = {
            name: position
            for position, (name, _type_name, _required) in enumerate(
                MODULE.BASE.ELEMENT_SCHEMA
            )
        }
        relationship_index = {
            name: position
            for position, (name, _type_name, _required) in enumerate(
                MODULE.BASE.RELATIONSHIP_SCHEMA
            )
        }
        self.assertEqual(len(relationships), len(elements) * 2)
        for row in elements:
            for field in MODULE.PRIVATE_ELEMENT_FIELDS:
                self.assertIsNone(row[element_index[field]])
            retained_tags = json.loads(row[element_index["tags_json"]])
            self.assertTrue(set(retained_tags).issubset(MODULE.SAFE_TAG_KEYS))
            self.assertNotIn("Private Person", json.dumps(row, default=str))
            self.assertNotIn("private@example.invalid", json.dumps(row, default=str))
        for row in relationships:
            self.assertIsNone(row[relationship_index["company_name_raw"]])
            self.assertEqual(
                row[relationship_index["evidence_status"]],
                "SOURCE_PARTY_WITHHELD_PRIVACY",
            )
            self.assertEqual(
                row[relationship_index["abstention_reason"]],
                "VERIFIED_COMPANY_NUMBER_REQUIRED",
            )
            self.assertNotIn("Private Person", json.dumps(row))

    def test_hostile_build_duckdb_and_geojson_readback_are_privacy_safe(self) -> None:
        envelope = MODULE.BASE.load_json(ROOT / MODULE.BASE.FIXTURE_REL)
        sentinel = "PRIVATE-SENTINEL private@example.invalid"
        for element in envelope["payload"]["elements"]:
            element["user"] = sentinel
            element["uid"] = 999999
            element["changeset"] = 888888
            element["tags"].update(
                {
                    "name": sentinel,
                    "operator": sentinel,
                    "owner": sentinel,
                    "ref": sentinel,
                    "wikidata": sentinel,
                    "operator:wikidata": sentinel,
                    "ref:GB:uprn": sentinel,
                    "contact:email": sentinel,
                    "phone": sentinel,
                    "description": sentinel,
                    "note": sentinel,
                    "arbitrary": sentinel,
                    "input:electricity": sentinel,
                }
            )
        with tempfile.TemporaryDirectory() as temporary:
            temporary_path = Path(temporary)
            input_path = temporary_path / "hostile.json"
            candidate = temporary_path / "candidate"
            input_path.write_text(MODULE.BASE.pretty_json(envelope), encoding="utf-8")
            source_commit = "a" * 40
            build_command = [
                sys.executable,
                str(MODULE_PATH),
                "build",
                "--root",
                str(ROOT),
                "--input",
                str(input_path),
                "--output-root",
                str(candidate),
                "--source-commit",
                source_commit,
            ]
            verify_command = [
                sys.executable,
                str(MODULE_PATH),
                "verify",
                "--root",
                str(candidate),
                "--source-root",
                str(ROOT),
                "--input",
                str(input_path),
                "--expected-source-commit",
                source_commit,
            ]
            subprocess.run(build_command, check=True, capture_output=True, text=True)
            verified = subprocess.run(
                verify_command, check=True, capture_output=True, text=True
            )
            self.assertEqual(json.loads(verified.stdout)["privacy"], "PASS")

            duckdb = MODULE.BASE.load_duckdb()
            connection = duckdb.connect(":memory:")
            try:
                for relative_path in (
                    MODULE.BASE.ELEMENTS_REL,
                    MODULE.BASE.RELATIONSHIPS_REL,
                ):
                    rows = connection.execute(
                        "SELECT * FROM read_parquet(?, hive_partitioning=false)",
                        [str(candidate / relative_path)],
                    ).fetchall()
                    self.assertNotIn(sentinel, json.dumps(rows, default=str))
            finally:
                connection.close()
            for relative_path in (MODULE.BASE.GEOJSON_REL, MODULE.BASE.AUDIT_REL):
                self.assertNotIn(
                    sentinel,
                    (candidate / relative_path).read_text(encoding="utf-8"),
                )

    def test_malformed_empty_and_missing_provenance_never_land(self) -> None:
        invalid_payloads = [
            None,
            {"elements": [], "osm3s": self.valid_payload["osm3s"]},
            {"elements": self.valid_payload["elements"]},
        ]
        for payload in invalid_payloads:
            with self.subTest(payload=payload), tempfile.TemporaryDirectory() as temporary:
                output = Path(temporary) / "overpass-fetch.json"
                responses = [FakeResponse(200, payload) for _ in MODULE.BACKOFFS]
                with mock.patch.object(
                    MODULE.requests, "post", side_effect=responses
                ), mock.patch.object(MODULE.time, "sleep"):
                    with self.assertRaises(RuntimeError):
                        MODULE.fetch(ROOT, output)
                self.assertFalse(output.exists())
                self.assertTrue(MODULE.failure_evidence_path(output).is_file())


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

Test OSM Overpass Indexed

A test in the tests folder of Data Centres GB. It is built from the indexed overpass tests class (`IndexedOverpassTests`).

testdata-centres-gb / tests/test_202608281702_osm_overpass_indexed.py · lines 1–102 of 102 · version 2026-08-28 17:02 · Entry point

What it does
It tests its inputs. Defines IndexedOverpassTests, test_doctor_and_exact_selector_closure, test_center_only_fixture_builds_and_verifies_through_successor. Uses libraries __future__, importlib.util, json, subprocess, sys. Side effects: reads or writes files; starts processes.
Why it exists in the grid workflow
Domain stage site_feasibility (topic 'maps-gis'): substation-to-site feasibility (terrain, LiDAR and connection evidence before design), a journey named in Ventus Ltd's brief.
Inputs & outputs
In: JSON file center-only.json.
Downstream impact
It is itself an entry point (test); no other file was found loading it.
What it achieves
Defines `IndexedOverpassTests`, `test_doctor_and_exact_selector_closure` and `test_center_only_fixture_builds_and_verifies_through_successor`.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
data-centres-gb · tests · test
Uses
__future__, importlib.util, json, subprocess, sys, tempfile, unittest, pathlib
Used by
none found
Produces
IndexedOverpassTests
Defines here
IndexedOverpassTests, test_doctor_and_exact_selector_closure, test_center_only_fixture_builds_and_verifies_through_successor
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_202608281702_osm_overpass_indexed.py:1-102 · blob a77148572efb8d9af6914f2474af15b54fa47fe3 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem, process · domain stage: site_feasibility · users: IPP_developer, landowner_planner · canonical: supporting_data
from __future__ import annotations

import importlib.util
import json
import subprocess
import sys
import tempfile
import unittest
from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]
MODULE_PATH = ROOT / "build/python/202608281702-osm-overpass-indexed.py"
SPEC = importlib.util.spec_from_file_location("osm_overpass_indexed_202608281702", MODULE_PATH)
assert SPEC and SPEC.loader
MODULE = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(MODULE)


class IndexedOverpassTests(unittest.TestCase):
    def test_doctor_and_exact_selector_closure(self) -> None:
        result = MODULE.doctor(ROOT)
        self.assertEqual(result["status"], "PASS")
        query = (ROOT / MODULE.QUERY_REL).read_text(encoding="utf-8")
        actual = {
            line.strip()
            for line in query.splitlines()
            if line.strip().startswith("nwr(area.gb)")
        }
        expected = {
            f'nwr(area.gb)["{prefix}{feature}"="{value}"];'
            for prefix in ("", *[f"{name}:" for name in MODULE.BASE.LIFECYCLES])
            for feature in MODULE.BASE.FEATURE_KEYS
            for value in ("data_center", "data_centre")
        }
        self.assertEqual(actual, expected)
        self.assertNotIn('[~"', query)
        self.assertNotIn("out meta geom", query)
        self.assertIn("out meta center qt;", query)

    def test_center_only_fixture_builds_and_verifies_through_successor(self) -> None:
        envelope = MODULE.BASE.load_json(ROOT / MODULE.BASE.FIXTURE_REL)
        envelope["query_sha256"] = MODULE.QUERY_SHA256
        for element in envelope["payload"]["elements"]:
            if element["type"] != "node":
                element.pop("geometry", None)
                element.pop("members", None)
                self.assertIn("center", element)
        with tempfile.TemporaryDirectory() as temporary:
            temporary_path = Path(temporary)
            input_path = temporary_path / "center-only.json"
            candidate = temporary_path / "candidate"
            input_path.write_text(MODULE.BASE.pretty_json(envelope), encoding="utf-8")
            source_commit = "b" * 40
            base_command = [sys.executable, str(MODULE_PATH)]
            subprocess.run(
                [
                    *base_command,
                    "build",
                    "--root",
                    str(ROOT),
                    "--input",
                    str(input_path),
                    "--output-root",
                    str(candidate),
                    "--source-commit",
                    source_commit,
                ],
                check=True,
                capture_output=True,
                text=True,
            )
            verified = subprocess.run(
                [
                    *base_command,
                    "verify",
                    "--root",
                    str(candidate),
                    "--source-root",
                    str(ROOT),
                    "--input",
                    str(input_path),
                    "--expected-source-commit",
                    source_commit,
                ],
                check=True,
                capture_output=True,
                text=True,
            )
            receipt = json.loads(verified.stdout)
            self.assertEqual(receipt["indexed_query"], "PASS")
            self.assertEqual(receipt["privacy"], "PASS")
            audit = MODULE.BASE.load_json(candidate / MODULE.BASE.AUDIT_REL)
            self.assertEqual(audit["query_repair"], MODULE.receipt())
            self.assertEqual(
                audit["query_repair"]["failure_artifact_digest"],
                MODULE.FAILURE_ARTIFACT_DIGEST,
            )


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

Federation Radial

A style sheet in the dashboard folder of Data Federation Map for GlobalGrid2050 All Repos.

renderdata-federation-map-for-globalgrid2050-all-repos / dashboard/federation_radial.css · lines 1–94 of 94 · Entry point

What it does
Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage site_feasibility (topic 'maps-gis'): substation-to-site feasibility (terrain, LiDAR and connection evidence before design), a journey named in Ventus Ltd's brief.
Downstream impact
Used directly by 4 files: Federation Radial (data-federation-map-for-globalgrid2050-all-repos, https://ventusltd.github.io/data-federation-map-for-globalgrid2050-all-repos/dashboard/federation_radial.html); Spider Full Po Test (data-federation-map-for-globalgrid2050-all-repos, https://ventusltd.github.io/data-federation-map-for-globalgrid2050-all-repos/dashboard/sandbox/spider_full_po_test.html); Spider Sandbox (ventus-grid-engine, https://ventusltd.github.io/ventus-grid-engine/spider-sandbox.html); Testcode — Grid Engine Page (globalgrid2050, https://globalgrid2050.com/testcode/202609141754/grid-engine/). Reached from 284 other entry points, including Code Generator — Substation Finder Page (code-generator, https://ventusltd.github.io/code-generator/apps/substation-finder/); Iterations — 43 Registry Growth Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/43-registry-growth/); Iterations — 47 Federation Honesty Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/47-federation-honesty/).
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name. Described from its file name only (a candidate, not yet checked against the code).
Why it matters
Loaded by the page of the same name at https://ventusltd.github.io/data-federation-map-for-globalgrid2050-all-repos/dashboard/federation_radial.html and 2 other pages. Checked by Spider Full Po Test.
Application
data-federation-map-for-globalgrid2050-all-repos · dashboard · style sheet
Uses
none found
Used by
loaded by Federation Radial (stylesheet), loaded by Spider Full Po Test (stylesheet), loaded by Spider Sandbox (stylesheet), loaded by Testcode — Grid Engine Page (stylesheet)
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-federation-map-for-globalgrid2050-all-repos@fffd624e77d820ebc04ab25f9d97871b254be61c dashboard/federation_radial.css:1-94 · blob 020e1b2274b1754a461a64f952b8811a1c149392 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: site_feasibility · users: IPP_developer, landowner_planner · canonical: supporting_data
:root{
  --gold:#ffd54a;
  --gold-hot:#fff8b0;
  --gold-glow:rgba(255,213,74,.55);
}

.viewbtn{
  position:relative;
  overflow:hidden;
}

.controls > span.grouplabel:nth-of-type(2){
  display:none;
}

.viewbtn[aria-pressed="true"]{
  border-color:var(--gold);
  background:linear-gradient(135deg,rgba(255,213,74,.24),rgba(255,248,176,.08));
  color:var(--gold-hot);
  box-shadow:0 0 0 1px rgba(255,213,74,.3),0 0 24px rgba(255,213,74,.26),inset 0 0 18px rgba(255,213,74,.08);
}

.viewbtn[aria-pressed="true"]::before{
  content:"";
  position:absolute;
  inset:-40% -30%;
  background:linear-gradient(115deg,transparent 35%,rgba(255,255,220,.32) 48%,transparent 61%);
  transform:translateX(-60%);
  animation:solarSweep 3.4s ease-in-out infinite;
  pointer-events:none;
}

.viewbtn[aria-pressed="true"]::after{
  content:"";
  position:absolute;
  left:29px;
  top:10px;
  width:4px;
  height:4px;
  border-radius:50%;
  background:#fffbe8;
  box-shadow:0 0 4px 2px var(--gold-hot),0 0 20px 7px rgba(255,213,74,.72),0 0 34px 12px rgba(255,153,0,.28);
  animation:solarGlint 2.7s ease-in-out infinite;
  pointer-events:none;
}

.spider-glyph{
  position:relative;
  display:inline-grid;
  place-items:center;
  width:1.15em;
  height:1.15em;
  color:var(--gold);
  filter:sepia(1) saturate(4.8) hue-rotate(2deg) brightness(1.7) drop-shadow(0 0 3px var(--gold-hot)) drop-shadow(0 0 12px var(--gold-glow));
  text-shadow:0 0 4px var(--gold-hot),0 0 16px var(--gold-glow);
  transform:translateZ(0);
}

.spider-glyph::after{
  content:"";
  position:absolute;
  left:55%;
  top:30%;
  width:4px;
  height:4px;
  border-radius:50%;
  background:#fffbe8;
  box-shadow:0 0 4px 2px var(--gold-hot),0 0 20px 7px rgba(255,213,74,.72),0 0 34px 12px rgba(255,153,0,.28);
  animation:solarGlint 2.7s ease-in-out infinite;
  pointer-events:none;
}

.overlay.spider{
  background:radial-gradient(circle at center,rgba(255,213,74,.06),transparent 36%),radial-gradient(circle at center,rgba(0,229,255,.045),transparent 45%);
}

@keyframes solarGlint{
  0%,38%,100%{opacity:.18;transform:scale(.65)}
  45%{opacity:1;transform:scale(1.4)}
  52%{opacity:.45;transform:scale(.9)}
}

@keyframes solarSweep{
  0%,34%,100%{transform:translateX(-70%)}
  52%{transform:translateX(70%)}
}

@media (prefers-reduced-motion:reduce){
  .spider-glyph::after,
  .viewbtn[aria-pressed="true"]::before,
  .viewbtn[aria-pressed="true"]::after{
    animation:none;
  }
}

Federation Radial

A web page in the dashboard folder of Data Federation Map for GlobalGrid2050 All Repos covering solar and uses data from Elexon Balancing Mechanism Reporting Service (BMRS). Published at https://ventusltd.github.io/data-federation-map-for-globalgrid2050-all-repos/dashboard/federation_radial.html.

Set aside from the main view: 98% of its lines are the same as dashboard/sandbox/spider_full_po_test.html (data-federation-map-for-globalgrid2050-all-repos), which stays. (near-copy-of, proposed by families.py). 97% of lines shared with Spider Full Po Test; read that one first. All set-aside files, with reasons. Nothing was deleted.

Evidence
  • line-jaccard 0.9752 to data-federation-map-for-globalgrid2050-all-repos@fffd624e77d820ebc04ab25f9d97871b254be61c dashboard/sandbox/spider_full_po_test.html:1-208 b286439c0858f06abbc2337169020509aad514ce
  • sha256 950d093501c0ac7a22b50b41184d22a3e1d89f63b8a9d0f84a64613b742096e1
  • target sha256 d9f6f19448a02be502ca3a7bcf7100ec27a599249d91ef4a119789ea9ff3a141
  • group of 3 (identity.json near-copy edges >= 0.9)
  • canonical rule: reachable, newest stamp, core repo, most lines

renderdata-federation-map-for-globalgrid2050-all-repos / dashboard/federation_radial.html · lines 1–207 of 207 · Entry point · pattern applyRootLinks (shared by 10 files)

What it does
It draws solar. Defines 13 functions or classes, including applyRootLinks, S, rebuildSelect, actionable, openUrl. Side effects: changes the web page (DOM); makes network requests; uses storage (browser storage, DuckDB or Parquet).
Why it exists in the grid workflow
Domain stage site_feasibility (topic 'maps-gis'): substation-to-site feasibility (terrain, LiDAR and connection evidence before design), a journey named in Ventus Ltd's brief. Domain terms in the code: solar.
Inputs & outputs
In: data source: Elexon BMRS; JSON file nodes.json; JSON file edges.json; DuckDB queries; form fields (user input). Out: web page; SVG drawing.
Downstream impact
Used directly by 1 file: Registry of All Content in Repos and Dependencies — Index Page (registry_of_all_content_in_repos_and_dependencies, https://ventusltd.github.io/registry_of_all_content_in_repos_and_dependencies/). Reached from 130 other entry points, including Iterations — 43 Registry Growth Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/43-registry-growth/); Iterations — 47 Federation Honesty Page (galaxies-wafers, https://ventusltd.github.io/galaxies-wafers/iterations/47-federation-honesty/); GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html). It is itself an entry point, published at https://ventusltd.github.io/data-federation-map-for-globalgrid2050-all-repos/dashboard/federation_radial.html.
What it achieves
It applies root links (`applyRootLinks`), rebuilds select (`rebuildSelect`) and opens URL (`openUrl`). Ventus Global Grid 2050. It responds to change and click events.
Why it matters
Loaded by the Registry of All Content in Repos and Dependencies page in Registry of All Content in Repos and Dependencies at https://ventusltd.github.io/registry_of_all_content_in_repos_and_dependencies/.
Application
data-federation-map-for-globalgrid2050-all-repos · dashboard · page
Uses
Federation Radial (stylesheet), Live Sandbox — Federation Control Ledger Page (estate URL)
Used by
linked from Registry of All Content in Repos and Dependencies — Index Page (link)
Produces
applyRootLinks, S, rebuildSelect, actionable, openUrl, handleTap, drillInto, popTo, neighbours, distribute, reshapeNodes, loadJSON
Defines here
applyRootLinks, S, rebuildSelect, actionable, openUrl, handleTap, drillInto, popTo, neighbours, distribute, reshapeNodes, loadJSON, loadRoot
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 dashboard/federation_radial.html:1-207 · blob b9220e37e7d74595e7525f67024f363257356aa9 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, network, storage · domain stage: site_feasibility · users: IPP_developer, landowner_planner · canonical: supporting_data
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<title>Ventus Global Grid 2050 · The Spider Sandbox</title>
<style>
  :root{
    --bg:#0b0d12;--panel:#12151c;--panel2:#151923;--line:#262b36;--text:#eef2fb;--muted:#9aa3b5;--cyan:#00e5ff;
    --e-data:#00e5ff;--e-governance:#b47cff;--e-archive:#7da0c8;--e-external:#5f76a4;--e-repo:#b8ccff;--e-workflow:#00ffff;
    --safe-x:clamp(12px,2.3vw,28px);--shell:1040px;--card:220px;--gap:14px;
  }
  *{box-sizing:border-box}
  html,body{margin:0;min-height:100%}
  body{background:radial-gradient(1200px 700px at 50% -10%,rgba(0,229,255,.06),transparent 60%),var(--bg);color:var(--text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;height:100dvh;overflow:hidden;display:flex;flex-direction:column}
  button,select{font:inherit}
  .top{border-bottom:1px solid var(--line);background:rgba(11,13,18,.92);backdrop-filter:blur(16px)}
  .bar,.controls,.crumbs,.hint{width:min(var(--shell),calc(100vw - var(--safe-x)*2));margin:0 auto}
  .bar{display:flex;align-items:center;gap:10px 14px;flex-wrap:wrap;padding:max(env(safe-area-inset-top),12px) 0 10px}
  .brand{display:flex;flex-direction:column;line-height:1.05;min-width:190px}
  .brand .ey{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.6rem;letter-spacing:.22em;text-transform:uppercase;color:var(--cyan)}
  .brand h1{margin:2px 0 0;font-size:1rem;font-weight:650}
  .pick{display:flex;align-items:center;gap:8px;flex:1 1 280px;min-width:0}
  .pick label,.grouplabel{font-family:ui-monospace,monospace;font-size:.58rem;letter-spacing:.16em;text-transform:uppercase;color:var(--muted);flex:none}
  select{flex:1 1 auto;min-width:0;background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:10px;padding:9px 32px 9px 12px;font-size:.85rem;cursor:pointer;appearance:none;background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);background-position:calc(100% - 16px) center,calc(100% - 11px) center;b  … [line shortened here: 459 characters; full line on GitHub]
  select:focus-visible,button:focus-visible{outline:none;border-color:var(--cyan);box-shadow:0 0 0 2px rgba(0,229,255,.18)}
  .count{font-family:ui-monospace,monospace;font-size:.72rem;color:var(--muted);margin-left:auto;white-space:nowrap}
  .count b{color:var(--text);font-weight:600}
  .controls{display:flex;align-items:center;gap:8px 14px;flex-wrap:wrap;padding:8px 0 4px}
  .seg{display:inline-flex;border:1px solid var(--line);border-radius:999px;overflow:hidden;flex:none;background:rgba(18,21,28,.7)}
  .seg button{border:0;background:transparent;color:var(--muted);font-size:.72rem;padding:7px 13px;cursor:pointer;white-space:nowrap}
  .seg button[aria-pressed="true"]{background:rgba(0,229,255,.16);color:var(--text)}
  .seg button.gh[aria-pressed="true"]{background:rgba(184,204,255,.18)}
  .seg button.ext[aria-pressed="true"]{background:rgba(95,118,164,.28)}
  .seg button:disabled{opacity:.4;cursor:not-allowed}
  .viewbtn{border:1px solid rgba(255,255,255,.55);background:rgba(255,255,255,.08);color:#fff;border-radius:999px;padding:6px 12px;cursor:pointer;font-size:.86rem;line-height:1;display:inline-flex;align-items:center;gap:7px}
  .viewbtn[aria-pressed="true"]{border-color:var(--cyan);background:rgba(0,229,255,.16);box-shadow:0 0 22px rgba(0,229,255,.12)}
  .srctag{margin-left:auto;font-family:ui-monospace,monospace;font-size:.56rem;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);border:1px solid var(--line);border-radius:999px;padding:2px 8px}
  .srctag.live{color:var(--cyan);border-color:rgba(0,229,255,.4)}
  .crumbs{display:flex;align-items:center;gap:6px;padding:2px 0 0;font-family:ui-monospace,monospace;font-size:.66rem;color:var(--muted);min-height:18px}
  .crumbs a{color:var(--cyan);cursor:pointer;text-decoration:none}
  .crumbs .sep{opacity:.5}
  .hint{padding:4px 0 8px;font-family:ui-monospace,monospace;font-size:.62rem;color:var(--muted)}
  .hint b{color:var(--text);font-weight:600}
  .stage{flex:1;min-height:0;position:relative;overflow:hidden}
  .overlay{position:absolute;inset:0}
  .overlay.column{overflow-y:auto;overflow-x:hidden;padding:16px var(--safe-x) max(env(safe-area-inset-bottom),22px)}
  .shell{width:min(var(--shell),100%);margin:0 auto;display:flex;flex-direction:column;gap:12px}
  .card{border:1px solid var(--line);border-radius:14px;background:linear-gradient(160deg,rgba(255,255,255,.055),rgba(255,255,255,.014));padding:10px 12px;display:flex;flex-direction:column;gap:6px;min-height:74px;box-shadow:0 16px 44px rgba(0,0,0,.12)}
  .card .row{display:flex;align-items:center;gap:7px}
  .badge{font-family:ui-monospace,monospace;font-size:.55rem;letter-spacing:.07em;border:1px solid var(--line);border-radius:6px;padding:2px 5px;color:var(--muted);flex:none}
  .name{font-size:.85rem;font-weight:650;line-height:1.15;overflow-wrap:anywhere}
  .dot{width:9px;height:9px;border-radius:50%;flex:none;margin-left:auto;box-shadow:0 0 8px currentColor}
  .reason{font-size:.68rem;color:var(--muted);line-height:1.25}
  .relrow{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
  .reltag{font-family:ui-monospace,monospace;font-size:.55rem;letter-spacing:.05em;text-transform:uppercase;padding:1px 7px;border-radius:999px;border:1px solid currentColor}
  .arrow{font-family:ui-monospace,monospace;font-size:.62rem;color:var(--muted)}
  .go{font-family:ui-monospace,monospace;font-size:.6rem;color:var(--cyan);margin-left:auto}
  .is-center{border-color:var(--cyan);box-shadow:0 0 0 1px rgba(0,229,255,.22),0 0 26px rgba(0,229,255,.12)}
  .is-center .name{font-size:.95rem}
  .contents{align-self:flex-start;margin-top:3px;font-family:ui-monospace,monospace;font-size:.62rem;color:var(--cyan);border:1px solid rgba(0,229,255,.4);border-radius:999px;padding:4px 10px;background:rgba(0,229,255,.08);cursor:pointer}
  .inert{opacity:.34}
  .sect{font-family:ui-monospace,monospace;font-size:.6rem;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);margin:16px 2px 4px}
  .branch{position:relative;padding-left:20px;display:flex;flex-direction:column;gap:9px}
  .branch::before{content:"";position:absolute;left:7px;top:-6px;bottom:14px;width:2px;background:var(--line)}
  .twig{position:relative;cursor:pointer}
  .twig::before{content:"";position:absolute;left:-13px;top:28px;width:13px;height:2px;background:var(--twig,var(--line))}
  .twig .card{border-left:3px solid var(--twig,var(--line))}
  .empty{color:var(--muted);font-size:.78rem;padding:6px 2px}
  .overlay.spider{overflow:auto;cursor:grab;background:radial-gradient(circle at center,rgba(0,229,255,.045),transparent 45%)}
  .overlay.spider.dragging{cursor:grabbing;user-select:none}
  .spiderCanvas{position:relative;min-width:100%;min-height:100%}
  .spiderGrid{position:absolute;inset:0;background-image:linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),linear-gradient(90deg,rgba(255,255,255,.03) 1px, transparent 1px);background-size:80px 80px;mask-image:radial-gradient(circle at center,black,transparent 78%);pointer-events:none}
  .wires{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible}
  .spoke{stroke-width:1.8;fill:none;opacity:.88}
  .place{position:absolute;transform:translate(-50%,-50%);width:var(--card);cursor:pointer}
  .place.center{width:250px;cursor:default}
  .legend{position:sticky;left:14px;bottom:10px;display:flex;flex-wrap:wrap;gap:5px 12px;width:max-content;max-width:70%;pointer-events:none;padding:4px 0 10px 14px}
  .legend span{display:flex;align-items:center;gap:6px;font-family:ui-monospace,monospace;font-size:.58rem;letter-spacing:.05em;text-transform:uppercase;color:var(--muted)}
  .legend i{width:15px;height:0;border-top:2px solid;display:inline-block}
  .maphint{position:sticky;top:12px;left:14px;width:max-content;max-width:min(560px,calc(100vw - 32px));font-family:ui-monospace,monospace;font-size:.62rem;color:var(--muted);background:rgba(18,21,28,.8);border:1px solid var(--line);border-radius:999px;padding:5px 10px;backdrop-filter:blur(10px);z-index:5}
  @media (max-width:680px){:root{--safe-x:14px}.brand{min-width:100%}.bar{gap:8px}.count{width:100%;margin-left:0}.controls{gap:7px 10px}.seg button{padding:7px 10px;font-size:.68rem}.viewbtn{padding:6px 10px}.srctag{margin-left:0}.shell{gap:10px}.card{border-radius:12px}.name{font-size:.82rem}}
</style>
<link rel="stylesheet" href="federation_radial.css" />
</head>
<body>
  <div class="top">
    <div class="bar">
      <div class="brand"><span class="ey">Ventus · Global Grid 2050</span><h1>The Spider Sandbox</h1></div>
      <div class="pick"><label for="focus">Focus</label><select id="focus"></select></div>
      <div class="count" id="count"></div>
    </div>
    <div class="controls">
      <span class="grouplabel">Show</span>
      <div class="seg" id="relSeg" role="group" aria-label="Relationship direction">
        <button data-mode="both" aria-pressed="true">Both</button>
        <button data-mode="out" aria-pressed="false">Outgoing</button>
        <button data-mode="in" aria-pressed="false">Incoming</button>
      </div>
      <button class="viewbtn" id="spiderToggle" aria-pressed="false" title="Toggle optional spider view"><span class="spider-glyph" aria-hidden="true">🕷</span><span id="viewLabel">Spider</span></button>
      <span class="grouplabel">Tap does</span>
      <div class="seg" id="actSeg" role="group" aria-label="Tap action">
        <button data-act="explore" aria-pressed="true">Explore</button>
        <button class="gh" data-act="github" aria-pressed="false">GitHub</button>
        <button class="ext" data-act="external" aria-pressed="false">External</button>
        <button data-act="status" aria-pressed="false" disabled title="Enables when the page reads live scanner data">Status</button>
      </div>
      <span class="srctag" id="srcTag" title="Data source for this view">snapshot</span>
    </div>
    <div class="crumbs" id="crumbs"></div>
    <div class="hint" id="hint"></div>
  </div>
  <div class="stage" id="stage"><div class="overlay column" id="overlay"></div></div>
<script>
const GH_BASE="https://github.com/Ventusltd/data-federation-map-for-globalgrid2050-all-repos";
const LIVE_PAGE="https://ventusltd.github.io/data-federation-map-for-globalgrid2050-all-repos/live_sandbox/federation_control_ledger/";
const EXT_HOME={"DuckDB":"https://duckdb.org","Parquet":"https://parquet.apache.org","GitHub Actions":"https://github.com/features/actions","Elexon BMRS API":"https://bmrs.elexon.co.uk","GitHub Pages":"https://pages.github.com"};
const PAGE_HOME={"globalgrid2050":"https://globalgrid2050.com/","globalgrid2050-hompage":"https://globalgrid2050.com/","data-federation-map-for-globalgrid2050-all-repos":LIVE_PAGE};
const ROOT_NODES=[
  {label:"data-federation-map-for-globalgrid2050-all-repos",type:"data",rag:"green",reason:"active federation repository",child:"data-federation"},
  {label:"data-gb-electricity",type:"data",rag:"red",reason:"contract finding surfaced"},
  {label:"data-interconnectors",type:"data",rag:"red",reason:"contract finding surfaced"},
  {label:"gb-electricity-ui",type:"ui",rag:"red",reason:"depends on verified data repos"},
  {label:"globalgrid2050",type:"source_archive",rag:"blue",reason:"source archive"},
  {label:"globalgrid2050-hompage",type:"homepage",rag:"green",reason:"homepage dependency surfaced"},
  {label:"pandapower",type:"unknown",rag:"grey",reason:"not fully classified"},
  {label:"Podcast-transcripts",type:"unknown",rag:"amber",reason:"workflow finding"},
  {label:"pv-arc-protection-circuit",type:"unknown",rag:"amber",reason:"workflow finding"},
  {label:"Solar-PV-Hybrid-and-off-grid",type:"unknown",rag:"amber",reason:"workflow finding"},
  {label:"solar-repowering-whitepaper",type:"unknown",rag:"amber",reason:"workflow finding"},
  {label:"youengineer-code-review",type:"ui",rag:"amber",reason:"reference UI pattern source"},
  {label:"DuckDB",type:"external",rag:"blue",reason:"proof query engine"},
  {label:"Parquet",type:"external",rag:"blue",reason:"columnar proof store"},
  {label:"Elexon BMRS API",type:"external",rag:"blue",reason:"external electricity source"},
  {label:"GitHub Actions",type:"external",rag:"blue",reason:"static build runner"},
];
const ROOT_EDGES=[
  [0,12,"external"],[0,13,"external"],[0,5,"governance"],[0,15,"external"],[0,14,"external"],
  [1,4,"archive"],[1,5,"governance"],[1,14,"external"],[1,15,"external"],[1,12,"external"],[1,13,"external"],
  [2,4,"archive"],[2,5,"governance"],[2,14,"external"],[2,13,"external"],[2,1,"repo"],[2,3,"repo"],[2,15,"external"],[2,12,"external"],
  [3,1,"data"],[3,2,"data"],[3,5,"governance"],[3,15,"external"],
  [4,14,"external"],[4,15,"external"],
  [5,14,"external"],[5,0,"data"],[5,1,"data"],[5,2,"data"],[5,3,"repo"],[5,4,"archive"],[5,12,"external"],[5,13,"external"],[5,15,"external"],
  [6,15,"external"],
];
function applyRootLinks(nodes){nodes.forEach(n=>{n.gh=n.type==="external"?null:`https://github.com/Ventusltd/${n.label}`;n.ext=EXT_HOME[n.label]||PAGE_HOME[n.label]||null;});return nodes;}
applyRootLinks(ROOT_NODES);
const CHILD_NODES=[
  {label:"data-federation repo",type:"data",rag:"green",reason:"root of this child scope",gh:GH_BASE+"/tree/main"},
  {label:"live dashboard page",type:"ui",rag:"green",reason:"GitHub Pages browser UI in this repo",gh:GH_BASE+"/tree/main/live_sandbox/federation_control_ledger",ext:LIVE_PAGE},
  {label:"index.html",type:"ui",rag:"green",reason:"page shell for the board",gh:GH_BASE+"/blob/main/live_sandbox/federation_control_ledger/index.html"},
  {label:"app.js",type:"ui",rag:"green",reason:"board renderer and interaction logic",gh:GH_BASE+"/blob/main/live_sandbox/federation_control_ledger/app.js"},
  {label:"style.css",type:"ui",rag:"green",reason:"board visual system",gh:GH_BASE+"/blob/main/live_sandbox/federation_control_ledger/style.css"},
  {label:"data cartridge folder",type:"data",rag:"green",reason:"manifest, nodes, edges, layers, sectors",gh:GH_BASE+"/tree/main/live_sandbox/federation_control_ledger/data"},
  {label:"data/manifest.json",type:"data",rag:"amber",reason:"root cartridge manifest; key still flagged",gh:GH_BASE+"/blob/main/live_sandbox/federation_control_ledger/data/manifest.json"},
  {label:"data/nodes.json",type:"data",rag:"green",reason:"repo and source nodes for the board",gh:GH_BASE+"/blob/main/live_sandbox/federation_control_ledger/data/nodes.json"},
  {label:"data/edges.json",type:"data",rag:"green",reason:"relationship lines for the board",gh:GH_BASE+"/blob/main/live_sandbox/federation_control_ledger/data/edges.json"},
  {label:"reports folder",type:"unknown",rag:"green",reason:"scan reports and evidence",gh:GH_BASE+"/tree/main/reports"},
  {label:"FEDERATION_MAP_LATEST.md",type:"unknown",rag:"green",reason:"latest human-readable scan report",gh:GH_BASE+"/blob/main/reports/FEDERATION_MAP_LATEST.md"},
  {label:"every-drop-is-the-ocean",type:"unknown",rag:"green",reason:"canonical doctrine and addenda",gh:GH_BASE+"/tree/main/every-drop-is-the-ocean"},
  {label:"GitHub Pages",type:"external",rag:"blue",reason:"static public hosting",ext:LIVE_PAGE},
  {label:"GitHub Actions",type:"external",rag:"blue",reason:"future scanner and validation runner",ext:EXT_HOME["GitHub Actions"],gh:GH_BASE+"/actions"},
];
const CHILD_EDGES=[[0,1,"repo"],[1,2,"repo"],[1,3,"repo"],[1,4,"repo"],[1,5,"data"],[3,5,"data"],[5,6,"data"],[5,7,"data"],[5,8,"data"],[0,9,"governance"],[9,10,"governance"],[0,11,"governance"],[1,12,"external"],[0,13,"external"],[3,13,"external"]];
const SCOPES={"root":{label:"Federation",nodes:ROOT_NODES,edges:ROOT_EDGES},"data-federation":{label:"data-federation internals",nodes:CHILD_NODES,edges:CHILD_EDGES}};
const RAG={green:"#00ff88",amber:"#ffcc00",red:"#ff5555",blue:"#3aa0ff",grey:"#9298a6"};
const ECSS={data:"#00e5ff",governance:"#b47cff",archive:"#7da0c8",external:"#5f76a4",repo:"#b8ccff",workflow:"#00ffff"};
const BADGE={data:"DB",ui:"UI",homepage:"WEB",source_archive:"SRC",unknown:"REPO",external:"EXT"};
const REL={data:"data",governance:"governance",archive:"archive",external:"external",repo:"repo ref",workflow:"workflow"};
const SVGNS="http://www.w3.org/2000/svg";
let mode="both", action="explore", view="column", current=0, scopeKey="root", stack=[];
const sel=document.getElementById("focus"), overlay=document.getElementById("overlay"), elCount=document.getElementById("count"), elCrumbs=document.getElementById("crumbs"), elHint=document.getElementById("hint"), spiderToggle=document.getElementById("spiderToggle"), viewLabel=document.getElementById("viewLabel");
function S(){return SCOPES[scopeKey];}
function rebuildSelect(){sel.innerHTML="";S().nodes.forEach((n,i)=>{const o=document.createElement("option");o.value=i;o.textContent=n.label;sel.appendChild(o);});sel.value=current;}
sel.addEventListener("change",()=>{current=+sel.value;draw();});
document.querySelectorAll("#relSeg button").forEach(b=>b.addEventListener("click",()=>{mode=b.dataset.mode;document.querySelectorAll("#relSeg button").forEach(x=>x.setAttribute("aria-pressed",String(x===b)));draw();}));
document.querySelectorAll("#actSeg button").forEach(b=>b.addEventListener("click",()=>{if(b.disabled)return;action=b.dataset.act;document.querySelectorAll("#actSeg button").forEach(x=>x.setAttribute("aria-pressed",String(x===b)));draw();}));
spiderToggle.addEventListener("click",()=>{view=view==="spider"?"column":"spider";spiderToggle.setAttribute("aria-pressed",String(view==="spider"));viewLabel.textContent=view==="spider"?"Column":"Spider";draw();});
let rt;new ResizeObserver(()=>{clearTimeout(rt);rt=setTimeout(draw,80);}).observe(document.getElementById("stage"));
function actionable(n){return action==="explore" ? true : action==="github" ? !!n.gh : action==="external" ? !!n.ext : false;}
function openUrl(u){if(u)window.open(u,"_blank","noopener");}
function handleTap(i){const n=S().nodes[i];if(action==="explore"){current=i;sel.value=i;draw();}else if(action==="github"){openUrl(n.gh);}else if(action==="external"){openUrl(n.ext);}}
function drillInto(childKey){stack.push({key:scopeKey,current});scopeKey=childKey;current=0;mode="both";document.querySelectorAll("#relSeg button").forEach(x=>x.setAttribute("aria-pressed",String(x.dataset.mode==="both")));rebuildSelect();draw();}
function popTo(idx){const target=stack[idx];stack=stack.slice(0,idx);scopeKey=target.key;current=target.current;rebuildSelect();draw();}
function neighbours(idx){const out=[],inc=[];S().edges.forEach(([f,t,ty])=>{if(f===idx)out.push({other:t,type:ty});if(t===idx)inc.push({other:f,type:ty});});return {out,inc};}
function cardInner(node,opts={}){const center=opts.center, rel=opts.rel, dim=opts.dim;let relHTML="";if(rel){const c=ECSS[rel.type]||ECSS.repo;relHTML=`<div class="relrow"><span class="arrow">${rel.dir==="out"?"depends on →":"← depended on by"}</span><span class="reltag" style="color:${c}">${REL[rel.type]||rel.type}</span>${opts.go?`<span class="go">${opts.go}</span>`:""}</div>`;}let contents="";i  … [line shortened here: 959 characters; full line on GitHub]
function setHint(){const base={explore:"<b>Explore</b> — tap a card to re-centre. Use the spider only when you choose it.",github:"<b>GitHub</b> — tap a repo to open it. Cards with no repo are dimmed.",external:"<b>External</b> — tap an external system to open it. Others are dimmed."};elHint.innerHTML=(base[action]||"")+(view==="spider"?" &nbsp; <b>Spider view</b> — scroll or drag the large canvas  … [line shortened here: 408 characters; full line on GitHub]
function setCrumbs(){elCrumbs.innerHTML="";const trail=[...stack.map((s,i)=>({label:SCOPES[s.key].label,idx:i})),{label:S().label,idx:-1}];trail.forEach((c,k)=>{if(k)elCrumbs.insertAdjacentHTML("beforeend",`<span class="sep">›</span>`);if(c.idx===-1){const s=document.createElement("strong");s.textContent=c.label;s.style.color="var(--text)";elCrumbs.appendChild(s);}else{const a=document.createEleme  … [line shortened here: 504 characters; full line on GitHub]
function draw(){const nodes=S().nodes,focus=nodes[current];let {out,inc}=neighbours(current);let lo=mode==="in"?[]:out,li=mode==="out"?[]:inc;elCount.innerHTML=`<b>${out.length}</b> dependencies &nbsp;·&nbsp; <b>${inc.length}</b> dependents`;setHint();setCrumbs();overlay.innerHTML="";overlay.className="overlay "+view;if(view==="spider")drawSpider(focus,lo,li);else drawColumn(focus,lo,li);overlay.q  … [line shortened here: 523 characters; full line on GitHub]
function drawColumn(focus,out,inc){const nodes=S().nodes;const shell=document.createElement("div");shell.className="shell";shell.innerHTML=`<div class="focuswrap">${cardInner(focus,{center:true,dim:!actionable(focus),go:goLabel(focus)})}</div>`;const section=(title,items,dir)=>{const s=document.createElement("div");s.innerHTML=`<div class="sect">${title}</div>`;if(!items.length){const e=document.c  … [line shortened here: 1,162 characters; full line on GitHub]
function marker(defs,type){const m=document.createElementNS(SVGNS,"marker");m.id="arr-"+type;m.setAttribute("viewBox","0 0 10 10");m.setAttribute("refX","9");m.setAttribute("refY","5");m.setAttribute("markerWidth","8");m.setAttribute("markerHeight","8");m.setAttribute("orient","auto");const p=document.createElementNS(SVGNS,"path");p.setAttribute("d","M0,0 L10,5 L0,10 z");p.setAttribute("fill",ECSS  … [line shortened here: 457 characters; full line on GitHub]
function distribute(items,side,cx,cy,gap,xGap){const n=items.length;if(!n)return[];return items.map((it,k)=>{const y=cy+(k-(n-1)/2)*gap;const stagger=(n>5&&k%2?90:0);const x=cx+side*(xGap+stagger);return{...it,dir:side>0?"out":"in",x,y};});}
function drawSpider(focus,out,inc){const stage=document.getElementById("stage");const sw=stage.clientWidth,sh=stage.clientHeight;const maxSide=Math.max(out.length,inc.length,1);const gap=176;const xGap=Math.max(420,260+maxSide*38);const cw=Math.max(sw,Math.ceil(680+xGap*2+maxSide*120));const ch=Math.max(sh,Math.ceil(520+gap*(maxSide+1)));const cx=cw/2,cy=ch/2;const pts=[...distribute(out,1,cx,cy,g  … [line shortened here: 2,606 characters; full line on GitHub]
function enableDragPan(el){let down=false,sx=0,sy=0,sl=0,st=0;el.onpointerdown=e=>{if(e.target.closest("button,select"))return;down=true;sx=e.clientX;sy=e.clientY;sl=el.scrollLeft;st=el.scrollTop;el.classList.add("dragging");el.setPointerCapture(e.pointerId);};el.onpointermove=e=>{if(!down)return;el.scrollLeft=sl-(e.clientX-sx);el.scrollTop=st-(e.clientY-sy);};el.onpointerup=e=>{down=false;el.clas  … [line shortened here: 549 characters; full line on GitHub]
const DATA_BASE="../../live_sandbox/federation_control_ledger/data/";
const CHILD_KEY="data-federation";
function reshapeNodes(fc){return (fc.features||[]).map(f=>{const p=f.properties||{};const cm=p.child_manifest||null;return {label:p.label||f.id,type:p.repo_type||p.scope_type||"unknown",rag:p.rag||p.status||"grey",reason:p.status_reason||"",child:(cm&&/data-federation/.test(cm))?CHILD_KEY:null};});}
async function loadJSON(path){const r=await fetch(DATA_BASE+path,{cache:"no-cache"});if(!r.ok)throw new Error(path+" "+r.status);return r.json();}
async function loadRoot(){try{const [nf,ef]=await Promise.all([loadJSON("nodes.json"),loadJSON("edges.json")]);const nodes=reshapeNodes(nf);if(!nodes.length)throw new Error("empty");applyRootLinks(nodes);SCOPES.root.nodes=nodes;SCOPES.root.edges=(ef.edges||[]).map(e=>[e[0],e[1],e[2]]);return "live";}catch(e){return "snapshot";}}
const CONTENTS_BASE="../data/federation_map/contents/provenance=declared/repo=Ventusltd__globalgrid2050/";
const MONO_GH="https://github.com/Ventusltd/globalgrid2050";
const CONTENTS_KEY="globalgrid2050-contents";
async function loadContents(){try{const get=p=>fetch(CONTENTS_BASE+p,{cache:"no-cache"}).then(r=>{if(!r.ok)throw new Error(p+" "+r.status);return r.json();});const [mf,nf,ef]=await Promise.all([get("manifest.json"),get("nodes.json"),get("edges.json")]);if(!Array.isArray(nf)||!nf.length)throw new Error("empty nodes");BADGE.eye_app="EYE";BADGE.sense_app="SENSE";BADGE.served_surface="PAGE";REL.contai  … [line shortened here: 1,115 characters; full line on GitHub]
(async()=>{const src=await loadRoot();await loadContents();const tag=document.getElementById("srcTag");if(tag){tag.textContent=src;tag.classList.toggle("live",src==="live");}rebuildSelect();draw();})();
</script>
</body>
</html>