GLOBALGRID2050 / EXPLORE CODE

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

CI Verify and 3 more files

A Python command-line tool in Data Grid GB that reads sources and lanes, using SHA-256. It checks registry (`check_registry`), checks raw (`check_raw`) and checks outputs (`check_outputs`).

386 lines of Python and YAML from data-grid-gb, in 4 files. Topic: Automation and CI. Section 1698 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. Test Assets Workflow test · data-grid-gb / .github/workflows/test-assets.yml lines 1–83
  2. UKPN Secondary Columnar Workflow automation · data-grid-gb / .github/workflows/ukpn-secondary-columnar.yml lines 1–80
  3. Data Grid GB — CI automation · data-grid-gb / ci/__init__.py lines 1–1
  4. CI Verify automation · data-grid-gb / ci/verify.py lines 1–222

Test Assets Workflow

A GitHub Actions workflow in Data Grid GB. Runs on push and on pull requests.

testdata-grid-gb / .github/workflows/test-assets.yml · lines 1–83 of 83 · Entry point

What it does
It tests its inputs. Side effects: starts processes.
Inputs & outputs
In: JSON file reproduction.json.
Downstream impact
It is itself an entry point (workflow); no other file was found loading it.
What it achieves
Tests for the data-centre and conventional-generation pipelines.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
data-grid-gb · .github/workflows · workflow
Uses
Test Assets (workflow run), Test DC Address Locations (workflow run), Test Lanes (workflow run), CI Verify (workflow run), Run Lanes (workflow run), Reproduce (workflow run)
Used by
none found
Produces
none declared
Defines here
Test the asset pipelines
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
data-grid-gb@4a9cef6c7c791f76d416c8b2fbafac8265f7a263 .github/workflows/test-assets.yml:1-83 · blob 253a1e95755ecbab8f48c3084f0cf355ab3b0509 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: unknown · users: none · canonical: supporting_data
# Tests for the data-centre and conventional-generation pipelines.
#
# Two legs, as in Ventusltd/lightning's test workflow: "requirements" installs
# requirements.txt (openpyxl, for spreadsheet sources such as DUKES 5.11) and may
# not skip a dependency test; "bare" proves that fetch, verify and reproduce need
# nothing beyond the standard library.
name: Test the asset pipelines

on:
  push:
    paths:
      - 'assetpipe/**'
      - 'datacentres/**'
      - 'conventional/**'
      - 'pipelines/fetch_assets.py'
      - 'pipelines/run_lanes.py'
      - 'ci/**'
      - 'reproduce.py'
      - 'tests/**'
      - 'requirements.txt'
      - '.github/workflows/test-assets.yml'
      - '.github/workflows/fetch-assets.yml'
  pull_request:
    paths:
      - 'assetpipe/**'
      - 'datacentres/**'
      - 'conventional/**'
      - 'pipelines/fetch_assets.py'
      - 'pipelines/run_lanes.py'
      - 'ci/**'
      - 'reproduce.py'
      - 'tests/**'
      - 'requirements.txt'
      - '.github/workflows/test-assets.yml'
      - '.github/workflows/fetch-assets.yml'

permissions:
  contents: read

jobs:
  test:
    name: test (${{ matrix.deps }})
    runs-on: ubuntu-24.04
    timeout-minutes: 10
    strategy:
      fail-fast: false
      matrix:
        deps: [requirements, bare]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - name: Install requirements.txt
        if: matrix.deps == 'requirements'
        run: pip install -r requirements.txt
      - name: Static check (undefined names)
        run: |
          pip install pyflakes==3.2.0
          python -m pyflakes assetpipe ci tests reproduce.py pipelines/fetch_assets.py pipelines/run_lanes.py datacentres conventional | tee "$RUNNER_TEMP/pyflakes.txt" || true
          if grep -E "undefined name|referenced before assignment|unable to detect undefined names" "$RUNNER_TEMP/pyflakes.txt"; then
            echo "::error::pyflakes found an undefined name"
            exit 1
          fi
      - name: Unit tests
        env:
          ASSETS_REQUIRE_DEPS: ${{ matrix.deps == 'requirements' && '1' || '0' }}
        run: python -m unittest discover -s tests -v
      - name: Verify the committed data (fails closed; no unverified-licence lane outputs)
        run: python ci/verify.py
      - name: Lane self-tests (synthetic fixtures, no network)
        run: python pipelines/run_lanes.py selftest
      # The DC-A6 build reads three large pinned inputs that are not committed
      # (url + sha256 in conventional/lanes/lanes.json). They come from GitHub
      # itself, so this leg can rebuild DC-A6 and must not skip it.
      - name: Download pinned lane inputs
        if: matrix.deps == 'requirements'
        run: python pipelines/run_lanes.py inputs
      - name: Reproduce from the committed raw snapshots and rebuild every open lane
        env:
          ASSETS_REQUIRE_DEPS: ${{ matrix.deps == 'requirements' && '1' || '0' }}
          ASSETS_REQUIRE_INPUTS: ${{ matrix.deps == 'requirements' && '1' || '0' }}
        run: python reproduce.py check --json "$RUNNER_TEMP/reproduction.json"

UKPN Secondary Columnar Workflow

A GitHub Actions workflow in Data Grid GB that builds and publishes the site using data from the GridAtlas repository. Runs on push and by hand.

automationdata-grid-gb / .github/workflows/ukpn-secondary-columnar.yml · lines 1–80 of 80 · Entry point

What it does
It builds and publishes transformers. Side effects: reads or writes files; makes network requests; starts processes; uses storage (browser storage, DuckDB or Parquet).
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'ukpn'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: transformers.
Inputs & outputs
In: data source: gridatlas data; DuckDB queries. Out: commits pushed to the repository.
Downstream impact
It is itself an entry point (workflow); no other file was found loading it.
What it achieves
Named “Publish pinned UKPN secondary transformer partitions”.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
data-grid-gb · .github/workflows · workflow
Uses
Import UKPN (estate URL)
Used by
none found
Produces
none declared
Defines here
Publish pinned UKPN secondary transformer partitions
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
data-grid-gb@4a9cef6c7c791f76d416c8b2fbafac8265f7a263 .github/workflows/ukpn-secondary-columnar.yml:1-80 · blob 09f034010b6d47296b14e3a4625a68404b2d2e09 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem, network, process, storage · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: supporting_data
name: Publish pinned UKPN secondary transformer partitions

on:
  push:
    branches: [main]
    paths:
      - '.github/workflows/ukpn-secondary-columnar.yml'
  workflow_dispatch:

permissions:
  contents: write

concurrency:
  group: ukpn-secondary-202612010912
  cancel-in-progress: false

jobs:
  publish:
    runs-on: ubuntu-24.04
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
      - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
        with:
          python-version: '3.12'
      - name: Install pinned dependency
        run: python -m pip install duckdb==1.3.2
      - name: Build and verify exact previously audited bytes
        shell: bash
        run: |
          set -euo pipefail
          test "$(sha256sum ukpn-secondary/ukpn-secondary-site-transformers.zip | cut -d' ' -f1)" = c75933d86f4872a5f54712c0a945c283bb9038323a2ae9567df51ba3ce1b75c5
          curl --fail --silent --show-error --location https://raw.githubusercontent.com/Ventusltd/gridatlas/655be27d607612b3a767e1408c80e87002f8f2b1/tools/secondary/import_ukpn.py -o "$RUNNER_TEMP/import_ukpn.py"
          test "$(git hash-object "$RUNNER_TEMP/import_ukpn.py")" = 11f3cf36270ec95e6d952aced98a26ca38c4d97e
          python "$RUNNER_TEMP/import_ukpn.py" ukpn-secondary/ukpn-secondary-site-transformers.zip --output "$RUNNER_TEMP/ukpn-a"
          python "$RUNNER_TEMP/import_ukpn.py" ukpn-secondary/ukpn-secondary-site-transformers.zip --output "$RUNNER_TEMP/ukpn-b"
          diff -qr "$RUNNER_TEMP/ukpn-a" "$RUNNER_TEMP/ukpn-b"
          cd "$RUNNER_TEMP/ukpn-a"
          sha256sum --check <<'HASHES'
          b653eb5575903de1499d8d4baaa72f4947114bdcc9d98e62887804bfaba62f1e  grid_ukpn_secondary.geojson
          32cb071845049e6955421baa31d59799f5e4c8a24d07271cca01f3833f644991  grid_ukpn_secondary.parquet
          3c55aeebd0a92cee6fc53d4a13a99de3faf431565832c4dce1e513599fcf0c7e  ukpn_transformers.parquet
          725fb0c1ab078360b1b09326ab0d91bc00d7f03e4bec8c2a467debc537f7978e  ukpn_sites.parquet
          HASHES
      - name: Stage only canonical Parquet and provenance
        shell: bash
        run: |
          set -euo pipefail
          export CANDIDATE="$RUNNER_TEMP/ukpn-publication"
          mkdir -p "$CANDIDATE"
          cp "$RUNNER_TEMP/ukpn-a/"*.parquet "$CANDIDATE/"
          python - <<'PY'
          import json, os
          from pathlib import Path
          p = Path(os.environ['RUNNER_TEMP']) / 'ukpn-a' / 'manifest.json'
          m = json.loads(p.read_text())
          assert (m['source_rows'], m['distinct_sites'], m['map_rows'], m['unplaced_sites']) == (74719,56309,54558,1751)
          m['compiler_revision'] = '655be27d607612b3a767e1408c80e87002f8f2b1'
          for artifact in m['artifacts']:
              artifact['published'] = artifact['path'].endswith('.parquet')
          m['delivery'] = 'Only Parquet is distributed here; GeoJSON digest is reproducibility evidence, not a published file.'
          (Path(os.environ['CANDIDATE']) / 'manifest.json').write_text(json.dumps(m, indent=2, ensure_ascii=False)+'\n')
          PY
      - name: Publish immutable partition folder without force
        shell: bash
        run: |
          set -euo pipefail
          target=ukpn-secondary/202612010912
          test "$GITHUB_REF" = refs/heads/main
          if test -e "$target"; then
            diff -qr "$RUNNER_TEMP/ukpn-publication" "$target"
            echo "Exact generation already published; no mutation."
            exit 0
          fi
          mkdir "$target"
          cp "$RUNNER_TEMP/ukpn-publication/"* "$target/"
          git add -- "$target"
          git -c user.name='github-actions[bot]' -c user.email='41898282+github-actions[bot]@users.noreply.github.com' commit -m "Publish reproducible UKPN secondary transformer Parquet 202612010912"
          git push origin HEAD:main
          git ls-remote --exit-code origin refs/heads/main

Data Grid GB — CI

A Python module.

automationdata-grid-gb / ci/__init__.py · lines 1–1 of 1

Downstream impact
Used directly by 1 file: Test Assets (data-grid-gb). Reached from 1 other entry point, including Test Assets Workflow (data-grid-gb).
What it achieves
CI helpers (`ci/verify.py`).
Why it matters
Checked by Test Assets.
Application
data-grid-gb · ci · Python module
Uses
none found
Used by
imported by Test Assets (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
data-grid-gb@4a9cef6c7c791f76d416c8b2fbafac8265f7a263 ci/__init__.py:1-1 · blob aafebe4d6d528ec9789e90a6d8affaf9f47dc16a · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: unknown · effects: none found · domain stage: unknown · users: none · canonical: supporting_data
"""CI helpers (ci/verify.py)."""

CI Verify

A Python command-line tool in Data Grid GB that reads sources and lanes, using SHA-256. It checks registry (`check_registry`), checks raw (`check_raw`) and checks outputs (`check_outputs`).

automationdata-grid-gb / ci/verify.py · lines 1–222 of 222 · Entry point · pattern check_outputs (shared by 2 files)

What it does
It loads sources and lanes. Defines 6 functions or classes, including fetcher_status, sha256_file, check_registry, check_raw, check_outputs. Uses libraries __future__, argparse, hashlib, json, re. Side effects: reads or writes files.
Inputs & outputs
In: JSON file sources.json; JSON file INDEX.json; JSON file lanes.json; command-line arguments.
Downstream impact
Used directly by 3 files: Fetch Assets Workflow (data-grid-gb); Test Assets Workflow (data-grid-gb); Test Assets (data-grid-gb).
What it achieves
Verify the committed data-centre and conventional-generation data. It accepts `--root`, `--domain` and `--allow-unverified-lanes`.
Why it matters
Run by Fetch Assets Workflow. Checked by 2 tests, including Test Assets Workflow.
Application
data-grid-gb · ci · Python CLI
Uses
Data Grid GB — Assetpipe (import), Schema (import), __future__, argparse, hashlib, json, re, sys, pathlib
Used by
run by Fetch Assets Workflow (workflow run), run by Test Assets Workflow (workflow run), imported by Test Assets (import)
Produces
fetcher_status, sha256_file, check_registry, check_raw, check_outputs, main
Defines here
fetcher_status, sha256_file, check_registry, check_raw, check_outputs, main
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
data-grid-gb@4a9cef6c7c791f76d416c8b2fbafac8265f7a263 ci/verify.py:1-222 · blob 40bf4f8c1059cafc1bcdb33b47060343b938bfd2 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: ingest · effects: filesystem · domain stage: unknown · users: none · canonical: supporting_data
#!/usr/bin/env python3
"""Verify the committed data-centre and conventional-generation data. Fails closed.

    python ci/verify.py [--root .] [--domain datacentres|conventional|all]

Checks, per domain, each only when its file exists:

- registry   ``sources.json`` and ``NOTICE``: schema, unique ids, open in yes/no/unverified, a NOTICE entry per source, a
             licence and licence URL for every open source, and no ready fetcher
             for a source that is not fully open;
- raw        ``raw/MANIFEST.json``: every committed file exists with the pinned
             bytes and sha256; no raw file sits on disk without a pin;
- outputs    ``normalised/*.geojson``: listed in ``INDEX.json`` with the same
             sha256 and count; from a registered source with ``open: "yes"``;
             licence equal to the registry's; ``raw_sha256`` equal to the pins;
             every feature a valid record (assetpipe.schema: IT load and grid
             connection MW separate, unknown is null not zero, licence and
             evidence URL present, location precision stated); unique ids;
             the three honesty sentences present.

- lanes      ``lanes/lanes.json`` + ``lanes/MANIFEST.json``: every committed file in
             every vendored lane directory matches its pin, nothing unpinned, no
             lane that is not fully open, pinned inputs intact, and no outputs
             from a lane whose licence is unverified (``--allow-unverified-lanes``
             relaxes only that last rule, for review branches).

Exit 0 when every check passes, 1 otherwise (``::error::`` lines), as
lightning's ci/verify_data.py does.
"""
from __future__ import annotations

import argparse
import hashlib
import json
import re
import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))

from assetpipe import DOMAINS  # noqa: E402
from assetpipe import lanes as lanelib  # noqa: E402
from assetpipe.schema import OPEN_VALUES, SCHEMA_COLLECTION, VALIDATORS  # noqa: E402

HONESTY = (
    "Proximity is not connection, capacity or feasibility.",
    "A pipeline entry is not a commitment.",
    "Unknown is null, not zero.",
)
STATUS_LINE = re.compile(r'^STATUS = "(\w+)"', re.M)


def fetcher_status(path: Path) -> str:
    match = STATUS_LINE.search(path.read_text(encoding="utf-8"))
    return match.group(1) if match else "missing"


IGNORED_RAW = {"MANIFEST.json", ".gitkeep", "README.md"}


def sha256_file(path: Path) -> str:
    return hashlib.sha256(path.read_bytes()).hexdigest()


def check_registry(ddir: Path, domain: str) -> tuple[str, dict]:
    reg = json.loads((ddir / "sources.json").read_text(encoding="utf-8"))
    if reg.get("schema") != "gb-asset-source-registry.v1" or reg.get("domain") != domain:
        raise ValueError("not a gb-asset-source-registry.v1 for this domain")
    by_id = {}
    for entry in reg.get("sources", []):
        sid = entry.get("id")
        if not sid or sid in by_id:
            raise ValueError(f"missing or duplicate source id {sid!r}")
        if entry.get("open") not in OPEN_VALUES:
            raise ValueError(f"{sid}: open must be one of {OPEN_VALUES}")
        if entry["open"] == "yes":
            for key in ("licence", "licence_url", "url", "publisher"):
                if not entry.get(key):
                    raise ValueError(f"{sid}: open source without {key}")
            if not str(entry["licence_url"]).startswith("https://"):
                raise ValueError(f"{sid}: licence_url is not https")
        module = entry.get("module")
        if module:
            path = ddir / "fetchers" / f"{module}.py"
            if not path.exists():
                raise ValueError(f"{sid}: fetcher {path.relative_to(ddir.parent)} missing")
            text = path.read_text(encoding="utf-8")
            if f'SOURCE_ID = "{sid}"' not in text:
                raise ValueError(f"{sid}: {path.name} does not declare SOURCE_ID = \"{sid}\"")
            if fetcher_status(path) not in ("ready", "snapshot", "placeholder"):
                raise ValueError(f"{sid}: {path.name} has no STATUS = \"ready|snapshot|placeholder\" line")
            if entry["open"] == "no" and fetcher_status(path) != "placeholder":
                raise ValueError(f"{sid}: a source that is not fully open has a ready fetcher")
        by_id[sid] = entry
    notice = (ddir / "NOTICE").read_text(encoding="utf-8") if (ddir / "NOTICE").exists() else ""
    for sid, entry in by_id.items():
        if f"{sid}  (open: {entry['open']})" not in notice:
            raise ValueError(f"NOTICE has no entry '{sid}  (open: {entry['open']})' matching the registry")
    states = [fetcher_status(ddir / "fetchers" / f"{e['module']}.py") for e in by_id.values() if e.get("module")]
    return (f"registry ok ({len(by_id)} sources, {states.count('ready')} ready, "
            f"{states.count('snapshot')} snapshot-only)"), by_id


def check_raw(ddir: Path) -> tuple[str, dict]:
    raw_dir = ddir / "raw"
    manifest_path = raw_dir / "MANIFEST.json"
    if not manifest_path.exists():
        stray = [p for p in raw_dir.rglob("*") if p.is_file() and p.name not in IGNORED_RAW] if raw_dir.exists() else []
        if stray:
            raise ValueError(f"raw files without a MANIFEST.json: {[str(p.relative_to(ddir)) for p in stray[:5]]}")
        return "raw ok (no snapshots yet)", {"files": {}}
    manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
    if manifest.get("schema") != "gb-asset-raw-manifest.v1":
        raise ValueError("raw/MANIFEST.json is not gb-asset-raw-manifest.v1")
    for rel, meta in manifest["files"].items():
        path = raw_dir / rel
        if not meta.get("committed", True):
            continue
        if not path.exists():
            raise ValueError(f"raw/{rel} is pinned but missing")
        data = path.read_bytes()
        if len(data) != meta["bytes"] or hashlib.sha256(data).hexdigest() != meta["sha256"]:
            raise ValueError(f"raw/{rel} does not match its pinned bytes/sha256")
        if not str(meta.get("url", "")).startswith("https://"):
            raise ValueError(f"raw/{rel} was not fetched from an https URL")
    on_disk = {p.relative_to(raw_dir).as_posix() for p in raw_dir.rglob("*")
               if p.is_file() and p.name not in IGNORED_RAW}
    orphans = sorted(on_disk - set(manifest["files"]))
    if orphans:
        raise ValueError(f"raw files without a pin: {orphans[:5]}")
    return f"raw ok ({len(manifest['files'])} pinned files)", manifest


def check_outputs(ddir: Path, domain: str, registry: dict, manifest: dict) -> str:
    out_dir = ddir / "normalised"
    files = sorted(p for p in out_dir.glob("*.geojson")) if out_dir.exists() else []
    index_path = out_dir / "INDEX.json"
    index = json.loads(index_path.read_text(encoding="utf-8")) if index_path.exists() else {"outputs": {}}
    listed = set(index.get("outputs", {}))
    present = {p.name for p in files}
    if listed != present:
        raise ValueError(f"INDEX.json lists {sorted(listed)} but normalised/ holds {sorted(present)}")
    schema_name, validate = VALIDATORS[domain]
    total = 0
    for path in files:
        meta_index = index["outputs"][path.name]
        if sha256_file(path) != meta_index["sha256"]:
            raise ValueError(f"{path.name}: sha256 differs from INDEX.json")
        obj = json.loads(path.read_text(encoding="utf-8"))
        meta = obj.get("metadata") or {}
        if obj.get("type") != "FeatureCollection" or meta.get("schema") != SCHEMA_COLLECTION:
            raise ValueError(f"{path.name}: not a {SCHEMA_COLLECTION} FeatureCollection")
        if meta.get("record_schema") != schema_name or meta.get("domain") != domain:
            raise ValueError(f"{path.name}: record_schema/domain mismatch")
        sid = meta.get("source_id")
        entry = registry.get(sid)
        if entry is None:
            raise ValueError(f"{path.name}: source {sid!r} is not in the registry")
        if entry["open"] != "yes":
            raise ValueError(f"{path.name}: source {sid} is not marked fully open (open: {entry['open']})")
        if meta.get("licence") != entry["licence"] or meta.get("licence_url") != entry["licence_url"]:
            raise ValueError(f"{path.name}: licence differs from the registry")
        pins = {rel: m["sha256"] for rel, m in manifest["files"].items() if m.get("source_id") == sid}
        if meta.get("raw_sha256") != pins or not pins:
            raise ValueError(f"{path.name}: raw_sha256 does not equal the raw pins for {sid}")
        if list(meta.get("honesty") or []) != list(HONESTY):
            raise ValueError(f"{path.name}: the honesty sentences are missing or altered")
        features = obj.get("features")
        if not isinstance(features, list) or len(features) != meta.get("count") or len(features) != meta_index["count"]:
            raise ValueError(f"{path.name}: feature count differs from metadata/INDEX")
        seen = set()
        for i, feature in enumerate(features):
            props = (feature or {}).get("properties")
            problems = validate(props)
            if problems:
                raise ValueError(f"{path.name} feature {i}: {problems[0]}")
            if feature.get("id") != props["id"] or props["id"] in seen:
                raise ValueError(f"{path.name} feature {i}: id mismatch or duplicate {props['id']!r}")
            if (props.get("source") or {}).get("id") != sid:
                raise ValueError(f"{path.name} feature {i}: record source differs from the file's source")
            seen.add(props["id"])
            geometry = feature.get("geometry")
            if (props["location"]["precision"] == "unknown") != (geometry is None):
                raise ValueError(f"{path.name} feature {i}: geometry and location.precision disagree")
        total += len(features)
    return f"outputs ok ({len(files)} files, {total} records)"


def main(argv=None) -> int:
    parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument("--root", type=Path, default=ROOT)
    parser.add_argument("--domain", default="all", choices=(*DOMAINS, "all"))
    parser.add_argument("--allow-unverified-lanes", action="store_true",
                        help="accept lane outputs whose licence is unverified (review branches only; never main)")
    args = parser.parse_args(argv)
    failed = False
    for domain in (DOMAINS if args.domain == "all" else (args.domain,)):
        ddir = args.root / domain
        if not (ddir / "sources.json").exists():
            print(f"::error::verify {domain}: sources.json missing")
            failed = True
            continue
        try:
            message, registry = check_registry(ddir, domain)
            print(f"verify {domain}: {message}")
            message, manifest = check_raw(ddir)
            print(f"verify {domain}: {message}")
            print(f"verify {domain}: {check_outputs(ddir, domain, registry, manifest)}")
            problems = lanelib.check_manifest(domain, args.root, strict_open=not args.allow_unverified_lanes)
            if problems:
                raise ValueError("lanes: " + "; ".join(problems[:10]))
            n = len(lanelib.load_lanes(domain, args.root)["lanes"])
            print(f"verify {domain}: lanes ok ({n} vendored lanes, every file pinned)")
        except Exception as error:  # noqa: BLE001 - reported, then exit 1
            failed = True
            print(f"::error::verify {domain}: {type(error).__name__}: {error}")
    return 1 if failed else 0


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