GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Solar and storage design / star-solar-star / testcode/202609150040

Build Global Star and 7 more files

A Python command-line tool in the testcode folder of Star Solar Star that fetches iea audited statements, solar and wind, using SHA-256 from the GlobalGrid2050 repository.

679 lines of Python and HTML from star-solar-star, in 8 files. Topic: Solar and storage design. Section 260 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. Build Global Star ingest · star-solar-star / testcode/202609150040/build_global_star.py lines 1–211
  2. Testcode — Create Page render · star-solar-star / testcode/202609150040/create/index.html lines 1–53
  3. Issue to Star ingest · star-solar-star / testcode/202609150040/issue_to_star.py lines 1–38
  4. Make Publication other · star-solar-star / testcode/202609150040/make_publication.py lines 1–34
  5. Merge Results ingest · star-solar-star / testcode/202609150040/merge_results.py lines 1–42
  6. Star Contract ingest · star-solar-star / testcode/202609150040/star_contract.py lines 1–156
  7. Test Country Star test · star-solar-star / testcode/202609150040/test_country_star.py lines 1–102
  8. Write Result ingest · star-solar-star / testcode/202609150040/write_result.py lines 1–43

Build Global Star

A Python command-line tool in the testcode folder of Star Solar Star that fetches iea audited statements, solar and wind, using SHA-256 from the GlobalGrid2050 repository.

ingeststar-solar-star / testcode/202609150040/build_global_star.py · lines 1–211 of 211 · version 2026-09-15 00:40 · Entry point · pattern source (shared by 13 files)

What it does
It fetches iea audited statements, solar and wind. Defines 7 functions or classes, including fetch, digest, visible_text, source, iea_payload. Uses libraries __future__, argparse, datetime, hashlib, html. Side effects: reads or writes files; makes network requests.
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, wind.
Inputs & outputs
In: data source: globalgrid2050 data; JSON file iea-audited-statements.json; command-line arguments.
Downstream impact
Used directly by 3 files: Test Country Star (star-solar-star); Country Star Candidate Workflow (star-solar-star); Country Star CI Workflow (star-solar-star).
What it achieves
It is built from the fetch step (`fetch`), the digest step (`digest`) and the visible text helper (`visible_text`). Build a global solar definition from dated IRENA/IEA public sources. Its code works with 600 GW and 800 GW. It accepts `--output`, `--accessed-utc` and `--allow-audited-iea-fixture-on-403`.
Why it matters
Run by Country Star Candidate Workflow and Country Star CI Workflow. Checked by Test Country Star.
Application
star-solar-star · testcode/202609150040 · Python CLI
Uses
Star Contract (import), __future__, argparse, datetime, hashlib, html, json, re, urllib.error
Used by
imported by Test Country Star (import), run by Country Star Candidate Workflow (workflow run), run by Country Star CI Workflow (workflow run)
Produces
fetch, digest, visible_text, source, iea_payload, iea_source, build
Defines here
fetch, digest, visible_text, source, iea_payload, iea_source, build
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
star-solar-star@4ac16c0c2297c4b6022afc4d6f921faf091bb74e testcode/202609150040/build_global_star.py:1-211 · blob 9856c34989774193573dbd65f51359ac79e3fe3b · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: ingest · effects: filesystem, network · domain stage: experimental · users: none · canonical: unknown
#!/usr/bin/env python3
"""Build a global solar definition from dated IRENA/IEA public sources."""
from __future__ import annotations

import argparse
import datetime as dt
import hashlib
import html
import json
import re
import urllib.error
import urllib.request
from pathlib import Path

from star_contract import CANONICALIZATION, seed_for, validate, write_json


USER_AGENT = "GlobalGrid2050-Star-Creator/1.0 (+https://github.com/Ventusltd/star-solar-star)"
IRENA_URL = "https://www.irena.org/-/media/Files/IRENA/Agency/Publication/2026/Mar/IRENA_DAT_RE_capacity_statistics_2026.pdf"
IEA_SOLAR_URL = "https://www.iea.org/reports/global-energy-review-2026/technology-solar-pv-and-wind"
IEA_TRENDS_URL = "https://www.iea.org/reports/global-energy-review-2026/global-trends"
GLOBALGRID_COMMIT = "35f07f9c0ef6bbdaae3c9f27f5a361118f49624f"
GLOBALGRID_URL = f"https://raw.githubusercontent.com/Ventusltd/globalgrid2050/{GLOBALGRID_COMMIT}/solar_deployment_statistics/index.md"
IRENA_SHA256 = "fc580bd4f4ee39ef20de6b1ce3926005a4e3e3b8e2c92fd6a16d175a52515921"
FIXTURE = Path(__file__).with_name("iea-audited-statements.json")


def fetch(url: str) -> bytes:
    request = urllib.request.Request(url, headers={"User-Agent": USER_AGENT, "Accept": "*/*"})
    with urllib.request.urlopen(request, timeout=60) as response:
        if response.status != 200:
            raise RuntimeError(f"GET {url} returned HTTP {response.status}")
        return response.read()


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


def visible_text(raw: bytes) -> str:
    text = raw.decode("utf-8", errors="replace")
    text = re.sub(r"<script[\s\S]*?</script>|<style[\s\S]*?</style>", " ", text, flags=re.IGNORECASE)
    text = re.sub(r"<[^>]+>", " ", text)
    return re.sub(r"\s+", " ", html.unescape(text)).strip()


def source(source_id: str, publisher: str, title: str, url: str, published: str, accessed: str, raw: bytes, **extra):
    row = {
        "id": source_id,
        "publisher": publisher,
        "title": title,
        "url": url,
        "published": published,
        "accessed_utc": accessed,
        "bytes": len(raw),
        "sha256": digest(raw),
    }
    row.update(extra)
    return row


def iea_payload(source_id: str, url: str, allow_audited_fixture_on_403: bool) -> tuple[bytes | None, str, dict | None]:
    try:
        raw = fetch(url)
        return raw, visible_text(raw), None
    except urllib.error.HTTPError as exc:
        if exc.code != 403 or not allow_audited_fixture_on_403:
            raise
        fixture = json.loads(FIXTURE.read_text(encoding="utf-8"))
        evidence = next((row for row in fixture["sources"] if row["id"] == source_id), None)
        if evidence is None or evidence["url"] != url:
            raise ValueError(f"audited fixture does not bind {source_id} to {url}") from exc
        if not isinstance(evidence["bytes"], int) or evidence["bytes"] <= 0 or not re.fullmatch(r"[0-9a-f]{64}", evidence["sha256"]):
            raise ValueError(f"audited fixture provenance is invalid for {source_id}") from exc
        return None, " ".join(evidence["markers"]), evidence


def iea_source(source_id: str, title: str, url: str, accessed: str, raw: bytes | None, evidence: dict | None) -> dict:
    if raw is not None:
        return source(source_id, "International Energy Agency", title, url, "2026-04-20", accessed, raw, licence="CC BY 4.0")
    assert evidence is not None
    return {
        "id": source_id,
        "publisher": "International Energy Agency",
        "title": title,
        "url": url,
        "published": "2026-04-20",
        "accessed_utc": accessed,
        "bytes": evidence["bytes"],
        "sha256": evidence["sha256"],
        "licence": "CC BY 4.0",
        "retrieval": "audited local observation; GitHub runner received HTTP 403",
    }


def build(accessed_utc: str | None = None, allow_audited_fixture_on_403: bool = False) -> dict:
    accessed = accessed_utc or dt.datetime.now(dt.timezone.utc).isoformat(timespec="seconds").replace("+00:00", "Z")
    irena_raw = fetch(IRENA_URL)
    iea_solar_raw, solar_text, iea_solar_evidence = iea_payload("iea-ger-2026-solar", IEA_SOLAR_URL, allow_audited_fixture_on_403)
    iea_trends_raw, trends_text, iea_trends_evidence = iea_payload("iea-ger-2026-trends", IEA_TRENDS_URL, allow_audited_fixture_on_403)
    estate_raw = fetch(GLOBALGRID_URL)
    if digest(irena_raw) != IRENA_SHA256 or not irena_raw.startswith(b"%PDF"):
        raise ValueError("IRENA report bytes differ from the audited Renewable Capacity Statistics 2026 PDF")
    estate_text = estate_raw.decode("utf-8", errors="strict")
    required_solar = ("surpassing 600 GW", "cumulative solar PV capacity to around 2 800 GW")
    required_trends = ("record increase of 600 TWh", "nearly 2 700 TWh", "over 8%")
    if any(marker not in solar_text for marker in required_solar):
        raise ValueError("IEA solar page no longer contains the audited 2025 capacity statements")
    if any(marker not in trends_text for marker in required_trends):
        raise ValueError("IEA global trends page no longer contains the audited 2025 generation statements")
    if "# Global Solar PV Deployment 2025" not in estate_text:
        raise ValueError("pinned estate solar deployment page has an unexpected title")

    observations = [
        {
            "key": "irena:solar-pv-capacity:world:2025",
            "metric": "solar photovoltaic installed capacity",
            "period": "2025",
            "value": 2383162,
            "unit": "MW",
            "relation": "exact",
            "source_id": "irena-rsc-2026",
            "locator": "PDF page 36, Solar photovoltaic table, World row, 2025 column",
        },
        {
            "key": "irena:solar-pv-net-change:world:2025",
            "metric": "solar photovoltaic installed-capacity net change",
            "period": "2025",
            "value": 510349,
            "unit": "MW",
            "relation": "exact",
            "source_id": "irena-rsc-2026",
            "locator": "Derived from PDF page 36 World row: 2,383,162 MW (2025) minus 1,872,813 MW (2024)",
            "derivation": {"formula": "2025 capacity minus 2024 capacity", "inputs_mw": [2383162, 1872813]},
        },
        {
            "key": "iea:solar-pv-capacity:world:2025",
            "metric": "solar photovoltaic installed capacity",
            "period": "2025",
            "value": 2800,
            "unit": "GW",
            "relation": "approximately",
            "source_id": "iea-ger-2026-solar",
            "locator": "Technology: Solar PV and wind; 2025 capacity paragraph",
        },
        {
            "key": "iea:solar-pv-additions:world:2025",
            "metric": "solar photovoltaic capacity additions",
            "period": "2025",
            "value": 600,
            "unit": "GW",
            "relation": "greater_than",
            "source_id": "iea-ger-2026-solar",
            "locator": "Technology: Solar PV and wind; 2025 capacity paragraph",
        },
        {
            "key": "iea:solar-pv-generation:world:2025",
            "metric": "solar photovoltaic electricity generation",
            "period": "2025",
            "value": 2700,
            "unit": "TWh",
            "relation": "approximately",
            "source_id": "iea-ger-2026-trends",
            "locator": "Global trends; Solar saw extraordinary growth in 2025",
        },
        {
            "key": "iea:solar-pv-generation-share:world:2025",
            "metric": "solar photovoltaic share of global electricity generation",
            "period": "2025",
            "value": 8,
            "unit": "percent",
            "relation": "greater_than",
            "source_id": "iea-ger-2026-trends",
            "locator": "Global trends; Solar saw extraordinary growth in 2025",
        },
    ]
    star = {
        "schema": "star-solar-star.definition.v1",
        "id": "global-solar-2025",
        "type": "global-solar",
        "name": "Global Solar 2025",
        "description": "Dated public observations are kept as separate source statements; differing scopes and estimates are not averaged.",
        "region": {"scheme": "UN_M49", "code": "001", "name": "World"},
        "sources": [
            source("irena-rsc-2026", "International Renewable Energy Agency", "Renewable Capacity Statistics 2026", IRENA_URL, "2026", accessed, irena_raw),
            iea_source("iea-ger-2026-solar", "Global Energy Review 2026: Technology—Solar PV and wind", IEA_SOLAR_URL, accessed, iea_solar_raw, iea_solar_evidence),
            iea_source("iea-ger-2026-trends", "Global Energy Review 2026: Global trends", IEA_TRENDS_URL, accessed, iea_trends_raw, iea_trends_evidence),
            source("globalgrid-solar-deployment", "GlobalGrid2050", "Global Solar PV Deployment 2025", GLOBALGRID_URL, "2026-09-14", accessed, estate_raw, role="estate context; numerical observations use IRENA/IEA only", commit=GLOBALGRID_COMMIT),
        ],
        "observations": observations,
        "seed": {
            "algorithm": "sha256",
            "canonicalization": CANONICALIZATION,
            "inputs": sorted(item["key"] for item in observations),
            "url_parameter": "seed",
            "value": seed_for(observations),
        },
    }
    validate(star)
    return star


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--output", type=Path, required=True)
    parser.add_argument("--accessed-utc")
    parser.add_argument("--allow-audited-iea-fixture-on-403", action="store_true")
    args = parser.parse_args()
    value = build(args.accessed_utc, args.allow_audited_iea_fixture_on_403)
    write_json(args.output, value)
    print(f"{args.output}: {args.output.stat().st_size} bytes sha256={digest(args.output.read_bytes())} seed={value['seed']['value']}")

Testcode — Create Page

A web page in Star Solar Star that reads inputs for editor, using ISO 3166-1 and SHA-256.

renderstar-solar-star / testcode/202609150040/create/index.html · lines 1–53 of 53 · version 2026-09-15 00:40 · Entry point · pattern canonical (shared by 28 files)

What it does
It draws its content. Defines canonical, hex, seed. 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.
Inputs & outputs
In: form fields (user input). Out: web page.
Downstream impact
It is itself an entry point (page); no other file was found loading it.
What it achieves
Its name says it creates page. Defines `canonical`, `hex` and `seed`. It responds to click events.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
star-solar-star · testcode/202609150040/create · page
Uses
none found
Used by
none found
Produces
canonical, hex, seed
Defines here
canonical, hex, seed
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
star-solar-star@4ac16c0c2297c4b6022afc4d6f921faf091bb74e testcode/202609150040/create/index.html:1-53 · blob dee63c450d81a1b5493657dccd576291755a00d3 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: unknown
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <title>Create a solar star definition</title>
  <style>
    :root { color-scheme: dark; --space:#07131f; --panel:#10263a; --line:#2d6f88; --text:#f2f7fa; --muted:#a8bdc8; --solar:#e7b84b; --data:#44b7c8; }
    * { box-sizing:border-box; }
    html,body { margin:0; min-width:0; background:var(--space); color:var(--text); font:16px/1.5 system-ui,sans-serif; }
    main { width:min(100%,54rem); margin:0 auto; padding:1rem; overflow-wrap:anywhere; }
    h1 { font-size:clamp(1.55rem,7vw,2.4rem); line-height:1.1; margin:.4rem 0; }
    p { color:var(--muted); }
    .panel { background:var(--panel); border:1px solid var(--line); border-radius:1rem; padding:1rem; }
    textarea { display:block; width:100%; min-height:27rem; resize:vertical; border:1px solid var(--line); border-radius:.75rem; padding:.8rem; background:#06101a; color:var(--text); font:13px/1.45 ui-monospace,monospace; }
    .actions { display:grid; grid-template-columns:repeat(auto-fit,minmax(11rem,1fr)); gap:.65rem; margin-top:.8rem; }
    button,a.button { min-height:48px; display:flex; align-items:center; justify-content:center; border:1px solid var(--line); border-radius:.75rem; padding:.7rem 1rem; background:#15364d; color:var(--text); font:inherit; text-decoration:none; cursor:pointer; }
    button.primary { border-color:var(--solar); color:#fff5d3; }
    output { display:block; min-height:3rem; margin-top:.8rem; padding:.75rem; border-left:4px solid var(--data); background:#091a27; }
    code { color:#9ce4ed; }
    @media (max-width:430px) { main { padding:.75rem; } .panel { padding:.75rem; } textarea { min-height:22rem; } }
  </style>
</head>
<body>
<main>
  <h1>Create a solar star definition</h1>
  <p>A star is a small, source-bound JSON record. Enter only public observations. Each number needs a dated HTTPS source, byte count, SHA-256, access time and source locator. Source observations stay separate; the creator does not average them.</p>
  <section class="panel" aria-labelledby="editor-label">
    <h2 id="editor-label">Definition JSON</h2>
    <textarea id="editor" spellcheck="false" aria-describedby="help"></textarea>
    <p id="help">Country records use ISO 3166-1 alpha-2. The world record uses UN M49 <code>001</code>. Prepare recomputes the deterministic seed and puts the encoded definition in this page's URL.</p>
    <div class="actions">
      <button id="prepare" class="primary" type="button">Prepare definition</button>
      <button id="copy" type="button">Copy encoded URL</button>
      <a id="issue" class="button" href="https://github.com/Ventusltd/star-solar-star/issues/new">Open proposal issue</a>
    </div>
    <output id="status" role="status" aria-live="polite">Ready for a public, sourced definition.</output>
  </section>
</main>
<script>
const editor=document.querySelector('#editor'),status=document.querySelector('#status'),issue=document.querySelector('#issue');
const canonical=value=>Array.isArray(value)?'['+value.map(canonical).join(',')+']':value&&typeof value==='object'?'{'+Object.keys(value).sort().map(k=>JSON.stringify(k)+':'+canonical(value[k])).join(',')+'}':JSON.stringify(value);
const hex=bytes=>Array.from(bytes,b=>b.toString(16).padStart(2,'0')).join('');
const seed=async observations=>hex(new Uint8Array(await crypto.subtle.digest('SHA-256',new TextEncoder().encode(canonical([...observations].sort((a,b)=>a.key.localeCompare(b.key)))))));
const template={schema:'star-solar-star.definition.v1',id:'replace-with-stable-id',type:'country-solar',name:'Replace with public name',description:'Replace with a neutral description of the public observations.',region:{scheme:'ISO_3166-1_alpha-2',code:'GB',name:'United Kingdom'},sources:[],observations:[],seed:{algorithm:'sha256',canonicalization:'UTF-8 JSON, recursively sorted object keys, obse  … [line shortened here: 507 characters; full line on GitHub]
const fromUrl=new URL(location.href).searchParams.get('star');
if(fromUrl){try{editor.value=JSON.stringify(JSON.parse(fromUrl),null,2)}catch(error){editor.value=JSON.stringify(template,null,2);status.textContent='The URL definition could not be decoded.'}}else editor.value=JSON.stringify(template,null,2);
async function prepare(){try{const value=JSON.parse(editor.value);if(!Array.isArray(value.sources)||!value.sources.length)throw new Error('Add at least one public source with complete provenance.');if(!Array.isArray(value.observations)||!value.observations.length)throw new Error('Add at least one source-linked observation.');value.seed={algorithm:'sha256',canonicalization:template.seed.canonicaliz  … [line shortened here: 1,134 characters; full line on GitHub]
document.querySelector('#prepare').addEventListener('click',prepare);
document.querySelector('#copy').addEventListener('click',async()=>{await prepare();try{await navigator.clipboard.writeText(location.href);status.textContent='Encoded URL copied.'}catch(error){status.textContent='Copy was unavailable; select the browser URL.'}});
</script>
</body>
</html>

Issue to Star

A Python command-line tool in the testcode folder of Star Solar Star that extracts an approved star definition from an issue and write its stable path.

ingeststar-solar-star / testcode/202609150040/issue_to_star.py · lines 1–38 of 38 · version 2026-09-15 00:40 · Entry point · pattern extract (shared by 8 files)

What it does
It loads data. Defines extract, publish. Uses libraries __future__, argparse, json, re, pathlib. 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: "`issue_to_star.py` is the fail-closed conversion step after approval."
Inputs & outputs
In: command-line arguments.
Downstream impact
Used directly by 2 files: Test Country Star (star-solar-star); Test Integrity (star-solar-star). Reached from 3 other entry points, including Country Star CI Workflow (star-solar-star); Country Star Candidate Workflow (star-solar-star); Solar Integrity Workflow (star-solar-star).
What it achieves
It is built from the extract step (`extract`) and the publish step (`publish`). The README says: `issue_to_star.py` is the fail-closed conversion step after approval. It accepts `--body-file` and `--output-dir`.
Why it matters
Checked by 2 tests, including Test Country Star.
Application
star-solar-star · testcode/202609150040 · Python CLI
Uses
Star Contract (import), __future__, argparse, json, re, pathlib
Used by
imported by Test Country Star (import), imported by Test Integrity (import)
Produces
extract, publish
Defines here
extract, publish
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
star-solar-star@4ac16c0c2297c4b6022afc4d6f921faf091bb74e testcode/202609150040/issue_to_star.py:1-38 · blob 61ad8405bb12100e2030b3c60ba1367802b261b9 · GitHub at these lines
State
achieves: readme · context: readme_derived · stage: ingest · effects: filesystem · domain stage: experimental · users: none · canonical: unknown
#!/usr/bin/env python3
"""Extract an approved star definition from an issue and write its stable path."""
from __future__ import annotations

import argparse
import json
import re
from pathlib import Path

from star_contract import validate, write_json


def extract(body: str) -> dict:
    match = re.search(r"###\s+Star JSON\s*\n+```(?:json)?\s*\n([\s\S]*?)\n```", body, flags=re.IGNORECASE)
    if not match:
        raise ValueError("issue body lacks a fenced JSON object under '### Star JSON'")
    parsed = json.loads(match.group(1))
    validate(parsed)
    return parsed


def publish(star: dict, output_dir: Path) -> Path:
    path = output_dir / f"{star['id']}.star.json"
    if path.exists():
        current = json.loads(path.read_text(encoding="utf-8"))
        if current != star:
            raise FileExistsError(f"{path} already exists with different content; use a new id")
        return path
    write_json(path, star)
    return path


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--body-file", type=Path, required=True)
    parser.add_argument("--output-dir", type=Path, required=True)
    args = parser.parse_args()
    print(publish(extract(args.body_file.read_text(encoding="utf-8")), args.output_dir).as_posix())

Make Publication

A Python command-line tool in the testcode folder of Star Solar Star covering global solar star, iea audited statements and star schema, using SHA-256.

otherstar-solar-star / testcode/202609150040/make_publication.py · lines 1–34 of 34 · version 2026-09-15 00:40 · Entry point

What it does
Uses libraries __future__, hashlib, json, pathlib. 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 global-solar.star.json; JSON file iea-audited-statements.json; JSON file star.schema.json; JSON file publication.json.
Downstream impact
Used directly by 3 files: Country Star Candidate Workflow (star-solar-star); Country Star CI Workflow (star-solar-star); Sun Star Candidate Workflow (star-solar-star).
What it achieves
Create a deterministic manifest for the candidate implementation. It writes `publication.json`.
Why it matters
Run by Country Star Candidate Workflow, Country Star CI Workflow and Sun Star Candidate Workflow.
Application
star-solar-star · testcode/202609150040 · Python CLI
Uses
Star Contract (import), __future__, hashlib, json, pathlib
Used by
run by Country Star Candidate Workflow (workflow run), run by Country Star CI Workflow (workflow run), run by Sun Star Candidate Workflow (workflow run)
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
star-solar-star@4ac16c0c2297c4b6022afc4d6f921faf091bb74e testcode/202609150040/make_publication.py:1-34 · blob 099c6a44e47007f76e8e2beed0019d2fd5bab425 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: ingest · effects: filesystem · domain stage: experimental · users: none · canonical: unknown
#!/usr/bin/env python3
"""Create a deterministic manifest for the candidate implementation."""
from __future__ import annotations

import hashlib
import json
from pathlib import Path

from star_contract import write_json


ROOT = Path(__file__).resolve().parent
FILES = [
    "README.md",
    "build_global_star.py",
    "create/index.html",
    "global-solar.star.json",
    "iea-audited-statements.json",
    "issue_to_star.py",
    "merge_results.py",
    "star.schema.json",
    "star_contract.py",
    "test_country_star.py",
    "write_result.py",
]


if __name__ == "__main__":
    rows = []
    for relative in FILES:
        raw = (ROOT / relative).read_bytes()
        rows.append({"path": relative, "bytes": len(raw), "sha256": hashlib.sha256(raw).hexdigest()})
    write_json(ROOT / "publication.json", {"schema": "star-solar-star.candidate-publication.v1", "files": rows})
    print(json.dumps({row["path"]: row["sha256"] for row in rows}, sort_keys=True))

Merge Results

A Python command-line tool in the testcode folder of Star Solar Star that reads solar, using SHA-256. It is built from the load step (`load`).

ingeststar-solar-star / testcode/202609150040/merge_results.py · lines 1–42 of 42 · version 2026-09-15 00:40 · Entry point

What it does
It loads solar. Defines load. Uses libraries __future__, argparse, hashlib, json, pathlib. 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. Domain terms in the code: solar. README: "`write_result.py` reduces each lane to stable facts, and `merge_results.py` refuses promotion unless local and GitHub facts and code commits match exactly."
Inputs & outputs
In: command-line arguments.
Downstream impact
Used directly by 1 file: Country Star CI Workflow (star-solar-star).
What it achieves
Fail closed unless local and GitHub lanes report identical stable facts. It accepts `--local`, `--ci` and `--output`.
Why it matters
Run by Country Star CI Workflow.
Application
star-solar-star · testcode/202609150040 · Python CLI
Uses
Star Contract (import), __future__, argparse, hashlib, json, pathlib
Used by
run by Country Star CI Workflow (workflow run)
Produces
load
Defines here
load
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
star-solar-star@4ac16c0c2297c4b6022afc4d6f921faf091bb74e testcode/202609150040/merge_results.py:1-42 · blob cf118785af8580f59273d44a44a44be82f8d50d8 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: ingest · effects: filesystem · domain stage: experimental · users: none · canonical: unknown
#!/usr/bin/env python3
"""Fail closed unless local and GitHub lanes report identical stable facts."""
from __future__ import annotations

import argparse
import hashlib
import json
from pathlib import Path

from star_contract import canonical_bytes, write_json


def load(path: Path) -> dict:
    value = json.loads(path.read_text(encoding="utf-8"))
    if value.get("result_schema") != "star-solar-star.lane-result.v1":
        raise ValueError(f"{path}: unsupported result schema")
    return value


if __name__ == "__main__":
    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()
    local, ci = load(args.local), load(args.ci)
    if local["lane"] == ci["lane"]:
        raise ValueError("independent results must have different lane names")
    if local["code_commit"] != ci["code_commit"]:
        raise ValueError("independent results used different code commits")
    if local["facts"] != ci["facts"]:
        raise ValueError("local and GitHub facts disagree; refusing promotion")
    evidence_sha = hashlib.sha256(canonical_bytes(local["facts"])).hexdigest()
    merged = {
        "result_schema": "star-solar-star.agreement.v1",
        "code_commit": local["code_commit"],
        "lanes": sorted([local["lane"], ci["lane"]]),
        "facts_sha256": evidence_sha,
        "facts": local["facts"],
    }
    write_json(args.output, merged)
    print(f"agreed facts sha256={evidence_sha}")

Star Contract

A Python command-line tool in the testcode folder of Star Solar Star that reads solar, using ISO 3166-1 and SHA-256.

ingeststar-solar-star / testcode/202609150040/star_contract.py · lines 1–156 of 156 · version 2026-09-15 00:40 · Entry point · pattern _public_https_url (shared by 2 files)

What it does
It loads solar. Defines 7 functions or classes, including canonical_bytes, seed_for, _require, _date_like, _public_https_url. Uses libraries __future__, argparse, datetime, hashlib, ipaddress. 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. Domain terms in the code: solar.
Inputs & outputs
In: command-line arguments.
Downstream impact
Used directly by 9 files: Build Global Star (star-solar-star); Issue to Star (star-solar-star); Make Publication (star-solar-star); Merge Results (star-solar-star); and 5 more. Reached from 4 other entry points, including Country Star CI Workflow (star-solar-star); Solar Integrity Workflow (star-solar-star); Sun Star Candidate Workflow (star-solar-star).
What it achieves
It writes JSON (`write_json`) and is built from the canonical bytes helper (`canonical_bytes`) and the seed for helper (`seed_for`). Dependency-free validator and seed compiler for public solar star definitions.
Why it matters
Imported by 6 files, including Build Global Star, Issue to Star and Make Publication. Run by Country Star Candidate Workflow. Checked by 2 tests, including Test Country Star.
Application
star-solar-star · testcode/202609150040 · Python CLI
Uses
__future__, argparse, datetime, hashlib, ipaddress, json, math, re
Used by
imported by Build Global Star (import), imported by Issue to Star (import), imported by Make Publication (import), imported by Merge Results (import), imported by Test Country Star (import), imported by Write Result (import), imported by Test Integrity (import), imported by Vectors (import), and 1 more
Produces
canonical_bytes, seed_for, validate, write_json
Defines here
canonical_bytes, seed_for, _require, _date_like, _public_https_url, validate, write_json
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
star-solar-star@4ac16c0c2297c4b6022afc4d6f921faf091bb74e testcode/202609150040/star_contract.py:1-156 · blob d7e26346e2ea2800d747b0ee10227e886ffc79ce · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: ingest · effects: filesystem · domain stage: experimental · users: none · canonical: unknown
#!/usr/bin/env python3
"""Dependency-free validator and seed compiler for public solar star definitions."""
from __future__ import annotations

import argparse
import datetime as dt
import hashlib
import ipaddress
import json
import math
import re
import urllib.parse
from pathlib import Path
from typing import Any


SCHEMA = "star-solar-star.definition.v1"
CANONICALIZATION = "UTF-8 JSON, recursively sorted object keys, observations sorted by key, no insignificant whitespace"
SHA256 = re.compile(r"^[0-9a-f]{64}$")
SLUG = re.compile(r"^[a-z0-9]+(?:-[a-z0-9]+)*$")
PERIOD = re.compile(r"^[0-9]{4}(?:-[0-9]{2}(?:-[0-9]{2})?)?$")
RELATIONS = {"exact", "approximately", "greater_than", "less_than"}
PUBLIC_LANGUAGE_EXCLUSIONS = (
    "companies house",
    "prospect company",
    "sales target",
    "karma",
    "vedic",
    "enemy",
    "verdict",
)


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


def seed_for(observations: list[dict[str, Any]]) -> str:
    ordered = sorted(observations, key=lambda item: item["key"])
    return hashlib.sha256(canonical_bytes(ordered)).hexdigest()


def _require(condition: bool, message: str) -> None:
    if not condition:
        raise ValueError(message)


def _date_like(value: Any, label: str) -> None:
    _require(isinstance(value, str) and PERIOD.fullmatch(value) is not None, f"{label} must be YYYY, YYYY-MM or YYYY-MM-DD")


def _public_https_url(value: Any, label: str) -> None:
    _require(isinstance(value, str), f"{label} must be a string")
    parsed = urllib.parse.urlsplit(value)
    _require(parsed.scheme == "https" and parsed.hostname is not None, f"{label} must use HTTPS with a host")
    _require(parsed.username is None and parsed.password is None, f"{label} must not contain credentials")
    _require(not parsed.fragment, f"{label} must not contain a fragment")
    host = parsed.hostname.lower().rstrip(".")
    try:
        address = ipaddress.ip_address(host)
    except ValueError:
        _require("." in host and host != "localhost" and not host.endswith(".local"), f"{label} host must be public")
    else:
        _require(address.is_global, f"{label} IP host must be globally routable")


def validate(star: dict[str, Any]) -> dict[str, Any]:
    _require(isinstance(star, dict), "star must be a JSON object")
    required = {"schema", "id", "type", "name", "description", "region", "sources", "observations", "seed"}
    _require(required <= set(star), f"missing top-level keys: {sorted(required - set(star))}")
    _require(star["schema"] == SCHEMA, f"schema must be {SCHEMA}")
    _require(isinstance(star["id"], str) and SLUG.fullmatch(star["id"]) is not None, "id must be a lowercase hyphenated slug")
    _require(star["type"] in {"country-solar", "global-solar"}, "unsupported star type")
    _require(isinstance(star["name"], str) and 1 <= len(star["name"].strip()) <= 120, "name must contain 1 to 120 characters")
    _require(isinstance(star["description"], str) and 1 <= len(star["description"].strip()) <= 500, "description must contain 1 to 500 characters")

    public_text = " ".join([star["name"], star["description"]]).lower()
    for term in PUBLIC_LANGUAGE_EXCLUSIONS:
        _require(term not in public_text, f"public-facing name/description contains excluded term: {term}")

    region = star["region"]
    _require(isinstance(region, dict), "region must be an object")
    _require(set(region) == {"scheme", "code", "name"}, "region must contain scheme, code and name only")
    if star["type"] == "country-solar":
        _require(region["scheme"] == "ISO_3166-1_alpha-2", "country stars require ISO 3166-1 alpha-2")
        _require(re.fullmatch(r"[A-Z]{2}", str(region["code"])) is not None, "country code must be two uppercase letters")
    else:
        _require(region["scheme"] == "UN_M49" and region["code"] == "001", "global star requires UN M49 code 001")

    sources = star["sources"]
    _require(isinstance(sources, list) and sources, "sources must be a non-empty array")
    source_ids = set()
    for pos, source in enumerate(sources):
        label = f"sources[{pos}]"
        needed = {"id", "publisher", "title", "url", "published", "accessed_utc", "bytes", "sha256"}
        _require(isinstance(source, dict) and needed <= set(source), f"{label} lacks required provenance")
        _require(source["id"] not in source_ids, f"duplicate source id {source['id']}")
        source_ids.add(source["id"])
        _public_https_url(source["url"], f"{label}.url")
        _date_like(source["published"], f"{label}.published")
        _require(isinstance(source["accessed_utc"], str) and source["accessed_utc"].endswith("Z"), f"{label}.accessed_utc must end in Z")
        try:
            dt.datetime.fromisoformat(source["accessed_utc"].replace("Z", "+00:00"))
        except ValueError as exc:
            raise ValueError(f"{label}.accessed_utc is invalid") from exc
        _require(isinstance(source["bytes"], int) and not isinstance(source["bytes"], bool) and source["bytes"] > 0, f"{label}.bytes must be positive")
        _require(isinstance(source["sha256"], str) and SHA256.fullmatch(source["sha256"]) is not None, f"{label}.sha256 is invalid")

    observations = star["observations"]
    _require(isinstance(observations, list) and observations, "observations must be a non-empty array")
    keys = set()
    for pos, observation in enumerate(observations):
        label = f"observations[{pos}]"
        needed = {"key", "metric", "period", "value", "unit", "relation", "source_id", "locator"}
        _require(isinstance(observation, dict) and needed <= set(observation), f"{label} lacks required fields")
        _require(isinstance(observation["key"], str) and observation["key"], f"{label}.key is required")
        _require(observation["key"] not in keys, f"duplicate observation key {observation['key']}")
        keys.add(observation["key"])
        _date_like(observation["period"], f"{label}.period")
        value = observation["value"]
        _require(isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value), f"{label}.value must be finite")
        _require(isinstance(observation["unit"], str) and observation["unit"], f"{label}.unit is required")
        _require(observation["relation"] in RELATIONS, f"{label}.relation is unsupported")
        _require(observation["source_id"] in source_ids, f"{label} refers to unknown source")
        _require(isinstance(observation["locator"], str) and observation["locator"], f"{label}.locator is required")

    seed = star["seed"]
    _require(isinstance(seed, dict), "seed must be an object")
    _require(seed.get("algorithm") == "sha256", "seed algorithm must be sha256")
    _require(seed.get("canonicalization") == CANONICALIZATION, "unexpected seed canonicalization")
    _require(seed.get("url_parameter") == "seed", "seed URL parameter must be seed")
    expected_inputs = sorted(keys)
    _require(seed.get("inputs") == expected_inputs, "seed inputs must be all observation keys in sorted order")
    expected_seed = seed_for(observations)
    _require(seed.get("value") == expected_seed, "seed does not match canonical observations")
    return {
        "id": star["id"],
        "type": star["type"],
        "region": region["code"],
        "sources": len(sources),
        "observations": len(observations),
        "seed": expected_seed,
    }


def write_json(path: Path, value: Any) -> None:
    path.parent.mkdir(parents=True, exist_ok=True)
    with path.open("w", encoding="utf-8", newline="\n") as handle:
        handle.write(json.dumps(value, ensure_ascii=False, indent=2, sort_keys=True) + "\n")


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("star", type=Path)
    args = parser.parse_args()
    print(json.dumps(validate(json.loads(args.star.read_text(encoding="utf-8"))), sort_keys=True))

Test Country Star

A test in the testcode folder of Star Solar Star that checks Issue to Star and Star Contract, using SHA-256.

teststar-solar-star / testcode/202609150040/test_country_star.py · lines 1–102 of 102 · version 2026-09-15 00:40 · Entry point · pattern setUpClass (shared by 19 files)

What it does
It tests its inputs. Defines 12 functions or classes, including StarContractTests, setUpClass, test_global_record_validates, test_observation_order_does_not_change_seed, test_modified_measurement_is_rejected_without_new_seed. Uses libraries __future__, copy, importlib.util, json, sys. 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 global-solar.star.json.
Downstream impact
Used directly by 2 files: Country Star Candidate Workflow (star-solar-star); Country Star CI Workflow (star-solar-star).
What it achieves
It sets up class (`setUpClass`) and is built from the star contract tests class (`StarContractTests`). Defines `StarContractTests`, `setUpClass`, `test_global_record_validates` and 9 more. Its code works with 600 GW.
Why it matters
Run by Country Star Candidate Workflow and Country Star CI Workflow.
Application
star-solar-star · testcode/202609150040 · test
Uses
Issue to Star (import), Star Contract (import), Build Global Star (import), __future__, copy, importlib.util, json, sys, tempfile, unittest, urllib.error
Used by
run by Country Star Candidate Workflow (workflow run), run by Country Star CI Workflow (workflow run)
Produces
StarContractTests
Defines here
StarContractTests, setUpClass, test_global_record_validates, test_observation_order_does_not_change_seed, test_modified_measurement_is_rejected_without_new_seed, test_private_work_language_is_rejected, test_source_url_must_be_public_https_without_credentials_or_fragment, test_existing_id_cannot_be_replaced_with_different_content, test_text_outside_json_fence_is_never_parsed_as_code, test_issue_parser_accepts_one_json_fence, test_creator_is_mobile_and_deterministic, test_iea_fixture_is_used_only_for_explicit_403_policy
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
star-solar-star@4ac16c0c2297c4b6022afc4d6f921faf091bb74e testcode/202609150040/test_country_star.py:1-102 · blob d8bcedc7d1949f26ffa3acaa473857b51575eb51 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: ingest · effects: filesystem · domain stage: experimental · users: none · canonical: unknown
from __future__ import annotations

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


HERE = Path(__file__).resolve().parent
sys.path.insert(0, str(HERE))
from issue_to_star import extract, publish  # noqa: E402
from star_contract import seed_for, validate  # noqa: E402
import build_global_star  # noqa: E402


class StarContractTests(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.star = json.loads((HERE / "global-solar.star.json").read_text(encoding="utf-8"))

    def test_global_record_validates(self):
        result = validate(self.star)
        self.assertEqual(result["observations"], 6)
        self.assertEqual(result["region"], "001")
        self.assertEqual(result["seed"], "a8696b5b9286966a43af65e3556ff3805df60542ed08f6fbc841d7bfed92dffa")

    def test_observation_order_does_not_change_seed(self):
        self.assertEqual(seed_for(self.star["observations"]), seed_for(list(reversed(self.star["observations"]))))

    def test_modified_measurement_is_rejected_without_new_seed(self):
        changed = copy.deepcopy(self.star)
        changed["observations"][0]["value"] += 1
        with self.assertRaisesRegex(ValueError, "seed does not match"):
            validate(changed)

    def test_private_work_language_is_rejected(self):
        changed = copy.deepcopy(self.star)
        changed["description"] = "A Companies House prospect company list"
        with self.assertRaisesRegex(ValueError, "excluded term"):
            validate(changed)

    def test_source_url_must_be_public_https_without_credentials_or_fragment(self):
        invalid = (
            "https://localhost/source",
            "https://10.0.0.1/source",
            "https://user@example.com/source",
            "https://example.com/source#section",
        )
        for url in invalid:
            with self.subTest(url=url):
                changed = copy.deepcopy(self.star)
                changed["sources"][0]["url"] = url
                with self.assertRaises(ValueError):
                    validate(changed)

    def test_existing_id_cannot_be_replaced_with_different_content(self):
        with tempfile.TemporaryDirectory() as directory:
            output = Path(directory)
            publish(self.star, output)
            changed = copy.deepcopy(self.star)
            changed["description"] = "A different neutral description."
            with self.assertRaises(FileExistsError):
                publish(changed, output)

    def test_text_outside_json_fence_is_never_parsed_as_code(self):
        body = "$(untrusted text)\n### Star JSON\n```json\n" + json.dumps(self.star) + "\n```\n"
        self.assertEqual(extract(body), self.star)

    def test_issue_parser_accepts_one_json_fence(self):
        body = "Proposal\n### Star JSON\n```json\n" + json.dumps(self.star) + "\n```\n"
        self.assertEqual(extract(body), self.star)

    def test_creator_is_mobile_and_deterministic(self):
        page = (HERE / "create" / "index.html").read_text(encoding="utf-8")
        self.assertIn('name="viewport"', page)
        self.assertIn("min-height:48px", page)
        self.assertIn("crypto.subtle.digest('SHA-256'", page)
        self.assertNotIn("Math.random", page)
        self.assertNotIn("decodeURIComponent(fromUrl)", page)
        for excluded in ("prospect company", "sales target", "verdict"):
            self.assertNotIn(excluded, page.lower())

    def test_iea_fixture_is_used_only_for_explicit_403_policy(self):
        error = urllib.error.HTTPError(build_global_star.IEA_SOLAR_URL, 403, "Forbidden", {}, None)
        with mock.patch.object(build_global_star, "fetch", side_effect=error):
            with self.assertRaises(urllib.error.HTTPError):
                build_global_star.iea_payload("iea-ger-2026-solar", build_global_star.IEA_SOLAR_URL, False)
            raw, text, evidence = build_global_star.iea_payload(
                "iea-ger-2026-solar", build_global_star.IEA_SOLAR_URL, True
            )
        self.assertIsNone(raw)
        self.assertIn("surpassing 600 GW", text)
        self.assertEqual(evidence["sha256"], "e132b601459dd69c1f60257a277905a8cdced445787c8ce201509f171e691fea")


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

Write Result

A Python command-line tool in the testcode folder of Star Solar Star that reads solar, using SHA-256. It is built from the result for helper (`result_for`).

ingeststar-solar-star / testcode/202609150040/write_result.py · lines 1–43 of 43 · version 2026-09-15 00:40 · Entry point

What it does
It loads solar. Defines result_for. Uses libraries __future__, argparse, json, pathlib. 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. Domain terms in the code: solar. README: "`write_result.py` reduces each lane to stable facts, and `merge_results.py` refuses promotion unless local and GitHub facts and code commits match exactly."
Inputs & outputs
In: command-line arguments.
Downstream impact
Used directly by 3 files: Country Star Candidate Workflow (star-solar-star); Country Star CI Workflow (star-solar-star); Sun Star Candidate Workflow (star-solar-star).
What it achieves
Write the stable evidence used to compare independent execution lanes. It accepts `--star`, `--output` and `--lane`.
Why it matters
Run by Country Star Candidate Workflow, Country Star CI Workflow and Sun Star Candidate Workflow.
Application
star-solar-star · testcode/202609150040 · Python CLI
Uses
Star Contract (import), __future__, argparse, json, pathlib
Used by
run by Country Star Candidate Workflow (workflow run), run by Country Star CI Workflow (workflow run), run by Sun Star Candidate Workflow (workflow run)
Produces
result_for
Defines here
result_for
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
star-solar-star@4ac16c0c2297c4b6022afc4d6f921faf091bb74e testcode/202609150040/write_result.py:1-43 · blob ecacfbd695bc19d017b359fd627a03d2217548e8 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: ingest · effects: filesystem · domain stage: experimental · users: none · canonical: unknown
#!/usr/bin/env python3
"""Write the stable evidence used to compare independent execution lanes."""
from __future__ import annotations

import argparse
import json
from pathlib import Path

from star_contract import validate, write_json


def result_for(star: dict, lane: str, code_commit: str) -> dict:
    summary = validate(star)
    sources = {row["id"]: row for row in star["sources"]}
    return {
        "result_schema": "star-solar-star.lane-result.v1",
        "lane": lane,
        "code_commit": code_commit,
        "facts": {
            "id": summary["id"],
            "type": summary["type"],
            "region": star["region"],
            "observations": star["observations"],
            "observation_count": summary["observations"],
            "seed": summary["seed"],
            "source_urls": {key: sources[key]["url"] for key in sorted(sources)},
            "irena_pdf_sha256": sources["irena-rsc-2026"]["sha256"],
            "globalgrid_commit": sources["globalgrid-solar-deployment"]["commit"],
        },
    }


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--star", type=Path, required=True)
    parser.add_argument("--output", type=Path, required=True)
    parser.add_argument("--lane", required=True)
    parser.add_argument("--code-commit", required=True)
    args = parser.parse_args()
    star = json.loads(args.star.read_text(encoding="utf-8"))
    value = result_for(star, args.lane, args.code_commit)
    write_json(args.output, value)
    print(json.dumps(value["facts"], ensure_ascii=False, sort_keys=True))