GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Electricity markets and data pipelines / globalgrid2050 / uk_renewables_pipeline/202611161747/scripts/plugins

Build and 5 more files

A Python command-line tool in the global datacentres folder of GlobalGrid2050 that reads global centre records, facts, pass1 and pipeline audit, using SHA-256.

632 lines of JavaScript and Python and Shell from globalgrid2050, in 6 files. Topic: Electricity markets and data pipelines. Section 942 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. Research Priority V927 interaction · globalgrid2050 / uk_renewables_pipeline/202611161747/scripts/plugins/research-priority-v927.js lines 1–62
  2. Research Priority V927 render · globalgrid2050 / uk_renewables_pipeline/202611161747/styles/research-priority-v927.css lines 1–13
  3. Check V9 27 test · globalgrid2050 / uk_renewables_pipeline/202611161747/tests/check_v9_27.mjs lines 1–112
  4. Run V9 27 test · globalgrid2050 / uk_renewables_pipeline/202611161747/tests/run_v9_27.sh lines 1–104
  5. Build storage · globalgrid2050 / uk_renewables_pipeline/202611161757/global-datacentres/build.py lines 1–228
  6. Register Changes energy-data · globalgrid2050 / uk_renewables_pipeline/202611161757/scripts/plugins/register-changes.js lines 1–113

Research Priority V927

A JavaScript module in the plugins folder of GlobalGrid2050 that renders record (`renderRecord`) and attaches rows (`attachRows`), covering the Renewable Energy Planning Database (REPD) register and solar.

interactionglobalgrid2050 / uk_renewables_pipeline/202611161747/scripts/plugins/research-priority-v927.js · lines 1–62 of 62 · version 2026-11-16 17:47 · Not reached from any entry point (candidate for review) · pattern renderRecord (shared by 2 files)

What it does
It draws the REPD register and solar. Defines boundedFile, renderRecord, attachRows, reloadPriority. 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. Domain terms in the code: the REPD register, solar.
Inputs & outputs
In: JSON file priority.json.
What it achieves
It renders record (`renderRecord`) and attaches rows (`attachRows`). Research ordering is separate from official facts, news verification and Solar-1000. It responds to pipeline, toggle and click events.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · uk_renewables_pipeline/202611161747/scripts/plugins · JavaScript module
Uses
Bundle (import)
Used by
none found
Produces
reloadPriority
Defines here
boundedFile, renderRecord, attachRows, reloadPriority
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/202611161747/scripts/plugins/research-priority-v927.js:1-62 · blob 93907031922d347af91aeaeb6c77c45a207096f2 · 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: unreached_review
// Research ordering is separate from official facts, news verification and Solar-1000.
import {parsePriorityBundle,attachProjectPriority} from './prospecting/bundle.mjs';
const PIN='4cb13bcdc332730f1c88804b1a1cadae76b75d1c9ada4dd4f6d1c7252f86de27';
const directory=new URL('../../prospecting/',import.meta.url);
const status=document.getElementById('researchPriorityStatus');
let bundle=null,state='loading',epoch=0;
window.projectResearchPriorityState=state;
async function boundedFile(name,limit){
  const controller=new AbortController(),timer=setTimeout(()=>controller.abort(),8000);
  try{
    const response=await fetch(new URL(name,directory),{signal:controller.signal});
    if(!response.ok||Number(response.headers.get('content-length'))>limit)throw Error('Priority file unavailable');
    const reader=response.body.getReader(),chunks=[];let size=0;
    for(;;){const {done,value}=await reader.read();if(done)break;size+=value.byteLength;if(size>limit){await reader.cancel();throw Error('Priority file exceeds limit');}chunks.push(value);}
    const result=new Uint8Array(size);let offset=0;for(const chunk of chunks){result.set(chunk,offset);offset+=chunk.byteLength;}return result;
  }finally{clearTimeout(timer);}
}
function renderRecord(details){
  const row=details.closest('#tbody > tr[id^="repd-"]');if(!row||state==='loading')return;
  if(details.dataset.priorityEpoch===String(epoch))return;
  const identity='REPD-'+row.id.slice(5);
  try{attachProjectPriority(details,identity,bundle);}catch{attachProjectPriority(details,identity,null);}
  details.dataset.priorityEpoch=String(epoch);
}
function attachRows(){
  for(const row of document.querySelectorAll('#tbody > tr[id^="repd-"]')){
    const details=row.querySelector('.project-record');if(!details)continue;
    const identity='REPD-'+row.id.slice(5),priority=bundle?.byId.get(identity);
    let button=row.querySelector('.v927-priority-hint');
    if(!priority){button?.remove();}else{
      if(!button){button=document.createElement('button');button.type='button';button.className='v927-priority-hint';button.dataset.priorityProject=identity;details.after(button);}
      button.textContent=`Research #${priority.rank} · ${priority.score} points`;
      button.setAttribute('aria-label',`Read research priority ${priority.rank} for ${priority.name||identity}`);
    }
    if(details.open)renderRecord(details);
  }
}
export async function reloadPriority(){
  const current=++epoch;bundle=null;state='loading';window.projectResearchPriorityState=state;
  document.querySelectorAll('.v927-priority-hint, [data-priority-id], [data-priority-state]').forEach(node=>node.remove());
  if(status)status.textContent='Research priority is loading; official records remain unchanged.';
  try{
    const [manifest,priority]=await Promise.all([boundedFile('manifest.json',1024*1024),boundedFile('priority.json',16*1024*1024)]);
    const parsed=await parsePriorityBundle(priority,manifest,PIN);
    if(current!==epoch)return;
    bundle=parsed;state='accepted';
    if(status)status.textContent=`Research priority: ${bundle.model.returned_count.toLocaleString('en-GB')} ranked from 7,775 official records. Ranking reference time ${bundle.model.as_of}; source dates are shown per project. Momentum and financing are not assessed. This subset does not replace Solar-1000.`;
  }catch{
    if(current!==epoch)return;
    bundle=null;state='rejected';
    if(status)status.textContent='Research priority unavailable: the source-bound bundle could not be validated. Official records, CSV and MAP remain available.';
  }
  window.projectResearchPriorityState=state;attachRows();
}
window.addEventListener('pipeline-projects-rendered',attachRows);
document.getElementById('tbody')?.addEventListener('toggle',event=>{if(event.target.matches('.project-record')&&event.target.open)renderRecord(event.target);},true);
document.getElementById('tbody')?.addEventListener('click',event=>{
  const button=event.target.closest('.v927-priority-hint');if(!button)return;
  const details=button.closest('tr').querySelector('.project-record');details.open=true;renderRecord(details);
  const priority=details.querySelector('[data-priority-id]');if(priority){priority.open=true;priority.scrollIntoView({block:'start'});}
});
reloadPriority();

Research Priority V927

A style sheet in the styles folder of GlobalGrid2050.

renderglobalgrid2050 / uk_renewables_pipeline/202611161747/styles/research-priority-v927.css · lines 1–13 of 13 · version 2026-11-16 17:47 · Not reached from any entry point (candidate for review)

What it does
Side effects: changes the web page (DOM).
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
Additive project-detail styling only; existing table, actions and CSV unchanged.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · uk_renewables_pipeline/202611161747/styles · style sheet
Uses
none found
Used by
none found
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 uk_renewables_pipeline/202611161747/styles/research-priority-v927.css:1-13 · blob 701c5929cd16a88a1e8a54adda2acaf98a03d8a4 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
/* Additive project-detail styling only; existing table, actions and CSV unchanged. */
.project-record>.research-priority{max-width:100%;margin-top:10px;border-top:1px solid #304550;white-space:normal}
.project-record>.research-priority>summary{padding:9px 0;min-height:40px;color:#86e1d1;white-space:normal;cursor:pointer}
.project-record .priority-content{padding:2px 0 12px;font-size:12px;line-height:1.55;overflow-wrap:anywhere}
.project-record .priority-content p{margin:8px 0;font-weight:400}
.project-record .priority-content ul{margin:8px 0;padding-left:18px}
.project-record .priority-content li{margin:6px 0}
.project-record .priority-content .priority-note{color:#d5b976}
.project-record .priority-content .priority-unknown{font-weight:600}
.project-record>[data-priority-state]{display:block;margin-top:8px;font-size:12px;line-height:1.5;color:#a9bdc9;white-space:normal;overflow-wrap:anywhere}
.v927-priority-hint{display:block;margin:7px 0 0;padding:5px 0;max-width:100%;border:0;background:transparent;color:#86e1d1;font:500 11px/1.5 Arial,sans-serif;text-align:left;cursor:pointer;white-space:normal}
.v927-priority-hint:hover{text-decoration:underline}.v927-priority-hint:focus-visible{outline:2px solid #86e1d1;outline-offset:2px}
.project-record>.research-priority{scroll-margin-top:80px}

Check V9 27

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.

testglobalgrid2050 / uk_renewables_pipeline/202611161747/tests/check_v9_27.mjs · lines 1–112 of 112 · version 2026-11-16 17:47

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 27 (globalgrid2050).
What it achieves
It is built from the text step (`text`), the JSON step (`json`) and the sha256 step (`sha256`). Pipeline News V9.27, 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 27.
Application
globalgrid2050 · uk_renewables_pipeline/202611161747/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 27 (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/202611161747/tests/check_v9_27.mjs:1-112 · blob 1a3d8989325763f62ccc92c403881ba1f7f2952d · 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_27.mjs - Pipeline News V9.27, 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_27.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.27";
const STATE = "RELEASE CANDIDATE";
const PARENT_ID = "202611161734";
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"));
assert.ok(html.includes(`UK RENEWABLES PIPELINE ${ID}`), "index.html h1 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");
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(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");
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");

console.log(`check_v9_27: ${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 27

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/202611161747/tests/run_v9_27.sh · lines 1–104 of 104 · version 2026-11-16 17:47 · 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/202611161747/tests · shell script
Uses
Check V9 27 (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/202611161747/tests/run_v9_27.sh:1-104 · blob 3fccb6f1144de417b1bd4b717cb2f37474f3ed67 · 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_27.sh - Pipeline News V9.27: 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="202611161734"
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="66616800b2a865e506508fb6e7d991ea435f94e9"

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
  index.html
  prospecting/README.md
  prospecting/manifest.json
  prospecting/priority.csv
  prospecting/priority.json
  scripts/plugins/prospecting/adapter.mjs
  scripts/plugins/prospecting/bundle.mjs
  scripts/plugins/prospecting/view.mjs
  scripts/plugins/research-priority-v927.js
  styles/research-priority-v927.css
  tests/check_v9_27.mjs
  tests/run_v9_27.sh
)
REMOVED_FROM_PARENT=(
  tests/check_v9_26.mjs
  tests/run_v9_26.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_27.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.27 ($ID) validation suite: PASS ($ROOT)"

Build

A Python command-line tool in the global datacentres folder of GlobalGrid2050 that reads global centre records, facts, pass1 and pipeline audit, using SHA-256.

storageglobalgrid2050 / uk_renewables_pipeline/202611161757/global-datacentres/build.py · lines 1–228 of 228 · version 2026-11-16 17:57 · Entry point · pattern flatten (shared by 8 files)

What it does
It loads global centre records, facts, pass1 and pipeline audit. Defines 8 functions or classes, including compact_json, values, revision_url, selection_audit, project. Uses libraries __future__, hashlib, json, pathlib, shutil. Side effects: reads or writes files; uses storage (browser storage, DuckDB or Parquet).
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'datacentres'): 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. README: "`build.py` is a deterministic offline furnace."
Inputs & outputs
In: Parquet file global-data-centre-records-v1.parquet; JSON file source-facts.json; Parquet file pass1.parquet; DuckDB queries. Out: JSON file pipeline-audit.json; JSON file selection-audit.json; JSON file projects.json; Parquet file.
Downstream impact
It is itself an entry point (Python CLI); no other file was found loading it.
What it achieves
It is built from the compact JSON helper (`compact_json`), the values step (`values`) and the revision URL helper (`revision_url`). Rebuild the bounded global sample offline from pinned CC0 structured facts.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · uk_renewables_pipeline/202611161757/global-datacentres · Python CLI
Uses
__future__, hashlib, json, pathlib, shutil, tempfile, math, re
Used by
none found
Produces
compact_json, values, revision_url, selection_audit, project, flatten, expand, build
Defines here
compact_json, values, revision_url, selection_audit, project, flatten, expand, build
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/202611161757/global-datacentres/build.py:1-228 · blob 57d43a3e64435d95b322f3d2f9356e22ba306449 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem, storage · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
"""Rebuild the bounded global sample offline from pinned CC0 structured facts.

This is not a collector and makes no network requests. Updates require reviewed
entity revisions in source-facts.json and a new release; historical data stays.
"""
from __future__ import annotations

import hashlib
import json
from pathlib import Path
import shutil
import tempfile
import math
import re

HERE = Path(__file__).resolve().parent
SCHEMA = "globalgrid2050.global-datacentres.projects.v1"
DUCKDB_VERSION = "1.3.2"
BASELINE_IDS = frozenset({"Q12857142", "Q520438", "Q1277574", "Q11236058", "Q19721053", "Q142068471",
                          "Q142068695", "Q142068699", "Q138426651", "Q140089116", "Q139609394", "Q24259253"})
PARQUET = f"data/facilities/generation={HERE.parent.name}/source=WIKIDATA/global-data-centre-records-v1.parquet"
COLUMNS = [
    ("source_record_id", "VARCHAR"), ("name", "VARCHAR"), ("country_id", "VARCHAR"),
    ("country_name", "VARCHAR"), ("country_code", "VARCHAR"), ("operator_name", "VARCHAR"),
    ("latitude", "DOUBLE"), ("longitude", "DOUBLE"), ("precision_degrees", "DOUBLE"),
    ("it_load_mw", "DOUBLE"), ("site_demand_mw", "DOUBLE"), ("grid_connection_mw", "DOUBLE"),
    ("retrieved_at", "VARCHAR"), ("entity_revision", "BIGINT"), ("entity_url", "VARCHAR"),
    ("revision_url", "VARCHAR"), ("country_revision_url", "VARCHAR"), ("operator_revision_url", "VARCHAR"),
    ("source_licence", "VARCHAR"), ("licence_url", "VARCHAR"), ("source_facts_sha256", "VARCHAR"),
]


def compact_json(value):
    """Deterministic served bytes without redundant indentation."""
    return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":"), allow_nan=False) + "\n"


def values(entity, prop):
    claims = [c for c in entity["claims"].get(prop, []) if c["rank"] != "deprecated"]
    preferred = [c for c in claims if c["rank"] == "preferred"]
    return [c["value"] for c in preferred or claims]


def revision_url(entity):
    return f"https://www.wikidata.org/w/index.php?title={entity['id']}&oldid={entity['revision']}"


def selection_audit(facts):
    """Conservative lead screening; source descriptions are not verification."""
    candidates = facts["candidate_ids"]
    if len(candidates) > 200 or len(candidates) != len(set(candidates)):
        raise ValueError("Candidate query exceeds bound or duplicates IDs; quarantine required")
    if set(facts["baseline_ids"]) != BASELINE_IDS or not BASELINE_IDS <= set(candidates):
        raise ValueError("Original twelve identities changed; quarantine required")
    selected, rejected = [], []
    for entity_id in candidates:
        entity = facts["entities"][entity_id]
        description = entity.get("description", "")
        reason = None
        if entity_id not in BASELINE_IDS:
            if re.search(r"company|organizational unit|former|library automation|seven subject-based|supercomputer in the", description, re.I):
                reason = "Ambiguous company, organisation, aggregate, former or computing-service identity"
            elif not re.search(r"\bdata[ -]?cent(?:er|re)\b", description, re.I):
                reason = "Insufficient English site/campus description for prospecting"
        if reason:
            rejected.append({"id": "DC-WD-" + entity_id, "name": entity["label"],
                             "source_revision_url": revision_url(entity), "reason": reason})
        else:
            selected.append(entity_id)
    if selected != facts["selected_ids"]:
        raise ValueError("Pinned selection differs from conservative screening; quarantine required")
    return {"schema": "globalgrid2050.global-datacentres.selection-audit.v1", "rule": "bounded-site-description-v1",
            "candidate_count": len(candidates), "selected_count": len(selected), "quarantined_count": len(rejected),
            "baseline_preserved": True, "independently_verified": False,
            "query": facts["coverage_query"], "quarantined": rejected}


def project(path=HERE / "source-facts.json"):
    raw = path.read_bytes()
    facts = json.loads(raw)
    if facts["licence"] != "CC0-1.0":
        raise ValueError("Source rights not accepted; quarantine required")
    selection = selection_audit(facts)
    entities = facts["entities"]
    records = []
    for entity_id in facts["selected_ids"]:
        entity = entities[entity_id]
        if not {v["id"] for v in values(entity, "P31")} >= {"Q671224"}:
            raise ValueError("Source not classified as a data centre; quarantine required")
        countries = values(entity, "P17")
        if len(countries) != 1:
            raise ValueError("Ambiguous country; quarantine required")
        country = entities[countries[0]["id"]]
        codes = values(country, "P297")
        code = codes[0] if len(codes) == 1 and len(codes[0]) == 2 else None
        coordinates = values(entity, "P625")
        # Ambiguous or non-Earth coordinates are not mapped.
        point = coordinates[0] if len(coordinates) == 1 and coordinates[0]["globe"].endswith("/Q2") else None
        if point and (not all(isinstance(point[k], (float, int)) and math.isfinite(point[k]) for k in ("latitude", "longitude", "precision"))
                      or not (-90 <= point["latitude"] <= 90 and -180 <= point["longitude"] <= 180 and point["precision"] > 0)):
            raise ValueError("Invalid coordinate; quarantine required")
        operators = values(entity, "P137")
        operator = entities[operators[0]["id"]] if len(operators) == 1 else None
        records.append({
            "id": "DC-WD-" + entity_id, "name": entity["label"], "record_type": "data_centre",
            "country": {"code": code, "name": country["label"], "wikidata_id": country["id"]},
            "operator": operator["label"] if operator else None,
            "operating_status": "not_assessed", "verification_status": "SOURCE_INDEXED",
            "location": None if point is None else {
                "latitude": point["latitude"], "longitude": point["longitude"],
                "precision_degrees": point["precision"], "basis": "Wikidata P625 source point; not surveyed accuracy",
            },
            "capacity": {"it_load_mw": None, "site_demand_mw": None, "grid_connection_mw": None},
            "capacity_sources": {"it_load_mw": None, "site_demand_mw": None, "grid_connection_mw": None},
            "source": {"publisher": "Wikidata", "url": "https://www.wikidata.org/wiki/" + entity_id,
                       "revision_url": revision_url(entity), "revision": entity["revision"],
                       "retrieved_at": facts["retrieved_at"], "licence": "CC0-1.0",
                       "licence_url": facts["licence_url"]},
            "field_sources": {
                "name": revision_url(entity), "country": revision_url(country),
                "location": revision_url(entity) + "#P625" if point else None,
                "operator": revision_url(operator) if operator else None,
            },
        })
    if len(records) != len({r["id"] for r in records}):
        raise ValueError("Duplicate source identity; quarantine required")
    for record in records:
        if record["id"].removeprefix("DC-WD-") in BASELINE_IDS:
            semantic = {k: record[k] for k in ("id", "name", "country", "operator", "location", "capacity")}
            digest = hashlib.sha256(json.dumps(semantic, sort_keys=True, ensure_ascii=False, separators=(",", ":")).encode()).hexdigest()
            if facts["baseline_semantic_sha256"].get(record["id"]) != digest:
                raise ValueError("Original twelve semantic fields changed; quarantine required")
    records.sort(key=lambda p: (p["country"]["name"], p["name"]))
    return {"schema": SCHEMA, "generated_from_retrieval": facts["retrieved_at"],
            "coverage": "Bounded Wikidata prospecting sample; not a comprehensive worldwide register or verified-facility census. Ambiguous source identities are quarantined; countries and facilities without selected records are not implied absent.",
            "scope": "global", "record_count": len(records),
            "country_count": len({p["country"]["wikidata_id"] for p in records}),
            "candidate_count": selection["candidate_count"], "quarantined_count": selection["quarantined_count"],
            "source_facts_sha256": hashlib.sha256(raw).hexdigest(), "records": records}


def flatten(record, digest):
    p, s, f = record, record["source"], record["field_sources"]
    location = p["location"] or {}
    return (p["id"], p["name"], p["country"]["wikidata_id"], p["country"]["name"], p["country"]["code"], p["operator"],
            location.get("latitude"), location.get("longitude"), location.get("precision_degrees"),
            p["capacity"]["it_load_mw"], p["capacity"]["site_demand_mw"], p["capacity"]["grid_connection_mw"],
            s["retrieved_at"], s["revision"], s["url"], s["revision_url"], f["country"], f["operator"],
            s["licence"], s["licence_url"], digest)


def expand(row):
    r = dict(zip((name for name, _ in COLUMNS), row))
    return {
        "id": r["source_record_id"], "name": r["name"], "record_type": "data_centre",
        "country": {"code": r["country_code"], "name": r["country_name"], "wikidata_id": r["country_id"]},
        "operator": r["operator_name"], "operating_status": "not_assessed", "verification_status": "SOURCE_INDEXED",
        "location": None if r["latitude"] is None else {"latitude": r["latitude"], "longitude": r["longitude"],
                     "precision_degrees": r["precision_degrees"], "basis": "Wikidata P625 source point; not surveyed accuracy"},
        "capacity": {key: r[key] for key in ("it_load_mw", "site_demand_mw", "grid_connection_mw")},
        "capacity_sources": {"it_load_mw": None, "site_demand_mw": None, "grid_connection_mw": None},
        "source": {"publisher": "Wikidata", "url": r["entity_url"], "revision_url": r["revision_url"],
                   "revision": r["entity_revision"], "retrieved_at": r["retrieved_at"], "licence": r["source_licence"],
                   "licence_url": r["licence_url"]},
        "field_sources": {"name": r["revision_url"], "country": r["country_revision_url"],
                          "location": r["revision_url"] + "#P625" if r["latitude"] is not None else None,
                          "operator": r["operator_revision_url"]},
    }


def build(path=HERE / "source-facts.json", output_dir=None):
    """Furnace: validate -> typed Parquet -> exact readback -> browser export.

    Invalid source rows fail the entire build before any output is promoted.
    Unknown measurements remain null and are not erroneous/quarantined rows.
    """
    import duckdb
    if duckdb.__version__ != DUCKDB_VERSION:
        raise ValueError(f"DuckDB version drift: require {DUCKDB_VERSION}")
    candidate = project(path)
    rows = sorted(flatten(r, candidate["source_facts_sha256"]) for r in candidate["records"])
    with tempfile.TemporaryDirectory(prefix="global-dc-furnace-") as temporary:
        folder = Path(temporary)
        hashes = []
        for pass_number in (1, 2):
            parquet = folder / f"pass{pass_number}.parquet"
            with duckdb.connect(":memory:") as db:
                db.execute("SET threads=1")
                db.execute("CREATE TABLE records (" + ",".join(name + " " + kind for name, kind in COLUMNS) + ")")
                db.executemany("INSERT INTO records VALUES (" + ",".join("?" for _ in COLUMNS) + ")", rows)
                escaped = parquet.as_posix().replace("'", "''")
                db.execute(f"COPY (SELECT * FROM records ORDER BY source_record_id) TO '{escaped}' (FORMAT PARQUET, COMPRESSION ZSTD, ROW_GROUP_SIZE 2048)")
                readback = db.execute("SELECT * FROM read_parquet(?, hive_partitioning=false) ORDER BY source_record_id", [str(parquet)]).fetchall()
                if readback != rows:
                    raise ValueError("Parquet value/null readback failed; quarantine required")
                schema = db.execute("DESCRIBE SELECT * FROM read_parquet(?, hive_partitioning=false)", [str(parquet)]).fetchall()
                if [(r[0], r[1]) for r in schema] != COLUMNS:
                    raise ValueError("Parquet schema mismatch; quarantine required")
                codecs = db.execute("SELECT DISTINCT compression FROM parquet_metadata(?)", [str(parquet)]).fetchall()
                if codecs != [("ZSTD",)]:
                    raise ValueError("Parquet compression mismatch")
            hashes.append(hashlib.sha256(parquet.read_bytes()).hexdigest())
        if len(set(hashes)) != 1:
            raise ValueError("Deterministic double compile failed; quarantine required")
        candidate["records"] = sorted((expand(row) for row in readback), key=lambda p: (p["country"]["name"], p["name"]))
        selection = selection_audit(json.loads(path.read_bytes()))
        audit = {"schema": "globalgrid2050.global-datacentres.furnace-audit.v1", "source_facts_sha256": candidate["source_facts_sha256"],
                 "duckdb_version": DUCKDB_VERSION, "source_grain": "one Wikidata entity; not adjudicated facility identity",
                 "row_count": len(rows), "distinct_source_ids": len({r[0] for r in rows}), "quarantined_rows": selection["quarantined_count"],
                 "candidate_rows": selection["candidate_count"],
                 "source_rights": "CC0-1.0 structured data", "parquet": PARQUET, "parquet_sha256": hashes[0],
                 "compression": "ZSTD", "double_compile": "BYTE_IDENTICAL", "readback": "EXACT_VALUES_AND_NULLS",
                 "browser_export_source": "DUCKDB_PARQUET_READBACK", "verified_rows": 0,
                 "stages": ["pinned_cc0_facts", "validate_or_quarantine", "typed_normalization", "parquet_double_compile", "duckdb_readback", "browser_projection"]}
        if output_dir is not None:
            out = Path(output_dir)
            target = out / PARQUET
            target.parent.mkdir(parents=True, exist_ok=True)
            shutil.copyfile(folder / "pass1.parquet", target)
            (out / "pipeline-audit.json").write_text(compact_json(audit), encoding="utf-8", newline="\n")
            (out / "selection-audit.json").write_text(compact_json(selection), encoding="utf-8", newline="\n")
        return candidate


if __name__ == "__main__":
    result = build(output_dir=HERE)
    (HERE / "projects.json").write_text(compact_json(result), encoding="utf-8", newline="\n")
    print(f"Global source-indexed sample: {result['record_count']} leads, {result['country_count']} countries")

Register Changes

A JavaScript file in the plugins folder of GlobalGrid2050 that shows table (`showInTable`), covering the Renewable Energy Planning Database (REPD) register.

energy-dataglobalgrid2050 / uk_renewables_pipeline/202611161757/scripts/plugins/register-changes.js · lines 1–113 of 113 · version 2026-11-16 17:57 · Entry point · pattern style (shared by 2 files)

What it does
It draws the REPD register. Defines 8 functions or classes, including el, day, kind, showInTable, style. 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. Domain terms in the code: the REPD register.
Inputs & outputs
In: JSON file register_changes.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 shows table (`showInTable`) and is built from the day step (`day`) and the kind step (`kind`). What moved in the REPD between the July and October 2026 releases. It reads `events/register_changes.json`. It responds to click and DOMContentLoaded events.
Why it matters
Loaded by the UK Renewables Pipeline page at https://globalgrid2050.com/uk_renewables_pipeline/202611280922/.
Application
globalgrid2050 · uk_renewables_pipeline/202611161757/scripts/plugins · script
Uses
none found
Used by
loaded by GlobalGrid2050 — UK Renewables Pipeline Page (script src)
Produces
el, day, kind, showInTable, style, section, annotate, start
Defines here
el, day, kind, showInTable, style, section, annotate, 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/202611161757/scripts/plugins/register-changes.js:1-113 · blob 08c8266126cd6ac68a6a0e03daa74923ce8b938b · 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
/* Register changes: what moved in the REPD between the July and October 2026 releases.
 *
 * Reads events/register_changes.json (the register-change events whose REPD Ref ID is in
 * this page's list). Adds (1) one section below the newspaper listing the highest-scored
 * changes, each with a button that searches the table for that REPD Ref ID, and (2) one
 * entry in the PROJECT RECORD of each row that has a change.
 *
 * These are register events, not news stories: every line is generated from REPD fields.
 * The row's MAP link is not read, moved or changed. If the file cannot be read, nothing
 * is added.
 */
(function () {
  'use strict';
  var SHOWN = 12;
  var byRef = null;

  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) {
    var d = iso ? new Date(iso + 'T00:00:00Z') : null;
    return d && !isNaN(d) ? d.toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric', timeZone: 'UTC' }).toUpperCase() : 'DATE NOT GIVEN';
  }
  function kind(t) { return String(t || '').replace(/_/g, ' '); }

  function showInTable(ref) {
    var input = document.getElementById('search');
    if (!input) return;
    input.value = ref;
    input.dispatchEvent(new Event('input', { bubbles: true }));
    var table = document.querySelector('.tablewrap');
    if (table && table.scrollIntoView) table.scrollIntoView({ block: 'start' });
  }

  function style() {
    var s = el('style');
    s.textContent = '.reg-changes .rc-list{display:grid;grid-template-columns:1fr 1fr}' +
      '.rc-item{padding:12px 14px;border-bottom:1px solid #1b1f25;border-right:1px solid #1b1f25;background:#07090c;min-width:0}' +
      '.rc-kicker{display:block;color:#7f8996;font-size:10px;font-weight:bold}' +
      '.rc-title{display:block;color:#fff;font-size:13px;line-height:1.3;margin:5px 0 6px}' +
      '.rc-item button{font:inherit;font-size:10px;font-weight:bold;background:none;border:1px solid #39424e;color:var(--accent,#0ff);padding:4px 8px;cursor:pointer}' +
      '.rc-more{padding:12px 14px;color:var(--muted,#a6adbb);font-size:11px}' +
      '@media(max-width:768px){.reg-changes .rc-list{grid-template-columns:1fr}.rc-item{border-right:0}}';
    document.head.appendChild(s);
  }

  function section(doc) {
    // V9.28 withdraws the standalone panel and keeps original register events
    // inside their existing project records, with no change to MAP/CSV.
    if (document.querySelector('[data-register-changes="inline-only"]')) return;
    var anchor = document.getElementById('dcNews') || document.querySelector('section.newspaper');
    if (!anchor || document.getElementById('regChanges')) return;
    style();
    var sec = el('section', 'newspaper reg-changes');
    sec.id = 'regChanges';
    sec.setAttribute('data-feature', 'project-events');
    sec.setAttribute('aria-label', 'Register changes');
    var head = el('div', 'masthead');
    var h2 = el('h2', null, 'REGISTER CHANGES: ');
    h2.appendChild(el('span', null, 'JULY TO OCTOBER 2026 REPD'));
    head.appendChild(h2);
    var strap = el('div', 'strap');
    strap.appendChild(el('span', null, 'Changes found by comparing two official REPD releases · register events, not news stories · a status change is dated by the register and can lag the decision'));
    strap.appendChild(el('span', null, doc.events_in_this_version + ' CHANGES ON ' + doc.projects_with_an_event + ' PROJECTS IN THIS LIST · HIGHEST SCORED FIRST'));
    head.appendChild(strap);
    sec.appendChild(head);
    var list = el('div', 'rc-list');
    doc.events.slice(0, SHOWN).forEach(function (e) {
      var item = el('div', 'rc-item');
      item.appendChild(el('span', 'rc-kicker', kind(e.type) + ' · ' + day(e.date) + ' · REPD ' + e.ref));
      item.appendChild(el('span', 'rc-title', e.headline));
      var b = el('button', null, 'SHOW IN TABLE');
      b.type = 'button';
      b.addEventListener('click', function () { showInTable(e.ref); });
      item.appendChild(b);
      list.appendChild(item);
    });
    sec.appendChild(list);
    sec.appendChild(el('div', 'rc-more', 'Every project with a change carries it in its PROJECT RECORD in the table below.'));
    anchor.parentNode.insertBefore(sec, anchor.nextSibling);
  }

  function annotate() {
    if (!byRef) return;
    var rows = document.querySelectorAll('#tbody tr[id^="repd-"]:not([data-technology="interconnector"])');
    Array.prototype.forEach.call(rows, function (tr) {
      var events = byRef[tr.id.slice(5)];
      var grid = tr.querySelector('details.project-record .record-grid');
      if (!events || !grid || grid.querySelector('[data-feature="register-change"]')) return;
      var box = el('div');
      box.setAttribute('data-feature', 'register-change');
      box.appendChild(el('b', null, 'REGISTER CHANGE · JULY TO OCTOBER 2026'));
      box.appendChild(el('span', null, events.map(function (e) { return kind(e.type) + ' (' + day(e.date) + '): ' + e.headline; }).join(' · ')));
      grid.appendChild(box);
    });
  }

  function start() {
    if (typeof fetch !== 'function') return;
    fetch('events/register_changes.json', { cache: 'no-cache' }).then(function (r) { if (!r.ok) throw new Error(r.status); return r.json(); }).then(function (doc) {
      if (doc.schema !== 'globalgrid2050.pipeline-news.register-changes.v1' || !Array.isArray(doc.events) || !doc.events.length) return;
      var map = {};
      doc.events.forEach(function (e) { (map[e.ref] = map[e.ref] || []).push(e); });
      byRef = map;
      // The data-centre panel, when present, is inserted asynchronously; wait briefly so this section sits below it.
      setTimeout(function () { section(doc); }, 1500);
      annotate();
      var body = document.getElementById('tbody');
      if (body && typeof MutationObserver === 'function') new MutationObserver(annotate).observe(body, { childList: true, subtree: true });
    }, function () { /* file unreadable: add nothing */ });
  }

  if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start);
  else start();
})();