GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / AI agents and coordination / gemini / scripts

GlobalGrid2050 Verify VEDIC Homepage Release and 4 more files

A Python command-line tool in the scripts folder that fetches anatomy, translation geodesy, nearest spider and dictionary, using SHA-256 from the vedic- repository.

611 lines of Python and HTML and CSS from gemini, globalgrid2050, in 5 files. Topic: AI agents and coordination. Section 1620 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. Gemini Verify All Claims geodesy · gemini / scripts/verify_all_claims.py lines 1–179
  2. Test Manifest test · gemini / tests/test_manifest.py lines 1–84
  3. UI Gemini render · gemini / ui/gemini.css lines 1–18
  4. Gemini — UI Page render · gemini / ui/index.html lines 1–19
  5. GlobalGrid2050 Verify VEDIC Homepage Release automation · globalgrid2050 / scripts/verify_vedic_homepage_release.py lines 1–311

Gemini Verify All Claims

A Python command-line tool in the scripts folder that reads GB transmission network, connection points, wider fleet and transformers.

geodesygemini / scripts/verify_all_claims.py · lines 1–179 of 179 · Entry point · pattern haversine_km (shared by 7 files)

What it does
It loads GB transmission network, connection points, wider fleet and transformers. Defines haversine_km, run_audit, normalise. Uses libraries json, math, os, re, collections. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage agent_infra (repository name word 'gemini'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief). Domain terms in the code: transformers, 400kV, 275kV, 132kV, 66kV, 33kV.
Inputs & outputs
In: JSON file gb-transmission-network.v1.json; JSON file connection-points.v3.json; JSON file 202609030009-wider-fleet.json. Voltage levels named: 400kV, 275kV, 132kV, 66kV, 33kV, 11kV.
Downstream impact
It is itself an entry point (Python CLI); no other file was found loading it.
What it achieves
It runs audit (`run_audit`) and is built from the haversine km helper (`haversine_km`) and the normalise step (`normalise`). Independent Multi-Agent Claims Verification Script. Computes directly from raw JSON files in data-grid-GB, PipelineNews, and GridAtlas.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
gemini · scripts · Python CLI
Uses
json, math, os, re, collections
Used by
none found
Produces
haversine_km, run_audit
Defines here
haversine_km, run_audit, normalise
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
gemini@bf5d9f7de72c07ce57ec64864ac5181cc46c8381 scripts/verify_all_claims.py:1-179 · blob a6a98ad4bac63362b9b6e8acb49f89a740b412ff · GitHub at these lines
State
achieves: comment · context: auto · stage: ingest · effects: filesystem · domain stage: agent_infra · users: ai_agent · canonical: unknown
#!/usr/bin/env python3
"""
Independent Multi-Agent Claims Verification Script
Computes directly from raw json files in data-grid-gb, pipelinenews, and gridatlas.
Zero external dependencies, standard library only.
"""

import json
import math
import os
import re
from collections import Counter, defaultdict

GITHUB = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
GRID_GB = os.path.join(GITHUB, "data-grid-gb")
GRIDATLAS = os.path.join(GITHUB, "gridatlas")
PIPELINENEWS = os.path.join(GITHUB, "pipelinenews")

def haversine_km(lat1, lon1, lat2, lon2):
    R = 6371.0088  # Earth radius in km
    phi1, phi2 = math.radians(lat1), math.radians(lat2)
    dphi = math.radians(lat2 - lat1)
    dlambda = math.radians(lon2 - lon1)
    a = math.sin(dphi / 2)**2 + math.cos(phi1) * math.cos(phi2) * math.sin(dlambda / 2)**2
    c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a))
    return R * c

def run_audit():
    print("=" * 80)
    print("INDEPENDENT MULTI-AGENT CLAIMS VERIFICATION (DATA AUDIT)")
    print("=" * 80)

    net_path = os.path.join(GRID_GB, "derived", "gb-transmission-network.v1.json")
    cp_path = os.path.join(GRID_GB, "derived", "connection-points.v3.json")

    if not os.path.exists(net_path) or not os.path.exists(cp_path):
        print(f"ERROR: Missing derived data files in {GRID_GB}/derived/")
        return

    with open(net_path, encoding="utf-8") as f:
        net = json.load(f)
    with open(cp_path, encoding="utf-8") as f:
        cp = json.load(f)

    # 1. COWLEY
    print("\n[1] COWLEY SUBSTATION CLAIMS")
    cowl_cp = [p for p in cp["connection_points"] if p.get("site_code") == "COWL"][0]
    print(f"  Site Name: {cowl_cp['name']} (Code: {cowl_cp['site_code']})")
    print(f"  Owner: {cowl_cp['transmission_owner']}, Declared Voltages: {cowl_cp['voltages_kv']}")
    print(f"  Published Circuits: {cowl_cp['circuits']}")
    print(f"  Published Transformers: {cowl_cp['transformers']} (CARD CLAIM: 10)")
    print(f"  Winter MVA: {cowl_cp['circuit_winter_rating_mva']['min']} - {cowl_cp['circuit_winter_rating_mva']['max']} MVA")
    print(f"  Planned Changes: {cowl_cp['planned_changes']} across years {cowl_cp['planned_change_years']}")

    fc_132 = cowl_cp["fault_current_by_voltage"]["132"]["peak"]
    fc_400 = cowl_cp["fault_current_by_voltage"]["400"]["peak"]
    peak_rows = fc_132["scenarios"] + fc_400["scenarios"]
    peak_buses = set(fc_132["locations"] + fc_400["locations"])
    min_break = min(fc_132["metrics"]["three_phase_rms_break_current_ka"]["min"], fc_400["metrics"]["three_phase_rms_break_current_ka"]["min"])
    max_break = max(fc_132["metrics"]["three_phase_rms_break_current_ka"]["max"], fc_400["metrics"]["three_phase_rms_break_current_ka"]["max"])
    print(f"  Peak Fault Rows: {peak_rows} across {len(peak_buses)} buses ({sorted(list(peak_buses))})")
    print(f"  RMS Break Current: {min_break:.1f} - {max_break:.1f} kA (Exact: {min_break} to {max_break} kA)")

    node_to_site = {n["node"]: n["site_code"] for n in net["nodes"]}
    node_to_kv = {n["node"]: n["voltage_kv"] for n in net["nodes"]}

    cowl_xfmrs = [t for t in net["transformers"] if node_to_site.get(t["node_1"]) == "COWL" or node_to_site.get(t["node_2"]) == "COWL"]
    print(f"  Physical Transformers in Network Model at Cowley: {len(cowl_xfmrs)}")
    for t in cowl_xfmrs:
        print(f"    {t['node_1']} ({node_to_kv.get(t['node_1'])}kV) <-> {t['node_2']} ({node_to_kv.get(t['node_2'])}kV): {t['rating_mva']} MVA")

    # 2. TRANSFORMER DOUBLE COUNT
    print("\n[2] ESTATE-WIDE TRANSFORMER COUNT AUDIT (CLAIM F3)")
    total_transformers = net["transformers"]
    intra_site = sum(1 for t in total_transformers if node_to_site.get(t["node_1"]) == node_to_site.get(t["node_2"]))
    
    site_physical_xfmr = defaultdict(list)
    for t in total_transformers:
        s1 = node_to_site.get(t["node_1"])
        s2 = node_to_site.get(t["node_2"])
        if s1 == s2:
            site_physical_xfmr[s1].append(t)
        else:
            site_physical_xfmr[s1].append(t)
            site_physical_xfmr[s2].append(t)

    sites_with_xfmrs = [p for p in cp["connection_points"] if p["transformers"] > 0 or len(site_physical_xfmr[p["site_code"]]) > 0]
    inflated_sites = []
    sum_physical = sum(len(site_physical_xfmr[p["site_code"]]) for p in sites_with_xfmrs)
    sum_displayed = sum(p["transformers"] for p in sites_with_xfmrs)

    for p in sites_with_xfmrs:
        code = p["site_code"]
        phys = len(site_physical_xfmr[code])
        disp = p["transformers"]
        if disp > phys:
            inflated_sites.append((code, p["name"], phys, disp))

    print(f"  Total physical transformers in gb-transmission-network: {len(total_transformers)}")
    print(f"  Intra-site transformers (both windings at same site): {intra_site} ({intra_site/len(total_transformers)*100:.2f}%)")
    print(f"  Sites with transformers: {len(sites_with_xfmrs)}")
    print(f"  Sites where displayed count > physical units: {len(inflated_sites)} ({len(inflated_sites)/len(sites_with_xfmrs)*100:.2f}%)")
    print(f"  Total sum of displayed transformer presences: {sum_displayed}")
    print(f"  Total sum of physical transformer presences: {sum_physical} (Overstatement ratio: {sum_displayed/sum_physical:.2f}x)")

    # 3. NAME NORMALISATION COLLISIONS
    print("\n[3] SUBSTATION NAME NORMALISATION COLLISIONS (CLAIM F2)")
    NOISE_RE = re.compile(r'\b(SUBSTATION|SUB STATION|SUBSTN|GRID|SUPPLY|POINT|GSP|NATIONAL|POWER|STATION|WIND|FARM|WINDFARM|OFFSHORE|ONSHORE|EXTENSION|400KV|275KV|132KV|66KV|33KV|11KV|NGET|SSE|SP|SHE)\b', re.IGNORECASE)
    def normalise(name):
        s = re.sub(r'[^A-Z0-9 ]', ' ', str(name or '').upper())
        return ' '.join(NOISE_RE.sub(' ', s).split())

    raw_site_names = set(p["name"] for p in cp["connection_points"])
    norm_to_names = defaultdict(set)
    for p in cp["connection_points"]:
        norm_to_names[normalise(p["name"])].add(p["name"])

    colliding = {k: v for k, v in norm_to_names.items() if len(v) > 1}
    total_colliding = sum(len(v) for v in colliding.values())
    print(f"  Total distinct site names in connection-points: {len(raw_site_names)}")
    print(f"  Total distinct normalized keys: {len(norm_to_names)}")
    print(f"  Colliding keys (mapped to 2+ distinct original sites): {len(colliding)}")
    print(f"  Sites swallowed inside colliding keys: {total_colliding} ({total_colliding/len(raw_site_names)*100:.2f}% of network)")

    # 4. GEOCODING COVERAGE
    print("\n[4] CONNECTION POINTS GEOCODING COVERAGE (CLAIM F4)")
    total_pts = len(cp["connection_points"])
    located = [p for p in cp["connection_points"] if p.get("location") and p["location"].get("lat") is not None]
    print(f"  Total connection points: {total_pts}")
    print(f"  Located points (with coordinates): {len(located)} ({len(located)/total_pts*100:.2f}%)")
    print(f"  Unlocated points (blind to nearest-search): {total_pts - len(located)} ({(total_pts - len(located))/total_pts*100:.2f}%)")

    # 5. CABLE CIRCUITS BENCHMARK
    print("\n[5] THE 95 CABLE CIRCUITS BENCHMARK & MULTIPLIER K=1.245")
    site_locs = {p["site_code"]: (p["location"]["lat"], p["location"]["lon"]) for p in cp["connection_points"] if p.get("location") and p["location"].get("lat") is not None}
    cable_candidates = []
    for c in net["circuits"]:
        cable_km = c.get("cable_km")
        s1 = node_to_site.get(c["node_1"])
        s2 = node_to_site.get(c["node_2"])
        if s1 != s2 and cable_km and float(cable_km) > 0 and (c.get("ohl_km") or 0) == 0:
            if s1 in site_locs and s2 in site_locs:
                lat1, lon1 = site_locs[s1]
                lat2, lon2 = site_locs[s2]
                cable_candidates.append({
                    "s1": s1, "s2": s2,
                    "cable_km": float(cable_km),
                    "straight_km": haversine_km(lat1, lon1, lat2, lon2)
                })

    print(f"  Total fully-buried cable circuits with known endpoint coordinates: {len(cable_candidates)}")
    impossible = [c for c in cable_candidates if c["straight_km"] > c["cable_km"]]
    print(f"  Geometrically impossible circuits (straight > published): {len(impossible)}")
    
    raw_errs = sorted([abs(c["straight_km"] - c["cable_km"]) / c["cable_km"] * 100 for c in cable_candidates])
    k_errs = sorted([abs(c["straight_km"] * 1.245 - c["cable_km"]) / c["cable_km"] * 100 for c in cable_candidates])
    print(f"  Raw straight-line median absolute error: {raw_errs[len(raw_errs)//2]:.2f}%")
    print(f"  Straight line * 1.245 median absolute error: {k_errs[len(k_errs)//2]:.2f}%")
    print(f"  Circuits within 15% error with k=1.245: {sum(1 for e in k_errs if e <= 15)/len(k_errs)*100:.1f}%")

    # 6. WIDER FLEET VERIFICATION
    print("\n[6] PIPELINENEWS WIDER FLEET REPD REFERENCE VERIFICATION")
    wf_file = os.path.join(PIPELINENEWS, "releases", "202609030009-pipelinenews", "data", "202609030009-wider-fleet.json")
    if os.path.exists(wf_file):
        with open(wf_file, encoding="utf-8") as f:
            wf = json.load(f)
        resolved = [r for r in wf if r.get("ref")]
        print(f"  Total wider fleet projects in 202609030009: {len(wf)}")
        print(f"  Projects with resolved REPD reference: {len(resolved)} ({len(resolved)/len(wf)*100:.2f}%)")
        rainham = [r for r in wf if "Rainham Phase II" in r.get("n", "")]
        if rainham:
            print(f"  Rainham Phase II: ref={rainham[0].get('ref')}, ll={rainham[0].get('ll')}")

    print("\n" + "=" * 80)
    print("AUDIT COMPLETE")
    print("=" * 80)

if __name__ == "__main__":
    run_audit()

Test Manifest

A test in the tests folder of Gemini that uses SHA-256. It is built from the manifest tests class (`ManifestTests`), the links class (`Links`) and the handle starttag helper (`handle_starttag`).

testgemini / tests/test_manifest.py · lines 1–84 of 84 · Entry point · pattern Links (shared by 3 files)

What it does
It tests its inputs. Defines 11 functions or classes, including ManifestTests, test_published_artifacts, test_static_directory, Links, __init__. Uses libraries hashlib, json, pathlib, unittest, html.parser. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage agent_infra (repository name word 'gemini'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
Inputs & outputs
In: JSON file SOURCES.json.
Downstream impact
Used directly by 1 file: Publish Gemini Bridge Workflow (gemini).
What it achieves
Defines `ManifestTests`, `test_published_artifacts`, `test_static_directory` and 6 more.
Why it matters
Run by Publish Gemini Bridge Workflow.
Application
gemini · tests · test
Uses
hashlib, json, pathlib, unittest, html.parser, xml.etree.ElementTree
Used by
run by Publish Gemini Bridge Workflow (workflow run)
Produces
ManifestTests
Defines here
ManifestTests, test_published_artifacts, test_static_directory, Links, __init__, handle_starttag, test_static_homepage, Links, __init__, handle_starttag, test_packets_and_discovery
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
gemini@bf5d9f7de72c07ce57ec64864ac5181cc46c8381 tests/test_manifest.py:1-84 · blob 485f945b8fd49b572ffb6acaf26a89ff43e342cf · GitHub at these lines
State
achieves: name · context: auto · stage: ingest · effects: filesystem · domain stage: agent_infra · users: ai_agent · canonical: unknown
import hashlib
import json
import pathlib
import unittest

class ManifestTests(unittest.TestCase):
    def test_published_artifacts(self):
        root = pathlib.Path(__file__).resolve().parents[1] / "docs"
        m = json.loads((root / "MANIFEST.json").read_text())
        self.assertGreaterEqual(len(m["artifacts"]), 8)
        seen = set()
        for a in m["artifacts"]:
            rel = a["pages_url"].removeprefix(m["pages_base_url"])
            self.assertNotIn(rel, seen)
            seen.add(rel)
            self.assertEqual(hashlib.sha256((root / rel).read_bytes()).hexdigest(), a["sha256"])
        self.assertIn("CONTEXT_BUNDLE.md", seen)
        self.assertIn("ACTIVE_TASKS.md", seen)
        self.assertIn("files/context/SOURCES.json", seen)
        self.assertIn(m["source_commit"], (root/"index.html").read_text())

    def test_static_directory(self):
        from html.parser import HTMLParser
        root = pathlib.Path(__file__).resolve().parents[1] / "docs"
        page = (root / "index.html").read_text()
        class Links(HTMLParser):
            def __init__(self):
                super().__init__()
                self.links = []
                self.tags = []
            def handle_starttag(self, tag, attrs):
                self.tags.append(tag)
                self.links.extend(v for k, v in attrs if k == "href")
        parser = Links()
        parser.feed(page)
        self.assertNotIn("script", parser.tags)
        self.assertNotIn("@@", page)
        self.assertIn("GLOBALGRID2050 / GEMINI", page)
        self.assertIn("Genome Spider", page)
        self.assertIn("assets/globalgrid2050.css", parser.links)
        self.assertIn("assets/gemini.css", parser.links)
        for href in parser.links:
            if not href.startswith(("https://", "#")):
                self.assertTrue((root / href).is_file(), href)

    def test_static_homepage(self):
        from html.parser import HTMLParser
        root = pathlib.Path(__file__).resolve().parents[1] / "docs"
        class Links(HTMLParser):
            def __init__(self):
                super().__init__()
                self.local = []
            def handle_starttag(self, tag, attrs):
                self_test.assertNotEqual(tag, "script")
                for name, value in attrs:
                    if name in ("href", "src") and value and "://" not in value and not value.startswith("#"):
                        self.local.append(value)
        self_test = self
        parser = Links()
        home = (root/"index.html").read_text()
        parser.feed(home)
        for path in parser.local:
            self.assertTrue((root/path).is_file(), path)
        for path in ("MANIFEST.json","CONTEXT_BUNDLE.md","ACTIVE_TASKS.md","assets/globalgrid2050.css","assets/gemini.css"):
            self.assertIn(path, parser.local)
        self.assertIn("GLOBALGRID2050 / GEMINI", home)
        self.assertIn("class=\"stories\"", home)
        self.assertIn("class=\"title\"", home)

    def test_packets_and_discovery(self):
        import xml.etree.ElementTree as ET
        root = pathlib.Path(__file__).resolve().parents[1] / "docs"
        m = json.loads((root/"MANIFEST.json").read_text())
        ids = {a["id"] for a in m["artifacts"]}
        urls = {x.text for x in ET.parse(root/"sitemap.xml").getroot().iter("{http://www.sitemaps.org/schemas/sitemap/0.9}loc")}
        for slug in ("satnav-concept","gridatlas","ventus-grid-engine","genome-spider","vedic-index","kuiper-directory"):
            for ext in ("html","md"):
                p = "packets/"+slug+"."+ext
                self.assertIn(p, ids)
                self.assertIn(m["pages_base_url"]+p, urls)
                self.assertLessEqual((root/p).stat().st_size, 15000)
            self.assertIn("packets/"+slug+".html",(root/"index.html").read_text())
        self.assertIn("handoff/GEMINI_INC_001.md",ids)
        self.assertIn("Sitemap: "+m["pages_base_url"]+"sitemap.xml",(root/"robots.txt").read_text())

UI Gemini

A style sheet covering solar. Served with the page at https://ventusltd.github.io/gemini/ui/.

rendergemini / ui/gemini.css · lines 1–18 of 18 · Not reached from any entry point (candidate for review)

What it does
Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage agent_infra (path word 'gemini'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief). Domain terms in the code: solar.
What it achieves
Pipeline News foundation adapted for Gemini: source, `ui/styles/202608261740-v7-foundation.css`.
Why it matters
No other file in the estate was found to import it.
Application
gemini · ui · style sheet
Uses
none found
Used by
none found
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
gemini@bf5d9f7de72c07ce57ec64864ac5181cc46c8381 ui/gemini.css:1-18 · blob dfc02ad2c97e14cbbf9b9bb7e3a641e7515611d3 · GitHub at these lines
State
achieves: comment · context: auto · stage: output · effects: dom · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
/* Pipeline News foundation adapted for Gemini: source e35c772, ui/styles/202608261740-v7-foundation.css. */
.gemini-feed{--panel:#0b0e14;--solar:#66ccff;--accent:#00ffff;--ok:#00ff88;min-width:0;margin:24px 0}
.gemini-feed .newspaper{border:1px solid #424b55;background:#06080b;margin-bottom:28px;box-shadow:0 0 22px rgba(0,255,255,.04)}
.gemini-feed .masthead{padding:16px 18px 12px;border-bottom:1px solid #424b55}
.gemini-feed .masthead h2{font-size:24px;line-height:1;color:#fff;letter-spacing:2px}
.gemini-feed .masthead h2 span{color:var(--solar)}
.gemini-feed .strap{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-top:8px;color:#8e98a5;font-size:10px;text-transform:uppercase}
.gemini-feed .stories{display:grid;grid-template-columns:repeat(3,minmax(280px,1fr));align-items:stretch}
.gemini-feed .story{display:block;padding:18px;border-right:1px solid #252a31;border-bottom:1px solid #252a31;text-decoration:none;min-height:180px;background:#07090c}
.gemini-feed .story:hover{background:#0b0f14}
.gemini-feed .story .kicker{font-size:10px;font-weight:bold;letter-spacing:.5px}
.gemini-feed .story h3{color:#fff;font-size:17px;line-height:1.28;margin:9px 0 12px}
.gemini-feed .story p{color:#aeb6c1;font-size:11px;line-height:1.55}
.gemini-feed .story .source{display:block;color:#7f8996;margin-top:12px;font-size:10px}
.gemini-feed .stories{grid-template-columns:repeat(2,minmax(280px,1fr))}
.gemini-feed .masthead h2{font-size:20px}
.gemini-feed .stories{grid-template-columns:1fr}
.gemini-feed .stories{grid-template-columns:repeat(2,minmax(0,1fr))}.gemini-feed .story{min-height:0;overflow-wrap:anywhere}.gemini-feed .story .kicker{color:var(--cyan);text-transform:uppercase}.gemini-feed .story p{font-size:13px}.gemini-feed .story .source{color:#bbb}.gemini-feed .masthead h2{font-size:18px;line-height:1.4}.gemini-feed .strap{color:#bbb}.bridge-meta{font-size:12px;color:var(--m  … [line shortened here: 1,532 characters; full line on GitHub]

Gemini — UI Page

A web page. Published at https://ventusltd.github.io/gemini/ui/.

rendergemini / ui/index.html · lines 1–19 of 19 · Entry point

What it does
It draws its content. Uses libraries assets/globalgrid2050.css, assets/gemini.css. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage agent_infra (repository name word 'gemini'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
Inputs & outputs
Out: web page.
Downstream impact
It is itself an entry point, published at https://ventusltd.github.io/gemini/ui/.
What it achieves
Public engineering context and evidence for Gemini, Claude and ChatGPT.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
gemini · ui · page
Uses
assets/globalgrid2050.css, assets/gemini.css
Used by
none found
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
gemini@bf5d9f7de72c07ce57ec64864ac5181cc46c8381 ui/index.html:1-19 · blob 3d0b839bd94bec9b8f8ca2930d1df1e8fd434e8b · GitHub at these lines
State
achieves: comment · context: auto · stage: output · effects: dom · domain stage: agent_infra · users: ai_agent · canonical: unknown
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Gemini | GlobalGrid2050</title><meta name="description" content="Public engineering context and evidence for Gemini, Claude and ChatGPT."><link rel="stylesheet" href="assets/globalgrid2050.css"><link rel="stylesheet" href="assets/gemini.css"></head>
<body>
<header><h1 class="brand">GLOBALGRID2050 / GEMINI</h1><p class="mission">Engineering intelligence, shared evidence and reusable software for the world's electricity systems.</p></header>
<main>
<nav class="bridge-nav" aria-label="Primary navigation"><a href="https://www.globalgrid2050.com/">GlobalGrid2050</a><a href="MANIFEST.json">Manifest</a><a href="CONTEXT_BUNDLE.md">Context bundle</a><a href="ACTIVE_TASKS.md">Active tasks</a><a href="#instruments">Instruments</a><a href="#handoff">Handover</a></nav>
<div class="bridge-meta"><span><strong>Source revision</strong> <code>@@SHA@@</code></span><span><strong>Source UTC</strong> <time>@@STAMP@@</time></span><span><strong>@@COUNT@@</strong> published artifacts</span><span><strong>@@REPOS@@</strong> pinned repositories</span></div>
<section class="gemini-feed" aria-label="Engineering briefings"><div class="newspaper"><div class="masthead"><h2>GLOBALGRID2050 <span>GEMINI BRIEFING</span></h2><div class="strap"><span>Engineering context · read only</span><span>Increment 001</span></div></div><div class="stories">@@CARDS@@</div></div></section>
<h2 class="sections-heading">Browse sections</h2>
<section aria-label="Engineering directory">
<details id="instruments" open><summary><span class="number">01</span><span class="title">Intellectual instruments<small>Spider · Genome Spider · Kuiper · Vedic</small></span></summary><div class="inside"><p>Discover dependencies, inspect evidence and reuse existing commands before writing new code.</p><ul class="bridge-sources">@@SOURCES@@</ul></div></details>
<details id="context" open><summary><span class="number">02</span><span class="title">Engineering context<small>Public files, manifest and active assignments</small></span></summary><div class="inside"><a class="launch" href="CONTEXT_BUNDLE.md">Read complete context &rarr;</a><ul class="bridge-artifacts">@@ARTIFACTS@@</ul></div></details>
<details id="handoff"><summary><span class="number">03</span><span class="title">Agent handover<small>Gemini · Claude · ChatGPT</small></span></summary><div class="inside"><p>Review source pins, register a bounded assignment, return a patch and reproducible evidence. No automatic production merge.</p><a class="launch" href="files/handoff/GEMINI_NOTES.md">Open handover &rarr;</a></div></details>
</section>
<p class="bridge-note">Source timestamps and digests describe the published snapshot, not live acceptance or deployment of upstream software.</p>
</main>
<footer><p>Ventus Ltd · GlobalGrid2050 · Public AI interoperability</p><p><a href="MANIFEST.json">Machine-readable manifest</a> · <a href="https://github.com/Ventusltd/gemini">Source repository</a></p></footer>
</body></html>

GlobalGrid2050 Verify VEDIC Homepage Release

A Python command-line tool in the scripts folder that fetches anatomy, translation geodesy, nearest spider and dictionary, using SHA-256 from the vedic- repository.

automationglobalgrid2050 / scripts/verify_vedic_homepage_release.py · lines 1–311 of 311 · Entry point · pattern verify_release (shared by 3 files)

What it does
It fetches anatomy, translation geodesy, nearest spider and dictionary. Defines 12 functions or classes, including sha, read, match, verify_release, verify_command_root. Uses libraries hashlib, json, os, pathlib, re. Side effects: reads or writes files; makes network requests; starts processes.
Why it exists in the grid workflow
Domain stage agent_infra (path word 'vedic'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
Inputs & outputs
In: data source: vedic- data; JSON file anatomy.json; JSON file translation-geodesy.json; JSON file nearest-spider.json; JSON file dictionary.json; JSON file release.json; JSON file command-index.json; JSON file vedic-v3-release.json. Out: JSON file homepage-owner.json.
Downstream impact
Used directly by 1 file: GlobalGrid2050 VEDIC Homepage Promotion Workflow (globalgrid2050).
What it achieves
It verifies release (`verify_release`), verifies command root (`verify_command_root`) and checks evidence only (`check_evidence_only`). Exact release and homepage verification for the manifest-driven VEDIC promotion. It reads `release.json`.
Why it matters
Run by GlobalGrid2050 VEDIC Homepage Promotion Workflow.
Application
globalgrid2050 · scripts · Python CLI
Uses
GlobalGrid2050 Import Homepage Owner (script call), GlobalGrid2050 Measure Homepage Version (script call), VEDIC — Index Page (estate URL), hashlib, json, os, pathlib, re, shutil, subprocess, sys
Used by
run by GlobalGrid2050 VEDIC Homepage Promotion Workflow (workflow run)
Produces
sha, read, match, verify_release, verify_command_root, check_evidence_only, verify_evidence_only, import_bundle, compare_catalogues, verify_command_successor, main
Defines here
sha, read, match, verify_release, verify_command_root, check_evidence_only, verify_evidence_only, payload, import_bundle, compare_catalogues, verify_command_successor, main
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 scripts/verify_vedic_homepage_release.py:1-311 · blob 73c94f259c86d939a8d9c32a06d666a1038d5bd9 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem, network, process · domain stage: agent_infra · users: ai_agent · canonical: production_core
"""Exact release and homepage verification for the manifest-driven VEDIC promotion."""
import hashlib
import json
import os
import pathlib
import re
import shutil
import subprocess
import sys
import tempfile
import time
from urllib.request import Request, urlopen

ROOT = pathlib.Path.cwd()
PUBLIC_FILES = {"index.html","data/anatomy.json","data/translation-geodesy.json","data/nearest-spider.json","data/dictionary.json"}
DOMAIN = "https://globalgrid2050.com/"
def sha(data):
    return hashlib.sha256(data).hexdigest()
def read(url):
    with urlopen(Request(url,headers={"User-Agent":"GlobalGrid2050-VEDIC-release-verifier","Cache-Control":"no-cache"}),timeout=30) as response:
        assert response.status == 200,url
        raw=response.read(1000001)
        assert 0<len(raw)<=1000000,url
        return raw
def match(url,wanted):
    for i in range(6):
        try:
            got=read(url+("?" if "?" not in url else "&")+"vedic-v2-check="+str(i))
            if got==wanted:
                print("MATCH",url,sha(got),flush=True)
                return
        except Exception as exc:
            print("RETRY",url,type(exc).__name__,flush=True)
        time.sleep(5)
    raise AssertionError("Public bytes not verified: "+url)
def verify_release(release):
    url=release["url"]
    manifest_raw=read(url+"release.json")
    assert sha(manifest_raw)==release["manifest_sha256"],"served release manifest changed"
    manifest=json.loads(manifest_raw)
    assert manifest["schema"]=="vedic.pages.release.v1"
    assert manifest["version"]==release["version"] and manifest["source_commit"]==release["source_commit"]
    assert manifest["row_count"]==release["row_count"]
    assert set(manifest["files"])==PUBLIC_FILES
    raw_base="https://raw.githubusercontent.com/Ventusltd/vedic-/"+release["source_commit"]+"/"
    for f,digest in manifest["files"].items():
        wanted=read(raw_base+f)
        assert sha(wanted)==digest,(f,"source/manifest mismatch")
        if f=="data/dictionary.json":
            rows=json.loads(wanted)["entries"]
            assert len(rows)==release["row_count"]==len({e["gg_id"] for e in rows})
        match(url+f,wanted)
        if release.get("root_alias"):
            match(release["root_alias"]+f,wanted)
    if release.get("root_alias"):
        match(release["root_alias"]+"release.json",manifest_raw)
def verify_command_root(target):
    """Retain the original promotion evidence while checking the stable destination."""
    git_base = "https://raw.githubusercontent.com/Ventusltd/vedic-/"
    baseline_pin = target["source_commit"]
    assert re.fullmatch(r"[0-9a-f]{40}", baseline_pin)
    baseline = {path: read(git_base + baseline_pin + "/" + path) for path in PUBLIC_FILES}
    rows = json.loads(baseline["data/dictionary.json"])["entries"]
    assert len(rows) == target["row_count"]
    original = {"schema": "vedic.pages.release.v1", "version": target["version"],
                "source_commit": baseline_pin, "row_count": len(rows),
                "files": {path: sha(data) for path, data in baseline.items()}}
    encoded = (json.dumps(original, sort_keys=True, indent=2) + "\n").encode("utf-8")
    assert sha(encoded) == target["manifest_sha256"], "historical command release evidence changed"

    url = target["url"]
    current = json.loads(read(url + "release.json"))
    source = current["source_commit"]
    assert current["schema"] == original["schema"] and re.fullmatch(r"[0-9a-f]{40}", source)
    assert "prose_count" not in current
    files = current["files"]
    receipt_pattern = r"data/accelerator-loop-([0-9]{6})\.json"
    receipts = {path for path in files if re.fullmatch(receipt_pattern, path)}
    generated = set(files) - PUBLIC_FILES - receipts
    assert PUBLIC_FILES <= files.keys()
    assert all(path == "data/command-index.json" or re.fullmatch(r"data/command-pages/\d{6}\.json", path)
               for path in generated)
    assert not generated or "data/command-index.json" in generated

    for path in PUBLIC_FILES:
        committed = read(git_base + source + "/" + path)
        assert sha(committed) == files[path], (path, "source/manifest mismatch")
        match(url + path, committed)
        if path == "data/dictionary.json":
            entries = json.loads(committed)["entries"]
            assert len(entries) == current["row_count"] == len({row["gg_id"] for row in entries})
            assert entries[:len(rows)] == rows, "original 69 command records changed"
    for path in sorted(receipts):
        committed = read(git_base + source + "/" + path)
        assert sha(committed) == files[path], (path, "source/manifest mismatch")
        receipt = json.loads(committed)
        assert receipt["schema"] == "vedic.accelerator.loop-public.v1", path
        seed = int(re.fullmatch(receipt_pattern, path)[1])
        assert receipt["seeds"]["element"] == seed, path
        match(url + path, committed)
    for path in sorted(generated):
        assert sha(read(url + path)) == files[path], (path, "generated file/manifest mismatch")
    print("PASS: stable VEDIC command root", source, current["row_count"], flush=True)


def check_evidence_only(v2_payload,v3_payload):
    """V3 may add public prose, never a producer module or executable package."""
    assert set(v2_payload)==set(v3_payload)==PUBLIC_FILES
    for name in PUBLIC_FILES-{"index.html"}:
        assert v2_payload[name]==v3_payload[name],(name,"historical dictionary/metadata changed")
    before=v2_payload["index.html"]
    after=v3_payload["index.html"]
    import re
    scripts=lambda raw: re.findall(rb"<script\b[^>]*>.*?</script\s*>",raw,re.I|re.S)
    assert scripts(before)==scripts(after),"executable dashboard scripts changed"
    assert after.count(b'id="package-evidence"')==1
    section=after.split(b'id="package-evidence"',1)[1].split(b"</section>",1)[0]
    assert b"Source redistribution remains blocked" in section
    assert b"not engineering approval or independently accepted software" in section
    assert b"Package download unavailable" in section
    assert not re.search(rb"<(?:script|iframe|object|embed|form|link)\b|<[^>]+\s(?:on[a-z]+\s*=|download(?:\s|=|>))",section,re.I),"active or download markup in evidence section"
    links=re.findall(rb'href="([^"]+)"',section)
    assert len(links)==5 and all(re.fullmatch(rb"https://github\.com/Ventusltd/vedic-/actions/runs/[0-9]+",link) for link in links),"non-evidence link"
    # Remove just the approved register and version label, and require the exact V2 bytes.
    start=after.index(b'<section class="panel" id="package-evidence">')
    end=after.index(b"</section>",start)+len(b"</section>")
    restored=(after[:start]+after[end:]).replace(b"VEDIC V3 / 50 meanings + package capability register",b"VEDIC V2 / 202611261351 / 50 meanings")
    assert restored==before,"unexpected dashboard changes outside evidence register"
def verify_evidence_only(m):
    def payload(release):
        base="https://raw.githubusercontent.com/Ventusltd/vedic-/"+release["source_commit"]+"/"
        return {name:read(base+name) for name in PUBLIC_FILES}
    check_evidence_only(payload(m["v2"]),payload(m["v3"]))
    print("PASS: V3 evidence-only delta, no package bytes, identical dictionary and executable scripts",flush=True)
def import_bundle(root,pin_bytes):
    (root/"catalogue").mkdir(parents=True,exist_ok=True)
    (root/"scripts").mkdir(parents=True,exist_ok=True)
    shutil.copyfile(ROOT/"scripts/import_homepage_owner.py",root/"scripts/import_homepage_owner.py")
    (root/"catalogue/homepage-owner.json").write_bytes(pin_bytes)
    subprocess.run([sys.executable,str(root/"scripts/import_homepage_owner.py")],check=True)
def compare_catalogues(previous,current,m):
    p=next(e for e in previous["entities"] if e["id"]=="vedic")
    q=next(e for e in current["entities"] if e["id"]=="vedic")
    assert [e for e in current["entities"] if e["id"]!="vedic"]==[e for e in previous["entities"] if e["id"]!="vedic"]
    assert {k:v for k,v in current.items() if k not in ("entities","promotions")}=={k:v for k,v in previous.items() if k not in ("entities","promotions")}
    assert {k:v for k,v in q.items() if k not in ("releases","operative_release_id")}=={k:v for k,v in p.items() if k not in ("releases","operative_release_id")}
    target=m.get("v3",m["v2"])
    old_id=m["v2"]["version"] if "v3" in m else "v1"
    assert p["operative_release_id"]==old_id and q["operative_release_id"]==m["release_id"]
    assert len(q["releases"])==len(p["releases"])+1
    if "v3" in m:
        assert q["releases"][:-1]==p["releases"]
    else:
        assert len(p["releases"])==1
        assert q["releases"][0]=={**p["releases"][0],"archive_url":m["v1"]["url"],"archive_kind":"app"}
    new=q["releases"][-1]
    assert new["id"]==m["release_id"] and new["url"]==target["url"] and new["status"]=="available"
    assert new["source_ref"]=="https://github.com/Ventusltd/vedic-/tree/"+target["source_commit"]
    promos=previous.get("promotions",[])
    assert current["promotions"][:-1]==promos
    promotion=current["promotions"][-1]
    assert (promotion["entity_id"],promotion["from_release_id"],promotion["to_release_id"])==("vedic",old_id,m["release_id"])
def verify_command_successor(manifest):
    assert manifest["schema"] == "vedic.homepage.commands.v1"
    target = manifest["commands"]
    assert target["url"] == "https://ventusltd.github.io/vedic-/"
    assert target["row_count"] > 50
    event = os.environ["EVENT"]
    if event == "workflow_run":
        assert os.environ["DEPLOY_CONCLUSION"] == "success", "Domain deploy not successful"
    history = json.loads((ROOT/"catalogue/vedic-v3-release.json").read_bytes())
    for name in ("v1", "v2", "v3"):
        prior_release = dict(history[name])
        prior_release.pop("root_alias", None)
        verify_release(prior_release)
    verify_evidence_only(history)
    verify_command_root(target)
    live_pin = (ROOT/"catalogue/homepage-owner.json").read_bytes()
    # Replay the VEDIC-only promotion against its original publisher commit.
    pin_bytes = subprocess.check_output(["git", "show",
        "013ced3cb5c022e3f44add74763b52e98e89f543:catalogue/homepage-owner.json"])
    pin = json.loads(pin_bytes)
    assert pin["commit"] == manifest["owner_commit"]
    previous_pin = subprocess.check_output(["git", "show",
        manifest["prior_domain_commit"] + ":catalogue/homepage-owner.json"])
    old_pin = json.loads(previous_pin)
    assert old_pin["commit"] == manifest["prior_owner_commit"]
    assert {k:v for k,v in pin["files"].items() if k not in {"index.html", "data/homepage.json"}} == {
        k:v for k,v in old_pin["files"].items() if k not in {"index.html", "data/homepage.json"}}
    with tempfile.TemporaryDirectory() as tmp:
        scratch = pathlib.Path(tmp)
        previous, current = scratch/"previous", scratch/"current"
        import_bundle(previous, previous_pin)
        import_bundle(current, pin_bytes)
        old = json.loads((previous/"homepage-shell/data/homepage.json").read_bytes())
        new = json.loads((current/"homepage-shell/data/homepage.json").read_bytes())
        old_vedic = next(row for row in old["entities"] if row["id"] == "vedic")
        new_vedic = next(row for row in new["entities"] if row["id"] == "vedic")
        assert [row for row in old["entities"] if row["id"] != "vedic"] == [
            row for row in new["entities"] if row["id"] != "vedic"]
        exclude = {"releases", "operative_release_id"}
        assert {k:v for k,v in old_vedic.items() if k not in exclude} == {
            k:v for k,v in new_vedic.items() if k not in exclude}
        assert new_vedic["releases"][:-1] == old_vedic["releases"]
        command = new_vedic["releases"][-1]
        assert command["id"] == new_vedic["operative_release_id"] == target["version"]
        assert command["url"] == target["url"] and command["status"] == "available"
        assert command["source_ref"] == "https://github.com/Ventusltd/vedic-/tree/" + target["source_commit"]
        assert {k:v for k,v in old.items() if k not in {"entities", "promotions"}} == {
            k:v for k,v in new.items() if k not in {"entities", "promotions"}}
        assert new["promotions"][:-1] == old["promotions"]
        promotion = new["promotions"][-1]
        assert (promotion["entity_id"], promotion["from_release_id"], promotion["to_release_id"]) == (
            "vedic", old_vedic["operative_release_id"], target["version"])
        original = (previous/"index.html").read_bytes()
        proposed = (current/"index.html").read_bytes()
        snapshot = ROOT/manifest["snapshot"]
        assert snapshot.read_bytes() == original and sha(original) == manifest["snapshot_sha256"]
        assert original.replace(history["v3"]["url"].encode(), target["url"].encode(), 1) == proposed
        assert (b'href="' + target["url"].encode() + b'">Open VEDIC') in proposed
        observed = current
        if live_pin != pin_bytes:
            observed = scratch/"live"
            import_bundle(observed, live_pin)
            catalogue = json.loads((observed/"homepage-shell/data/homepage.json").read_bytes())
            active = next(row for row in catalogue["entities"] if row["id"] == "vedic")
            assert active == new_vedic, "VEDIC source, release or navigation changed"
            assert (b'href="' + target["url"].encode() + b'">Open VEDIC') in (observed/"index.html").read_bytes()
        # Before merge, compare the public site with the PR base. The deployment
        # event checks the candidate bytes after Pages switches the live site.
        if event == "pull_request":
            payload = json.loads(pathlib.Path(os.environ["GITHUB_EVENT_PATH"]).read_bytes())
            base_sha = payload["pull_request"]["base"]["sha"]
            assert re.fullmatch(r"[0-9a-f]{40}", base_sha)
            base_pin = subprocess.check_output(["git", "show", base_sha + ":catalogue/homepage-owner.json"])
            if base_pin != live_pin:
                observed = scratch/"deployed-base"
                import_bundle(observed, base_pin)
        match(DOMAIN, (observed/"index.html").read_bytes())
        for path in pin["files"]:
            if path != "index.html":
                match(DOMAIN + "homepage-shell/" + path, (observed/"homepage-shell"/path).read_bytes())
    print("PASS: exact VEDIC command release and navigation-only homepage successor", flush=True)


def main():
    successor = ROOT/"catalogue/vedic-commands-release.json"
    if successor.exists():
        verify_command_successor(json.loads(successor.read_bytes()))
        return
    v3=ROOT/"catalogue/vedic-v3-release.json"
    m=json.loads((v3 if v3.exists() else ROOT/"catalogue/vedic-v2-release.json").read_bytes())
    target=m.get("v3",m["v2"])
    pin_bytes=(ROOT/"catalogue/homepage-owner.json").read_bytes()
    pin=json.loads(pin_bytes)
    assert m["schema"]==("vedic.homepage.release.v3" if "v3" in m else "vedic.homepage.release.v2")
    event=os.environ["EVENT"]
    if event=="workflow_run":
        assert os.environ["DEPLOY_CONCLUSION"]=="success","Domain deploy not successful"
    verify_release(m["v1"])
    verify_release(m["v2"])
    if "v3" in m:
        assert not m["v2"].get("root_alias"),"V2 must remain immutable, not current alias"
        verify_release(m["v3"])
        verify_evidence_only(m)
    with tempfile.TemporaryDirectory() as tmp:
        root=pathlib.Path(tmp)
        previous,current=root/"previous",root/"current"
        old_pin=subprocess.check_output(["git","show",m["prior_domain_commit"]+":catalogue/homepage-owner.json"])
        assert json.loads(old_pin)["commit"]==m["prior_owner_commit"]
        import_bundle(previous,old_pin)
        import_bundle(current,pin_bytes)
        previous_doc=json.loads((previous/"homepage-shell/data/homepage.json").read_bytes())
        current_doc=json.loads((current/"homepage-shell/data/homepage.json").read_bytes())
        # Exact owner pin gate for this release, not a stale-pin success skip.
        if pin["commit"]==m["owner_commit"]:
            assert pin["files"]==m["owner_files"]
            compare_catalogues(previous_doc,current_doc,m)
            snapshot=ROOT/m["snapshot"]
            metrics=json.loads((ROOT/m["metrics"]).read_bytes())
            measured=json.loads(subprocess.check_output([sys.executable,str(ROOT/"scripts/measure_homepage_version.py"),str(snapshot)]))[0]
            for key in ("lines","words","characters","bytes","sha256"):
                assert measured[key]==metrics[key],key
            assert metrics["source_commit"]==m["prior_domain_commit"] and metrics["source_owner_commit"]==m["prior_owner_commit"]
            assert snapshot.read_bytes()==(previous/"index.html").read_bytes(),"restore snapshot mismatch"
            assert sha((current/"index.html").read_bytes())==metrics["proposed_root_sha256"]
            if event=="pull_request":
                match(DOMAIN,snapshot.read_bytes())
                for f in json.loads(old_pin)["files"]:
                    if f!="index.html":
                        match(DOMAIN+"homepage-shell/"+f,(previous/"homepage-shell"/f).read_bytes())
        else:
            # Later unrelated owner promotions must retain these exact VEDIC release routes.
            e=next(x for x in current_doc["entities"] if x["id"]=="vedic")
            assert e["operative_release_id"]==m["release_id"],"VEDIC successor requires explicit manifest update"
            old=next(r for r in e["releases"] if r["id"]=="v1")
            new=next(r for r in e["releases"] if r["id"]==m["release_id"])
            assert old["archive_url"]==m["v1"]["url"] and new["url"]==target["url"]
        assert (current/"index.html").read_text().count('id="vedic"')==1
        assert target["url"] in (current/"index.html").read_text()
        if "v3" in m:
            e=next(x for x in current_doc["entities"] if x["id"]=="vedic")
            assert next(r for r in e["releases"] if r["id"]==m["v2"]["version"])["url"]==m["v2"]["url"]
        if event=="workflow_run":
            match(DOMAIN,(current/"index.html").read_bytes())
            for f in pin["files"]:
                if f!="index.html":
                    match(DOMAIN+"homepage-shell/"+f,(current/"homepage-shell"/f).read_bytes())
    print("PASS: immutable VEDIC releases, owner catalogue, importer, restore point and applicable public bytes")
if __name__=="__main__":
    main()