In this section
- Cockpit Skin render · globalgrid2050 / automation/repd_reporting/v2/cockpit-skin.css lines 1–52
- Cockpit Skin render · globalgrid2050 / automation/repd_reporting/v2/cockpit-skin.mjs lines 1–101
- Renewable Energy Planning Database (REPD) Reports Integrated energy-data · globalgrid2050 / automation/repd_reporting/v2/repd-reports-integrated.mjs lines 1–348
- Spider Audit ingest · globalgrid2050 / automation/repd_reporting/v2/spider-audit.mjs lines 1–95
Cockpit Skin
A style sheet in the REPD reporting folder of GlobalGrid2050 covering the Renewable Energy Planning Database (REPD) register, solar and battery storage (BESS).
renderglobalgrid2050 / automation/repd_reporting/v2/cockpit-skin.css · lines 1–52 of 52 · 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 'repd'): 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, battery storage (BESS).
- What it achieves
- REPD cockpit v2 SKIN CONTRACT — source-derived from V9.73, not a new theme.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · automation/repd_reporting/v2 · 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 automation/repd_reporting/v2/cockpit-skin.css:1-52 · blob 8629bc7a7a427d15c1d597633ba4246e0d447e0b · 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
/* REPD cockpit v2 SKIN CONTRACT — source-derived from V9.73, not a new theme.
Has no effect until a future immutable release mounts [data-repd-cockpit-v2]
and calls applyRepdCockpitSkin() from cockpit-skin.mjs.
Do not change .mw, th, .badge, gauges, ticker or existing reports. */
[data-repd-cockpit-v2] {
background:var(--pn-cockpit-panel);
color:var(--pn-cockpit-text);
border:1px solid var(--pn-cockpit-line);
font-family:"Courier New",monospace;
min-width:0;
}
[data-repd-cockpit-v2] :is(button,select,input) {
background:var(--pn-cockpit-bg);
color:var(--pn-cockpit-muted);
border:1px solid var(--pn-cockpit-line);
font:700 11px/1.3 "Courier New",monospace;
min-height:34px;
}
[data-repd-cockpit-v2] :is(button,select,input):focus-visible {
outline:2px solid var(--pn-cockpit-accent);
outline-offset:2px;
}
[data-repd-cockpit-v2] :is(button,select):hover,
[data-repd-cockpit-v2] button[aria-pressed="true"] {
color:var(--pn-cockpit-text);
border-color:var(--pn-cockpit-accent);
}
[data-repd-cockpit-v2] [data-repd-role="heading"] {
color:var(--pn-cockpit-accent);
}
[data-repd-cockpit-v2] [data-repd-role="mw"] {
color:var(--pn-cockpit-mw);
font-weight:700;
font-variant-numeric:tabular-nums;
}
[data-repd-cockpit-v2] [data-technology="solar"] { --pn-cockpit-technology-colour:var(--pn-cockpit-solar) }
[data-repd-cockpit-v2] [data-technology="bess"] { --pn-cockpit-technology-colour:var(--pn-cockpit-bess) }
[data-repd-cockpit-v2] [data-technology="wind_onshore"] { --pn-cockpit-technology-colour:var(--pn-cockpit-onshore) }
[data-repd-cockpit-v2] [data-technology="wind_offshore"],
[data-repd-cockpit-v2] [data-technology="interconnector"] { --pn-cockpit-technology-colour:var(--pn-cockpit-offshore) }
[data-repd-cockpit-v2] [data-repd-role="technology"] {
background:var(--pn-cockpit-technology-colour);
color:var(--pn-cockpit-bg);
font-weight:700;
}
[data-repd-cockpit-v2] [data-repd-role="row"] {
border-bottom:1px solid var(--pn-cockpit-soft);
}
[data-repd-cockpit-v2] [data-repd-role="muted"] { color:var(--pn-cockpit-muted) }
@media(max-width:680px) {
[data-repd-cockpit-v2] :is(button,select) { min-height:36px;max-width:100% }
}Cockpit Skin
A JavaScript module in the REPD reporting folder of GlobalGrid2050 that reads Renewable Energy Planning Database (REPD) skin and verifies REPD skin, covering the REPD register and solar.
renderglobalgrid2050 / automation/repd_reporting/v2/cockpit-skin.mjs · lines 1–101 of 101 · Entry point
- What it does
- Defines requireBrowser, readRepdSkin, verifyRepdSkin, applyRepdCockpitSkin. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'repd'): 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, battery storage (BESS).
- Downstream impact
- Used directly by 2 files: Cockpit Skin Test (globalgrid2050); GlobalGrid2050 Renewable Energy Planning Database (REPD) Cockpit V2 Workflow (globalgrid2050). Reached from 1 other entry point, including GlobalGrid2050 Pn V974 Cockpit Integration Workflow (globalgrid2050).
- What it achieves
- It reads REPD skin (`readRepdSkin`), verifies REPD skin (`verifyRepdSkin`) and applies REPD cockpit skin (`applyRepdCockpitSkin`). PipelineNews cockpit skin v1 — source-derived presentation contract.
- Why it matters
- Run by GlobalGrid2050 Renewable Energy Planning Database (REPD) Cockpit V2 Workflow. Checked by Cockpit Skin Test.
- Application
- globalgrid2050 · automation/repd_reporting/v2 · JavaScript module
- Uses
- none found
- Used by
- imported by Cockpit Skin Test (import), run by GlobalGrid2050 Renewable Energy Planning Database (REPD) Cockpit V2 Workflow (workflow run)
- Produces
- REPD_ROOT_TOKENS, REPD_V973_REFERENCE, REPD_TECH_BADGE_TOKENS, readRepdSkin, verifyRepdSkin, applyRepdCockpitSkin
- Defines here
- requireBrowser, readRepdSkin, verifyRepdSkin, applyRepdCockpitSkin
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 automation/repd_reporting/v2/cockpit-skin.mjs:1-101 · blob f2d4c1a70bdef7441c76234725bcf721813dab0c · 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: production_core
/**
* PipelineNews cockpit skin v1 — source-derived presentation contract.
*
* READS the live REPD V9.73 palette. Does not introduce an alternate theme,
* mutate table/gauge/headline styles, or change the application colour scheme.
* Pair with cockpit-skin.css in a future immutable release.
*
* Source of truth:
* uk_renewables_pipeline/202611222330/styles/v7.css (:root, .mw, th)
* uk_renewables_pipeline/202611222330/scripts/plugins/projects-v9-8.js (badges)
*/
export const REPD_ROOT_TOKENS = Object.freeze([
"--bg", "--panel", "--line", "--soft", "--text",
"--muted", "--accent", "--ok", "--solar", "--bess", "--off"
]);
// Expected published V9.73 palette, pinned for drift detection; never substituted
// for live values by the binding function.
export const REPD_V973_REFERENCE = Object.freeze({
"--bg": "#000",
"--panel": "#0b0e14",
"--line": "#2f343d",
"--soft": "#222",
"--text": "#fff",
"--muted": "#a6adbb",
"--accent": "#00ffff",
"--ok": "#00ff88",
"--solar": "#ffff00",
"--bess": "#ffae00",
"--off": "#0066ff"
});
export const REPD_TECH_BADGE_TOKENS = Object.freeze({
solar: "--solar",
bess: "--bess",
wind_onshore: "--accent",
wind_offshore: "--off",
interconnector: "--off"
});
function requireBrowser(documentRef, windowRef) {
if (!documentRef?.documentElement || typeof windowRef?.getComputedStyle !== "function") {
throw new Error("REPD skin requires a mounted browser document and getComputedStyle");
}
if (!documentRef.getElementById("repdPanel")) {
throw new Error("REPD skin source panel is missing; refusing to invent a palette");
}
}
export function readRepdSkin(documentRef, windowRef) {
requireBrowser(documentRef, windowRef);
const declarations = windowRef.getComputedStyle(documentRef.documentElement);
const tokens = {};
for (const name of REPD_ROOT_TOKENS) {
const value = declarations.getPropertyValue(name)?.trim();
if (!value) throw new Error("Missing official REPD skin token " + name);
tokens[name] = value;
}
return Object.freeze(tokens);
}
export function verifyRepdSkin(tokens, reference = REPD_V973_REFERENCE) {
const differences = [];
for (const name of REPD_ROOT_TOKENS) {
const actual = tokens?.[name]?.trim()?.toLowerCase();
if (!actual) {
differences.push({ name, expected: reference[name], actual: "(missing)" });
} else if (actual !== reference[name]) {
// A future owner-approved source palette revision requires explicit review.
differences.push({ name, expected: reference[name], actual });
}
}
return { matchesV973: differences.length === 0, differences };
}
/**
* Applies the EXISTING REPD theme only to a new cockpit host.
* All existing panels and globally defined CSS variables stay unchanged.
* Returns a receipt for CI to compare with the source palette.
*/
export function applyRepdCockpitSkin(host, { documentRef, windowRef } = {}) {
if (!host?.style?.setProperty) throw new Error("A cockpit host element is required");
const tokens = readRepdSkin(documentRef, windowRef);
const aliases = {
"--bg": "--pn-cockpit-bg",
"--panel": "--pn-cockpit-panel",
"--line": "--pn-cockpit-line",
"--soft": "--pn-cockpit-soft",
"--text": "--pn-cockpit-text",
"--muted": "--pn-cockpit-muted",
"--accent": "--pn-cockpit-accent",
"--ok": "--pn-cockpit-mw",
"--solar": "--pn-cockpit-solar",
"--bess": "--pn-cockpit-bess",
"--off": "--pn-cockpit-offshore"
};
for (const [source, target] of Object.entries(aliases)) {
host.style.setProperty(target, tokens[source]);
}
host.style.setProperty("--pn-cockpit-onshore", tokens["--accent"]);
const verdict = verifyRepdSkin(tokens);
// Do not silently conceal source drift. We deliberately USE the live
// palette, and integration QA must resolve any source/reference mismatch.
return Object.freeze({ source: "REPD-CURRENT-COMPUTED-STYLE", ...verdict, tokens });
}Renewable Energy Planning Database (REPD) Reports Integrated
A JavaScript module in the REPD reporting folder of GlobalGrid2050 that makes facet (`makeFacet`), refreshes choices (`refreshChoices`) and builds interconnector capacity report (`buildInterconnectorCapacityReport`) (units: MW).
energy-dataglobalgrid2050 / automation/repd_reporting/v2/repd-reports-integrated.mjs · lines 1–348 of 348 · Entry point · pattern buildInterconnectorCapacityReport (shared by 2 files)
- What it does
- It draws capacity, the REPD register, interconnectors and solar. Defines 27 functions or classes, including el, makeFacet, selections, nativeTechnology, nativeStatus. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage upstream_foresight (path word 'repd'): 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, interconnectors, solar.
- Inputs & outputs
- Out: CSV file -capacity.csv; downloaded file repd-.
- Downstream impact
- Used directly by 1 file: GlobalGrid2050 Pn V974 Cockpit Integration Workflow (globalgrid2050).
- What it achieves
- It makes facet (`makeFacet`), refreshes choices (`refreshChoices`) and builds interconnector capacity report (`buildInterconnectorCapacityReport`). PipelineNews V9.74 candidate: same REPD cockpit with source-faithful cross-filters; original visual styles untouched. It responds to change, click and toggle events.
- Why it matters
- Run by GlobalGrid2050 Pn V974 Cockpit Integration Workflow.
- Application
- globalgrid2050 · automation/repd_reporting/v2 · JavaScript module
- VEDIC
- EXPORT FILTERED PROJECTS (GG2050-VEDIC-000060): Pipeline News · Renewable project register. active_table_owner, filtered_register_rows, official_detail_partitions → csv_download_or_refusal
- Uses
- ./scripts/core/state.js, ./scripts/plugins/projects-v9-8.js, ./repd-reports-model.mjs, ../../automation/repd_reporting/v2/cockpit-facets.mjs, ./scripts/core/atlas-interconnector-link-v9-8.js
- Used by
- run by GlobalGrid2050 Pn V974 Cockpit Integration Workflow (workflow run), mentioned in Standalone (comment link)
- Produces
- el, makeFacet, selections, nativeTechnology, nativeStatus, chosenFilter, refreshChoices, unique, values, buildInterconnectorCapacityReport, empty, add
- Defines here
- el, makeFacet, selections, nativeTechnology, nativeStatus, chosenFilter, refreshChoices, unique, values, buildInterconnectorCapacityReport, empty, add, formatCapacity, formatCount, capacityDescription, projectTableLink, projectMapLink, statusDetails, projectRow, projectDetails, add, makeGroup, sourceRows, render, selectReport, downloadCsv, quote
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 automation/repd_reporting/v2/repd-reports-integrated.mjs:1-348 · blob df95452a0dec01a1cf345ccdf2539dd1e98e6201 · 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: production_core
// PipelineNews V9.74 candidate: same REPD cockpit with source-faithful cross-filters; original visual styles untouched.
import { state } from "./scripts/core/state.js";
import { atlasUrlV9_5_1 } from "./scripts/plugins/projects-v9-8.js";
import { buildRepdCapacityReport } from "./repd-reports-model.mjs";
import { buildCockpitReport, SOURCE_UNAVAILABLE } from "../../automation/repd_reporting/v2/cockpit-facets.mjs";
import { buildAtlasInterconnectorLinkV9_8 } from "./scripts/core/atlas-interconnector-link-v9-8.js";
const panel = document.getElementById("repdReportsPanel");
const reportButtons = [...document.querySelectorAll("[data-repd-report]")];
const reportScope = document.getElementById("repdReportScope");
const reportBody = document.getElementById("repdReportsBody");
const reportSummary = document.getElementById("repdReportsSummary");
const csvButton = document.getElementById("repdReportCsv");
const closeButton = document.getElementById("repdReportsClose");
const titles = { operator: "Capacity by operator", status: "Capacity by official REPD status", region: "Capacity by region" };
let active = "";
let lastReport = null;
let lastSnapshot = null;
let lastSelection = null;
function el(tag, className, value) {
const result = document.createElement(tag);
if (className) result.className = className;
if (value !== undefined) result.textContent = String(value);
return result;
}
// All facets live inside the existing REPD report tablet, never a second dashboard.
function makeFacet(key, title) {
const label = document.createElement("label");
label.className = "repd-cockpit-facet";
const span = document.createElement("span");
span.textContent = title;
const select = document.createElement("select");
select.id = "repdFacet" + key[0].toUpperCase() + key.slice(1);
select.setAttribute("aria-label", "Cockpit report " + title);
label.append(span, select);
if (csvButton?.parentElement) csvButton.parentElement.insertBefore(label, csvButton);
select.addEventListener("change", render);
return select;
}
const statusFacet = panel ? makeFacet("status", "STATUS") : null;
const operatorFacet = panel ? makeFacet("operator", "OPERATOR") : null;
const regionFacet = panel ? makeFacet("region", "REGION") : null;
if (reportScope?.options?.[0]) reportScope.options[0].textContent = "COCKPIT TECHNOLOGY + STATUS";
if (reportScope?.options?.[1]) reportScope.options[1].textContent = "CURRENT TABLE FILTERS + COCKPIT";
function selections(select, values, initialLabel, initialValue = "All") {
if (!select) return;
const previous = select.value || initialValue;
const options = [new Option(initialLabel, initialValue)];
for (const value of values) {
if (value === initialValue) continue;
options.push(new Option(value, value));
}
if (![...options].some(option => option.value === previous)) options.push(new Option(previous, previous));
select.replaceChildren(...options);
select.value = previous;
}
function nativeTechnology() {
const active = document.querySelector('#tech [data-technology][aria-pressed="true"]');
return active?.dataset.technology || new URL(window.location.href).searchParams.get("technology") || "all";
}
function nativeStatus() {
const active = document.querySelector('#status [data-official-status][aria-pressed="true"]');
return active?.dataset.officialStatus || "All";
}
function chosenFilter() {
return {
technology: nativeTechnology(),
status: statusFacet?.value === "FOLLOW" || !statusFacet?.value ? nativeStatus() : statusFacet.value,
operator: operatorFacet?.value || "All",
region: regionFacet?.value || "All",
};
}
function refreshChoices(report) {
const unique = (items) => [...new Set(items)].sort((a,b) => a.localeCompare(b,"en-GB"));
const statusValues = unique([...state.all, ...(Array.isArray(state.interconnectors) ? state.interconnectors : [])]
.map(row => String(row.status || "Not reported").trim() || "Not reported"));
const previous = statusFacet?.value || "FOLLOW";
selections(statusFacet, ["All", ...statusValues], "FOLLOW TABLE STATUS", "FOLLOW");
if (statusFacet) {
if (![...statusFacet.options].some(option => option.value === "All")) {
statusFacet.add(new Option("ALL OFFICIAL STATUSES", "All"));
}
const all = [...statusFacet.options].find(option => option.value === "All");
if (all) all.textContent = "ALL OFFICIAL STATUSES";
statusFacet.value = previous;
}
const values = (key) => report.facets?.[key]?.map(item => item.value) || [];
selections(operatorFacet, values("operator"), "ALL OPERATORS");
selections(regionFacet, values("region"), "ALL REGIONS");
}
function buildInterconnectorCapacityReport(projects, dimension) {
// Separate, explicitly labelled interconnector inventory; no REPD ID dedupe or mixing.
const empty = () => ({count:0, recordedCapacity:0, solarMwp:0, otherMw:0, missingCapacity:0});
const total = empty(), groups = new Map();
const seen = new Set();
const add = (target, project) => {
target.count++;
const capacity = project.capacity_mw;
if (typeof capacity !== "number" || !Number.isFinite(capacity) || capacity < 0) target.missingCapacity++;
else { target.recordedCapacity+=capacity;target.otherMw+=capacity; }
};
for (const project of projects) {
const ref = String(project.asset_id ?? project.gg_project_id ?? project.bmrs_code ?? "").trim();
if (!ref || seen.has(ref)) throw new Error("Missing/duplicate interconnector ID: " + ref);
seen.add(ref);
const name = String(project[dimension] || "Not reported").trim() || "Not reported";
let group = groups.get(name);
if (!group) { group = {name, ...empty(), projects:[], statuses:new Map()};groups.set(name,group); }
const status = String(project.status || "Not reported").trim() || "Not reported";
if (!group.statuses.has(status)) group.statuses.set(status,empty());
add(group.statuses.get(status),project);add(group,project);add(total,project);
group.projects.push(project);
}
return {dimension,total,groups:[...groups.values()].sort((a,b)=>b.recordedCapacity-a.recordedCapacity || b.count-a.count || a.name.localeCompare(b.name,"en-GB")), uniqueRefs:seen.size};
}
function formatCapacity(n) {
return Number(n || 0).toLocaleString("en-GB", { maximumFractionDigits: 2 });
}
function formatCount(n) {
return Number(n || 0).toLocaleString("en-GB");
}
function capacityDescription(summary) {
return formatCapacity(summary.recordedCapacity) + " recorded MW/MWp · " +
formatCapacity(summary.solarMwp) + " solar MWp · " +
formatCapacity(summary.otherMw) + " other MW";
}
function projectTableLink(project) {
const href = new URL(window.location.href);
href.hash = "";
href.search = "";
href.searchParams.set("q", String(project.repd_ref));
href.searchParams.set("technology", String(project.technology || "all"));
return href.href;
}
function projectMapLink(project) {
try {
if (project.technology === "interconnector") {
const link = buildAtlasInterconnectorLinkV9_8(project);
return link ? new URL(link, window.location.href).href : "";
}
const href = atlasUrlV9_5_1(project);
if (!href) return "";
const url = new URL(href);
if (url.origin !== "https://ventusltd.github.io" ||
url.pathname !== "/gridatlas/atlas/" ||
url.searchParams.get("repd_ref") !== String(project.repd_ref)) return "";
return url.href;
} catch {
return "";
}
}
function statusDetails(group, destination) {
const heading = el("h4", "repd-report-subtitle", "All source-reported statuses");
destination.append(heading);
const statuses = [...group.statuses].sort((a, b) =>
b[1].recordedCapacity - a[1].recordedCapacity || a[0].localeCompare(b[0], "en-GB"));
const list = el("div", "repd-report-statuses");
for (const [status, stats] of statuses) {
const item = el("div", "repd-report-status-item");
item.append(el("span", "", status));
item.append(el("span", "", formatCount(stats.count) + " projects"));
item.append(el("span", "", capacityDescription(stats)));
list.append(item);
}
destination.append(list);
}
function projectRow(project) {
const row = el("div", "repd-report-project");
const link = el("a", "", String(project.name || "Unnamed REPD project"));
link.href = projectTableLink(project);
link.title = "Open this REPD record in the existing PipelineNews table, with MAP and A4";
row.append(link);
row.append(el("span", "", project.technology === "interconnector" ? "INTERCONNECTOR " + (project.bmrs_code || project.gg_project_id || "") : "REPD " + project.repd_ref));
row.append(el("span", "", String(project.status || "Not reported")));
row.append(el("span", "", (typeof project.capacity_mw === "number" && Number.isFinite(project.capacity_mw) ? formatCapacity(project.capacity_mw) : "Not reported") +
(project.technology === "solar" ? " MWp" : " MW")));
const mapHref = projectMapLink(project);
if (mapHref) {
const map = el("a", "repd-report-map", "MAP");
map.href = mapHref;
map.target = "_blank";
map.rel = "noopener noreferrer";
map.title = "Open canonical GridAtlas with the selected REPD project";
row.append(map);
} else {
row.append(el("span", "repd-report-no-map", "NO MAP"));
}
return row;
}
function projectDetails(group, destination) {
destination.append(el("h4", "repd-report-subtitle", "Projects · full REPD membership"));
const projects = [...group.projects].sort((a, b) =>
(Number(b.capacity_mw) || 0) - (Number(a.capacity_mw) || 0));
const list = el("div", "repd-report-project-list");
destination.append(list);
let shown = 0;
const more = el("button", "repd-report-more", "");
more.type = "button";
const add = () => {
const fragment = document.createDocumentFragment();
for (const project of projects.slice(shown, shown + 100)) fragment.append(projectRow(project));
list.append(fragment);
shown = Math.min(projects.length, shown + 100);
more.textContent = "SHOW NEXT 100 · " + formatCount(shown) + " / " + formatCount(projects.length);
more.hidden = shown >= projects.length;
};
more.addEventListener("click", add);
add();
destination.append(more);
}
function makeGroup(group, maximum, index) {
const details = el("details", "repd-report-group");
const heading = el("summary", "repd-report-row");
heading.append(el("span", "repd-report-name", (active === "operator" ? "#" + String(index + 1) + " " : "") + group.name));
heading.append(el("span", "", formatCapacity(group.recordedCapacity)));
heading.append(el("span", "", formatCapacity(group.solarMwp)));
heading.append(el("span", "", formatCapacity(group.otherMw)));
heading.append(el("span", "", formatCount(group.count)));
const track = el("span", "repd-report-track");
const bar = el("span", "repd-report-bar");
bar.style.width = (maximum > 0 ? Math.max(0, group.recordedCapacity / maximum * 100) : 0) + "%";
track.append(bar);
heading.append(track);
details.append(heading);
const content = el("div", "repd-report-group-details");
details.append(content);
details.addEventListener("toggle", () => {
if (!details.open || content.dataset.loaded) return;
content.dataset.loaded = "true";
statusDetails(group, content);
projectDetails(group, content);
});
return details;
}
function sourceRows() {
if (!Array.isArray(state.all) || !state.all.length) return null;
const filters = chosenFilter();
const usesTable = reportScope.value === "filtered";
const inRepd = filters.technology !== "interconnector";
const selectedRows = usesTable && inRepd ? state.filtered : state.all;
if (!Array.isArray(selectedRows)) return null;
const interconnectors = usesTable && !inRepd ? state.filtered : state.interconnectors;
const snapshot = buildCockpitReport(selectedRows, {
dimension:active, filters, interconnectors
});
lastSnapshot = snapshot;
lastSelection = filters;
if (snapshot.availability === SOURCE_UNAVAILABLE) {
throw new Error(snapshot.message);
}
// Preserve all original status names, even if the REPD table has only four
// fast status buttons. The report's STATUS facet exposes the complete source.
refreshChoices(snapshot);
return snapshot.rows;
}
function render() {
if (!active || panel.hidden) return;
reportBody.replaceChildren();
try {
const rows = sourceRows();
if (!rows) {
lastReport = null;
reportSummary.textContent = "Loading the canonical REPD records…";
return;
}
const report = lastSnapshot?.source === "interconnector"
? buildInterconnectorCapacityReport(rows, active)
: buildRepdCapacityReport(rows, active);
lastReport = report;
const scope = lastSnapshot?.source === "interconnector"
? "Separate interconnector inventory · not REPD" : reportScope.value === "filtered"
? "Current REPD table filters + cockpit" : "Cockpit-filtered official REPD register";
const techLabel = lastSelection?.technology === "all" ? "ALL REPD TECHNOLOGIES" : String(lastSelection?.technology || "all").replaceAll("_"," ").toUpperCase();
const statusLabel = lastSelection?.status === "All" ? "ALL OFFICIAL STATUSES" : String(lastSelection?.status);
reportSummary.textContent = titles[active] + " · " + techLabel + " · " + statusLabel + " · " + scope +
" · SOURCE " + formatCount(lastSnapshot?.sourceProjects || 0) + " · SELECTED " + formatCount(lastSnapshot?.matchingProjects || 0) + " · " +
formatCount(report.total.count) + " projects · " +
formatCount(report.groups.length) + " groups · " +
capacityDescription(report.total) +
(report.total.missingCapacity ? " · " + report.total.missingCapacity + " without a reported capacity" : "");
const heading = el("div", "repd-report-row repd-report-columns");
for (const name of ["Group", "Recorded MW/MWp", "Solar MWp", "Other MW", "Projects"]) {
heading.append(el("span", "", name));
}
heading.append(el("span", "", ""));
reportBody.append(heading);
const maximum = report.groups.length ? report.groups[0].recordedCapacity : 0;
const fragment = document.createDocumentFragment();
for (const [index, group] of report.groups.entries()) fragment.append(makeGroup(group, maximum, index));
reportBody.append(fragment);
if (!report.groups.length) reportBody.append(el("p", "", "No projects match the chosen technology, status, operator and region."));
} catch (error) {
lastReport = null;
lastSnapshot = null;
reportSummary.textContent = "Report validation failed: " + String(error?.message || error);
}
}
function selectReport(dimension) {
if (active === dimension && !panel.hidden) {
panel.hidden = true;
active = "";
} else {
active = dimension;
panel.hidden = false;
}
for (const button of reportButtons) {
const pressed = button.dataset.repdReport === active;
button.setAttribute("aria-pressed", String(pressed));
button.setAttribute("aria-expanded", String(pressed));
}
if (active) render();
}
function downloadCsv() {
if (!lastReport) return;
const quote = value => { const text = String(value ?? ""); const safe = /^[=+@\-\t\r\n]/.test(text) ? "'" + text : text; return '"' + safe.replaceAll('"', '""') + '"'; };
const rows = [["dimension", "technology selection", "status selection", "operator filter", "region filter", "group", "projects", "recorded MW/MWp", "solar MWp", "other MW", "missing capacity"]];
for (const group of lastReport.groups) {
rows.push([active, lastSelection?.technology, lastSelection?.status, lastSelection?.operator, lastSelection?.region,
group.name, group.count, group.recordedCapacity, group.solarMwp, group.otherMw, group.missingCapacity]);
}
const blob = new Blob([rows.map(row => row.map(quote).join(",")).join("\r\n") + "\r\n"], { type: "text/csv;charset=utf-8" });
const url = URL.createObjectURL(blob);
const a = el("a");
a.href = url;
a.download = "repd-" + active + "-capacity.csv";
document.body.append(a);
a.click();
a.remove();
URL.revokeObjectURL(url);
}
if (panel && reportScope && reportSummary && reportBody) {
for (const button of reportButtons) button.addEventListener("click", () => selectReport(button.dataset.repdReport));
reportScope.addEventListener("change", render);
closeButton?.addEventListener("click", () => {
panel.hidden = true;
active = "";
for (const button of reportButtons) {
button.setAttribute("aria-pressed", "false");
button.setAttribute("aria-expanded", "false");
}
});
csvButton?.addEventListener("click", downloadCsv);
window.addEventListener("pipeline-category-changed", () => { if (active) render(); });
window.addEventListener("pipeline-projects-rendered", () => {
if (active) render();
});
}Spider Audit
A JavaScript module in the REPD reporting folder of GlobalGrid2050 that fetches spider inputs, the Renewable Energy Planning Database (REPD) register and interconnectors.
ingestglobalgrid2050 / automation/repd_reporting/v2/spider-audit.mjs · lines 1–95 of 95 · Entry point · pattern assert (shared by 7 files)
- What it does
- It fetches spider inputs, the REPD register and interconnectors. Defines gitBlob, assert, checkSource, fileText, hasAll. Uses libraries node:fs, node:crypto, node:path, node:url. Side effects: reads or writes files; makes network requests.
- Why it exists in the grid workflow
- Domain stage agent_infra (path word 'spider'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief). Domain terms in the code: the REPD register, interconnectors. README: "`spider-audit.mjs` verifies Git blob identities of every dependency, tests that the existing controls/data hooks are still present, and includes two negative mutation checks."
- Inputs & outputs
- In: JSON file SPIDER-INPUTS.json.
- Downstream impact
- Used directly by 2 files: GlobalGrid2050 Pn V974 Cockpit Integration Workflow (globalgrid2050); GlobalGrid2050 Renewable Energy Planning Database (REPD) Cockpit V2 Workflow (globalgrid2050).
- What it achieves
- It checks source (`checkSource`) and is built from the git blob helper (`gitBlob`) and the assert step (`assert`). Spider-style input closure / fail-closed audit for isolated REPD cockpit v2.
- Why it matters
- Run by GlobalGrid2050 Pn V974 Cockpit Integration Workflow and GlobalGrid2050 Renewable Energy Planning Database (REPD) Cockpit V2 Workflow.
- Application
- globalgrid2050 · automation/repd_reporting/v2 · JavaScript module
- Uses
- node:fs, node:crypto, node:path, node:url
- Used by
- run by GlobalGrid2050 Pn V974 Cockpit Integration Workflow (workflow run), run by GlobalGrid2050 Renewable Energy Planning Database (REPD) Cockpit V2 Workflow (workflow run)
- Produces
- gitBlob, assert, checkSource, fileText, hasAll
- Defines here
- gitBlob, assert, checkSource, fileText, hasAll
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 automation/repd_reporting/v2/spider-audit.mjs:1-95 · blob ae7de6635c74c5171791be11514ad876d7fad0bf · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: ingest · effects: filesystem, network · domain stage: agent_infra · users: IPP_developer, ai_agent · canonical: production_core
/**
* Spider-style input closure / fail-closed audit for isolated REPD cockpit v2.
* No network access, no external dependencies, no mutation of production.
* See Ventusltd/spiders/AGENTS.md + Ventusltd/testcode/README.md.
*/
import { readFileSync, existsSync } from "node:fs";
import { createHash } from "node:crypto";
import { join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
const here = fileURLToPath(new URL(".", import.meta.url));
const root = resolve(here, "../../..");
const inputs = JSON.parse(readFileSync(join(here, "SPIDER-INPUTS.json"), "utf8"));
const problems = [];
const facts = [];
function gitBlob(bytes) {
return createHash("sha1")
.update("blob " + bytes.length + "\0")
.update(bytes)
.digest("hex");
}
function assert(condition, message) {
if (!condition) problems.push(message);
}
function checkSource(source) {
const full = join(root, source.path);
if (!existsSync(full)) {
problems.push("MISSING REQUIRED INPUT " + source.path);
return;
}
const content = readFileSync(full);
const sha = gitBlob(content);
assert(sha === source.gitBlob,
"SOURCE DRIFT " + source.path + " (expected " + source.gitBlob + ", observed " + sha + ")");
facts.push({ path: source.path, gitBlob: sha, bytes: content.length });
}
for (const source of inputs.sources) checkSource(source);
for (const candidate of inputs.candidate) {
assert(existsSync(join(root, candidate.path)), "MISSING CANDIDATE " + candidate.path);
}
function fileText(path) {
const full = join(root, path);
return existsSync(full) ? readFileSync(full, "utf8") : "";
}
const index = fileText("uk_renewables_pipeline/202611222330/index.html");
const liveReports = fileText("uk_renewables_pipeline/202611222330/repd-reports.mjs");
const projectControls = fileText("uk_renewables_pipeline/202611222330/scripts/plugins/projects-v9-8.js");
const facets = fileText("automation/repd_reporting/v2/cockpit-facets.mjs");
function hasAll(text, markers) {
return markers.every(marker => text.includes(marker));
}
const indexes = [
'data-technology="all"', 'data-technology="solar"',
'data-technology="bess"', 'data-technology="wind_onshore"',
'data-technology="wind_offshore"', 'data-technology="interconnector"',
'data-repd-report="operator"', 'data-repd-report="status"',
'data-repd-report="region"', 'id="repdReportsPanel"',
'src="repd-reports.mjs"', 'src="report-a4.mjs"'
];
assert(hasAll(index, indexes), "MISSING NATIVE V9.73 TECHNOLOGY/REPORT/MAP-A4 DOM CONTRACT");
assert(hasAll(liveReports, ['import { state }', 'buildRepdCapacityReport',
'atlasUrlV9_5_1', 'state.filtered', 'state.all']), "MISSING NATIVE REPORT DATA/MAP CONTRACT");
assert(hasAll(projectControls, ['state.filtered = filtered', 'updateGaugesV9_2(filtered)',
'pipeline-projects-rendered', 'dataset.technology']), "MISSING NATIVE FILTER/GAUGE/RENDER HOOK");
assert(hasAll(facets, ['buildCockpitReport', 'cockpitSelection', 'sourceProjects',
'interconnector', 'SOURCE_UNAVAILABLE', 'verifyInventory']),
"MISSING ISOLATED CROSS-FILTER EXPORT OR SOURCE SEPARATION");
assert(!/\b(?:window|document|fetch|XMLHttpRequest)\s*(?:\.|\(|\[)/.test(facets),
"CANDIDATE PURE AGGREGATION HAS DOM OR NETWORK SIDE EFFECT");
assert(!index.includes("automation/repd_reporting/v2/cockpit-facets.mjs"),
"BASELINE HAS BEEN SILENTLY MOUNTED; INTEGRATION MUST BE A NEW IMMUTABLE EDITION");
assert(inputs.integrationStatus === "ISOLATED_ONLY" && inputs.proofStage === "OFFLINE",
"AUDIT CANNOT CLAIM PRODUCTION OR NETWORK ACCEPTANCE");
// Test that the proof can detect two manufactured failures, without writing files.
const damagedDOM = index.replace('data-repd-report="operator"', 'data-repd-report="missing"');
assert(!hasAll(damagedDOM, indexes), "MUTATION TEST FAILED: missing report action not detected");
const source = inputs.sources[0];
if (index) {
assert(gitBlob(Buffer.from(index + "\nSPIDER-MUTATION")) !== source.gitBlob,
"MUTATION TEST FAILED: changed source not detected");
}
const summary = {
schema: "ventus.pipeline.cockpit-spider-audit.v1",
success: problems.length === 0,
stage: "OFFLINE_ONLY",
status: "ISOLATED_NOT_PUBLISHED",
baseline: inputs.releaseBaseline,
inputsChecked: facts.length,
inputFacts: facts,
mutationGuards: 2,
problems,
caveat: "Source pin and code-shape checks, not real-data 7,775-row or browser acceptance."
};
console.log(JSON.stringify(summary, null, 2));
if (problems.length) process.exitCode = 1;