GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Electricity markets and data pipelines / globalgrid2050 / uk_renewables_pipeline/202611172355/tests

Preview V928 and 4 more files

A JavaScript file in the plugins folder of GlobalGrid2050 that draws official projects, project groups, selection audit and sources, using SHA-256.

596 lines of JavaScript and Shell from globalgrid2050, in 5 files. Topic: Electricity markets and data pipelines. Section 949 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. Check V9 42 test · globalgrid2050 / uk_renewables_pipeline/202611172355/tests/check_v9_42.mjs lines 1–123
  2. Run V9 42 test · globalgrid2050 / uk_renewables_pipeline/202611172355/tests/run_v9_42.sh lines 1–96
  3. Check V9 43 test · globalgrid2050 / uk_renewables_pipeline/202611180058/tests/check_v9_43.mjs lines 1–123
  4. Run V9 43 test · globalgrid2050 / uk_renewables_pipeline/202611180058/tests/run_v9_43.sh lines 1–97
  5. Preview V928 interaction · globalgrid2050 / uk_renewables_pipeline/202611180451/scripts/plugins/preview-v928.js lines 1–157

Check V9 42

A JavaScript module in the tests folder of GlobalGrid2050 that tests major project news, interconnectors and the Renewable Energy Planning Database (REPD) register, using SHA-256.

Set aside from the main view: 91% of its lines are the same as uk_renewables_pipeline/202611180520/tests/check_v9_45.mjs (globalgrid2050), which stays. (near-copy-of, proposed by families.py). 90% of lines shared with Check V9 45; read that one first. All set-aside files, with reasons. Nothing was deleted.

Evidence
  • line-jaccard 0.9099 to globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611180520/tests/check_v9_45.mjs:1-123 41fe9e5b51a076d6ffbe2ce5a8afe5a5265f4d56
  • sha256 9b19a2245cd69155a622052784039d87db21181a75382346364ccd315a28cdab
  • target sha256 e8956eb33f4e20f2a38ba682b879bfbfb35a358854d686c40467140d601f9e5b
  • group of 15 (identity.json near-copy edges >= 0.9)
  • canonical rule: reachable, newest stamp, core repo, most lines

testglobalgrid2050 / uk_renewables_pipeline/202611172355/tests/check_v9_42.mjs · lines 1–123 of 123 · version 2026-11-17 23:55

What it does
It tests major project news, interconnectors and the REPD register. Defines text, json, sha256, fmt. Uses libraries node:assert/strict, node:crypto, node:fs/promises, node:url, node:path. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'renewables'): 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: interconnectors, the REPD register.
Inputs & outputs
In: JSON file release.v9.1.json; JSON file release.v9.5.1.json; JSON file build_manifest.json; JSON file major_project_news_v9_5_1.json; JSON file interconnectors.v9.8.json; JSON file interconnectors.json; JSON file interconnectors_manifest.json.
Downstream impact
Used directly by 1 file: Run V9 42 (globalgrid2050).
What it achieves
It is built from the text step (`text`), the JSON step (`json`) and the sha256 step (`sha256`). Pipeline News V9.42, proven from the bytes and through the page's OWN loaders (the pattern of `check_v9_13.mjs`).
Why it matters
Checked by Run V9 42.
Application
globalgrid2050 · uk_renewables_pipeline/202611172355/tests · JavaScript module
Uses
Canonical Projects V9 5 1 (new URL import.meta.url), node:assert/strict, node:crypto, node:fs/promises, node:url, node:path
Used by
run by Run V9 42 (script call)
Produces
text, json, sha256, fmt
Defines here
text, json, sha256, fmt
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611172355/tests/check_v9_42.mjs:1-123 · blob 96b04a91531d05104c81e0ed4a404a8f33d4b3e7 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: ingest · effects: filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
/* check_v9_42.mjs - Pipeline News V9.42, proven from the bytes and through the
 * page's OWN loaders (the pattern of check_v9_13.mjs).
 *
 *   1. The contracts bind the fixtures held by 202611132345 by path and sha256.
 *   2. The page's own loader chain is imported unmodified and executed against the
 *      files in this folder; every invariant the browser asserts is asserted here.
 *   3. The spine partitions are what the manifest says (sha256 and counts).
 *   4. The UK newspaper feed is unchanged and Beacon Fen still resolves.
 *   5. The interconnector product and contract are the parent's, byte for byte.
 *   6. The page states its own identity and version label.
 *
 * Run: node tests/check_v9_42.mjs
 */
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { readFile } from "node:fs/promises";
import { fileURLToPath } from "node:url";
import { basename, dirname, join } from "node:path";

const HERE = dirname(fileURLToPath(import.meta.url));
const RELEASE = join(HERE, "..");
const ID = basename(RELEASE);
const ROOT = join(RELEASE, "..", "..");
const VERSION = "9.42";
const STATE = "RELEASE CANDIDATE";
const PARENT_ID = "202611171940";
const FIXTURE_OWNER = "202611132345";
const PARENT = join(RELEASE, "..", PARENT_ID);
const text = (p) => readFile(p, "utf8");
const json = async (p) => JSON.parse(await text(p));
const sha256 = (b) => createHash("sha256").update(b).digest("hex");

const NEWS_FEED_SHA256 = "cea104c3e9cfc07971680afdf5f64073e1d4825b63bfaf4e969266df8386ebbd";

// 1. contracts bind fixtures
const c91 = await json(join(RELEASE, "contracts", "release.v9.1.json"));
const c951 = await json(join(RELEASE, "contracts", "release.v9.5.1.json"));
assert.equal(c91.source.dataset, "DESNZ Renewable Energy Planning Database Q3 2026");
for (const [pathKey, shaKey] of [["identity_fixture", "identity_fixture_sha256"], ["coordinate_fixture", "coordinate_fixture_sha256"]]) {
  const rel = c91.source[pathKey];
  assert.ok(rel.startsWith(`uk_renewables_pipeline/${FIXTURE_OWNER}/fixtures/`), `${pathKey} must be the fixture owner's: ${rel}`);
  assert.equal(sha256(await readFile(join(ROOT, rel))), c91.source[shaKey], `${pathKey} bytes`);
}
const coords = await json(join(ROOT, c91.source.coordinate_fixture));
assert.equal(coords.source_workbook_sha256, c91.source.workbook_sha256, "coordinate fixture names the contract workbook");
const identity = await json(join(ROOT, c91.source.identity_fixture));
assert.equal(identity.schema, "globalgrid2050.project-identity.v6");
assert.equal(identity.records.length, identity.raw_record_count);
assert.equal(coords.source_records, identity.raw_record_count, "workbook and identity hold the same refs");

// 2. the page's own loader, unmodified, against these bytes
const ORIGIN = "http://release.invalid";
const BASE = `${ORIGIN}/uk_renewables_pipeline/${ID}/`;
globalThis.window = { location: { origin: ORIGIN, href: BASE } };
globalThis.fetch = async (path) => {
  const url = new URL(path, BASE);
  assert.ok(url.pathname.startsWith(`/uk_renewables_pipeline/${ID}/`), `loader fetched outside the release: ${url}`);
  const file = join(RELEASE, decodeURIComponent(url.pathname.slice(`/uk_renewables_pipeline/${ID}/`.length)));
  const body = await text(file);
  return { ok: true, status: 200, url: url.href, json: async () => JSON.parse(body) };
};
const loader = await import(new URL("../scripts/data/canonical-projects-v9-5-1.js", import.meta.url).href);
const model = await loader.loadCanonicalProjectsV9_5_1();
assert.equal(model.projects.length, c951.expected.project_count);
assert.equal(Math.round(model.metadata.capacity_mw), c951.expected.displayed_capacity_mw);

// 3. partitions are the manifest's bytes
const manifest = await json(join(RELEASE, "data", "v9.1", "build_manifest.json"));
for (const part of [...manifest.project_partitions, ...manifest.atlas_partitions]) {
  assert.equal(sha256(await readFile(join(RELEASE, part.path))), part.sha256, `${part.path} hash`);
}
const atlasFeatures = manifest.atlas_partitions.reduce((n, p) => n + p.feature_count, 0);
assert.equal(atlasFeatures, manifest.geometry_count, "atlas features = valid geometries");
for (const key of Object.keys(c91.expected)) assert.equal(manifest[key], c91.expected[key], `manifest ${key}`);
assert.equal(manifest.source_dataset, c91.source.dataset);
assert.equal(manifest.source_record_count, identity.raw_record_count);

// 4. the newspaper: unchanged Q2 feed, every bound ref still resolves
const feedBytes = await readFile(join(ROOT, "dist", "major_project_news_v9_5_1.json"));
assert.equal(sha256(feedBytes), NEWS_FEED_SHA256, "dist/major_project_news_v9_5_1.json must not be rebuilt by this release");
const feed = JSON.parse(feedBytes);
const byRef = new Map(model.projects.map((p) => [p.repd_ref, p]));
const boundRefs = new Set(feed.canonical_items.map((item) => String(item.repd_ref)));
const unresolved = [...boundRefs].filter((ref) => !byRef.has(ref));
const beacon = byRef.get(feed.beacon_fen_contract.repd_ref);
assert.ok(beacon, "Beacon Fen must be in the spine");
assert.equal(beacon.capacity_mw, feed.beacon_fen_contract.official_capacity_mw, "Beacon Fen official capacity");

// 5. interconnectors are the parent's
for (const rel of ["contracts/interconnectors.v9.8.json", "data/v9.8/interconnectors.json", "data/v9.8/interconnectors_manifest.json"]) {
  assert.equal(sha256(await readFile(join(RELEASE, rel))), sha256(await readFile(join(PARENT, rel))), `${rel} is the parent's`);
}

// 6. page identity
const fmt = (n) => n.toLocaleString("en-GB");
const html = await text(join(RELEASE, "index.html"));
const compact = html.includes(`data-edition="${ID}"`);
assert.ok(compact || html.includes(`UK RENEWABLES PIPELINE ${ID}`), "visible page identity names this release");
assert.ok(new RegExp(`Canonical DESNZ REPD Q3 2026[^<]*${fmt(manifest.project_count)} solar, BESS and wind records`).test(html), "index.html states the Q3 register count");
assert.ok(!html.includes("REPD Q2 2026: 7,680"), "index.html must not claim the Q2 register");
assert.ok(html.includes("scripts/app-v9-8.js"), "index.html loads the v9.8 app");
const label = html.slice(html.indexOf("<body>"), html.indexOf('<section class="newspaper">'));
assert.ok(!/CANDIDATE/.test(label.replaceAll("RELEASE CANDIDATE", "")), "brand, nav, h1 and meta carry no candidate label other than this version's own state");
if (compact) {
  assert.ok(label.includes(`<small>PIPELINE NEWS · V${VERSION}</small>`), "compact brand names the version");
  assert.ok(label.includes(`>V${VERSION} · PIPELINE NEWS</a>`), "compact nav names the version");
  assert.ok(label.includes(`V${VERSION} · `) && label.includes(' · REPD OCTOBER 2026 · '), "compact stamp names the version and source vintage");
  assert.ok(html.includes(`<title>GlobalGrid2050 | Pipeline News V${VERSION} · ${ID}</title>`), "compact title names this release");
  assert.equal((html.match(/<section\b/g)||[]).length,2,"exactly two principal blocks");
  for (const tab of ['solarTab','bessTab','gridTab','datacentreTab']) assert.ok(html.includes(`id="${tab}" role="tab"`),`category ${tab}`);
  assert.ok(!html.includes('<th>NEWS SIGNAL</th>')&&!html.includes('id="solar1000Pilot"'),"withdrawn panels/column do not return");
} else {
assert.ok(label.includes(`<small>UK RENEWABLES PIPELINE · V${VERSION}</small>`), "brand names the version");
assert.ok(label.includes(`<a class="active" href="#">V${VERSION} ${STATE} · REPD Q3 2026</a>`), "nav names the version");
assert.ok(new RegExp(`<strong>V${VERSION.replace(".", "\\.")} · REPD OCTOBER 2026 \\(Q3\\) · [^<]+ · ${STATE} · \\d+ November 2026</strong>`).test(label), "meta line names the version and its date");
assert.ok(html.includes(`<title>GlobalGrid2050 | UK Renewables Pipeline ${ID}</title>`), "title names this release");
}
assert.ok(label.includes(`<a href="../${PARENT_ID}/">`), "nav links back to the parent");
assert.ok(label.includes('<a href="../versions.html">'), "nav links to the list of all versions");

console.log(`check_v9_42: ${ID} loader PASS - ${fmt(model.projects.length)} records, ${model.metadata.capacity_mw.toLocaleString("en-GB", { minimumFractionDigits: 2 })} MW, `
  + `${manifest.geometry_count} with geometry / ${manifest.missing_geometry_count} without; news feed unchanged, `
  + `${boundRefs.size - unresolved.length}/${boundRefs.size} bound refs resolve${unresolved.length ? ` (unresolved: ${unresolved.join(", ")})` : ""}`);

Run V9 42

A shell script in the tests folder of GlobalGrid2050 that tests interconnectors.

Set aside from the main view: A comment at the top of the file says a tool wrote it. (noise-generated, proposed by noise.py). All set-aside files, with reasons. Nothing was deleted.

Evidence
  • line 4 comment: # Written by automation/pipeline_release/new_version.py by the pattern of run_v9_13.sh.

testglobalgrid2050 / uk_renewables_pipeline/202611172355/tests/run_v9_42.sh · lines 1–96 of 96 · version 2026-11-17 23:55 · Entry point · pattern is_listed (shared by 38 files)

What it does
It tests interconnectors. Defines is_listed, walk. Side effects: starts processes.
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'renewables'): 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: interconnectors.
Inputs & outputs
In: JSON file release.v9.1.json; command-line arguments.
Downstream impact
It is itself an entry point (shell script); no other file was found loading it.
What it achieves
Defines `is_listed` and `walk`.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · uk_renewables_pipeline/202611172355/tests · shell script
Uses
Check V9 42 (script call)
Used by
none found
Produces
is_listed, walk
Defines here
is_listed, walk
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611172355/tests/run_v9_42.sh:1-96 · blob 29e0efda40155806c7eef1f532fabf6764b9fe44 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: unknown · effects: process · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
#!/usr/bin/env bash
# run_v9_42.sh - Pipeline News V9.42: one visible step on its parent, same REPD
# October 2026 (Q3 2026) register. Offline, in a git checkout or a plain copy.
# Written by automation/pipeline_release/new_version.py by the pattern of run_v9_13.sh.
set -euo pipefail

HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
RELEASE="$(cd "$HERE/.." && pwd)"
ID="$(basename "$RELEASE")"
PARENT_ID="202611171940"
FIXTURE_OWNER="202611132345"
PARENT="$(cd "$RELEASE/../$PARENT_ID" && pwd)"
ROOT="$(cd "$RELEASE/../.." && pwd)"
# The parent by git tree of the bytes ON DISK.
PARENT_TREE="71c8f37b99675c9cd60745d59cb045b395381325"

SCRATCH="$(mktemp -d)"
trap 'rm -rf "$SCRATCH"' EXIT
actual_tree="$(python - "$ROOT" "$PARENT_ID" <<'PYTREE'
import sys
sys.path.insert(0, sys.argv[1] + "/automation/pipeline_release")
from common import tree_hash
print(tree_hash(sys.argv[2]))
PYTREE
)"
test "$actual_tree" = "$PARENT_TREE" || { echo "parent $PARENT_ID tree is $actual_tree, expected $PARENT_TREE" >&2; exit 1; }

# WHAT THIS VERSION CHANGES FROM ITS PARENT, NAMED ONE FILE AT A TIME.
CHANGED_FROM_PARENT=(
  CHANGES.md
  README.md
  contracts/mobile-map.v942.json
  index.html
  tests/check_v9_42.mjs
  tests/run_v9_42.sh
)
REMOVED_FROM_PARENT=(
  tests/check_v9_41.mjs
  tests/run_v9_41.sh
)
is_listed() {
  local needle="$1"; shift
  for entry in "$@"; do [[ "$entry" == "$needle" ]] && return 0; done
  return 1
}
walk() { find "$1" -type f -not -path '*/__pycache__/*' -not -name '*.pyc' -not -path '*/node_modules/*' | sort; }

while IFS= read -r file; do
  relative="${file#$PARENT/}"
  is_listed "$relative" "${CHANGED_FROM_PARENT[@]}" && continue
  if is_listed "$relative" "${REMOVED_FROM_PARENT[@]}"; then
    test ! -e "$RELEASE/$relative" || { echo "should not be copied: $relative" >&2; exit 1; }
    continue
  fi
  cmp -s "$file" "$RELEASE/$relative" || { echo "inherited file differs from parent: $relative" >&2; exit 1; }
done < <(walk "$PARENT")
while IFS= read -r file; do
  relative="${file#$RELEASE/}"
  is_listed "$relative" "${CHANGED_FROM_PARENT[@]}" && continue
  test -e "$PARENT/$relative" || { echo "unlisted new file: $relative" >&2; exit 1; }
done < <(walk "$RELEASE")
for relative in "${CHANGED_FROM_PARENT[@]}"; do
  test -f "$RELEASE/$relative" || { echo "listed but missing: $relative" >&2; exit 1; }
  if [[ -f "$PARENT/$relative" ]] && cmp -s "$PARENT/$relative" "$RELEASE/$relative"; then
    echo "listed as changed but identical to parent: $relative" >&2; exit 1
  fi
done

# The register is the parent's: contract, spine and interconnector product byte for byte.
cmp -s "$PARENT/contracts/release.v9.1.json" "$RELEASE/contracts/release.v9.1.json"
grep -q "\"identity_fixture\": \"uk_renewables_pipeline/$FIXTURE_OWNER/fixtures/2026q3/project_identity_2026q3.json\"" "$RELEASE/contracts/release.v9.1.json"
diff -r "$PARENT/data/v9.1" "$RELEASE/data/v9.1"
diff -r "$PARENT/data/v9.8" "$RELEASE/data/v9.8"

# Spine and interconnector product rebuilt in a scratch root that holds this version
# and, at the fixture owner's path, only the two fixtures the contract binds. They
# must reproduce the committed bytes.
SROOT="$SCRATCH/root"
COPY="$SROOT/uk_renewables_pipeline/$ID"
mkdir -p "$SROOT/uk_renewables_pipeline/$FIXTURE_OWNER/fixtures"
cp -a "$ROOT/uk_renewables_pipeline/$FIXTURE_OWNER/fixtures/2026q3" "$SROOT/uk_renewables_pipeline/$FIXTURE_OWNER/fixtures/"
cp -a "$RELEASE" "$COPY"
rm -rf "$COPY/data/v9.1"
PYTHONDONTWRITEBYTECODE=1 python "$COPY/scripts/data/build_v9_1_spine.py"
diff -r "$RELEASE/data/v9.1" "$COPY/data/v9.1"
node "$COPY/scripts/build/interconnectors-v9-8.mjs" >/dev/null
diff -r "$RELEASE/data/v9.8" "$COPY/data/v9.8"

node "$HERE/check_v9_42.mjs"
node "$HERE/check_map_contract_all_rows.mjs"

while IFS= read -r source; do
  node --check "$source"
done < <(find "$RELEASE/scripts" -type f \( -name '*.js' -o -name '*.mjs' \) -print | sort)

echo "V9.42 ($ID) validation suite: PASS ($ROOT)"

Check V9 43

A JavaScript module in the tests folder of GlobalGrid2050 that tests major project news, interconnectors and the Renewable Energy Planning Database (REPD) register, using SHA-256.

Set aside from the main view: 91% of its lines are the same as uk_renewables_pipeline/202611180633/tests/check_v9_46.mjs (globalgrid2050), which stays. (near-copy-of, proposed by families.py). 90% of lines shared with Check V9 46; read that one first. All set-aside files, with reasons. Nothing was deleted.

Evidence
  • line-jaccard 0.9099 to globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611180633/tests/check_v9_46.mjs:1-123 9f1538d9805be2e4a3a6c6ed26617a29434b2ea5
  • sha256 16e4a4059925d172a11c6fa6fb956657244651efd48d8fb1f9e1941a42997789
  • target sha256 fa0a644be1fbe746f77a5f2dc4035f7d3e7cf316c73d778f43123d971eb378c8
  • group of 3 (identity.json near-copy edges >= 0.9)
  • canonical rule: reachable, newest stamp, core repo, most lines

testglobalgrid2050 / uk_renewables_pipeline/202611180058/tests/check_v9_43.mjs · lines 1–123 of 123 · version 2026-11-18 00:58

What it does
It tests major project news, interconnectors and the REPD register. Defines text, json, sha256, fmt. Uses libraries node:assert/strict, node:crypto, node:fs/promises, node:url, node:path. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'renewables'): 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: interconnectors, the REPD register.
Inputs & outputs
In: JSON file release.v9.1.json; JSON file release.v9.5.1.json; JSON file build_manifest.json; JSON file major_project_news_v9_5_1.json; JSON file interconnectors.v9.8.json; JSON file interconnectors.json; JSON file interconnectors_manifest.json.
Downstream impact
Used directly by 1 file: Run V9 43 (globalgrid2050).
What it achieves
It is built from the text step (`text`), the JSON step (`json`) and the sha256 step (`sha256`). Pipeline News V9.43, proven from the bytes and through the page's OWN loaders (the pattern of `check_v9_13.mjs`).
Why it matters
Checked by Run V9 43.
Application
globalgrid2050 · uk_renewables_pipeline/202611180058/tests · JavaScript module
Uses
Canonical Projects V9 5 1 (new URL import.meta.url), node:assert/strict, node:crypto, node:fs/promises, node:url, node:path
Used by
run by Run V9 43 (script call)
Produces
text, json, sha256, fmt
Defines here
text, json, sha256, fmt
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611180058/tests/check_v9_43.mjs:1-123 · blob ff4114d7e3a1ba1d046c6b932b8b18c52973050d · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: ingest · effects: filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
/* check_v9_43.mjs - Pipeline News V9.43, proven from the bytes and through the
 * page's OWN loaders (the pattern of check_v9_13.mjs).
 *
 *   1. The contracts bind the fixtures held by 202611132345 by path and sha256.
 *   2. The page's own loader chain is imported unmodified and executed against the
 *      files in this folder; every invariant the browser asserts is asserted here.
 *   3. The spine partitions are what the manifest says (sha256 and counts).
 *   4. The UK newspaper feed is unchanged and Beacon Fen still resolves.
 *   5. The interconnector product and contract are the parent's, byte for byte.
 *   6. The page states its own identity and version label.
 *
 * Run: node tests/check_v9_43.mjs
 */
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { readFile } from "node:fs/promises";
import { fileURLToPath } from "node:url";
import { basename, dirname, join } from "node:path";

const HERE = dirname(fileURLToPath(import.meta.url));
const RELEASE = join(HERE, "..");
const ID = basename(RELEASE);
const ROOT = join(RELEASE, "..", "..");
const VERSION = "9.43";
const STATE = "BUILD";
const PARENT_ID = "202611172355";
const FIXTURE_OWNER = "202611132345";
const PARENT = join(RELEASE, "..", PARENT_ID);
const text = (p) => readFile(p, "utf8");
const json = async (p) => JSON.parse(await text(p));
const sha256 = (b) => createHash("sha256").update(b).digest("hex");

const NEWS_FEED_SHA256 = "cea104c3e9cfc07971680afdf5f64073e1d4825b63bfaf4e969266df8386ebbd";

// 1. contracts bind fixtures
const c91 = await json(join(RELEASE, "contracts", "release.v9.1.json"));
const c951 = await json(join(RELEASE, "contracts", "release.v9.5.1.json"));
assert.equal(c91.source.dataset, "DESNZ Renewable Energy Planning Database Q3 2026");
for (const [pathKey, shaKey] of [["identity_fixture", "identity_fixture_sha256"], ["coordinate_fixture", "coordinate_fixture_sha256"]]) {
  const rel = c91.source[pathKey];
  assert.ok(rel.startsWith(`uk_renewables_pipeline/${FIXTURE_OWNER}/fixtures/`), `${pathKey} must be the fixture owner's: ${rel}`);
  assert.equal(sha256(await readFile(join(ROOT, rel))), c91.source[shaKey], `${pathKey} bytes`);
}
const coords = await json(join(ROOT, c91.source.coordinate_fixture));
assert.equal(coords.source_workbook_sha256, c91.source.workbook_sha256, "coordinate fixture names the contract workbook");
const identity = await json(join(ROOT, c91.source.identity_fixture));
assert.equal(identity.schema, "globalgrid2050.project-identity.v6");
assert.equal(identity.records.length, identity.raw_record_count);
assert.equal(coords.source_records, identity.raw_record_count, "workbook and identity hold the same refs");

// 2. the page's own loader, unmodified, against these bytes
const ORIGIN = "http://release.invalid";
const BASE = `${ORIGIN}/uk_renewables_pipeline/${ID}/`;
globalThis.window = { location: { origin: ORIGIN, href: BASE } };
globalThis.fetch = async (path) => {
  const url = new URL(path, BASE);
  assert.ok(url.pathname.startsWith(`/uk_renewables_pipeline/${ID}/`), `loader fetched outside the release: ${url}`);
  const file = join(RELEASE, decodeURIComponent(url.pathname.slice(`/uk_renewables_pipeline/${ID}/`.length)));
  const body = await text(file);
  return { ok: true, status: 200, url: url.href, json: async () => JSON.parse(body) };
};
const loader = await import(new URL("../scripts/data/canonical-projects-v9-5-1.js", import.meta.url).href);
const model = await loader.loadCanonicalProjectsV9_5_1();
assert.equal(model.projects.length, c951.expected.project_count);
assert.equal(Math.round(model.metadata.capacity_mw), c951.expected.displayed_capacity_mw);

// 3. partitions are the manifest's bytes
const manifest = await json(join(RELEASE, "data", "v9.1", "build_manifest.json"));
for (const part of [...manifest.project_partitions, ...manifest.atlas_partitions]) {
  assert.equal(sha256(await readFile(join(RELEASE, part.path))), part.sha256, `${part.path} hash`);
}
const atlasFeatures = manifest.atlas_partitions.reduce((n, p) => n + p.feature_count, 0);
assert.equal(atlasFeatures, manifest.geometry_count, "atlas features = valid geometries");
for (const key of Object.keys(c91.expected)) assert.equal(manifest[key], c91.expected[key], `manifest ${key}`);
assert.equal(manifest.source_dataset, c91.source.dataset);
assert.equal(manifest.source_record_count, identity.raw_record_count);

// 4. the newspaper: unchanged Q2 feed, every bound ref still resolves
const feedBytes = await readFile(join(ROOT, "dist", "major_project_news_v9_5_1.json"));
assert.equal(sha256(feedBytes), NEWS_FEED_SHA256, "dist/major_project_news_v9_5_1.json must not be rebuilt by this release");
const feed = JSON.parse(feedBytes);
const byRef = new Map(model.projects.map((p) => [p.repd_ref, p]));
const boundRefs = new Set(feed.canonical_items.map((item) => String(item.repd_ref)));
const unresolved = [...boundRefs].filter((ref) => !byRef.has(ref));
const beacon = byRef.get(feed.beacon_fen_contract.repd_ref);
assert.ok(beacon, "Beacon Fen must be in the spine");
assert.equal(beacon.capacity_mw, feed.beacon_fen_contract.official_capacity_mw, "Beacon Fen official capacity");

// 5. interconnectors are the parent's
for (const rel of ["contracts/interconnectors.v9.8.json", "data/v9.8/interconnectors.json", "data/v9.8/interconnectors_manifest.json"]) {
  assert.equal(sha256(await readFile(join(RELEASE, rel))), sha256(await readFile(join(PARENT, rel))), `${rel} is the parent's`);
}

// 6. page identity
const fmt = (n) => n.toLocaleString("en-GB");
const html = await text(join(RELEASE, "index.html"));
const compact = html.includes(`data-edition="${ID}"`);
assert.ok(compact || html.includes(`UK RENEWABLES PIPELINE ${ID}`), "visible page identity names this release");
assert.ok(new RegExp(`Canonical DESNZ REPD Q3 2026[^<]*${fmt(manifest.project_count)} solar, BESS and wind records`).test(html), "index.html states the Q3 register count");
assert.ok(!html.includes("REPD Q2 2026: 7,680"), "index.html must not claim the Q2 register");
assert.ok(html.includes("scripts/app-v9-8.js"), "index.html loads the v9.8 app");
const label = html.slice(html.indexOf("<body>"), html.indexOf('<section class="newspaper">'));
assert.ok(!/CANDIDATE/.test(label.replaceAll("RELEASE CANDIDATE", "")), "brand, nav, h1 and meta carry no candidate label other than this version's own state");
if (compact) {
  assert.ok(label.includes(`<small>PIPELINE NEWS · V${VERSION}</small>`), "compact brand names the version");
  assert.ok(label.includes(`>V${VERSION} · PIPELINE NEWS</a>`), "compact nav names the version");
  assert.ok(label.includes(`V${VERSION} · `) && label.includes(' · REPD OCTOBER 2026 · '), "compact stamp names the version and source vintage");
  assert.ok(html.includes(`<title>GlobalGrid2050 | Pipeline News V${VERSION} · ${ID}</title>`), "compact title names this release");
  assert.equal((html.match(/<section\b/g)||[]).length,2,"exactly two principal blocks");
  for (const tab of ['solarTab','bessTab','gridTab','datacentreTab']) assert.ok(html.includes(`id="${tab}" role="tab"`),`category ${tab}`);
  assert.ok(!html.includes('<th>NEWS SIGNAL</th>')&&!html.includes('id="solar1000Pilot"'),"withdrawn panels/column do not return");
} else {
assert.ok(label.includes(`<small>UK RENEWABLES PIPELINE · V${VERSION}</small>`), "brand names the version");
assert.ok(label.includes(`<a class="active" href="#">V${VERSION} ${STATE} · REPD Q3 2026</a>`), "nav names the version");
assert.ok(new RegExp(`<strong>V${VERSION.replace(".", "\\.")} · REPD OCTOBER 2026 \\(Q3\\) · [^<]+ · ${STATE} · \\d+ November 2026</strong>`).test(label), "meta line names the version and its date");
assert.ok(html.includes(`<title>GlobalGrid2050 | UK Renewables Pipeline ${ID}</title>`), "title names this release");
}
assert.ok(label.includes(`<a href="../${PARENT_ID}/">`), "nav links back to the parent");
assert.ok(label.includes('<a href="../versions.html">'), "nav links to the list of all versions");

console.log(`check_v9_43: ${ID} loader PASS - ${fmt(model.projects.length)} records, ${model.metadata.capacity_mw.toLocaleString("en-GB", { minimumFractionDigits: 2 })} MW, `
  + `${manifest.geometry_count} with geometry / ${manifest.missing_geometry_count} without; news feed unchanged, `
  + `${boundRefs.size - unresolved.length}/${boundRefs.size} bound refs resolve${unresolved.length ? ` (unresolved: ${unresolved.join(", ")})` : ""}`);

Run V9 43

A shell script in the tests folder of GlobalGrid2050 that tests interconnectors.

Set aside from the main view: A comment at the top of the file says a tool wrote it. (noise-generated, proposed by noise.py). All set-aside files, with reasons. Nothing was deleted.

Evidence
  • line 4 comment: # Written by automation/pipeline_release/new_version.py by the pattern of run_v9_13.sh.

testglobalgrid2050 / uk_renewables_pipeline/202611180058/tests/run_v9_43.sh · lines 1–97 of 97 · version 2026-11-18 00:58 · Entry point · pattern is_listed (shared by 38 files)

What it does
It tests interconnectors. Defines is_listed, walk. Side effects: starts processes.
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'renewables'): 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: interconnectors.
Inputs & outputs
In: JSON file release.v9.1.json; command-line arguments.
Downstream impact
It is itself an entry point (shell script); no other file was found loading it.
What it achieves
Defines `is_listed` and `walk`.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · uk_renewables_pipeline/202611180058/tests · shell script
Uses
Check V9 43 (script call)
Used by
none found
Produces
is_listed, walk
Defines here
is_listed, walk
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611180058/tests/run_v9_43.sh:1-97 · blob 50a20e8564c49bd84345ac6a958d822a70e9917d · GitHub at these lines
State
achieves: name · context: readme_derived · stage: unknown · effects: process · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
#!/usr/bin/env bash
# run_v9_43.sh - Pipeline News V9.43: one visible step on its parent, same REPD
# October 2026 (Q3 2026) register. Offline, in a git checkout or a plain copy.
# Written by automation/pipeline_release/new_version.py by the pattern of run_v9_13.sh.
set -euo pipefail

HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
RELEASE="$(cd "$HERE/.." && pwd)"
ID="$(basename "$RELEASE")"
PARENT_ID="202611172355"
FIXTURE_OWNER="202611132345"
PARENT="$(cd "$RELEASE/../$PARENT_ID" && pwd)"
ROOT="$(cd "$RELEASE/../.." && pwd)"
# The parent by git tree of the bytes ON DISK.
PARENT_TREE="d0f9c8107d321034b4f9f67e1ae9442bb09dbe00"

SCRATCH="$(mktemp -d)"
trap 'rm -rf "$SCRATCH"' EXIT
actual_tree="$(python - "$ROOT" "$PARENT_ID" <<'PYTREE'
import sys
sys.path.insert(0, sys.argv[1] + "/automation/pipeline_release")
from common import tree_hash
print(tree_hash(sys.argv[2]))
PYTREE
)"
test "$actual_tree" = "$PARENT_TREE" || { echo "parent $PARENT_ID tree is $actual_tree, expected $PARENT_TREE" >&2; exit 1; }

# WHAT THIS VERSION CHANGES FROM ITS PARENT, NAMED ONE FILE AT A TIME.
CHANGED_FROM_PARENT=(
  CHANGES.md
  README.md
  contracts/journey-entry.v943.json
  index.html
  tests/check_v9_43.mjs
  tests/run_v9_43.sh
)
REMOVED_FROM_PARENT=(
  tests/check_v9_42.mjs
  tests/run_v9_42.sh
)
is_listed() {
  local needle="$1"; shift
  for entry in "$@"; do [[ "$entry" == "$needle" ]] && return 0; done
  return 1
}
walk() { find "$1" -type f -not -path '*/__pycache__/*' -not -name '*.pyc' -not -path '*/node_modules/*' | sort; }

while IFS= read -r file; do
  relative="${file#$PARENT/}"
  is_listed "$relative" "${CHANGED_FROM_PARENT[@]}" && continue
  if is_listed "$relative" "${REMOVED_FROM_PARENT[@]}"; then
    test ! -e "$RELEASE/$relative" || { echo "should not be copied: $relative" >&2; exit 1; }
    continue
  fi
  cmp -s "$file" "$RELEASE/$relative" || { echo "inherited file differs from parent: $relative" >&2; exit 1; }
done < <(walk "$PARENT")
while IFS= read -r file; do
  relative="${file#$RELEASE/}"
  is_listed "$relative" "${CHANGED_FROM_PARENT[@]}" && continue
  test -e "$PARENT/$relative" || { echo "unlisted new file: $relative" >&2; exit 1; }
done < <(walk "$RELEASE")
for relative in "${CHANGED_FROM_PARENT[@]}"; do
  test -f "$RELEASE/$relative" || { echo "listed but missing: $relative" >&2; exit 1; }
  if [[ -f "$PARENT/$relative" ]] && cmp -s "$PARENT/$relative" "$RELEASE/$relative"; then
    echo "listed as changed but identical to parent: $relative" >&2; exit 1
  fi
done

# The register is the parent's: contract, spine and interconnector product byte for byte.
cmp -s "$PARENT/contracts/release.v9.1.json" "$RELEASE/contracts/release.v9.1.json"
grep -q "\"identity_fixture\": \"uk_renewables_pipeline/$FIXTURE_OWNER/fixtures/2026q3/project_identity_2026q3.json\"" "$RELEASE/contracts/release.v9.1.json"
diff -r "$PARENT/data/v9.1" "$RELEASE/data/v9.1"
diff -r "$PARENT/data/v9.8" "$RELEASE/data/v9.8"

# Spine and interconnector product rebuilt in a scratch root that holds this version
# and, at the fixture owner's path, only the two fixtures the contract binds. They
# must reproduce the committed bytes.
SROOT="$SCRATCH/root"
COPY="$SROOT/uk_renewables_pipeline/$ID"
mkdir -p "$SROOT/uk_renewables_pipeline/$FIXTURE_OWNER/fixtures"
cp -a "$ROOT/uk_renewables_pipeline/$FIXTURE_OWNER/fixtures/2026q3" "$SROOT/uk_renewables_pipeline/$FIXTURE_OWNER/fixtures/"
cp -a "$RELEASE" "$COPY"
rm -rf "$COPY/data/v9.1"
PYTHONDONTWRITEBYTECODE=1 python "$COPY/scripts/data/build_v9_1_spine.py"
diff -r "$RELEASE/data/v9.1" "$COPY/data/v9.1"
node "$COPY/scripts/build/interconnectors-v9-8.mjs" >/dev/null
diff -r "$RELEASE/data/v9.8" "$COPY/data/v9.8"

node "$ROOT/automation/journey_entry_ui/20261118/verify-closure.mjs" "$RELEASE"
node "$HERE/check_v9_43.mjs"
node "$HERE/check_map_contract_all_rows.mjs"

while IFS= read -r source; do
  node --check "$source"
done < <(find "$RELEASE/scripts" -type f \( -name '*.js' -o -name '*.mjs' \) -print | sort)

echo "V9.43 ($ID) validation suite: PASS ($ROOT)"

Preview V928

A JavaScript file in the plugins folder of GlobalGrid2050 that draws official projects, project groups, selection audit and sources, using SHA-256.

interactionglobalgrid2050 / uk_renewables_pipeline/202611180451/scripts/plugins/preview-v928.js · lines 1–157 of 157 · version 2026-11-18 04:51 · Entry point · pattern activate (shared by 9 files)

What it does
It draws official projects, project groups, selection audit and sources. Defines pinnedBytes, text, loadGrid, activate, initialiseCategory. Side effects: changes the web page (DOM); makes network requests.
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'renewables'): 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.
Inputs & outputs
In: JSON file projects.json; JSON file official-projects.json; JSON file project-groups.json; JSON file selection-audit.json; JSON file sources.json; JSON file transition-context.json.
Downstream impact
Used directly by 1 file: GlobalGrid2050 — UK Renewables Pipeline Page (globalgrid2050, https://globalgrid2050.com/uk_renewables_pipeline/202611280922/). Reached from 4 other entry points, including GlobalGrid2050 Pipeline Legal Evidence Workflow (globalgrid2050); V923 Public Readback Workflow (neural-link-between-agents); A4 Legal Model (globalgrid2050).
What it achieves
It loads grid (`loadGrid`) and is built from the pinned bytes helper (`pinnedBytes`) and the text step (`text`). Non-live host composition. Modules retain their own owners and evidence states. It responds to click, keydown and pipeline events.
Why it matters
Loaded by the UK Renewables Pipeline page at https://globalgrid2050.com/uk_renewables_pipeline/202611280922/.
Application
globalgrid2050 · uk_renewables_pipeline/202611180451/scripts/plugins · script
Uses
Render (dynamic import), Model (dynamic import), Render (dynamic import)
Used by
loaded by GlobalGrid2050 — UK Renewables Pipeline Page (script src)
Produces
pinnedBytes, text, loadGrid, activate, initialiseCategory
Defines here
pinnedBytes, text, loadGrid, activate, initialiseCategory
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611180451/scripts/plugins/preview-v928.js:1-157 · blob cc88f570754e88ea454c744222a6d6be1f5744f2 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, network · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
/* Non-live host composition. Modules retain their own owners and evidence states. */
const tabs = [...document.querySelectorAll('.pipeline-tabs [role="tab"]')];
const panels = ['repdPanel', 'gridPanel', 'datacentrePanel', 'offtakersPanel', 'pricesPanel'].map(id => document.getElementById(id));
let dcStarted = false;
let gridStarted = false;
let defaultApplied = false;
let journeyRestoreCategory = history.state?.pipelineJourneyReturn?.category;
let categoryChosenByUser = false;

const dcInputs = Object.freeze({
  urls: {
    projects: 'global-datacentres/projects.json',
    official: 'global-datacentres/official-projects.json',
    groups: 'global-datacentres/project-groups.json',
    audit: 'global-datacentres/selection-audit.json',
    baseline: '../202611161747/global-datacentres/projects.json',
  },
  sha256: {
    projects: 'faf617d9979151b7d309554cb1cd59d343f70b9d60616f90db45e5c2a227d449',
    official: 'bcf6473bebe78e7a7dab566b1998ea51237d653c5a8584420690c2cea9a5180f',
    groups: 'b77afd5846a3c27697e49664fabb4c0020a81a88ccaa680fb5130f6d6d1b8970',
    audit: 'faa79b4651d62baee822b8e6f748e447d0b8aebbe1c8c13beafd81d973b1c592',
    baseline: '224b039d9801eea547ec4934b6e247f756ec7846e35c62ebe1774ef134597bae',
  },
});

async function pinnedBytes(url, expected) {
  const response = await fetch(url, {cache: 'no-store'});
  if (!response.ok) throw new Error('Preview input unavailable');
  const bytes = new Uint8Array(await response.arrayBuffer());
  if (bytes.length > 2 * 1024 * 1024) throw new Error('Preview input exceeds bound');
  const hash = await crypto.subtle.digest('SHA-256', bytes);
  const hex = Array.from(new Uint8Array(hash), x => x.toString(16).padStart(2, '0')).join('');
  if (hex !== expected) throw new Error('Preview input identity changed');
  return bytes;
}

function text(tag, value) {
  const element = document.createElement(tag);
  element.textContent = value;
  return element;
}

async function loadGrid() {
  const host = document.getElementById('gridDirectory');
  host.replaceChildren(text('p', 'Loading official source directory…'));
  try {
    const bytes = await pinnedBytes('../../automation/news/grid_watch/sources.json',
      'd4ef4584859d712ac15c07e02b9e201cc693b65542ccdc204427c8a7b114ca62');
    const catalogue = JSON.parse(new TextDecoder('utf-8', {fatal: true}).decode(bytes));
    if (catalogue.schema !== 'globalgrid2050.grid_watch.sources.v1' || catalogue.sources.length !== 14) throw new Error('Invalid directory');
    const fragment = document.createDocumentFragment();
    fragment.appendChild(text('p', '14 source-directory entries · 0 approved project updates'));
    for (const source of catalogue.sources) {
      const url = new URL(source.url);
      if (url.protocol !== 'https:' || url.username || url.password || url.hostname !== source.hostname) throw new Error('Unsafe source');
      const row = text('article', '');
      row.className = 'grid-source';
      const link = text('a', source.publisher + ' · ' + source.operator);
      link.href = url.href; link.target = '_blank'; link.rel = 'noopener noreferrer';
      row.append(link, text('small', source.role.replaceAll('_', ' ') + ' · Rights ' + source.licence_state), text('p', source.coverage));
      fragment.appendChild(row);
    }
    host.replaceChildren(fragment);
    host.dataset.state = 'directory-only';
  } catch {
    host.replaceChildren(text('p', 'Grid source directory unavailable. No project updates displayed.'));
    host.dataset.state = 'unavailable';
  }
}

function activate(tab, focus = false, preserveTechnology = false) {
  for (const item of tabs) {
    const selected = item === tab;
    item.setAttribute('aria-selected', String(selected));
    item.tabIndex = selected ? 0 : -1;
  }
  const panel = document.getElementById(tab.getAttribute('aria-controls'));
  for (const item of panels) item.hidden = item !== panel;
  panel.setAttribute('aria-labelledby', tab.id);
  if (focus) tab.focus();
  if (['solar', 'bess'].includes(tab.dataset.view) && !preserveTechnology) {
    document.querySelector('#tech [data-technology="' + tab.dataset.view + '"]')?.click();
  } else if (tab.dataset.view === 'grid' && !gridStarted) {
    gridStarted = true; void loadGrid();
  } else if (tab.dataset.view === 'datacentre' && !dcStarted) {
    dcStarted = true;
    const host = document.getElementById('datacentreHost');
    if (window.GGDataCentreUI) void window.GGDataCentreUI.mount(host, dcInputs).then(()=>{
      if(host.querySelector('.ggdc-table'))window.dispatchEvent(new CustomEvent('pipeline-datacentre-ready'));
    }).catch(()=>{});
    else host.replaceChildren(text('p', 'Data Centre records unavailable.'));
  }
  window.dispatchEvent(new CustomEvent('pipeline-category-changed', {detail: tab.dataset.view}));
}

for (const tab of tabs) {
  tab.addEventListener('click', event => {
    const restoring = !event.isTrusted && journeyRestoreCategory === tab.dataset.view;
    if (restoring) { journeyRestoreCategory = null; if (categoryChosenByUser) return; }
    if (event.isTrusted) categoryChosenByUser = true;
    activate(tab, false, restoring);
  });
  tab.addEventListener('keydown', event => {
    let index = tabs.indexOf(tab);
    if (event.key === 'ArrowRight') index = (index + 1) % tabs.length;
    else if (event.key === 'ArrowLeft') index = (index + tabs.length - 1) % tabs.length;
    else if (event.key === 'Home') index = 0;
    else if (event.key === 'End') index = tabs.length - 1;
    else return;
    event.preventDefault(); if (event.isTrusted) categoryChosenByUser = true; activate(tabs[index], true);
  });
}
function initialiseCategory() {
  if (defaultApplied) return;
  defaultApplied = true;
  queueMicrotask(() => {
    if (categoryChosenByUser) return;
    const technology = new URL(location.href).searchParams.get('technology');
    if (!technology || technology === 'solar') activate(document.getElementById('solarTab'));
    else if (technology === 'bess') activate(document.getElementById('bessTab'));
  });
}
window.addEventListener('pipeline-projects-rendered', initialiseCategory);
if (document.getElementById('tbody').dataset.complete === 'true') initialiseCategory();

let contextStarted = false;
const contextDisclosure = document.getElementById('contextDisclosure');
// This cache is explicitly preview-only: production must not self-grant source acceptance.
const contextPreview = ['127.0.0.1', 'localhost', '[::1]'].includes(location.hostname);
contextDisclosure.hidden = !contextPreview;
contextDisclosure.addEventListener('toggle', async event => {
  if (!contextPreview || !event.target.open || contextStarted) return;
  contextStarted = true;
  const host = document.getElementById('contextHost');
  try {
    const expected = 'de0d205186ae2a30914711e1b25bacefc325f7c02efb880e4d5d5a6c070a87c1';
    const cache = '../../automation/v928_context/preview/';
    const manifestBytes = await pinnedBytes(cache + 'manifest.json',
      '8ee9770c0e22512879b93d73e4386521ca410f1ccf53069a7f8de6d7eccf8515');
    const manifest = JSON.parse(new TextDecoder('utf-8', {fatal: true}).decode(manifestBytes));
    if (manifest.preview_only !== true || manifest.publication_authorized !== false ||
        manifest.files['transition-context.json'].sha256 !== expected) throw new Error('Unaccepted Context preview');
    const assets = Object.fromEntries(await Promise.all(Object.entries(manifest.files).map(async ([path, pin]) =>
      [path, await pinnedBytes(cache + path, pin.sha256)])));
    const bytes = assets['transition-context.json'];
    const [{renderContext}, {buildViewModel}, {renderFigures}] = await Promise.all([
      import('../../../../automation/v928_context/preview/render.mjs'),
      import('../../../../automation/v928_context/preview/figures/b460cb7f76172691b5ffb6d2a7f1a8e12057ba20/model.mjs'),
      import('../../../../automation/v928_context/preview/figures/b460cb7f76172691b5ffb6d2a7f1a8e12057ba20/render.mjs'),
    ]);
    host.replaceChildren();
    await renderContext(host, bytes, {expectedSha256: expected, figures: {buildViewModel, renderFigures}});
  } catch {
    host.replaceChildren(text('p', 'Context unavailable. No replacement figures or project associations displayed.'));
  }
});