In this section
- Check V9 5 1 test · globalgrid2050 / uk_renewables_pipeline/202609051156/tests/check_v9_5_1.mjs lines 1–302
- Check V9 6 1 test · globalgrid2050 / uk_renewables_pipeline/202609051156/tests/check_v9_6_1.mjs lines 1–140
- Check V9 6 2 test · globalgrid2050 / uk_renewables_pipeline/202609051156/tests/check_v9_6_2.mjs lines 1–103
- Contract Failure Semantics V9 7 test · globalgrid2050 / uk_renewables_pipeline/202609051156/tests/contract_failure_semantics_v9_7.mjs lines 1–84
Check V9 5 1
A JavaScript module in the tests folder of GlobalGrid2050 that tests major project news, using SHA-256 and uses data from the GridAtlas repository.
testglobalgrid2050 / uk_renewables_pipeline/202609051156/tests/check_v9_5_1.mjs · lines 1–302 of 302 · version 2026-09-05 11:56 · pattern gitTree (shared by 16 files)
- What it does
- It tests major project news and the REPD register. Defines readText, readJson, sha256, gitBlob, gitTree. Uses libraries node:assert/strict, node:child_process, node:crypto, node:fs/promises, node:url. Side effects: changes the web page (DOM); reads or writes files; 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: the REPD register.
- Inputs & outputs
- In: data source: gridatlas data; JSON file release.v9.5.1.json; JSON file release.v9.5.json; JSON file release.v9.1.json; JSON file v9_manifest.json; JSON file build_manifest.json; JSON file major_project_news_v9_5_1.json.
- Downstream impact
- Used directly by 1 file: Run V9 5 1 (globalgrid2050).
- What it achieves
- It reads text (`readText`) and reads JSON (`readJson`). Defines `readText`, `readJson`, `sha256` and 2 more. It reads `contracts/release.v9.5.1.json`.
- Why it matters
- Checked by Run V9 5 1.
- Application
- globalgrid2050 · uk_renewables_pipeline/202609051156/tests · JavaScript module
- Uses
- Projects V9 5 1 (script call), Atlas Receiver V9 7 (script call), Project Filter V9 2 (import), GridAtlas — Atlas Page (estate URL), GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v8 Page (estate URL), node:assert/strict, node:child_process, node:crypto, node:fs/promises, node:url
- Used by
- run by Run V9 5 1 (script call)
- Produces
- readText, readJson, sha256, gitBlob, gitTree
- Defines here
- readText, readJson, sha256, gitBlob, gitTree
- 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/202609051156/tests/check_v9_5_1.mjs:1-302 · blob 49d4fbc5589a6d28dc9dc669ea1164f251778f26 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, filesystem, process · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import { createHash } from "node:crypto";
import { readFile } from "node:fs/promises";
import { fileURLToPath } from "node:url";
import {
buildProjectSearchTextV9_2,
projectMatchesV9_2,
summariseProjectsV9_2,
tokeniseSearchV9_2,
} from "../scripts/core/project-filter-v9-2.js";
import { atlasUrlV9_5_1, compareProjectUpdatesV9_5_1 } from "../scripts/plugins/projects-v9-5-1.js";
import {
atlasCentresOnRepdPointV9_7,
atlasReceiverV9_7,
isRetiredReceiverV9_7,
primeAtlasReceiverV9_7,
} from "../scripts/core/atlas-receiver-v9-7.js";
/* The deep-link contract, as the engine publishes it. Held here as the test's
own input so every branch runs with no network; the live file is audited
separately by Ventusltd/testcode drivers/link-targets.mjs, which reads
ventus-grid-engine/deeplink/receivers.json rather than restating it. */
const RECEIVER_CONTRACT = {
schema: "ventus.grid-engine.deeplink-receivers.v1",
canonical: { id: "gridatlas-v9", route: "https://ventusltd.github.io/gridatlas/atlas/", carries_engine: true },
/* A synthetic retired route. This fixture only needs SOMETHING retired to
exercise the refusal branch, and naming the estate's real dead route in a
test keeps a copy of it alive for the next person to copy. */
retired: [{ id: "synthetic-retired-receiver", route: "https://retired.invalid/no-engine/", carries_engine: false }],
};
const base = new URL("../", import.meta.url);
const root = new URL("../../../", import.meta.url);
const rootPath = fileURLToPath(root);
const readText = (path) => readFile(new URL(path, base), "utf8");
const readJson = async (path) => JSON.parse(await readText(path));
const sha256 = (value) => createHash("sha256").update(value).digest("hex");
const gitBlob = (path) => execFileSync("git", ["-C", rootPath, "hash-object", path], { encoding: "utf8" }).trim();
const gitTree = (revisionPath) => execFileSync("git", ["-C", rootPath, "rev-parse", revisionPath], { encoding: "utf8" }).trim();
const contract = await readJson("contracts/release.v9.5.1.json");
const parentContract = await readJson("contracts/release.v9.5.json");
const dataContract = await readJson("contracts/release.v9.1.json");
const releaseManifest = await readJson("data/v9_manifest.json");
const payload = await readJson("data/v9.1/build_manifest.json");
const projectParts = await Promise.all(payload.project_partitions.map(({ path }) => readJson(path)));
const projects = projectParts.flatMap((part) => part.projects);
const news = JSON.parse(await readFile(new URL("dist/major_project_news_v9_5_1.json", root), "utf8"));
assert.equal(contract.release, "9.5.1");
assert.equal(contract.frozen_parent.release, "9.5");
assert.equal(contract.frozen_parent.commit, "3acd56386d0bf2952f8f26754d615d20a7345e35");
assert.equal(contract.frozen_parent.subtree, "763c5b4055fc82939c1192a26123bfb2c75f3869");
assert.equal(contract.frozen_parent.tree_listing_sha256, "ddb147828316c7fba73cd7af4c7bb5c63280fb77b5410a66483b9618d460e15e");
assert.equal(contract.frozen_parent.must_remain_unchanged, true);
assert.equal(gitTree("HEAD:uk_renewables_pipeline/v9.5"), contract.frozen_parent.subtree, "V9.5 subtree changed while building V9.5.1");
assert.equal(gitTree("HEAD:uk_renewables_pipeline/v9.4"), contract.frozen_v9_4.subtree, "V9.4 subtree changed while building V9.5.1");
assert.equal(contract.data_parent.release, "9.1");
assert.equal(contract.data_parent.data_changed, false);
assert.equal(parentContract.release, "9.5");
assert.equal(dataContract.release, "9.1");
assert.equal(releaseManifest.version, "9.5.1");
assert.ok(["CANDIDATE", "LIVE_VALIDATED"].includes(releaseManifest.status));
assert.equal(releaseManifest.frozen_v9_5_commit, contract.frozen_parent.commit);
assert.equal(releaseManifest.frozen_v9_5_subtree, contract.frozen_parent.subtree);
assert.equal(contract.ui_contract.first_click, "updated_desc");
assert.equal(contract.ui_contract.second_click, "updated_asc");
assert.equal(contract.ui_contract.aria_sort_default, "none");
assert.equal(contract.ui_contract.aria_sort_newest, "descending");
assert.equal(contract.ui_contract.aria_sort_oldest, "ascending");
assert.equal(contract.ui_contract.project_table_columns, 11);
assert.equal(contract.news_contract.all_headline_count, 133);
assert.equal(contract.news_contract.relevant_headline_count, 45);
assert.equal(contract.news_contract.v9_4_baseline_headline_count, 125);
assert.equal(contract.news_contract.relevant_filter_is_functional, true);
assert.equal(contract.news_contract.discovery_only_drives_project_signal, false);
assert.equal(contract.news_contract.beacon_fen.repd_ref, "13599");
assert.equal(contract.news_contract.beacon_fen.official_capacity_mw, 400);
const frozenV92Blobs = {
"uk_renewables_pipeline/v9/scripts/core/project-filter-v9-2.js": "dceee01d0f51e85b071aef275250c1fb223eeba7",
"uk_renewables_pipeline/v9/scripts/core/news-relevance-v9-2.js": "f8374bfd6f0c47e98ca1e7f2f3312c9281a34e8a",
"uk_renewables_pipeline/v9/scripts/data/canonical-projects-v9-2.js": "e3d9b7bb0f39b813cf3b1f125467efbd6a021dda",
"uk_renewables_pipeline/v9/scripts/plugins/gauges-v9-2.js": "1d081d2d9e1630912b912953cf18f431754f9e19",
"uk_renewables_pipeline/v9/scripts/plugins/newspaper-v9-2.js": "6c72de9e9bd8f41bf525a32ca2436e53ddb466b0",
"uk_renewables_pipeline/v9/scripts/plugins/projects-v9-2.js": "0e222ea75e9db8dc3e9f1e829a15ac3ee1ca0acf",
"uk_renewables_pipeline/v9/styles/v9-2.css": "f4ac1a09145b0f4824e333ac2acbc767d84f2da6",
};
for (const [path, expected] of Object.entries(frozenV92Blobs)) {
assert.equal(gitBlob(path), expected, `${path} changed after the frozen V9.2 checkpoint`);
}
assert.equal(payload.project_count, 7680);
assert.equal(payload.capacity_mw, 356474.09);
assert.equal(payload.largest_mw, 4100);
assert.equal(payload.geometry_count, 7652);
assert.equal(payload.missing_geometry_count, 28);
assert.equal(payload.solar_count, 3563);
assert.equal(payload.bess_count, 1609);
assert.equal(payload.wind_onshore_count, 2399);
assert.equal(payload.wind_offshore_count, 109);
assert.equal(projects.length, 7680);
assert.equal(new Set(projects.map((project) => project.repd_ref)).size, 7680);
assert.ok(projects.every((project) => project.capacity_mw >= 1));
assert.deepEqual(summariseProjectsV9_2(projects), { count: 7680, capacity_mw: 356474.09, largest_mw: 4100 });
const datedProjects = projects.filter((project) => project.repd_record_updated);
const undatedProjects = projects.filter((project) => !project.repd_record_updated);
assert.ok(datedProjects.length > 1);
assert.ok(datedProjects.every((project) => /^\d{4}-\d{2}-\d{2}$/.test(project.repd_record_updated)));
const newestFirst = [...projects].sort((left, right) => compareProjectUpdatesV9_5_1(left, right, "desc"));
const oldestFirst = [...projects].sort((left, right) => compareProjectUpdatesV9_5_1(left, right, "asc"));
assert.ok(newestFirst[0].repd_record_updated >= newestFirst[1].repd_record_updated);
assert.ok(oldestFirst[0].repd_record_updated <= oldestFirst[1].repd_record_updated);
if (undatedProjects.length) {
assert.equal(newestFirst.at(-1).repd_record_updated, null);
assert.equal(oldestFirst.at(-1).repd_record_updated, null);
}
const berwick = projects.find((project) => project.repd_ref === "9873");
assert.ok(berwick);
const searchText = buildProjectSearchTextV9_2(berwick);
assert.equal(projectMatchesV9_2(berwick, {
technology: "wind_offshore",
status: "All",
county: "All",
tokens: tokeniseSearchV9_2("GG2050-REPD-9873 Berwick"),
}, searchText), true);
assert.equal(projectMatchesV9_2(berwick, {
technology: "solar",
status: "All",
county: "All",
tokens: [],
}, searchText), false);
/* WHAT THIS ASSERTION USED TO SAY, AND WHY IT WAS WRONG.
It read:
assert.equal(atlasUrlV9_5_1(berwick), "", "no contract read yet, so no link
may be built");
— and it passed, every run, because the module built no link until a
cross-origin fetch resolved. It was certifying as correct the exact state
this release's users were reported in: the release's own proof made the
failure mode unfalsifiable. The rest of the suite could never go red on it.
It is not deleted, it is INVERTED, and the thing that made it safe to invert
is stated rather than assumed. Before any network exists, this module now
answers from a contract compiled into it, and that compiled contract is
pinned to the engine's published one by testcode/drivers/link-targets.mjs,
which reads ventus-grid-engine/deeplink/receivers.json and fails offline if
the two disagree. The refusal branches this assertion was protecting are all
still tested below: a contract that fails its schema, one that names no
canonical receiver, and one that names its own canonical route as retired
each still yield "". What no longer yields "" is a slow network, which was
never a statement about which receiver is correct. */
assert.equal(
atlasUrlV9_5_1(berwick).startsWith("https://ventusltd.github.io/gridatlas/atlas/"),
true,
"a link must exist before any network has resolved, against the compiled-in canonical receiver",
);
assert.equal(
atlasReceiverV9_7(),
"https://ventusltd.github.io/gridatlas/atlas/",
"the compiled-in canonical receiver, known at import",
);
assert.equal(
isRetiredReceiverV9_7("https://globalgrid2050.com/repd_grid_atlasv8/"),
true,
"the compiled-in contract must also carry the retired routes, or a retired route could be adopted before the live contract is read",
);
assert.equal(primeAtlasReceiverV9_7(RECEIVER_CONTRACT), RECEIVER_CONTRACT.canonical.route);
assert.equal(atlasReceiverV9_7(), RECEIVER_CONTRACT.canonical.route);
const validAtlas = new URL(atlasUrlV9_5_1(berwick));
assert.equal(validAtlas.origin + validAtlas.pathname, "https://ventusltd.github.io/gridatlas/atlas/");
assert.equal(isRetiredReceiverV9_7(validAtlas.origin + validAtlas.pathname), false);
assert.equal(validAtlas.searchParams.get("repd_ref"), "9873");
assert.equal(validAtlas.searchParams.get("technology"), "wind_offshore");
assert.equal(validAtlas.searchParams.get("latitude"), String(berwick.latitude));
/* A record REPD published no coordinate for is still linkable: the contract
requires only repd_ref, and the canonical receiver resolves the project from
it -- measured live on REPD 13429, which arrives and names itself. It used to
return "", which rendered a button that silently did nothing. */
const missingGeometry = projects.find((project) => project.geometry_status !== "valid");
assert.ok(missingGeometry);
assert.equal(atlasCentresOnRepdPointV9_7(missingGeometry), false);
const refOnly = new URL(atlasUrlV9_5_1(missingGeometry));
assert.equal(refOnly.origin + refOnly.pathname, "https://ventusltd.github.io/gridatlas/atlas/");
assert.equal(refOnly.searchParams.get("repd_ref"), String(missingGeometry.repd_ref));
assert.equal(refOnly.searchParams.get("latitude"), null);
assert.equal(refOnly.searchParams.get("zoom"), null);
/* A contract that names its own canonical route as retired must fail closed
rather than resolve itself. */
assert.equal(primeAtlasReceiverV9_7({
schema: RECEIVER_CONTRACT.schema,
canonical: { route: RECEIVER_CONTRACT.retired[0].route, carries_engine: true },
retired: RECEIVER_CONTRACT.retired,
}), "");
assert.equal(atlasUrlV9_5_1(berwick), "");
assert.equal(primeAtlasReceiverV9_7(RECEIVER_CONTRACT), RECEIVER_CONTRACT.canonical.route);
assert.equal(news.schema, "globalgrid2050.major-project-news.v9.5.1");
assert.equal(news.all_headline_count, news.all_items.length);
assert.equal(news.relevant_headline_count, news.canonical_items.length);
assert.equal(news.all_items.length, 133);
assert.equal(news.canonical_items.length, 45);
assert.equal(news.v9_4_baseline_headline_count, 125);
assert.ok(news.canonical_items.every((item) => item.role === "PRIMARY_MATCH"));
assert.ok(news.canonical_items.every((item) => item.eligible_for_news_signal === true));
assert.ok(news.canonical_items.every((item) => item.gg_project_id === `GG2050-REPD-${item.repd_ref}`));
assert.equal(news.all_items.filter((item) => item.canonical_relevant).length, 45);
const beacon = news.canonical_items.find((item) => item.headline === "Beacon Fen Energy Park development consent decision announced");
assert.ok(beacon);
assert.equal(beacon.repd_ref, "13599");
assert.equal(beacon.capacity_mw, 400);
assert.equal(beacon.operator, "Low Carbon Limited");
const brecks = news.canonical_items.filter((item) => item.repd_ref === "10087");
assert.ok(brecks.length > 0);
assert.ok(brecks.every((item) => item.gg_development_id));
const html = await readText("index.html");
const mobileCss = await readText("styles/mobile.css");
const additiveCss = await readText("styles/v9-3.css");
const parentAdditiveCss = await readText("styles/v9-2.css");
const headerCss = await readText("styles/v9-4.css");
const responsiveCss = await readText("styles/v9-5-1.css");
const frozenParentCss = await readFile(new URL("uk_renewables_pipeline/v9/styles/v9-3.css", root), "utf8");
const projectsV95 = await readText("scripts/plugins/projects-v9-5-1.js");
const newspaperV95 = await readText("scripts/plugins/newspaper-v9-5-1.js");
const app = await readText("scripts/app-v9-5-1.js");
const rootIndex = await readFile(new URL("index.html", root), "utf8");
const packageJson = await readJson("package.json");
assert.match(html, /UK RENEWABLES PIPELINE V9\.5\.1/);
assert.match(html, />V9\.5\.1 (?:CANDIDATE|LIVE)</);
assert.match(html, /V9\.5 FROZEN APP/);
assert.match(html, /V9\.4 FROZEN APP/);
const styleOrder = [
html.indexOf("styles/v7.css?v=9.5.1"),
html.indexOf("styles/mobile.css?v=9.5.1"),
html.indexOf("styles/v9-3.css?v=9.5.1"),
html.indexOf("styles/v9-4.css?v=9.5.1"),
html.indexOf("styles/v9-5-1.css?v=9.5.1"),
];
assert.ok(styleOrder.every((value) => value >= 0));
assert.ok(styleOrder.every((value, index) => index === 0 || value > styleOrder[index - 1]));
assert.equal((html.match(/<canvas id="g[1-3]"/g) || []).length, 3);
assert.equal((html.match(/<th(?:\s|>)/g) || []).length, 11);
assert.match(html, /<th class="hide-mobile">REPD REF<\/th>/);
assert.match(html, /<th class="hide-mobile">GLOBALGRID REF<\/th>/);
assert.match(html, /id="repdUpdatedHeader" aria-sort="none"/);
assert.match(html, /id="sortUpdated"/);
assert.match(html, /id="updatedSortIndicator"[^>]*>↕<\/span>/);
assert.match(html, /id="sortProjects"/);
assert.match(html, /value="updated_desc"/);
assert.match(html, /value="updated_asc"/);
assert.match(html, /scripts\/app-v9-5-1\.js\?v=9\.5\.1/);
assert.equal(sha256(mobileCss), "9855b9c11255a85f477873d07cca45b057aedcdc8a6cc4aab2d29a0ffaac9b85");
assert.equal(additiveCss, frozenParentCss, "V9.4 changed its inherited V9.3.1 stylesheet copy");
const parentCssPrefix = parentAdditiveCss.trimEnd();
assert.ok(additiveCss.startsWith(parentCssPrefix), "V9.3 additive CSS no longer preserves the complete V9.2 prefix");
assert.match(headerCss, /\.repd-updated-heading button/);
assert.match(headerCss, /#updatedSortIndicator/);
assert.match(headerCss, /focus-visible/);
assert.match(responsiveCss, /@media\s*\(min-width:\s*921px\)\s*and\s*\(max-width:\s*1100px\)/);
assert.match(responsiveCss, /\.header\s*\{[^}]*flex-direction:\s*column[^}]*\}/s);
assert.match(responsiveCss, /\.status\s*\{[^}]*width:\s*100%[^}]*white-space:\s*normal[^}]*\}/s);
assert.match(app, /gauges-v9-2\.js/);
assert.match(app, /projects-v9-5-1\.js/);
assert.match(app, /newspaper-v9-5-1\.js/);
assert.match(projectsV95, /globalgrid2050_uk_renewables_pipeline_v9_5_1_/);
assert.match(projectsV95, /compareProjectUpdatesV9_5_1/);
assert.match(projectsV95, /function updateSortHeader\(\)/);
assert.match(projectsV95, /sortMode === "updated_desc" \? "updated_asc" : "updated_desc"/);
assert.match(projectsV95, /document\.getElementById\("sortUpdated"\)\.onclick/);
assert.match(projectsV95, /header\.setAttribute\("aria-sort", "descending"\)/);
assert.match(projectsV95, /header\.setAttribute\("aria-sort", "ascending"\)/);
assert.match(newspaperV95, /item\.role === "PRIMARY_MATCH"/);
assert.match(newspaperV95, /newsIndex\.get\(String\(project\.repd_ref\)\)/);
assert.match(newspaperV95, /major_project_news_v9_5_1\.json/);
assert.match(newspaperV95, /state\.newsMode === "RELEVANT" && item\.canonical_relevant !== true/);
assert.match(newspaperV95, /payload\.v9_4_baseline_headline_count === 125/);
assert.doesNotMatch(newspaperV95, /normaliseProject\(project\.name\)/);
assert.match(rootIndex, /UK Renewables Pipeline V9\.3\.1/);
assert.match(rootIndex, /UK Renewables Pipeline V9\.4/);
assert.match(rootIndex, /UK Renewables Pipeline V9\.5/);
assert.match(rootIndex, /UK Renewables Pipeline V9\.5\.1/);
assert.equal(packageJson.version, "9.5.1");
assert.equal(packageJson.scripts.validate, "bash tests/run_v9_5_1.sh");
assert.equal(packageJson.scripts["validate:browser"], "V9_BROWSER_SMOKE=1 bash tests/run_v9_5_1.sh");
console.log("V9.5.1: PASS (133 ALL, 45 RELEVANT, Beacon Fen REPD 13599; V9.5/V9.4 frozen)");Check V9 6 1
A JavaScript module in the tests folder of GlobalGrid2050 that tests major project news, using SHA-256.
testglobalgrid2050 / uk_renewables_pipeline/202609051156/tests/check_v9_6_1.mjs · lines 1–140 of 140 · version 2026-09-05 11:56 · pattern filesBelow (shared by 2 files)
- What it does
- It tests major project news. Defines 6 functions or classes, including text, json, sha256, gitTree, filesBelow. Uses libraries node:assert/strict, node:child_process, node:crypto, node:fs/promises, node:url. Side effects: reads or writes files; 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.
- Inputs & outputs
- In: JSON file release.v9.6.1.json; JSON file v9_manifest.json; JSON file build_manifest.json; JSON file major_project_news_v9_5_1.json.
- Downstream impact
- Used directly by 1 file: Run V9 6 1 (globalgrid2050).
- What it achieves
- It is built from the git tree helper (`gitTree`), the files below helper (`filesBelow`) and the digest map helper (`digestMap`). Defines `text`, `json`, `sha256` and 3 more.
- Why it matters
- Checked by Run V9 6 1.
- Application
- globalgrid2050 · uk_renewables_pipeline/202609051156/tests · JavaScript module
- Uses
- UK Renewables Pipeline — V9 5 1 Page (new URL import.meta.url), node:assert/strict, node:child_process, node:crypto, node:fs/promises, node:url
- Used by
- run by Run V9 6 1 (script call)
- Produces
- text, json, sha256, gitTree, filesBelow, digestMap
- Defines here
- text, json, sha256, gitTree, filesBelow, digestMap
- 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/202609051156/tests/check_v9_6_1.mjs:1-140 · blob d8b4991ddf2eaafd4c169b61afa06c0f5eed2866 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: ingest · effects: filesystem, process · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import { createHash } from "node:crypto";
import { access, readdir, readFile } from "node:fs/promises";
import { fileURLToPath } from "node:url";
const base = new URL("../", import.meta.url);
const parent = new URL("../../v9.5.1/", import.meta.url);
const root = new URL("../../../", import.meta.url);
const rootPath = fileURLToPath(root);
const text = (url) => readFile(url, "utf8");
const json = async (url) => JSON.parse(await text(url));
const sha256 = (value) => createHash("sha256").update(value).digest("hex");
const gitTree = (revisionPath) => execFileSync(
"git", ["-C", rootPath, "rev-parse", revisionPath], { encoding: "utf8" },
).trim();
async function filesBelow(directory, prefix = "") {
const entries = await readdir(directory, { withFileTypes: true });
const files = [];
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
if (["__pycache__", "node_modules"].includes(entry.name) || entry.name.endsWith(".pyc")) continue;
const relative = prefix ? `${prefix}/${entry.name}` : entry.name;
const url = new URL(`${entry.name}${entry.isDirectory() ? "/" : ""}`, directory);
if (entry.isDirectory()) files.push(...await filesBelow(url, relative));
else files.push(relative);
}
return files;
}
async function digestMap(directory) {
const files = await filesBelow(directory);
const rows = await Promise.all(files.map(async (path) => [
path,
sha256(await readFile(new URL(path, directory))),
]));
return new Map(rows);
}
const allowedModified = new Set([
"README.md",
"index.html",
"package-lock.json",
"package.json",
]);
const allowedAdded = new Set([
"contracts/release.v9.6.1.json",
"docs/releases/9.6.1.md",
"styles/v9-6-1.css",
"tests/browser_smoke_v9_6_1.mjs",
"tests/check_v9_6_1.mjs",
"tests/run_v9_6_1.sh",
]);
assert.equal(
gitTree("HEAD:uk_renewables_pipeline/v9.5.1"),
"95672822a2c534445ca12b0dd62f29154a66c0e8",
"the validated V9.5.1 parent subtree changed",
);
const [parentFiles, targetFiles] = await Promise.all([digestMap(parent), digestMap(base)]);
assert.deepEqual(
[...targetFiles.keys()].filter((path) => !parentFiles.has(path)).sort(),
[...allowedAdded].sort(),
"V9.6.1 contains an unapproved added or missing file",
);
assert.deepEqual(
[...parentFiles.keys()].filter((path) => !targetFiles.has(path)),
[],
"V9.6.1 omitted a V9.5.1 parent file",
);
for (const [path, digest] of parentFiles) {
if (!allowedModified.has(path)) {
assert.equal(targetFiles.get(path), digest, `${path} differs from frozen V9.5.1`);
}
}
const [contract, manifest, html, css, packageJson] = await Promise.all([
json(new URL("contracts/release.v9.6.1.json", base)),
json(new URL("data/v9_manifest.json", base)),
text(new URL("index.html", base)),
text(new URL("styles/v9-6-1.css", base)),
json(new URL("package.json", base)),
]);
assert.equal(contract.release, "9.6.1");
assert.ok(["CANDIDATE", "LIVE_VALIDATED"].includes(contract.status));
assert.equal(contract.frozen_parent.commit, "8b2432be75f224562fc1c416dbcc3319e31a47a8");
assert.equal(contract.frozen_parent.subtree, "95672822a2c534445ca12b0dd62f29154a66c0e8");
assert.equal(contract.runtime.app, "scripts/app-v9-5-1.js");
assert.equal(contract.runtime.data_changed, false);
assert.equal(contract.runtime.javascript_changed, false);
assert.equal(contract.runtime.news_changed, false);
assert.equal(contract.ui_contract.desktop_changed, false);
assert.equal(contract.ui_contract.project_table_inherited_min_width_px, 1280);
assert.equal(contract.ui_contract.capacity_range_filter, false);
assert.equal(contract.ui_contract.forced_table_width_px, null);
assert.equal(manifest.version, "9.5.1", "the V9.5.1 runtime manifest must remain unchanged");
assert.equal(packageJson.version, "9.6.1");
assert.match(html, /UK RENEWABLES PIPELINE V9\.6\.1/);
assert.match(html, /styles\/v9-6-1\.css\?v=9\.6\.1/);
assert.match(html, /scripts\/app-v9-5-1\.js\?v=9\.6\.1/);
assert.match(html, /V9\.6 DISCONTINUED/);
assert.doesNotMatch(html, /minCapacity|maxCapacity|capacity-controls/);
assert.doesNotMatch(html, /app-v9-6\.js|project-filter-v9-6|projects-v9-6/);
assert.equal((html.match(/class="card"/g) || []).length, 3);
assert.equal((html.match(/<th(?:\s|>)/g) || []).length, 11);
assert.match(css, /@media\s*\(max-width:\s*768px\)/);
assert.match(css, /-webkit-overflow-scrolling:\s*touch/);
assert.match(css, /overflow-x:\s*auto/);
assert.match(css, /\.tablewrap \.hide-mobile\s*\{[^}]*display:\s*table-cell/s);
assert.doesNotMatch(css, /\bmin-width\s*:|\n\s*width\s*:|1850|1500/);
assert.doesNotMatch(css, /gauges|stories|header|sidebar|newspaper|filters|display:\s*grid/);
for (const forbidden of [
"scripts/app-v9-6.js",
"scripts/core/project-filter-v9-6.js",
"scripts/plugins/projects-v9-6.js",
]) {
await assert.rejects(access(new URL(forbidden, base)), `${forbidden} must not exist in V9.6.1`);
}
const buildManifest = await json(new URL("data/v9.1/build_manifest.json", base));
const parts = await Promise.all(buildManifest.project_partitions.map(({ path }) => json(new URL(path, base))));
const projects = parts.flatMap((part) => part.projects);
assert.equal(projects.length, 7680);
assert.equal(Number(projects.reduce((sum, project) => sum + project.capacity_mw, 0).toFixed(2)), 356474.09);
assert.equal(Math.max(...projects.map((project) => project.capacity_mw)), 4100);
const news = await json(new URL("dist/major_project_news_v9_5_1.json", root));
assert.equal(news.all_items.length, 133);
assert.equal(news.canonical_items.length, 45);
const beacon = news.canonical_items.find((item) => item.headline === "Beacon Fen Energy Park development consent decision announced");
assert.equal(beacon.repd_ref, "13599");
assert.equal(beacon.operator, "Low Carbon Limited");
assert.equal(beacon.capacity_mw, 400);
console.log("V9.6.1 static gate: PASS (V9.5.1 byte parity plus mobile-only scroll CSS)");Check V9 6 2
A JavaScript module in the tests folder of GlobalGrid2050 that tests major project news, battery storage (BESS) and solar.
testglobalgrid2050 / uk_renewables_pipeline/202609051156/tests/check_v9_6_2.mjs · lines 1–103 of 103 · version 2026-09-05 11:56 · pattern story (shared by 6 files)
- What it does
- It tests major project news, battery storage (BESS) and solar. Defines text, json, gitTree, story. Uses libraries node:assert/strict, node:child_process, node:fs/promises, node:url. Side effects: reads or writes files; 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: battery storage (BESS), solar.
- Inputs & outputs
- In: JSON file release.v9.6.2.json; JSON file major_project_news_v9_5_1.json.
- Downstream impact
- Used directly by 1 file: Run V9 6 2 (globalgrid2050).
- What it achieves
- It is built from the git tree helper (`gitTree`) and the story step (`story`). Defines `text`, `json`, `gitTree` and 1 more. Its code works with 150 MW, 160 MWh and 170 MW.
- Why it matters
- Checked by Run V9 6 2.
- Application
- globalgrid2050 · uk_renewables_pipeline/202609051156/tests · JavaScript module
- Uses
- News Regions V9 6 2 (import), node:assert/strict, node:child_process, node:fs/promises, node:url
- Used by
- run by Run V9 6 2 (script call)
- Produces
- text, json, gitTree, story
- Defines here
- text, json, gitTree, story
- 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/202609051156/tests/check_v9_6_2.mjs:1-103 · blob 68b39ffccaa8b4fcea00004af9a50704e51ab0fb · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: ingest · effects: filesystem, process · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import { readFile } from "node:fs/promises";
import { fileURLToPath } from "node:url";
import {
classifyInternationalV9_6_2,
regionalCountsV9_6_2,
ukEvidenceV9_6_2,
} from "../scripts/core/news-regions-v9-6-2.js";
const base = new URL("../", import.meta.url);
const root = new URL("../../../", import.meta.url);
const rootPath = fileURLToPath(root);
const text = (url) => readFile(url, "utf8");
const json = async (url) => JSON.parse(await text(url));
const gitTree = (revisionPath) => execFileSync(
"git", ["-C", rootPath, "rev-parse", revisionPath], { encoding: "utf8" },
).trim();
assert.equal(
gitTree("HEAD:uk_renewables_pipeline/v9.6.1"),
"243d1217c9748a4246a6d427a5e80ac45c5bd22e",
"the validated V9.6.1 parent subtree changed",
);
const [contract, html, packageJson, feed] = await Promise.all([
json(new URL("contracts/release.v9.6.2.json", base)),
text(new URL("index.html", base)),
json(new URL("package.json", base)),
json(new URL("dist/major_project_news_v9_5_1.json", root)),
]);
assert.equal(contract.release, "9.6.2");
assert.ok(["CANDIDATE", "LIVE_VALIDATED"].includes(contract.status));
assert.equal(contract.frozen_parent.subtree, "243d1217c9748a4246a6d427a5e80ac45c5bd22e");
assert.equal(contract.runtime.project_data_changed, false);
assert.equal(contract.runtime.uk_matching_changed, false);
assert.equal(contract.runtime.regional_project_signal_eligible, false);
assert.equal(packageJson.version, "9.6.2");
assert.match(html, /UK RENEWABLES PIPELINE V9\.6\.2/);
for (const mode of ["UK", "INTERNATIONAL", "US", "EUROPE"]) {
assert.match(html, new RegExp(`data-news="${mode}"`));
}
assert.doesNotMatch(html, /data-news="RELEVANT"/);
assert.match(html, /scripts\/app-v9-6-2\.js\?v=9\.6\.2/);
assert.equal((html.match(/<th(?:\s|>)/g) || []).length, 11);
assert.equal(feed.all_items.length, 133);
assert.equal(feed.canonical_items.length, 45);
assert.equal(feed.all_items.filter((item) => item.canonical_relevant === true).length, 45);
for (const item of feed.canonical_items) {
assert.equal(item.role, "PRIMARY_MATCH");
assert.equal(item.eligible_for_news_signal, true);
assert.equal(item.gg_project_id, `GG2050-REPD-${item.repd_ref}`);
}
const counts = regionalCountsV9_6_2(feed.all_items);
assert.deepEqual(counts, { international: 19, us: 4, europe: 9, other: 6 });
assert.deepEqual(counts, {
international: contract.expected.international_headline_count,
us: contract.expected.us_headline_count,
europe: contract.expected.europe_headline_count,
other: contract.expected.international_other_headline_count,
});
const regional = feed.all_items.flatMap((item) => {
const classification = classifyInternationalV9_6_2(item);
return classification ? [{ item, classification }] : [];
});
assert.equal(regional.length, 19);
for (const { item, classification } of regional) {
assert.equal(item.canonical_relevant, false);
assert.equal(classification.project_signal_eligible, false);
assert.equal(classification.canonical_identity, false);
assert.ok(["SOLAR", "BESS", "SOLAR + BESS"].includes(classification.technology));
assert.equal(ukEvidenceV9_6_2(item), "");
}
function story(headline) {
return feed.all_items.find((item) => item.headline === headline);
}
assert.equal(classifyInternationalV9_6_2(story(
"New Jersey Board of Public Utilities releases 150MW BTM energy storage proposal - Energy-Storage.News",
)).region, "US");
assert.equal(classifyInternationalV9_6_2(story(
"Capital Dynamics acquires 170MW/680MWh BESS in County Kerry, Ireland",
)).region, "EUROPE");
assert.equal(classifyInternationalV9_6_2(story(
"‘One market into many’: AER says battery storage systems are reshaping Australia’s NEM - Energy-Storage.News",
)).region, "INTERNATIONAL_OTHER");
assert.equal(classifyInternationalV9_6_2(story(
"Canadian Solar says patent dispute with Maxeon is formally terminated",
)), null, "company name alone must not establish geography");
assert.equal(classifyInternationalV9_6_2(story(
"EDF to optimise Chinese lithium giant Ganfeng’s 160MWh Kintore battery storage system",
)), null, "the Kintore UK project must not leak into INTERNATIONAL");
assert.equal(classifyInternationalV9_6_2(story(
"Beacon Fen Energy Park development consent decision announced",
)), null, "canonical UK stories must not leak into INTERNATIONAL");
console.log("V9.6.2 static gate: PASS (45 UK; 19 international = 4 US + 9 Europe + 6 other)");Contract Failure Semantics V9 7
A JavaScript module in the tests folder of GlobalGrid2050 using data from the GridAtlas and GridAtlas-next repositories.
testglobalgrid2050 / uk_renewables_pipeline/202609051156/tests/contract_failure_semantics_v9_7.mjs · lines 1–84 of 84 · version 2026-09-05 11:56 · Not reached from any entry point (candidate for review)
- What it does
- It tests its inputs. Defines ok. 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.
- What it achieves
- What the deep-link contract's FAILURE branches actually do to the reader's links.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · uk_renewables_pipeline/202609051156/tests · JavaScript module
- Uses
- Atlas Receiver V9 7 (new URL import.meta.url), GridAtlas — Atlas Page (estate URL)
- Used by
- none found
- Produces
- ok
- Defines here
- ok
- 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/202609051156/tests/contract_failure_semantics_v9_7.mjs:1-84 · blob fa895ffbfe9afbb9244d96f44e4d96e3e6c8a5c6 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
/* What the deep-link contract's FAILURE branches actually do to the reader's links.
*
* Written 2026-09-05 after an independent review measured this module doing the
* opposite of what its own comment claimed. The comment said "a malformed
* document or a schema bump all leave the compiled-in route standing". Measured:
* a document with a schema this build did not recognise removed every MAP link
* from the page and reported verified:true while doing it. One branch handled
* every prime failure, so "I cannot read this" and "there is no receiver" were
* the same thing to it.
*
* That distinction cannot be asserted by reading the source, which is how it
* survived: the code and the comment were both present and disagreed. So this
* drives the real exported function with a stubbed fetch and asserts the
* OUTCOME - what route the reader is left with - for every branch.
*
* Each case re-imports the module under a fresh URL because the verification
* promise is memoised for the life of the module; without that, case 2 would
* silently receive case 1's answer and the file would pass by not running.
*
* node uk_renewables_pipeline/v9.7/tests/contract_failure_semantics_v9_7.mjs
*/
const MOD = new URL("../scripts/core/atlas-receiver-v9-7.js", import.meta.url).href;
const SCHEMA = "ventus.grid-engine.deeplink-receivers.v1";
const COMPILED = "https://ventusltd.github.io/gridatlas/atlas/";
const STANDS = { route: COMPILED, verified: false, withdrawn: false };
const ok = (json) => Promise.resolve({ ok: true, json: async () => json });
const cases = [
{ name: "network failure keeps the compiled route",
fetch: () => Promise.reject(new Error("network down")),
expect: STANDS },
{ name: "unparseable body keeps the compiled route",
fetch: () => Promise.resolve({ ok: true, json: () => Promise.reject(new Error("not json")) }),
expect: STANDS },
{ name: "HTTP error keeps the compiled route",
fetch: () => Promise.resolve({ ok: false, status: 503, json: async () => ({}) }),
expect: STANDS },
/* The regression. A schema this build does not know is not an instruction. */
{ name: "unknown schema keeps the compiled route and does NOT report verified",
fetch: () => ok({ schema: "ventus.grid-engine.deeplink-receivers.v99", canonical: { route: "https://elsewhere/", carries_engine: true } }),
expect: STANDS },
/* A contract that contradicts itself is unusable, not an instruction either. */
{ name: "contract naming its own canonical route retired keeps the compiled route",
fetch: () => ok({ schema: SCHEMA, canonical: { route: COMPILED, carries_engine: true }, retired: [{ route: COMPILED }] }),
expect: STANDS },
/* The one case that may take the links away, and it must say so in `withdrawn`
rather than leaving a caller to infer it from an empty route. */
{ name: "a readable contract naming no canonical receiver withdraws the links",
fetch: () => ok({ schema: SCHEMA, canonical: null }),
expect: { route: "", verified: true, withdrawn: true } },
{ name: "a canonical receiver that does not carry the engine withdraws the links",
fetch: () => ok({ schema: SCHEMA, canonical: { route: "https://elsewhere/", carries_engine: false } }),
expect: { route: "", verified: true, withdrawn: true } },
{ name: "a readable contract naming a different receiver adopts it",
fetch: () => ok({ schema: SCHEMA, canonical: { route: "https://ventusltd.github.io/gridatlas-next/atlas/", carries_engine: true }, retired: [] }),
expect: { route: "https://ventusltd.github.io/gridatlas-next/atlas/", verified: true, withdrawn: false } },
];
let failed = 0;
for (const [i, testCase] of cases.entries()) {
const module_ = await import(`${MOD}?case=${i}`);
globalThis.fetch = testCase.fetch;
const result = await module_.verifyAtlasReceiverV9_7();
const got = { route: result.route, verified: result.verified, withdrawn: result.withdrawn };
const pass = JSON.stringify(got) === JSON.stringify(testCase.expect);
if (!pass) failed += 1;
console.log(`${pass ? "PASS" : "FAIL"} ${testCase.name}`);
if (!pass) {
console.log(` expected ${JSON.stringify(testCase.expect)}`);
console.log(` got ${JSON.stringify(got)}`);
console.log(` reason ${result.reason}`);
}
}
console.log(`\n${cases.length - failed} passed / ${failed} failed`);
process.exit(failed ? 1 : 0);