GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Websites and apps / globalgrid2050 / testcode/202609150010

Concept Compute and 9 more files

A Python command-line tool in the testcode folder of GlobalGrid2050 that reads task and solar, using SHA-256. It scans markdown (`scan_markdown`) and builds payload (`build_payload`).

514 lines of Python and JavaScript from globalgrid2050, in 10 files. Topic: Websites and apps. Section 1976 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. Concept Compute storage · globalgrid2050 / testcode/202609150010/concept_compute.py lines 1–203
  2. Merge Results storage · globalgrid2050 / testcode/202609150010/merge_results.py lines 1–56
  3. Publication storage · globalgrid2050 / testcode/202609150010/publication.py lines 1–32
  4. Ring other · globalgrid2050 / testcode/202609150502/ring.mjs lines 1–18
  5. Table render · globalgrid2050 / testcode/202609150502/table.mjs lines 1–23
  6. Assess Bench storage · globalgrid2050 / testcode/20260915050706/assess-bench.mjs lines 1–27
  7. Portable Bench storage · globalgrid2050 / testcode/20260915050706/portable-bench.mjs lines 1–45
  8. Reproduce Night render · globalgrid2050 / testcode/20260915050706/reproduce-night.mjs lines 1–28
  9. Verify Evidence ingest · globalgrid2050 / testcode/20260915050706/verify-evidence.mjs lines 1–18
  10. Model transform · globalgrid2050 / testcode/202609151230/model.mjs lines 1–64

Concept Compute

A Python command-line tool in the testcode folder of GlobalGrid2050 that reads task and solar, using SHA-256. It scans markdown (`scan_markdown`) and builds payload (`build_payload`).

storageglobalgrid2050 / testcode/202609150010/concept_compute.py · lines 1–203 of 203 · version 2026-09-15 00:10 · Entry point · pattern scan_markdown (shared by 2 files)

What it does
It loads task and solar. Defines 11 functions or classes, including canonical, digest, file_record, scan_markdown, decode. Uses libraries __future__, argparse, ast, datetime, hashlib. Side effects: reads or writes files; starts processes.
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: solar.
Inputs & outputs
In: JSON file task.json; command-line arguments.
Downstream impact
Used directly by 2 files: GlobalGrid2050 Testcode Dual Compute Workflow (globalgrid2050); Test Dual Compute (globalgrid2050). Reached from 1 other entry point, including GlobalGrid2050 Project Signals Acid Workflow (globalgrid2050).
What it achieves
Compile the Sun Star concept into deterministic evidence and checks. It accepts `--repo`, `--lane` and `--output`.
Why it matters
Run by GlobalGrid2050 Testcode Dual Compute Workflow. Checked by Test Dual Compute.
Application
globalgrid2050 · testcode/202609150010 · Python CLI
Uses
GlobalGrid2050 Gridbot London Solar Daylight Geometry (script call), __future__, argparse, ast, datetime, hashlib, json, platform, re
Used by
run by GlobalGrid2050 Testcode Dual Compute Workflow (workflow run), imported by Test Dual Compute (import)
Produces
canonical, digest, file_record, scan_markdown, decode, pipeline_summary, geometry_summary, podcast_summary, git_commit, build_payload, main
Defines here
canonical, digest, file_record, scan_markdown, decode, pipeline_summary, geometry_summary, podcast_summary, git_commit, build_payload, 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 testcode/202609150010/concept_compute.py:1-203 · blob 739e069797b5ad0a6e7b6a0b5903abd65da82624 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem, process · domain stage: experimental · users: none · canonical: production_core
#!/usr/bin/env python3
"""Compile the Sun Star concept into deterministic evidence and checks."""

from __future__ import annotations

import argparse
import ast
import datetime as dt
import hashlib
import json
import platform
import re
import subprocess
from pathlib import Path
from typing import Any


STAMP = "202609150010"


def canonical(value: Any) -> bytes:
    return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":")).encode("utf-8")


def digest(data: bytes) -> str:
    return hashlib.sha256(data).hexdigest()


def file_record(repo: Path, relative: str) -> dict[str, Any]:
    data = (repo / relative).read_bytes()
    return {"path": relative.replace("\\", "/"), "bytes": len(data), "sha256": digest(data)}


def scan_markdown(repo: Path, relative: str) -> dict[str, Any]:
    data = (repo / relative).read_bytes()
    text = data.decode("utf-8")
    headings = [m.group(2).strip() for m in re.finditer(r"^(#{1,6})\s+(.+?)\s*$", text, re.MULTILINE)]
    links = sorted(set(re.findall(r"https?://[^\s)>\]}\"']+", text)))
    return {
        **file_record(repo, relative),
        "headings": headings,
        "outbound_links": links,
    }


def decode(dictionary: Any, value: Any) -> Any:
    if isinstance(value, int) and isinstance(dictionary, list) and 0 <= value < len(dictionary):
        return dictionary[value]
    return value


def pipeline_summary(repo: Path) -> dict[str, Any]:
    base = repo / "pipelinenews_intelligence"
    releases = sorted(p for p in base.iterdir() if p.is_dir() and re.fullmatch(r"\d{12}", p.name))
    if not releases:
        raise RuntimeError("no timestamped Pipeline News release")
    release = releases[-1]
    files = sorted((release / "data").glob("*fast-projects.json"))
    if len(files) != 1:
        raise RuntimeError(f"expected one fast-projects input in {release.name}, found {len(files)}")
    source = files[0]
    raw = source.read_bytes()
    doc = json.loads(raw)
    fields = doc["fields"]
    dictionaries = doc["dictionaries"]
    index = {name: fields.index(name) for name in fields}

    solar = []
    for row in doc["rows"]:
        technology = decode(dictionaries.get("technology"), row[index["technology"]])
        if str(technology).lower().startswith("solar"):
            capacity = row[index["capacity_mw"]]
            latitude = row[index["latitude"]]
            longitude = row[index["longitude"]]
            status = decode(dictionaries.get("status"), row[index["status"]])
            solar.append({
                "repd_ref": str(row[index["repd_ref"]]),
                "name": str(row[index["name"]]),
                "capacity_mw": float(capacity) if capacity not in (None, "") else 0.0,
                "has_coordinates": latitude not in (None, "") and longitude not in (None, ""),
                "status": str(status),
                "geometry_status": str(decode(dictionaries.get("geometry_status"), row[index["geometry_status"]])),
            })

    by_status: dict[str, int] = {}
    for project in solar:
        by_status[project["status"]] = by_status.get(project["status"], 0) + 1
    relative = source.relative_to(repo).as_posix()
    return {
        "release": release.name,
        "source": {"path": relative, "bytes": len(raw), "sha256": digest(raw)},
        "all_projects": len(doc["rows"]),
        "solar_projects": len(solar),
        "solar_mw": round(sum(p["capacity_mw"] for p in solar), 6),
        "solar_mw_rounded": round(sum(p["capacity_mw"] for p in solar)),
        "solar_with_coordinates": sum(1 for p in solar if p["has_coordinates"]),
        "missing_coordinate_projects": [
            {k: p[k] for k in ("repd_ref", "name", "status", "geometry_status")}
            for p in solar if not p["has_coordinates"]
        ],
        "by_status": dict(sorted(by_status.items())),
    }


def geometry_summary(repo: Path) -> dict[str, Any]:
    relative = "scripts/gridbot_london_solar_daylight_geometry.py"
    source = (repo / relative).read_text(encoding="utf-8")
    tree = ast.parse(source)
    functions = sorted(node.name for node in ast.walk(tree) if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)))
    return {**file_record(repo, relative), "functions": functions}


def podcast_summary(repo: Path) -> dict[str, Any]:
    relative = "podcast_transcripts/index.md"
    data = (repo / relative).read_bytes()
    text = data.decode("utf-8")
    matches = re.findall(r'<li><a href="#([^"]+)">([\s\S]*?)</a></li>', text)
    seen: set[str] = set()
    episodes = []
    for anchor, title in matches:
        if anchor in seen:
            continue
        seen.add(anchor)
        episodes.append({"anchor": anchor, "title": re.sub(r"<[^>]+>|\s+", " ", title).strip()})
    return {
        "path": relative,
        "bytes": len(data),
        "sha256": digest(data),
        "episode_count": len(episodes),
        "first_five": episodes[:5],
    }


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


def build_payload(repo: Path) -> dict[str, Any]:
    task_path = repo / "testcode" / STAMP / "task.json"
    task = json.loads(task_path.read_text(encoding="utf-8"))
    pipeline = pipeline_summary(repo)
    expected = task["expected"]
    checks = {
        "pipeline_release": pipeline["release"] == expected["pipeline_release"],
        "solar_projects": pipeline["solar_projects"] == expected["solar_projects"],
        "solar_mw_rounded": pipeline["solar_mw_rounded"] == expected["solar_mw_rounded"],
        "solar_with_coordinates": pipeline["solar_with_coordinates"] == expected["solar_with_coordinates"],
    }
    coordinate_claim = task["claims_from_scope"]["solar_with_coordinates"]
    return {
        "schema": "globalgrid2050.concept-result.v1",
        "stamp": STAMP,
        "task": task,
        "inputs": {
            "task": file_record(repo, f"testcode/{STAMP}/task.json"),
            "deployment_page": scan_markdown(repo, "solar_deployment_statistics/index.md"),
            "components_page": scan_markdown(repo, "solar_components/index.md"),
            "geometry": geometry_summary(repo),
            "podcast": podcast_summary(repo),
            "pipeline": pipeline,
        },
        "checks": checks,
        "all_checks_pass": all(checks.values()),
        "reconciliation_findings": [{
            "field": "solar_with_coordinates",
            "scope_claim": coordinate_claim,
            "observed": pipeline["solar_with_coordinates"],
            "matches": coordinate_claim == pipeline["solar_with_coordinates"],
            "treatment": "five projects remain explicit missing-geometry records; no coordinates inferred",
        }],
        "next_python_products": [
            "capture dated PV Live half-hourly observations with byte-level provenance",
            "parse attributed Solar Power Portal and PV Magazine RSS metadata under feed terms",
            "compile deterministic Sun Star daily JSON using a seed derived from the PV series",
            "render the UK Solar lens only after Claude's shared GRAMMAR.md is verified",
        ],
    }


def main() -> int:
    parser = argparse.ArgumentParser()
    parser.add_argument("--repo", type=Path, default=Path(__file__).resolve().parents[2])
    parser.add_argument("--lane", choices=("local", "ci"), required=True)
    parser.add_argument("--output", type=Path, required=True)
    args = parser.parse_args()
    repo = args.repo.resolve()
    payload = build_payload(repo)
    result = {
        "lane": args.lane,
        "generated_utc": dt.datetime.now(dt.timezone.utc).isoformat().replace("+00:00", "Z"),
        "runner": {"python": platform.python_version(), "system": platform.system()},
        "git_commit": git_commit(repo),
        "payload_sha256": digest(canonical(payload)),
        "payload": payload,
    }
    args.output.parent.mkdir(parents=True, exist_ok=True)
    args.output.write_text(json.dumps(result, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
    print(json.dumps({"lane": args.lane, "payload_sha256": result["payload_sha256"], "checks": payload["checks"]}, indent=2))
    return 0 if payload["all_checks_pass"] else 2


if __name__ == "__main__":
    raise SystemExit(main())

Merge Results

A Python command-line tool in the testcode folder of GlobalGrid2050 that uses SHA-256. It is built from the canonical step (`canonical`) and the merge step (`merge`).

storageglobalgrid2050 / testcode/202609150010/merge_results.py · lines 1–56 of 56 · version 2026-09-15 00:10 · Entry point · pattern merge (shared by 12 files)

What it does
It loads data. Defines canonical, merge, main. Uses libraries __future__, argparse, datetime, hashlib, json. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Inputs & outputs
In: command-line arguments.
Downstream impact
Used directly by 1 file: Test Dual Compute (globalgrid2050). Reached from 2 other entry points, including GlobalGrid2050 Project Signals Acid Workflow (globalgrid2050); GlobalGrid2050 Testcode Dual Compute Workflow (globalgrid2050).
What it achieves
Fail-closed merger for independently computed local and CI results. It accepts `--local`, `--ci` and `--output`.
Why it matters
Checked by Test Dual Compute.
Application
globalgrid2050 · testcode/202609150010 · Python CLI
Uses
__future__, argparse, datetime, hashlib, json, pathlib, typing
Used by
imported by Test Dual Compute (import)
Produces
canonical, merge, main
Defines here
canonical, merge, 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 testcode/202609150010/merge_results.py:1-56 · blob 00dcbfb10ce31e2a3c6f80543d7605f7df6eb5b3 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem · domain stage: experimental · users: none · canonical: production_core
#!/usr/bin/env python3
"""Fail-closed merger for independently computed local and CI results."""

from __future__ import annotations

import argparse
import datetime as dt
import hashlib
import json
from pathlib import Path
from typing import Any


def canonical(value: Any) -> bytes:
    return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":")).encode("utf-8")


def merge(local: dict[str, Any], ci: dict[str, Any]) -> dict[str, Any]:
    if local.get("lane") != "local" or ci.get("lane") != "ci":
        raise ValueError("expected local and ci lanes")
    local_hash = hashlib.sha256(canonical(local["payload"])).hexdigest()
    ci_hash = hashlib.sha256(canonical(ci["payload"])).hexdigest()
    if local_hash != local.get("payload_sha256") or ci_hash != ci.get("payload_sha256"):
        raise ValueError("a lane payload does not match its declared hash")
    if local_hash != ci_hash or local["payload"] != ci["payload"]:
        raise ValueError(f"local/CI divergence: {local_hash} != {ci_hash}")
    if not local["payload"].get("all_checks_pass"):
        raise ValueError("shared payload contains failed checks")
    return {
        "schema": "globalgrid2050.dual-compute-merge.v1",
        "agreement": True,
        "merged_utc": dt.datetime.now(dt.timezone.utc).isoformat().replace("+00:00", "Z"),
        "payload_sha256": local_hash,
        "lanes": {
            "local": {k: local[k] for k in ("generated_utc", "runner", "git_commit")},
            "ci": {k: ci[k] for k in ("generated_utc", "runner", "git_commit")},
        },
        "payload": local["payload"],
    }


def main() -> int:
    parser = argparse.ArgumentParser()
    parser.add_argument("--local", type=Path, required=True)
    parser.add_argument("--ci", type=Path, required=True)
    parser.add_argument("--output", type=Path, required=True)
    args = parser.parse_args()
    result = merge(json.loads(args.local.read_text(encoding="utf-8")), json.loads(args.ci.read_text(encoding="utf-8")))
    args.output.parent.mkdir(parents=True, exist_ok=True)
    args.output.write_text(json.dumps(result, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
    print(json.dumps({"agreement": True, "payload_sha256": result["payload_sha256"]}, indent=2))
    return 0


if __name__ == "__main__":
    raise SystemExit(main())

Publication

A Python module in the testcode folder of GlobalGrid2050 that writes the candidate's non-self-referential byte and SHA-256 manifest.

storageglobalgrid2050 / testcode/202609150010/publication.py · lines 1–32 of 32 · version 2026-09-15 00:10 · Entry point

What it does
Uses libraries hashlib, json, subprocess, pathlib. Side effects: reads or writes files; starts processes.
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Inputs & outputs
In: JSON file publication.json. Out: JSON file publication.json.
Downstream impact
It is itself an entry point (Python module); no other file was found loading it.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · testcode/202609150010 · Python module
Uses
hashlib, json, subprocess, pathlib
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
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609150010/publication.py:1-32 · blob 1490bedeefb5ef55394ba02f30e610e97d370e1a · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem, process · domain stage: experimental · users: none · canonical: production_core
#!/usr/bin/env python3
"""Write the candidate's non-self-referential byte and SHA-256 manifest."""

import hashlib
import json
import subprocess
from pathlib import Path


HERE = Path(__file__).resolve().parent
ROOT = HERE.parents[1]
owned = [
    p for p in sorted(HERE.rglob("*"))
    if p.is_file() and p.name not in {"publication.json"} and "__pycache__" not in p.parts
]
files = []
for path in owned:
    data = path.read_bytes()
    files.append({
        "path": path.relative_to(ROOT).as_posix(),
        "bytes": len(data),
        "sha256": hashlib.sha256(data).hexdigest(),
    })
payload = {
    "schema": "globalgrid2050.testcode-publication.v1",
    "stamp": "202609150010",
    "status": "test-only candidate; not promoted",
    "source_commit": subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=ROOT, text=True).strip(),
    "files": files,
}
(HERE / "publication.json").write_text(json.dumps(payload, indent=2) + "\n", encoding="utf-8")
print(json.dumps({"files": len(files), "publication": str(HERE / "publication.json")}, indent=2))

Ring

A JavaScript module in the testcode folder of GlobalGrid2050.

otherglobalgrid2050 / testcode/202609150502/ring.mjs · lines 1–18 of 18 · version 2026-09-15 05:02

Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Downstream impact
Used directly by 2 files: Self Test (globalgrid2050); Table (globalgrid2050). Reached from 1 other entry point, including GlobalGrid2050 UK Solar Lens Workflow (globalgrid2050).
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
Imported by Table. Checked by Self Test.
Application
globalgrid2050 · testcode/202609150502 · JavaScript module
Uses
Model (import)
Used by
imported by Self Test (import), imported by Table (import)
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
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609150502/ring.mjs:1-18 · blob 15e683af301450c5acfb7a8f198089272d37cc38 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: unknown · effects: none found · domain stage: experimental · users: none · canonical: production_core
import { unit } from './model.mjs';
export default {
  id:'ring', from:'UK solar REPD snapshot; Generator GRAMMAR section 2',
  wants:['block'], always:['block'], draws:[],
  hint() { return 'Each point is a project. Ring positions are seeded, not geographic coordinates.'; },
  layout(core,view,out) {
    const r = Math.max(1, Math.min(view.w,view.h)/2-22), cx=view.w/2, cy=view.h/2;
    for(let i=0;i<core.N;i++) {
      const angle=unit(view.seed,core.keyStr[i]+':angle')*Math.PI*2;
      const radius=r*Math.sqrt(.10+.90*unit(view.seed,core.keyStr[i]+':radius'));
      out[2*i]=cx+Math.cos(angle)*radius; out[2*i+1]=cy+Math.sin(angle)*radius;
    }
    return {bounds:[0,0,view.w,view.h],home:{pan:[0,0],zoom:1,rotate:0}};
  },
  edges() { return {a:new Uint32Array(),b:new Uint32Array(),kind:new Uint8Array(),cls:new Uint8Array(),w:new Float32Array()}; },
  geometry(){return null;}, labels(core,view,max){return view.focus>=0&&max>0?Uint32Array.of(view.focus):new Uint32Array();},
  hit(){return -1;}, camera(){return {pan:false,zoom:null,rotate:false};}, simplify(){return {};}, leave(){}
};

Table

A JavaScript module in the testcode folder of GlobalGrid2050.

renderglobalgrid2050 / testcode/202609150502/table.mjs · lines 1–23 of 23 · version 2026-09-15 05:02

What it does
It draws its content. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Downstream impact
Used directly by 1 file: Self Test (globalgrid2050). Reached from 1 other entry point, including GlobalGrid2050 UK Solar Lens Workflow (globalgrid2050).
What it achieves
It responds to click events.
Why it matters
Checked by Self Test.
Application
globalgrid2050 · testcode/202609150502 · JavaScript module
Uses
Ring (import)
Used by
imported by Self Test (import)
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
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609150502/table.mjs:1-23 · blob c65c1a5ed705139a1352722d9f8ab7fa32393e4b · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: production_core
import ring from './ring.mjs';
export default {
  ...ring,id:'table',from:'UK solar record table; Generator GRAMMAR section 2',
  always:[],
  hint(){return 'All projects remain available by permanent REPD key, including records without coordinates.';},
  layout(core,view,out){
    out.fill(NaN);
    let height=0;
    for(const row of view.params.tableRows||[]){out[2*row.i]=row.x;out[2*row.i+1]=row.y;height=Math.max(height,row.y+row.height/2);}
    return {bounds:[0,0,view.w,height],home:{pan:[0,0],zoom:1,rotate:0}};
  },
  overlay(core,view,host,shell){
    host.replaceChildren();
    const refs=view.visible;
    for(const i of refs){
      const b=document.createElement('button');b.className='project-row';b.dataset.ref=core.keyStr[i];
      b.textContent=`${core.label(i)} · ${core.rec[i].capacity_mw ?? 'capacity not recorded'}${core.rec[i].capacity_mw===null?'':' MW'} · ${core.rec[i].status}${core.rec[i].latitude===null?' · coordinates missing':''}`;
      b.style.borderLeftColor=core.colour(i);b.setAttribute('aria-pressed',String(view.focus===i));
      b.addEventListener('click',()=>shell.navigate(i));host.append(b);
    }
  },
  leave(){}
};

Assess Bench

A JavaScript module in the testcode folder of GlobalGrid2050 that uses SHA-256.

storageglobalgrid2050 / testcode/20260915050706/assess-bench.mjs · lines 1–27 of 27 · version 2026-09-15 05:07 · Not reached from any entry point (candidate for review)

What it does
It loads data. Uses libraries node:fs, node:crypto. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Inputs & outputs
In: command-line arguments.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · testcode/20260915050706 · JavaScript module
Uses
node:fs, node:crypto
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
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/20260915050706/assess-bench.mjs:1-27 · blob 2adf3c9243bb6d384ee09c7c7e6656f8b827cecd · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem · domain stage: experimental · users: none · canonical: unreached_review
import fs from 'node:fs';
import {createHash} from 'node:crypto';
const [benchPath,fallbackPath,out]=process.argv.slice(2);
if (!out || fs.existsSync(out)) throw new Error('Supply bench report, fallback report, and a new output filename');
const raw=fs.readFileSync(benchPath),reproRaw=fs.readFileSync(fallbackPath);
const bench=JSON.parse(raw),repro=JSON.parse(reproRaw);
const mobile=bench.lenses.filter(x=>x.mobile);
const checks={
  ownerFunctionalChecks:bench.pass===true,
  mobileTargets:mobile.length===6&&mobile.every(x=>x.smallestTap?.px>=44),
  noWebGL2Fallback:repro.fallbackErrors.length===0,
  liveIndustryNest:repro.industryAfter===true&&repro.homepageErrors.length===0,
};
const report={
  utc:new Date().toISOString(),sourceCommit:'7edc6fbd7f2d19397c6106371e3ce8de0f8c8a5d',
  sourceHarnessSha256:bench.harnessSha256,
  benchSha256:createHash('sha256').update(raw).digest('hex'),
  supplementalSha256:createHash('sha256').update(reproRaw).digest('hex'),
  pass:Object.values(checks).every(x=>x===true),checks,
  failures:[...mobile.filter(x=>x.smallestTap?.px<44).map(x=>`${x.lens} at ${x.width}: ${x.smallestTap.area} ${x.smallestTap.w}x${x.smallestTap.h}px; minimum 44px`),...repro.fallbackErrors],
  renderer:[...new Set(bench.lenses.map(x=>x.renderer))],
  physicalPhoneTest:false,
  limits:['430px is desktop touch/viewport emulation at DPR2, not a physical phone.','FPS is a four-second requestAnimationFrame sample; it does not establish sustained thermal performance.','NVIDIA sampler describes a separate GPU from the Intel renderer and cannot attribute the renderer GPU utilisation.','The native owner harness does not define a pass field; the portable wrapper adds functional  … [line shortened here: 474 characters; full line on GitHub]
};
fs.writeFileSync(out,JSON.stringify(report,null,2)+'\n');
console.log(JSON.stringify(report,null,2));
if(report.pass!==true)process.exitCode=1;

Portable Bench

A JavaScript module in the testcode folder of GlobalGrid2050 that runs the committed Generator measurement harness without changing its owner files, using SHA-256. It replaces once (`replaceOnce`).

storageglobalgrid2050 / testcode/20260915050706/portable-bench.mjs · lines 1–45 of 45 · version 2026-09-15 05:07 · Not reached from any entry point (candidate for review) · pattern replaceOnce (shared by 2 files)

What it does
It loads data. Defines replaceOnce. Uses libraries node:fs, node:path, node:url, node:crypto. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. README: "`portable-bench.mjs`: runs the committed owner script with explicit `PUPPETEER_MODULE`, `CHROME_PATH`, `BENCH_BASE` and a new `BENCH_OUT`"
What it achieves
The README says: Runs the committed owner script with explicit `PUPPETEER_MODULE`, `CHROME_PATH`, `BENCH_BASE` and a new `BENCH_OUT`.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · testcode/20260915050706 · JavaScript module
Uses
node:fs, node:path, node:url, node:crypto
Used by
none found
Produces
replaceOnce
Defines here
replaceOnce
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/20260915050706/portable-bench.mjs:1-45 · blob 55a7185d0c0b9aed0ddaccb3a1a6714ea1da9782 · GitHub at these lines
State
achieves: readme · context: readme_derived · stage: output · effects: filesystem · domain stage: experimental · users: none · canonical: unreached_review
// Run the committed Generator measurement harness without changing its owner files.
// PUPPETEER_MODULE, CHROME_PATH, BENCH_OUT, BENCH_BASE are required.
// Evidence is desktop viewport/touch emulation; it is not a physical phone test.
import fs from 'node:fs';
import path from 'node:path';
import { pathToFileURL, fileURLToPath } from 'node:url';
import { createHash } from 'node:crypto';
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
const sourceFile = path.join(root, 'testcode/202609142225/proof/bench.mjs');
const original = fs.readFileSync(sourceFile, 'utf8');
for (const key of ['PUPPETEER_MODULE', 'CHROME_PATH', 'BENCH_OUT', 'BENCH_BASE']) {
  if (!process.env[key]) throw new Error(`${key} is required`);
}
const out = path.resolve(process.env.BENCH_OUT);
if (fs.existsSync(out)) throw new Error('BENCH_OUT must be a new directory');
fs.mkdirSync(out, { recursive: true });
let source = original;
function replaceOnce(pattern, replacement) {
  const hits = source.match(new RegExp(pattern.source, 'gm')) || [];
  if (hits.length !== 1) throw new Error(`Expected one harness configuration match, got ${hits.length}`);
  source = source.replace(pattern, replacement);
}
replaceOnce(/^const puppeteer = .*;$/m, "const puppeteer = require(process.env.PUPPETEER_MODULE);");
replaceOnce(/^const PORT = .*;$/m, "const BASE = process.env.BENCH_BASE;");
replaceOnce(/^const OUT = .*;$/m, "const OUT = process.env.BENCH_OUT.replaceAll('\\\\', '/') + '/';");
replaceOnce(/^const CHROME = .*;$/m, "const CHROME = process.env.CHROME_PATH;");
replaceOnce(/} finally \{ await browser.close\(\); gpu.proc && gpu.proc.kill\(\); }/m,
  "} catch (e) { report.fatal = String(e.message); save(); } finally { await browser.close(); gpu.proc && gpu.proc.kill(); }");
source += `
report.harnessSha256 = ${JSON.stringify(createHash('sha256').update(original).digest('hex'))};
report.physicalPhoneTest = false;
report.acceptance = {
  completed: !report.fatal && report.lenses.length === 12 && report.coordination?.length === 2 && !!report.compose?.checks,
  layout: report.lenses.length === 12 && report.lenses.every(r => r.scrollWidth === r.innerWidth && r.afterInteraction.scrollWidth === r.innerWidth),
  errors: report.lenses.every(r => !r.errors.length && !r.pageErrors.length) && report.coordination?.every(r => !r.errors.length) && report.compose?.errors?.length === 0,
  selection: report.coordination?.every(r => r.steps.length === 6 && r.steps[0].haversineSelected && r.steps.slice(1).every(s => s.sameKey && s.visible)),
  recipe: !!report.compose?.checks && ['keysHave80299','keysHaveVd','everyBlockPinned','familyPinned','urlHasVd','urlHas80299'].every(k => report.compose.checks[k] === true)
};
report.pass = Object.values(report.acceptance).every(v => v === true);
save();
if (report.pass !== true) process.exitCode = 1;
`;
const runner = path.join(out, 'runner.mjs');
fs.writeFileSync(runner, source);
await import(pathToFileURL(runner));

Reproduce Night

A JavaScript module in the testcode folder of GlobalGrid2050.

renderglobalgrid2050 / testcode/20260915050706/reproduce-night.mjs · lines 1–28 of 28 · version 2026-09-15 05:07 · Not reached from any entry point (candidate for review)

What it does
Uses libraries node:module, node:fs. Side effects: changes the web page (DOM); reads or writes files.
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. README: "`reproduce-night.mjs`: requires `PUPPETEER_MODULE`, `CHROME_PATH`, and a new `REPRO_OUT`, with the repository already served at port 8891 for the forced fallback check."
What it achieves
The README says: Requires `PUPPETEER_MODULE`, `CHROME_PATH`, and a new `REPRO_OUT`, with the repository already served at port 8891 for the forced fallback check.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · testcode/20260915050706 · JavaScript module
Uses
node:module, node:fs
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
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/20260915050706/reproduce-night.mjs:1-28 · blob 16dfa727be726d7ea4d93a2e18e537f65a73bc11 · GitHub at these lines
State
achieves: readme · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: experimental · users: none · canonical: unreached_review
import { createRequire } from 'node:module';
import fs from 'node:fs';
const puppeteer = createRequire(import.meta.url)(process.env.PUPPETEER_MODULE);
const out = process.env.REPRO_OUT;
if (!out || fs.existsSync(out)) throw new Error('REPRO_OUT must name a new output file');
const browser = await puppeteer.launch({executablePath: process.env.CHROME_PATH, headless: true, args: ['--enable-gpu','--use-gl=angle','--use-angle=d3d11','--ignore-gpu-blocklist']});
const report = {utc: new Date().toISOString(), physicalPhoneTest: false};
try {
  const page = await browser.newPage();
  await page.setViewport({width:430,height:900,deviceScaleFactor:2,isMobile:true,hasTouch:true});
  report.homepageErrors=[];
  page.on('pageerror', e => report.homepageErrors.push(e.message));
  await page.goto('https://globalgrid2050.com/', {waitUntil:'domcontentloaded'});
  report.before = await page.evaluate(() => document.body.innerText);
  await new Promise(r => setTimeout(r,5000));
  report.after = await page.evaluate(() => document.body.innerText);
  report.industryBefore=report.before.includes('Industry Analysis');
  report.industryAfter=report.after.includes('Industry Analysis');
  await page.close();
  const fallback=await browser.newPage();
  report.fallbackErrors=[];
  fallback.on('pageerror',e=>report.fallbackErrors.push(e.message));
  await fallback.evaluateOnNewDocument(()=>{const original=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=function(kind,...args){return kind==='webgl2'?null:original.call(this,kind,...args);};});
  await fallback.goto('http://127.0.0.1:8891/testcode/202609142225/',{waitUntil:'networkidle0'});
  report.fallbackText=await fallback.evaluate(()=>document.body.innerText);
  await fallback.close();
} finally { await browser.close(); fs.writeFileSync(out,JSON.stringify(report,null,2)); }
console.log(JSON.stringify({industryBefore:report.industryBefore,industryAfter:report.industryAfter,homepageErrors:report.homepageErrors,fallbackErrors:report.fallbackErrors}));

Verify Evidence

A JavaScript module in the testcode folder of GlobalGrid2050 that reads publication, assessment, bench and supplemental, using SHA-256.

ingestglobalgrid2050 / testcode/20260915050706/verify-evidence.mjs · lines 1–18 of 18 · version 2026-09-15 05:07 · Entry point

What it does
It loads publication, assessment, bench and supplemental. Defines json, sha. Uses libraries node:fs, node:assert/strict, node:crypto. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Inputs & outputs
In: JSON file publication.json; JSON file assessment.json; JSON file bench.json; JSON file supplemental.json.
Downstream impact
Used directly by 1 file: GlobalGrid2050 Generator Device Review Workflow (globalgrid2050).
What it achieves
It is built from the JSON step (`json`) and the sha step (`sha`). Verify publication/evidence integrity. A successful run does not pass the unmet device gates. It reads `proof/bench.json`.
Why it matters
Run by GlobalGrid2050 Generator Device Review Workflow.
Application
globalgrid2050 · testcode/20260915050706 · JavaScript module
Uses
node:fs, node:assert/strict, node:crypto
Used by
run by GlobalGrid2050 Generator Device Review Workflow (workflow run)
Produces
json, sha
Defines here
json, sha
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/20260915050706/verify-evidence.mjs:1-18 · blob 30ddc4213be7daef66cf016753d5afd94d92b719 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: ingest · effects: filesystem · domain stage: experimental · users: none · canonical: production_core
// Verify publication/evidence integrity. A successful run does not pass the unmet device gates.
import fs from 'node:fs';
import assert from 'node:assert/strict';
import {createHash} from 'node:crypto';
const root=new URL('./',import.meta.url),read=p=>fs.readFileSync(new URL(p,root));
const json=p=>JSON.parse(read(p));
const sha=b=>createHash('sha256').update(b).digest('hex');
const manifest=json('publication.json'),assessment=json('assessment.json'),bench=json('proof/bench.json');
for(const [file,proof]of Object.entries(manifest.files)){
  assert.ok(!file.startsWith('/')&&!file.includes('..'));
  const bytes=read(file);assert.equal(bytes.length,proof.bytes,file);assert.equal(sha(bytes),proof.sha256,file);
}
assert.equal(sha(read('proof/bench.json')),assessment.benchSha256);
assert.equal(sha(read('supplemental.json')),assessment.supplementalSha256);
assert.equal(bench.lenses.length,12);assert.equal(bench.coordination.length,2);
assert.equal(assessment.pass,false);assert.equal(assessment.checks.mobileTargets,false);assert.equal(assessment.checks.noWebGL2Fallback,false);
assert.equal(assessment.physicalPhoneTest,false);assert.equal(bench.pass,true);
console.log(JSON.stringify({pass:true,meaning:'Published evidence is internally consistent; device acceptance remains false',files:Object.keys(manifest.files).length}));

Model

A JavaScript module in the testcode folder of GlobalGrid2050 that wraps time (`wrapTime`). It wraps time (`wrapTime`) and is built from the clamp step (`clamp`) and the point step (`point`).

transformglobalgrid2050 / testcode/202609151230/model.mjs · lines 1–64 of 64 · version 2026-09-15 12:30 · pattern clamp (shared by 24 files)

What it does
It calculates its inputs. Defines clamp, wrapTime, point, focusPoint, nearestConcept.
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Downstream impact
Used directly by 2 files: Self Test (globalgrid2050); Ring (globalgrid2050). Reached from 1 other entry point, including GlobalGrid2050 UK Solar Lens Workflow (globalgrid2050).
What it achieves
Harmonic paths illustrate concepts; their positions and phase are not engineering results.
Why it matters
Imported by Ring. Checked by Self Test.
Application
globalgrid2050 · testcode/202609151230 · JavaScript module
Uses
none found
Used by
imported by Self Test (import), imported by Ring (import)
Produces
TAU, KEYS, CONCEPTS, VIEWS, EDGES, clamp, wrapTime, point, focusPoint, nearestConcept
Defines here
clamp, wrapTime, point, focusPoint, nearestConcept
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609151230/model.mjs:1-64 · blob 2594fd4a4c0610271e91e225a177d80153aa3419 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: transform · effects: none found · domain stage: experimental · users: none · canonical: production_core
// Harmonic paths illustrate concepts; their positions and phase are not engineering results.
export const TAU = Math.PI * 2;
export const KEYS = ['identity','physics','replay','validation','interaction','composition'];
export const CONCEPTS = [
  {key:'identity',name:'Identity',color:'#76ead9',title:'A name can change. An identity stays.',copy:'Keep a stable key while the shape around it changes.'},
  {key:'physics',name:'Physics',color:'#f5bd73',title:'Give every number its physical meaning.',copy:'Power, energy and capacity are different quantities. Units, intervals and missing values need explicit rules.'},
  {key:'replay',name:'Replay',color:'#8fabff',title:'Return to the same starting point.',copy:'Return to the same inputs to repeat a study. Here, move the timeline to revisit a visual moment.'},
  {key:'validation',name:'Evidence',color:'#ed91bb',title:'A compelling picture still needs evidence.',copy:'A visual pattern can suggest a question. Tests and observations are needed to support a conclusion.'},
  {key:'interaction',name:'Interaction',color:'#b6cf79',title:'Make the invisible explorable.',copy:'Use the labelled buttons with touch or a keyboard. Pause the motion to explore a still frame.'},
  {key:'composition',name:'Composition',color:'#b7a1ee',title:'Six ideas. One understandable study.',copy:'Explore how these ideas fit together. Lines in the chord view show connections between the six concepts.'}
];
export const VIEWS = {
  twin:{kicker:'MIRROR / CONTINUITY',title:'The present, seen from both sides.',note:'Inspired by Quantum Twin Star · mirrored phase paths'},
  ring:{kicker:'ORBIT / CONTINUITY',title:'Different paths. Stable identities.',note:'Inspired by the ring lens · harmonic orbits'},
  particle:{kicker:'FIELD / POSSIBILITY',title:'Ideas in motion, without losing their centre.',note:'Inspired by the particle lens · bounded flowing clusters'},
  chord:{kicker:'WEAVE / DEPENDENCY',title:'Connections make a whole.',note:'Inspired by the chord lens · connections between ideas'},
  river:{kicker:'FLOW / REPLAY',title:'Follow an idea through time.',note:'Inspired by the river lens · reversible phase traces'},
  column:{kicker:'RHYTHM / COMPOSITION',title:'Separate voices, moving together.',note:'Inspired by the column lens · visual amplitude, not progress'},
  table:{kicker:'READ / OVERVIEW',title:'Stillness is another useful perspective.',note:'Inspired by the table lens · six ideas to explore'}
};
export const EDGES = [[0,2],[1,3],[2,3],[3,4],[0,5],[1,5],[2,5],[3,5],[4,5]];
export const clamp = (n,a,b) => Math.max(a,Math.min(b,n));
export const wrapTime = n => ((n % 60) + 60) % 60;
export function point(view,group,index,time,twin=false){
  const u=index/32, a=group*TAU/6-Math.PI/2, phase=TAU*time/60;
  const q=u*TAU, wobble=Math.sin(q*3+phase*2+group);
  let x,y;
  if(view==='twin'){
    const r=.22+.055*Math.sin(q*3+phase+group)+.018*Math.cos(q*5-phase);
    x=.5+r*Math.cos(a+q+phase); y=.5+r*Math.sin(a+q+phase)*1.06;
  }else if(view==='ring'||view==='chord'){
    const theta=a+(u-.5)*.74+phase;
    const r=.29+.034*Math.sin(q*2+phase*3+group);
    x=.5+r*Math.cos(theta);y=.5+r*Math.sin(theta);
  }else if(view==='particle'){
    const theta=a+phase;
    const rr=.055+.05*Math.sin(q*3+phase+group);
    x=.5+.22*Math.cos(theta)+rr*Math.cos(q*2-phase*(1+group%2));
    y=.5+.23*Math.sin(theta)+rr*Math.sin(q*3+phase);
  }else if(view==='river'){
    x=.08+u*.84;
    y=.23+group*.105+.035*Math.sin(u*TAU*1.6-phase*2+group*.4)+.012*wobble;
  }else if(view==='column'){
    x=.13+group*.148+.025*Math.sin(q*2+phase+group);
    y=.22+u*.57+.04*Math.sin(q+phase*2+group);
  }else{throw new Error('Unknown visual view');}
  if(twin){x=1-x;y=1-y;}
  return {x,y};
}
export function focusPoint(view,group,time){
  if(view==='river')return point(view,group,16,time);
  if(view==='column')return {x:.13+group*.148,y:.5};
  const a=group*TAU/6-Math.PI/2+TAU*time/60;
  const r=view==='particle'?.22:.29;
  return {x:.5+Math.cos(a)*r,y:.5+Math.sin(a)*r};
}
export function nearestConcept(view,x,y,time){
  let best=0,distance=Infinity;
  for(let g=0;g<6;g++)for(let i=0;i<32;i++){
    const p=point(view,g,i,time),d=(p.x-x)**2+(p.y-y)**2;
    if(d<distance){distance=d;best=g;}
  }
  return best;
}