In this section
- Run V9 36 test · globalgrid2050 / uk_renewables_pipeline/202611171507/tests/run_v9_36.sh lines 1–100
- Check V9 37 test · globalgrid2050 / uk_renewables_pipeline/202611171526/tests/check_v9_37.mjs lines 1–123
- Run V9 37 test · globalgrid2050 / uk_renewables_pipeline/202611171526/tests/run_v9_37.sh lines 1–98
- Check V9 38 test · globalgrid2050 / uk_renewables_pipeline/202611171550/tests/check_v9_38.mjs lines 1–123
- Run V9 38 test · globalgrid2050 / uk_renewables_pipeline/202611171550/tests/run_v9_38.sh lines 1–97
- Datacentre News energy-data · globalgrid2050 / uk_renewables_pipeline/202611171609/scripts/plugins/datacentre-news.js lines 1–124
Run V9 36
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/202611171507/tests/run_v9_36.sh · lines 1–100 of 100 · version 2026-11-17 15:07 · 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/202611171507/tests · shell script
- Uses
- Check V9 36 (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/202611171507/tests/run_v9_36.sh:1-100 · blob 9af148a23ded9b62b26b701952f3e90045804573 · 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_36.sh - Pipeline News V9.36: 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="202611171217"
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="fb7e0cba7a4c1ba42e311e55a07fee69e331b2b5"
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/ticker.v936.json
index.html
scripts/core/atlas-receiver-v9-7.js
scripts/layers/model.mjs
scripts/layers/pipeline-layers.css
scripts/layers/ticker.mjs
tests/check_v9_36.mjs
tests/run_v9_36.sh
)
REMOVED_FROM_PARENT=(
tests/check_v9_35.mjs
tests/run_v9_35.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_36.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.36 ($ID) validation suite: PASS ($ROOT)"Check V9 37
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 2dc6e240b52cd81336ea5079ec666a343337cb7cff635b27aed348a5c528f068
- 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/202611171526/tests/check_v9_37.mjs · lines 1–123 of 123 · version 2026-11-17 15:26
- 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 37 (globalgrid2050).
- What it achieves
- It is built from the text step (`text`), the JSON step (`json`) and the sha256 step (`sha256`). Pipeline News V9.37, 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 37.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611171526/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 37 (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/202611171526/tests/check_v9_37.mjs:1-123 · blob f1c0fe500a9a3d411f0548fe38ebeccad45f44b6 · 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_37.mjs - Pipeline News V9.37, 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_37.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.37";
const STATE = "RELEASE CANDIDATE";
const PARENT_ID = "202611171507";
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_37: ${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 37
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/202611171526/tests/run_v9_37.sh · lines 1–98 of 98 · version 2026-11-17 15:26 · 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/202611171526/tests · shell script
- Uses
- Check V9 37 (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/202611171526/tests/run_v9_37.sh:1-98 · blob e6c28993a34b59e26e697c4e28efbdd11af8f5e7 · 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_37.sh - Pipeline News V9.37: 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="202611171507"
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="b369aab20d3619e5d953cb2d21375c0b6baaeb0b"
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/news-quality.v937.json
index.html
scripts/build/interconnectors-v9-8.mjs
scripts/plugins/live-news.js
tests/check_v9_37.mjs
tests/run_v9_37.sh
)
REMOVED_FROM_PARENT=(
tests/check_v9_36.mjs
tests/run_v9_36.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_37.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.37 ($ID) validation suite: PASS ($ROOT)"Check V9 38
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 637a39f202287106df88dc41dcf8bff29d58c49a0c982a80a369a4e6e44e208c
- 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/202611171550/tests/check_v9_38.mjs · lines 1–123 of 123 · version 2026-11-17 15:50
- 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 38 (globalgrid2050).
- What it achieves
- It is built from the text step (`text`), the JSON step (`json`) and the sha256 step (`sha256`). Pipeline News V9.38, 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 38.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611171550/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 38 (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/202611171550/tests/check_v9_38.mjs:1-123 · blob 3915464ad2b2a8b89eb93fbc0894212a7ba95732 · 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_38.mjs - Pipeline News V9.38, 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_38.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.38";
const STATE = "RELEASE CANDIDATE";
const PARENT_ID = "202611171526";
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_38: ${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 38
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/202611171550/tests/run_v9_38.sh · lines 1–97 of 97 · version 2026-11-17 15:50 · 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/202611171550/tests · shell script
- Uses
- Check V9 38 (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/202611171550/tests/run_v9_38.sh:1-97 · blob 7756f22fc9d5d02673959fe07dd07ef672042e94 · 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_38.sh - Pipeline News V9.38: 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="202611171526"
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="23067795349db613732b36a313871c13f476c15e"
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/grid-notice.v938.json
index.html
scripts/plugins/gridatlas-state.js
tests/check_v9_38.mjs
tests/run_v9_38.sh
)
REMOVED_FROM_PARENT=(
tests/check_v9_37.mjs
tests/run_v9_37.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_38.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.38 ($ID) validation suite: PASS ($ROOT)"Datacentre News
A JavaScript file in the plugins folder of GlobalGrid2050 that works with first available (`firstAvailable`).
energy-dataglobalgrid2050 / uk_renewables_pipeline/202611171609/scripts/plugins/datacentre-news.js · lines 1–124 of 124 · version 2026-11-17 16:09 · Not reached from any entry point (candidate for review) · pattern style (shared by 2 files)
- What it does
- It draws its content. Defines 8 functions or classes, including fetchJson, firstAvailable, el, day, story. Side effects: changes the web page (DOM); makes network requests.
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'datacentre'): 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 datacentre_news.json.
- What it achieves
- It fetches JSON (`fetchJson`) and is built from the first available helper (`firstAvailable`) and the story step (`story`). Defines `fetchJson`, `firstAvailable`, `day` and 4 more. It responds to click and DOMContentLoaded events.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · uk_renewables_pipeline/202611171609/scripts/plugins · script
- Uses
- none found
- Used by
- none found
- Produces
- fetchJson, firstAvailable, el, day, story, style, render, start
- Defines here
- fetchJson, firstAvailable, el, day, story, style, render, start
- 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/202611171609/scripts/plugins/datacentre-news.js:1-124 · blob e24bb41f8d8078bcc8366d805e3dbf36e04ce175 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, network · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
(function () {
'use strict';
var SOURCES = [
'https://raw.githubusercontent.com/Ventusltd/globalgrid2050/datacentre-news-data/dist/datacentre_news.json',
'../../dist/datacentre_news.json'
];
var SCHEMA = 'globalgrid2050.news.datacentre-capex-politics.v1';
var PER_LANE = 8;
var LANES = [['capex', 'CAPEX · INVESTMENT'], ['politics', 'POLITICS · POLICY']];
function fetchJson(url) {
var ctl = typeof AbortController === 'function' ? new AbortController() : null;
var timer = setTimeout(function () { if (ctl) ctl.abort(); }, 5000);
return fetch(url, { cache: 'no-cache', signal: ctl ? ctl.signal : undefined })
.then(function (r) { if (!r.ok) throw new Error(r.status); return r.json(); })
.then(function (d) {
clearTimeout(timer);
if (!d || d.schema !== SCHEMA || !Array.isArray(d.items)) throw new Error('schema');
return d;
}, function (e) { clearTimeout(timer); throw e; });
}
function firstAvailable(i) {
if (i >= SOURCES.length) return Promise.reject(new Error('no source'));
return fetchJson(SOURCES[i]).catch(function () { return firstAvailable(i + 1); });
}
function el(tag, cls, text) {
var n = document.createElement(tag);
if (cls) n.className = cls;
if (text != null) n.textContent = text;
return n;
}
function day(iso) {
if (!iso) return 'DATE NOT GIVEN';
var d = new Date(iso);
if (isNaN(d)) return 'DATE NOT GIVEN';
return d.toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric', timeZone: 'UTC' }).toUpperCase();
}
function story(item) {
var a = el('a', 'dcn-item');
if (/^https:\/\//.test(item.link)) a.href = item.link;
a.target = '_blank';
a.rel = 'noopener noreferrer';
a.appendChild(el('span', 'dcn-kicker', (item.source || '') + ' · ' + (item.pinned ? 'PINNED' : day(item.date))));
a.appendChild(el('span', 'dcn-title', item.title || ''));
return a;
}
function style() {
var css = '.dc-news .dcn-cols{display:grid;grid-template-columns:1fr 1fr}' +
'.dcn-col{border-right:1px solid #252a31;min-width:0}.dcn-col:last-child{border-right:0}' +
'.dcn-col h3{font-size:11px;letter-spacing:1px;padding:10px 14px;border-bottom:1px solid #252a31;color:var(--accent,#0ff)}' +
'.dcn-col[data-lane=capex] h3{color:var(--solar,#ff0)}' +
'.dcn-item{display:block;padding:12px 14px;border-bottom:1px solid #1b1f25;text-decoration:none;background:#07090c}' +
'.dcn-item:hover{background:#0b0f14}.dcn-kicker{display:block;color:#7f8996;font-size:10px;font-weight:bold}' +
'.dcn-title{display:block;color:#fff;font-size:14px;line-height:1.3;margin:5px 0 3px}' +
'.dcn-site{display:block;color:var(--ok,#0f8);font-size:9px;font-weight:bold;margin-top:3px}' +
'.dcn-empty{padding:14px;color:var(--muted,#a6adbb);font-size:11px}' +
'.dc-news .news-tools{position:static}.dc-news .dcn-tabs{display:none}' +
'@media(max-width:768px){.dc-news .dcn-tabs{display:flex}.dc-news .dcn-cols{grid-template-columns:1fr}' +
'.dcn-col{border-right:0}.dc-news[data-tab=capex] .dcn-col[data-lane=politics],' +
'.dc-news[data-tab=politics] .dcn-col[data-lane=capex]{display:none}.dcn-title{font-size:13px}}';
var s = el('style');
s.id = 'dcn-style';
s.textContent = css;
document.head.appendChild(s);
}
function render(d) {
var anchor = document.querySelector('section.newspaper') || document.querySelector('.meta');
if (!anchor || document.getElementById('dcNews')) return;
style();
var sec = el('section', 'newspaper dc-news');
sec.id = 'dcNews';
sec.setAttribute('data-tab', 'capex');
sec.setAttribute('aria-label', 'Data centres: capex and politics');
var head = el('div', 'masthead');
var h2 = el('h2', null, 'DATA CENTRES: ');
h2.appendChild(el('span', null, 'CAPEX AND POLITICS'));
head.appendChild(h2);
var strap = el('div', 'strap');
var c = d.counts || {};
strap.appendChild(el('span', null, 'Headlines and links from public news and government feeds · no article text'));
strap.appendChild(el('span', null, 'UPDATED ' + day(d.generated_at) + ' · ' + (c.items || d.items.length) + ' HEADLINES · ' + (c.feeds_ok != null ? c.feeds_ok + ' FEEDS OK' : '')));
head.appendChild(strap);
sec.appendChild(head);
var tabs = el('div', 'news-tools dcn-tabs');
LANES.forEach(function (l, i) {
var b = el('button', i === 0 ? 'active' : '', l[1]);
b.type = 'button';
b.addEventListener('click', function () {
sec.setAttribute('data-tab', l[0]);
Array.prototype.forEach.call(tabs.children, function (x) { x.classList.toggle('active', x === b); });
});
tabs.appendChild(b);
});
sec.appendChild(tabs);
var cols = el('div', 'dcn-cols');
LANES.forEach(function (l) {
var col = el('div', 'dcn-col');
col.setAttribute('data-lane', l[0]);
col.appendChild(el('h3', null, l[1]));
var list = d.items.filter(function (it) { return (it.lanes || []).indexOf(l[0]) >= 0; }).slice(0, PER_LANE);
if (!list.length) col.appendChild(el('div', 'dcn-empty', 'No headlines in this lane yet.'));
list.forEach(function (it) { col.appendChild(story(it)); });
cols.appendChild(col);
});
sec.appendChild(cols);
anchor.parentNode.insertBefore(sec, anchor.nextSibling);
}
function start() {
if (typeof fetch !== 'function') return;
firstAvailable(0).then(function (d) { if (d.items.length) render(d); }, function () { /* quiet: no panel */ });
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start);
else start();
})();