In this section
- V9 6 1 render · globalgrid2050 / testcode/202609051152/pipeline/styles/v9-6-1.css lines 1–84
- Projects V9 5 1 energy-data · globalgrid2050 / testcode/202609051344/pipeline/scripts/plugins/projects-v9-5-1.js lines 1–411
- Teleprinter Bootstrap render · globalgrid2050 / testcode/202609052023/pipeline/teleprinter-bootstrap.js lines 1–11
- Provisional Identity transform · globalgrid2050 / testcode/202609060213/pipeline/assets/202609060213-provisional-identity.mjs lines 1–48
- Provisional Projects render · globalgrid2050 / testcode/202609060213/pipeline/assets/202609060213-provisional-projects.mjs lines 1–16
- BBC RSS Pipeline Model energy-data · globalgrid2050 / testcode/202609060232/pipeline/assets/202609060232-bbc-rss-pipeline-model.mjs lines 1–73
- BBC RSS Pipeline energy-data · globalgrid2050 / testcode/202609060232/pipeline/assets/202609060232-bbc-rss-pipeline.mjs lines 1–56
V9 6 1
A style sheet in the styles folder of GlobalGrid2050 covering the Renewable Energy Planning Database (REPD) register.
renderglobalgrid2050 / testcode/202609051152/pipeline/styles/v9-6-1.css · lines 1–84 of 84 · version 2026-09-05 11:52 · Entry point
- What it does
- Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: the REPD register.
- Downstream impact
- Used directly by 1 file: Sandbox — Pipeline Page (testcode).
- What it achieves
- V9.6.1 changes the mobile projects viewport only.
- Why it matters
- Loaded by the Pipeline page in Testcode.
- Application
- globalgrid2050 · testcode/202609051152/pipeline/styles · style sheet
- Uses
- none found
- Used by
- loaded by Sandbox — Pipeline Page (stylesheet)
- 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 testcode/202609051152/pipeline/styles/v9-6-1.css:1-84 · blob ec636cc2a186932d61983a183948ae979f605c73 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: production_core
/* V9.6.1 changes the mobile projects viewport only. The inherited V9.5.1
table width, rows, columns, typography and all non-mobile layout remain.
WHAT WAS REMOVED HERE, AND WHY.
V9.6.1 added `.tablewrap .hide-mobile { display: table-cell; }` inside this
query, to put all eleven columns on the phone behind a horizontal swipe. It
out-specifies the `.hide-mobile{display:none}` that v7.css has applied below
769 px since V7, so the five columns v7 hides came back. Combined with the
unconditional 1280 px table minimum in v9-3.css it drew the ACTIONS column —
the MAP button — 763 px past the right edge of a 393 px viewport, with
document.elementFromPoint() at the anchor's centre returning null. Measured
2026-09-05; reported by the architect on a real iPhone as "the map button
doesn't work just tested on mobile". This is not a regression from the
deep-link work of the same night: v9.6.2 serves the identical rule, so the
button has been unreachable on a phone since V9.6.1 shipped.
The swipe it was reaching for was never an affordance a reader could find,
and the five columns' facts are not lost by hiding them: the row already
prints REPD ref, GlobalGrid ref and updated date in .project-meta, and
county and operator in .mobile-extra, both of which v9-3.css shows only
below 769 px precisely so this trade is even.
overflow-x: auto stays. Nothing should need it now — the table is asserted
to fit its wrapper at 393 px by tests/browser_map_reachability_v9_7.mjs —
but a long site name must be able to scroll rather than be clipped away. */
@media (max-width: 768px) {
.tablewrap {
-webkit-overflow-scrolling: touch;
overflow-x: auto;
}
/* THE ACTIONS COLUMN IS PINNED TO THE RIGHT EDGE.
Hiding five columns and lifting the 1280 px minimum brings the table from
1280 px to 588 px, which still does not fit a 371 px wrapper: measured at
393 x 852, SITE NAME 131, TECHNOLOGY 114, STATUS 96, CAPACITY 60, NEWS
SIGNAL 107, ACTIONS 80. Five columns of real REPD content do not fit a
phone, and shrinking type until they do makes the page unreadable to make
one button reachable.
So the button stops depending on the fit. The last column is stuck to the
right edge of the scrolling wrapper, which makes MAP visible and hit-
testable at every horizontal scroll position and for every row, whatever
a site name's length does to the columns beside it. That is a stronger
guarantee than "it happens to fit today": a longer name in a later REPD
release cannot push it off again.
The two rules below then narrow the widest cells so the pinned column
covers as little as possible — the badge wraps instead of forcing its
whole label onto one line, and the signal note gets the width it needs
rather than the 100 px it inherited from a desktop layout. */
.tablewrap th:last-child,
.tablewrap td:last-child {
background: var(--panel);
border-left: 1px solid var(--soft);
position: sticky;
right: 0;
}
.tablewrap th:last-child {
background: #050505;
z-index: 6;
}
.tablewrap .badge {
white-space: normal;
}
.tablewrap .signal-note {
max-width: 76px;
}
}
/* The MAP cell's own sentence. A title attribute cannot be reached on a phone,
which reports hover: none, so the reason a record has no map point -- or no
receiver -- is printed in the cell instead of hidden behind a hover. */
.project-actions .map-note {
flex: 1 0 100%;
margin: 4px 0 0;
color: #aab4c0;
font: normal 9px/1.5 'Courier New', monospace;
text-transform: none;
white-space: normal;
}Projects V9 5 1
A JavaScript module in the plugins folder of GlobalGrid2050 that compares project updates v9, updates sort header, renders table and reads inputs for county and sort projects.
energy-dataglobalgrid2050 / testcode/202609051344/pipeline/scripts/plugins/projects-v9-5-1.js · lines 1–411 of 411 · version 2026-09-05 13:44 · pattern syncMapAtlasNav (shared by 4 files)
- What it does
- It draws the REPD register, solar, battery storage (BESS) and wind. Defines 22 functions or classes, including atlasUrlV9_5_1, displayDate, repdUpdatedTimestamp, compareProjectUpdatesV9_5_1, updateSortHeader. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: the REPD register, solar, battery storage (BESS), wind.
- Inputs & outputs
- Coordinate systems named: OSGB36 / EPSG:27700 (British National Grid), WGS84 / EPSG:4326.
- Downstream impact
- Used directly by 3 files: App V9 5 1 (globalgrid2050); App V9 6 2 (globalgrid2050); App V9 7 (globalgrid2050). Reached from 181 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); GlobalGrid2050 — PipelineNews Intelligence Page (globalgrid2050, https://globalgrid2050.com/pipelinenews_intelligence/202609050309/).
- What it achieves
- It compares project updates v9 (`compareProjectUpdatesV9_5_1`), updates sort header (`updateSortHeader`) and maps action HTML v9 (`mapActionHtmlV9_5_1`). Its `downloadCsv` function gives CSV download or refusal from active table owner, filtered register rows and official detail partitions (VEDIC: export filtered projects). It responds to click events.
- Why it matters
- Imported by App V9 5 1, App V9 6 2 and App V9 7.
- Application
- globalgrid2050 · testcode/202609051344/pipeline/scripts/plugins · 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
- Testcode — Pipeline (import), Atlas Receiver V9 7 (import), State (import), Project Filter V9 2 (import), Canonical Projects V9 5 1 (import), Gauges V9 2 (import), Newspaper V9 5 1 (import)
- Used by
- imported by App V9 5 1 (import), imported by App V9 6 2 (import), imported by App V9 7 (import)
- Produces
- atlasUrlV9_5_1, compareProjectUpdatesV9_5_1, loadProjectsV9_5_1, refreshProjectsV9_5_1, bindProjectControlsV9_5_1
- Defines here
- atlasUrlV9_5_1, displayDate, repdUpdatedTimestamp, compareProjectUpdatesV9_5_1, updateSortHeader, relationshipSummary, mapActionHtmlV9_5_1, renderTable, updateResultSummary, syncFilterUrl, apply, populateCounties, setButtonState, hydrateFiltersFromUrl, csvCell, downloadCsv, clearFilters, copyProjectId, loadProjectsV9_5_1, refreshProjectsV9_5_1, bindProjectControlsV9_5_1, syncMapAtlasNavV9_7
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609051344/pipeline/scripts/plugins/projects-v9-5-1.js:1-411 · blob c41a45a1de7869cb93960b8049edfaacad987428 · GitHub at these lines
- State
- achieves: code · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: production_core
import { escapeHtml } from "../core/utils.js";
import {
atlasCentresOnRepdPointV9_7,
atlasReceiverV9_7,
atlasUnavailableReasonV9_7,
buildAtlasDeepLinkV9_7,
verifyAtlasReceiverV9_7,
} from "../core/atlas-receiver-v9-7.js";
import { state } from "../core/state.js";
import {
buildProjectSearchTextV9_2,
projectMatchesV9_2,
summariseProjectsV9_2,
tokeniseSearchV9_2,
} from "../core/project-filter-v9-2.js";
import { loadCanonicalProjectsV9_5_1 } from "../data/canonical-projects-v9-5-1.js";
import {
formatCapacityV9_2,
formatLargestV9_2,
setGaugeUniverseV9_2,
updateGaugesV9_2,
} from "./gauges-v9-2.js";
import { signalForProjectV9_5_1 } from "./newspaper-v9-5-1.js";
const LABELS = Object.freeze({
solar: "Solar",
bess: "Battery Storage",
wind_onshore: "Onshore Wind",
wind_offshore: "Offshore Wind",
});
const COLOURS = Object.freeze({ solar: "#ffff00", bess: "#ffae00", wind_onshore: "#00ffff", wind_offshore: "#0066ff" });
const UNITS = Object.freeze({ solar: "MWp", bess: "MW", wind_onshore: "MW", wind_offshore: "MW" });
const ALLOWED_TECHNOLOGIES = new Set(["all", "solar", "bess", "wind_onshore", "wind_offshore"]);
const ALLOWED_STATUSES = new Set(["All", "Operational", "Under Construction", "Awaiting Construction", "Application Submitted"]);
const ALLOWED_SORTS = new Set(["capacity_desc", "updated_desc", "updated_asc"]);
let pageIndex = 0;
const PAGE_SIZE = 50;
let all = [];
let filtered = [];
let metadata = null;
let release = null;
let searchIndex = new Map();
let technology = "all";
let status = "All";
let county = "All";
let query = "";
let sortMode = "capacity_desc";
let controlsBound = false;
export function atlasUrlV9_5_1(project) {
// The receiver is not named here. It is read from the deep-link contract the
// engine publishes -- see ../core/atlas-receiver-v9-7.js for the measurement
// that made this necessary. Seven files in this directory each held their own
// copy of a route that had quietly stopped carrying the engine.
return buildAtlasDeepLinkV9_7(project);
}
function displayDate(value) {
if (!value) return "not supplied by REPD";
const [year, month, day] = String(value).split("-");
return year && month && day ? `${day}/${month}/${year}` : String(value);
}
function repdUpdatedTimestamp(project) {
if (!project.repd_record_updated) return null;
const value = Date.parse(`${project.repd_record_updated}T00:00:00Z`);
return Number.isFinite(value) ? value : null;
}
export function compareProjectUpdatesV9_5_1(left, right, direction = "desc") {
const leftTime = repdUpdatedTimestamp(left);
const rightTime = repdUpdatedTimestamp(right);
if (leftTime === null && rightTime === null) return 0;
if (leftTime === null) return 1;
if (rightTime === null) return -1;
return direction === "asc" ? leftTime - rightTime : rightTime - leftTime;
}
function updateSortHeader() {
const header = document.getElementById("repdUpdatedHeader");
const button = document.getElementById("sortUpdated");
const indicator = document.getElementById("updatedSortIndicator");
if (!header || !button || !indicator) return;
if (sortMode === "updated_desc") {
header.setAttribute("aria-sort", "descending");
indicator.textContent = "▼";
button.setAttribute("aria-label", "REPD updated date sorted newest first; click for oldest first");
button.title = "Newest first — click for oldest first";
return;
}
if (sortMode === "updated_asc") {
header.setAttribute("aria-sort", "ascending");
indicator.textContent = "▲";
button.setAttribute("aria-label", "REPD updated date sorted oldest first; click for newest first");
button.title = "Oldest first — click for newest first";
return;
}
header.setAttribute("aria-sort", "none");
indicator.textContent = "↕";
button.setAttribute("aria-label", "Sort by REPD updated date, newest first");
button.title = "Click for newest first";
}
function relationshipSummary(project) {
const development = Array.isArray(project.development_repd_refs) ? project.development_repd_refs.length : 0;
const direct = Array.isArray(project.direct_related_repd_refs) ? project.direct_related_repd_refs.length : 0;
const siblings = Array.isArray(project.planning_sibling_repd_refs) ? project.planning_sibling_repd_refs.length : 0;
return `${development} development · ${direct} direct · ${siblings} planning sibling record(s)`;
}
/* WHAT THE MAP CELL SAYS, AND WHY IT SAYS IT IN THE CELL.
This used to be a link or the two words NO MAP with its reason in a title
attribute. A phone reports hover: none, so on a phone the reason could not be
reached at all -- and 28 of these 7,680 records got the silent version.
Those 28 are no longer denied a link. The contract requires only repd_ref;
latitude and longitude are optional, and the canonical receiver resolves the
project from its REPD reference and centres on its own geometry. Measured on
REPD 13429 (Ossian), which has no REPD coordinate: the arrival names the
project, its capacity and its reference. So they get a MAP button and a
sentence saying whose coordinate the map is using -- which is the honest
answer, and the opposite of a button that quietly does nothing. */
function mapActionHtmlV9_5_1(project) {
const canonicalHref = atlasUrlV9_5_1(project);
let href = canonicalHref ? new URL("../atlas/" + new URL(canonicalHref).search, window.location.href).href : "";
if (href) { const u = new URL(href); u.searchParams.set("project", project.name); u.searchParams.set("capacity_mw", project.capacity_mw); href=u.href; }
if (!href) {
return `<span class="action-disabled">NO MAP</span>`
+ `<div class="map-note">${escapeHtml(atlasUnavailableReasonV9_7(project))}</div>`;
}
if (['10919','11613','11109','13735'].includes(String(project.repd_ref))) return `<a class="action-link atlaslink" target="_blank" rel="noopener" href="${escapeHtml(href)}">MAP ↗</a><div class="map-note">Approximate Crown Estate lease-area centre; indicative grid distances.</div>`;
const located = atlasCentresOnRepdPointV9_7(project);
const link = `<a class="action-link atlaslink" target="_blank" rel="noopener" href="${escapeHtml(href)}">${located ? "MAP" : "DETAILS"} ↗</a>`;
if (located) return link;
return `${link}<div class="map-note">No coordinates in the REPD record. Project details are available; map placement is unavailable.</div>`;
}
function renderTable() {
const body = document.getElementById("tbody");
pageIndex = Math.min(pageIndex, Math.max(0, Math.ceil(filtered.length / PAGE_SIZE) - 1));
body.innerHTML = filtered.slice(pageIndex * PAGE_SIZE, (pageIndex + 1) * PAGE_SIZE).map((project) => {
const label = LABELS[project.technology];
const unit = UNITS[project.technology];
const location = [project.county, project.region].filter(Boolean).join(" · ");
const signal = signalForProjectV9_5_1(project);
const news = new URL("https://www.google.com/search");
news.searchParams.set("q", `${project.name} ${label} UK`);
news.searchParams.set("tbm", "nws");
const mapAction = mapActionHtmlV9_5_1(project);
const planning = project.planning_application_reference || "not supplied by REPD";
const authority = project.planning_authority || "not supplied by REPD";
const developmentId = project.gg_development_id || "not assigned";
const updated = displayDate(project.repd_record_updated);
return `<tr id="repd-${escapeHtml(project.repd_ref)}" data-repd-updated="${escapeHtml(project.repd_record_updated || "")}"><td class="site">${escapeHtml(project.name)}<div class="project-meta">REPD ${escapeHtml(project.repd_ref)} · ${escapeHtml(project.gg_project_id)} · UPDATED ${escapeHtml(updated)}</div><div class="mobile-extra">${escapeHtml([location, project.operator].filter(Boolean).join( … [line shortened here: 2,120 characters; full line on GitHub]
}).join("");
const pagination = document.getElementById("projectPagination");
const pages = Math.max(1, Math.ceil(filtered.length / PAGE_SIZE));
pagination.innerHTML = `<button type="button" id="pagePrevious" ${pageIndex === 0 ? "disabled" : ""}>Previous</button><span role="status" aria-live="polite">Page ${pageIndex + 1} of ${pages} · ${filtered.length ? pageIndex * PAGE_SIZE + 1 : 0}–${Math.min((pageIndex + 1) * PAGE_SIZE, filtered.length)} of ${filtered.length.toLocaleString("en-GB")}</span><button type="button" id="pageNext" ${pageIn … [line shortened here: 451 characters; full line on GitHub]
for (const [id, delta] of [["pagePrevious", -1], ["pageNext", 1]]) {
document.getElementById(id).onclick = () => { pageIndex += delta; renderTable(); pagination.scrollIntoView({block:"start"}); };
}
}
function updateResultSummary() {
const summary = summariseProjectsV9_2(filtered);
const element = document.getElementById("resultsMeta");
element.textContent = `${summary.count.toLocaleString("en-GB")} of ${all.length.toLocaleString("en-GB")} records · ${formatCapacityV9_2(summary.capacity_mw)} MW · largest ${formatLargestV9_2(summary.largest_mw)} MW`;
element.classList.toggle("is-filtered", summary.count !== all.length);
element.dataset.filteredCount = String(summary.count);
element.dataset.totalCount = String(all.length);
}
function syncFilterUrl() {
const url = new URL(window.location.href);
for (const parameter of ["technology", "status", "county", "q", "sort"]) url.searchParams.delete(parameter);
if (technology !== "all") url.searchParams.set("technology", technology);
if (status !== "All") url.searchParams.set("status", status);
if (county !== "All") url.searchParams.set("county", county);
if (query) url.searchParams.set("q", query);
if (sortMode !== "capacity_desc") url.searchParams.set("sort", sortMode);
history.replaceState(null, "", url);
}
function apply({ syncUrl = true } = {}) {
pageIndex = 0;
const tokens = tokeniseSearchV9_2(query);
filtered = all.filter((project) => projectMatchesV9_2(project, {
technology,
status,
county,
tokens,
}, searchIndex.get(project.repd_ref)));
if (sortMode === "updated_desc") filtered.sort((left, right) => compareProjectUpdatesV9_5_1(left, right, "desc"));
if (sortMode === "updated_asc") filtered.sort((left, right) => compareProjectUpdatesV9_5_1(left, right, "asc"));
state.filtered = filtered;
updateGaugesV9_2(filtered);
renderTable();
updateResultSummary();
updateSortHeader();
if (syncUrl) syncFilterUrl();
}
function populateCounties() {
const select = document.getElementById("county");
select.replaceChildren(new Option("🌍 ALL COUNTIES", "All"));
[...new Set(all.map((project) => project.county).filter(Boolean))]
.sort((left, right) => left.localeCompare(right, "en-GB"))
.forEach((value) => select.add(new Option(`📍 ${value}`, value)));
}
function setButtonState(container, dataKey, selected) {
document.querySelectorAll(`${container} .btn`).forEach((button) => {
const active = button.dataset[dataKey] === selected;
button.classList.toggle("active", active);
button.setAttribute("aria-pressed", String(active));
});
}
function hydrateFiltersFromUrl() {
const parameters = new URLSearchParams(window.location.search);
const requestedTechnology = parameters.get("technology") || "all";
const requestedStatus = parameters.get("status") || "All";
const requestedCounty = parameters.get("county") || "All";
const requestedSort = parameters.get("sort") || "capacity_desc";
technology = ALLOWED_TECHNOLOGIES.has(requestedTechnology) ? requestedTechnology : "all";
status = ALLOWED_STATUSES.has(requestedStatus) ? requestedStatus : "All";
county = [...document.getElementById("county").options].some((option) => option.value === requestedCounty)
? requestedCounty
: "All";
query = parameters.get("q") || "";
sortMode = ALLOWED_SORTS.has(requestedSort) ? requestedSort : "capacity_desc";
setButtonState("#tech", "technology", technology);
setButtonState("#status", "officialStatus", status);
document.getElementById("county").value = county;
document.getElementById("search").value = query;
document.getElementById("sortProjects").value = sortMode;
}
function csvCell(value) {
let text = value === null || value === undefined ? "" : String(value);
if (/^(?:[=+\-@]|\s+[=+\-@]|\t|\r|\n)/u.test(text)) text = `'${text}`;
return `"${text.replaceAll('"', '""')}"`;
}
function downloadCsv(event) {
event.preventDefault();
const headers = ["Site Name", "REPD Ref", "GlobalGrid Project ID", "GlobalGrid Development ID", "Identity Status", "Identity Confidence", "Technology", "Official REPD Technology", "Official REPD Capacity", "Capacity Unit", "Official REPD Status", "Derived Lifecycle", "Operator or Applicant", "County", "Region", "Country", "Planning Authority", "Planning Application Reference", "REPD Record Updat … [line shortened here: 1,130 characters; full line on GitHub]
const rows = filtered.map((project) => {
const signal = signalForProjectV9_5_1(project);
return [project.name, project.repd_ref, project.gg_project_id, project.gg_development_id, project.identity_status, project.identity_confidence, LABELS[project.technology], project.repd_technology, project.capacity_mw, UNITS[project.technology], project.status, project.lifecycle, project.operator, project.county, project.region, project.country, project.planning_authority, project.planning_appl … [line shortened here: 1,392 characters; full line on GitHub]
});
const content = `\ufeff${[headers, ...rows].map((row) => row.map(csvCell).join(",")).join("\r\n")}`;
const url = URL.createObjectURL(new Blob([content], { type: "text/csv;charset=utf-8" }));
const anchor = document.createElement("a");
anchor.href = url;
anchor.download = `globalgrid2050_uk_renewables_pipeline_v9_5_1_${new Date().toISOString().slice(0, 10)}.csv`;
anchor.click();
URL.revokeObjectURL(url);
document.getElementById("exportMeta").textContent = `${filtered.length.toLocaleString("en-GB")} filtered records exported`;
}
function clearFilters(event) {
event.preventDefault();
technology = "all";
status = "All";
county = "All";
query = "";
sortMode = "capacity_desc";
setButtonState("#tech", "technology", technology);
setButtonState("#status", "officialStatus", status);
document.getElementById("county").value = county;
document.getElementById("search").value = "";
document.getElementById("sortProjects").value = sortMode;
apply();
}
async function copyProjectId(button) {
const value = button.dataset.copyId;
try {
await navigator.clipboard.writeText(value);
} catch {
const field = document.createElement("textarea");
field.value = value;
field.setAttribute("readonly", "");
field.style.position = "fixed";
field.style.opacity = "0";
document.body.appendChild(field);
field.select();
document.execCommand("copy");
field.remove();
}
const original = button.textContent;
button.textContent = "COPIED";
button.classList.add("copied");
setTimeout(() => {
button.textContent = original;
button.classList.remove("copied");
}, 1200);
}
export async function loadProjectsV9_5_1() {
try {
/* NOTHING CROSS-ORIGIN GATES THE FIRST ROW.
This was a Promise.all of the project payload AND a fetch to
ventusltd.github.io, because atlasUrlV9_5_1() is synchronous and
renderTable() calls it once per row, so the receiver had to be known
before the first paint. The consequence, measured 2026-09-05 at a phone
viewport: not one of 7,680 rows could appear until a request to a SECOND
ORIGIN had done DNS, TCP, TLS and a round trip — 59 ms on a wired link,
which is why every desktop check passed, and a cold-radio handshake on
the device the complaint came from. index.html:157 paints an empty
<tbody> with no placeholder, so the reader saw nothing at all for the
duration.
The receiver is now known at import (see core/atlas-receiver-v9-7.js),
so this awaits the payload alone. The contract is still read — fired
here, awaited by nobody — and the only thing it can do is change or
withdraw the links, which re-renders. On a correct estate it never
does, because the compiled contract is pinned to the published one by
testcode/drivers/link-targets.mjs. */
const verifying = verifyAtlasReceiverV9_7();
const model = await loadCanonicalProjectsV9_5_1();
all = [...model.projects];
filtered = all;
metadata = model.metadata;
release = model.release;
searchIndex = new Map(all.map((project) => [project.repd_ref, buildProjectSearchTextV9_2(project)]));
state.all = all;
state.filtered = filtered;
state.canonicalModel = model;
setGaugeUniverseV9_2(all);
populateCounties();
hydrateFiltersFromUrl();
apply({ syncUrl: false });
document.getElementById("releaseMeta").textContent = `V9.5.1 interface · V${release.data_parent.release} canonical data spine · all ${all.length.toLocaleString("en-GB")} qualifying records loaded`;
/* Re-render only if the engine's published contract disagrees with the one
compiled in — a different canonical receiver, or this one retired. Not
awaited, so a slow or dead contract costs the reader nothing, and on the
normal path `changed` is false and this does no work at all. */
verifying.then((result) => {
if (result.changed) refreshProjectsV9_5_1();
syncMapAtlasNavV9_7();
if (!result.verified) console.warn(`V9.5.1 MAP: ${result.reason}`);
});
} catch (error) {
console.error(error);
document.getElementById("tbody").innerHTML = '<tr><td colspan="11" style="text-align:center;color:#ff6666">Canonical Q2 REPD data unavailable. V9.5.1 has failed closed.</td></tr>';
document.getElementById("resultsMeta").textContent = "canonical data unavailable";
}
}
export function refreshProjectsV9_5_1() {
if (metadata) renderTable();
}
export function bindProjectControlsV9_5_1() {
if (controlsBound) return;
controlsBound = true;
document.querySelectorAll("#tech .btn").forEach((button) => {
button.onclick = () => {
technology = button.dataset.technology;
setButtonState("#tech", "technology", technology);
apply();
};
});
document.querySelectorAll("#status .btn").forEach((button) => {
button.onclick = () => {
status = button.dataset.officialStatus;
setButtonState("#status", "officialStatus", status);
apply();
};
});
document.getElementById("county").onchange = (event) => { county = event.target.value; apply(); };
document.getElementById("sortProjects").onchange = (event) => { sortMode = event.target.value; apply(); };
document.getElementById("sortUpdated").onclick = () => {
sortMode = sortMode === "updated_desc" ? "updated_asc" : "updated_desc";
document.getElementById("sortProjects").value = sortMode;
apply();
};
document.getElementById("search").oninput = (event) => { query = event.target.value.trim(); apply(); };
document.getElementById("export").onclick = downloadCsv;
document.getElementById("exportInline").onclick = downloadCsv;
document.getElementById("clearFilters").onclick = clearFilters;
document.getElementById("tbody").addEventListener("click", (event) => {
const button = event.target.closest(".copy-id");
if (button) copyProjectId(button);
});
}
/* The MAP ATLAS nav button is static HTML, so it cannot follow the receiver the
way a row's MAP cell does - and until 2026-09-05 it pointed at the retired V8
Atlas while every row pointed at the canonical one. The href in index.html is
now the compiled canonical route, which is correct before any network exists;
this re-points it only if the live contract disagrees, and hides it if the
contract withdraws the receiver entirely. Same signal, same moment, as the
table's own re-render. */
function syncMapAtlasNavV9_7() {
const nav = document.getElementById("mapAtlasNav");
if (!nav) return;
const route = atlasReceiverV9_7();
if (!route) {
nav.hidden = true;
return;
}
nav.hidden = false;
nav.href = new URL("../atlas/", window.location.href).href;
}Teleprinter Bootstrap
A JavaScript module in the pipeline folder of GlobalGrid2050 that draws pipeline pin and pipeline code.
renderglobalgrid2050 / testcode/202609052023/pipeline/teleprinter-bootstrap.js · lines 1–11 of 11 · version 2026-09-05 20:23 · Not reached from any entry point (candidate for review)
- What it does
- It draws pipeline pin and pipeline code. Side effects: changes the web page (DOM); makes network requests.
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
- Inputs & outputs
- In: JSON file pipeline-source-pin.json; JSON file pipeline-source-code.manifest.json.
- What it achieves
- No statement of purpose was found in the file, a README line naming it, or its name.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609052023/pipeline · JavaScript module
- Uses
- Controls (import)
- 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 testcode/202609052023/pipeline/teleprinter-bootstrap.js:1-11 · blob 87145cfd7262bc4dcdb890f93e3c4a4f156f2fe2 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, network · domain stage: experimental · users: none · canonical: unreached_review
import { mountTeleprinter } from '../teleprinter/controls.js';
const base = new URL('../teleprinter/', import.meta.url);
try {
const response = await fetch(new URL('pipeline-source-pin.json', base), { cache: 'no-store', credentials: 'same-origin', redirect: 'error' });
if (!response.ok) throw new Error('Source code is still being prepared.');
const pin = await response.json();
if (pin.generation !== '202609052023' || pin.app !== 'pipeline' || !/^[a-f0-9]{40}$/.test(pin.commit) || pin.repository !== 'https://github.com/Ventusltd/testcode') throw new Error('The source code version could not be checked.');
mountTeleprinter({ printButtons: undefined, appName: "Pipeline News", manifestUrl: new URL('pipeline-source-code.manifest.json', base), textUrl: new URL('pipeline-source-code.txt', base), expectedCommit: pin.commit, expectedRepository: pin.repository });
} catch (error) {
const note = document.createElement('p'); note.setAttribute('role', 'status'); note.textContent = 'Print options: ' + error.message; document.body.append(note);
}Provisional Identity
A JavaScript module in the assets folder of GlobalGrid2050 that works with the Renewable Energy Planning Database (REPD) register, using SHA-256.
transformglobalgrid2050 / testcode/202609060213/pipeline/assets/202609060213-provisional-identity.mjs · lines 1–48 of 48 · version 2026-09-06 02:13 · Not reached from any entry point (candidate for review) · pattern reconcileProvisional (shared by 3 files)
- What it does
- It calculates the REPD register. Defines globalGridReference, normalise, allocateProvisional, reconcileProvisional, resolveProject.
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: the REPD register.
- Downstream impact
- Used directly by 1 file: Provisional Projects (globalgrid2050).
- What it achieves
- It resolves project (`resolveProject`) and is built from the global grid reference helper (`globalGridReference`) and the normalise step (`normalise`). Uses the existing Pipeline Global Grid reference convention.
- Why it matters
- Imported by Provisional Projects.
- Application
- globalgrid2050 · testcode/202609060213/pipeline/assets · JavaScript module
- Uses
- none found
- Used by
- imported by Provisional Projects (import)
- Produces
- globalGridReference, allocateProvisional, reconcileProvisional, resolveProject
- Defines here
- globalGridReference, normalise, allocateProvisional, reconcileProvisional, resolveProject
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609060213/pipeline/assets/202609060213-provisional-identity.mjs:1-48 · blob 4e5c0b9989f5a8b437dfd05ff1af4df064d8e18f · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: transform · effects: none found · domain stage: experimental · users: none · canonical: unreached_review
// Uses the existing Pipeline Global Grid reference convention.
export const globalGridReference = ref => `GG2050-REPD-${ref}`;
const normalise = value => String(value ?? '').normalize('NFKC').toLowerCase().replace(/[^a-z0-9]+/g,' ').trim();
export function allocateProvisional(records, project) {
const existing = records.find(row => row.source_key === project.source_key);
if (existing) return structuredClone(existing);
let number=9999;
const used=new Set(records.flatMap(row=>[row.repd_ref,...(row.aliases ?? [])]));
while(used.has(`${number}-REPD-TBC`)) number++;
const repd_ref=`${number}-REPD-TBC`;
return {...structuredClone(project),repd_ref,official_repd_ref:null,
gg_project_id:globalGridReference(repd_ref),identity_status:'REPD_PENDING',
aliases:[],identity_history:[]};
}
export function reconcileProvisional(records, official, source) {
if (!source?.path || !/^[a-f0-9]{64}$/.test(source.sha256 ?? '')) throw Error('Quarterly source identity required');
const numeric=official.filter(row=>/^\d+$/.test(String(row.repd_ref)));
const occupied=new Set(records.filter(row=>row.official_repd_ref).map(row=>row.official_repd_ref));
return records.map(input=>{
const row=structuredClone(input);
if(row.official_repd_ref) return row;
// A common name or a nearby site is insufficient: require the declared
// name/alias, developer, county and reported capacity to agree uniquely.
const names=[row.name,...(row.name_aliases ?? [])].map(normalise);
const matches=numeric.filter(candidate=>names.includes(normalise(candidate.name))
&& normalise(candidate.operator)===normalise(row.operator)
&& normalise(candidate.county)===normalise(row.county)
&& Number(candidate.capacity_mw)===Number(row.capacity_mw));
if(matches.length!==1 || occupied.has(String(matches[0].repd_ref))) {
row.reconciliation={status:matches.length?'AMBIGUOUS_REQUIRES_REVIEW':'NO_VERIFIED_MATCH',source,candidate_count:matches.length};
return row;
}
const previous=row.repd_ref, next=String(matches[0].repd_ref);
occupied.add(next);
row.aliases=[...new Set([...row.aliases,previous,row.gg_project_id])];
row.repd_ref=next;row.official_repd_ref=next;row.gg_project_id=globalGridReference(next);
row.identity_status='REPD_BOUND';
row.identity_history.push({from:previous,to:next,source,reason:'unique name/developer/county/capacity match'});
row.reconciliation={status:'REPLACED_TEMPORARY_ID',source,candidate_count:1};
return row;
});
}
export function resolveProject(records, identity) {
return records.find(row=>[row.repd_ref,row.gg_project_id,...row.aliases].includes(identity)) ?? null;
}Provisional Projects
A JavaScript module in the assets folder of GlobalGrid2050 covering the Renewable Energy Planning Database (REPD) register.
renderglobalgrid2050 / testcode/202609060213/pipeline/assets/202609060213-provisional-projects.mjs · lines 1–16 of 16 · version 2026-09-06 02:13 · Not reached from any entry point (candidate for review) · pattern mount (shared by 45 files)
- What it does
- It draws the REPD register. Defines mount. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: the REPD register.
- What it achieves
- Defines `mount`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609060213/pipeline/assets · JavaScript module
- Uses
- Provisional Identity (import)
- Used by
- none found
- Produces
- CONTRACT, mount
- Defines here
- mount
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609060213/pipeline/assets/202609060213-provisional-projects.mjs:1-16 · blob 980fee50492f2e2a3ba58d129469966df48826ae · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: unreached_review
import {reconcileProvisional} from './202609060213-provisional-identity.mjs';
export const CONTRACT={schema:'pipelinenews.provisional-pipeline.v1',generation:'202609060213'};
export function mount({host,payload,official,source}) {
if(payload.schema!=='pipelinenews.provisional-register.v1') throw Error('Pending register schema mismatch');
const projects=reconcileProvisional(payload.projects,official,source);
const pending=projects.filter(row=>!row.official_repd_ref);
const label=document.createElement('p');label.textContent=pending.length+' reported project(s) awaiting a verified REPD match. These are additional intake records, excluded from official REPD capacity totals.';
const scroll=document.createElement('div');scroll.style.overflowX='auto';
const table=document.createElement('table');table.style.minWidth='620px';
const head=table.createTHead().insertRow();for(const text of ['Project','Temporary REPD ID','Global Grid reference','Reported capacity','Status','Source']){const th=document.createElement('th');th.textContent=text;head.append(th);}
for(const p of pending){const row=table.insertRow();for(const value of [p.name,p.repd_ref,p.gg_project_id,p.capacity_mw+' MW (reported upper bound)',p.status])row.insertCell().textContent=value;const cell=row.insertCell(),link=document.createElement('a');link.href=p.article_url;link.textContent='BBC News';cell.append(link);}
scroll.append(table);host.replaceChildren(label,scroll);
if(projects.length!==pending.length){const p=document.createElement('p');p.textContent=(projects.length-pending.length)+' previously temporary record(s) now matched to official REPD numbers; those projects belong in the main REPD table.';host.append(p);}
host.dataset.pendingReady='true';host.dataset.pendingCount=String(pending.length);
return {projects,pending:pending.length};
}BBC RSS Pipeline Model
A JavaScript module in the assets folder of GlobalGrid2050 that works with the Renewable Energy Planning Database (REPD) register and uses data from the PipelineNews repository.
Set aside from the main view: 97% of its lines are the same as cartridges/bbc-rss-pipeline-model.mjs (pipelinenews), which stays. (near-copy-of, proposed by families.py). 96% of lines shared with BBC RSS Pipeline Model; read that one first. All set-aside files, with reasons. Nothing was deleted.
Evidence
- line-jaccard 0.9672 to pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 cartridges/bbc-rss-pipeline-model.mjs:1-73 63a257b51e9bf26edcf8d9eaa02a611895ecf0f1
- sha256 eaf5320305fba5e44f72affe7117063b57a1502ba7c745b10b76e01975aa9ca4
- target sha256 42e4bbba938e6efb5701e0a6ab68e9c2a736e69d817dd506137cc8a376896f35
- group of 3 (identity.json near-copy edges >= 0.9)
- canonical rule: reachable, newest stamp, core repo, most lines
energy-dataglobalgrid2050 / testcode/202609060232/pipeline/assets/202609060232-bbc-rss-pipeline-model.mjs · lines 1–73 of 73 · version 2026-09-06 02:32 · Not reached from any entry point (candidate for review) · pattern projectObservation (shared by 3 files)
- What it does
- It calculates the REPD register. Defines articleIdentity, projectObservation, buildRssView, refreshRss.
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: the REPD register.
- Inputs & outputs
- In: JSON file bbc-rss.json.
- Downstream impact
- Used directly by 1 file: BBC RSS Pipeline (globalgrid2050).
- What it achieves
- It builds rss view (`buildRssView`) and refreshes rss (`refreshRss`). Defines `articleIdentity`, `projectObservation`, `buildRssView` and 1 more.
- Why it matters
- Imported by BBC RSS Pipeline.
- Application
- globalgrid2050 · testcode/202609060232/pipeline/assets · JavaScript module
- Uses
- Reported Project (import)
- Used by
- imported by BBC RSS Pipeline (import), mentioned in Standalone (comment link)
- Produces
- LIVE_RSS_URL, STALE_AFTER_MS, articleIdentity, projectObservation, buildRssView, refreshRss
- Defines here
- articleIdentity, projectObservation, buildRssView, refreshRss
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609060232/pipeline/assets/202609060232-bbc-rss-pipeline-model.mjs:1-73 · blob cdc149952dfb58cb1702ba56195fd56496d84ead · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: transform · effects: none found · domain stage: experimental · users: none · canonical: duplicate_candidate
import {validateReportedProject} from './202609060232-bbc-reported-project.mjs';
export const LIVE_RSS_URL = 'https://raw.githubusercontent.com/Ventusltd/pipelinenews/main/discovery/products/bbc-rss.json';
export const STALE_AFTER_MS = 3 * 60 * 60 * 1000;
export function articleIdentity(value) {
try {
const url = new URL(value);
const match = url.pathname.match(/^\/news\/articles\/([a-z0-9]+)\/?$/i);
if (url.protocol !== 'https:' || !['www.bbc.co.uk','www.bbc.com'].includes(url.hostname) || !match) return null;
return {id:'bbc:'+match[1].toLowerCase(), url:`https://www.bbc.co.uk/news/articles/${match[1].toLowerCase()}`};
} catch { return null; }
}
// The collector's asserted REPD fields are deliberately not a binding authority.
export function projectObservation(item, projects = [], evidence = [], official = []) {
const identity = articleIdentity(item.url);
const candidates = projects.filter(project=>articleIdentity(project.article_url)?.id === identity?.id);
const project = candidates.length === 1 ? candidates[0] : null;
const reported = evidence.find(report=>articleIdentity(report.article_url)?.id===identity?.id && report.primary_project===project?.name);
const validated = reported ? validateReportedProject(reported) : null;
const ref = String(project?.official_repd_ref || '');
const bound = project?.identity_status==='REPD_BOUND' && /^\d+$/.test(ref) && official.some(row=>String(row.repd_ref)===ref);
return {
name:project?.name || null,
status:bound?'OFFICIAL_IDENTITY_VERIFIED':project?'REPD_PENDING':'UNMATCHED_REQUIRES_REVIEW',
repd_ref:bound?ref:null,
temporary_ref:!bound&&/^[0-9]+-REPD-TBC$/.test(project?.repd_ref || '')?project.repd_ref:null,
gg_project_id:bound?`GG2050-REPD-${ref}`:project?.gg_project_id || null,
claims:validated?.claims || [],
related_projects:validated?.related_projects || [],
unknowns:validated?.unknowns || [],
evidence_basis:validated?.evidence_basis || null,
// A verified project identity never converts a report into official capacity or headroom.
capacity_basis:'reported only; excluded from official REPD totals',
eligible_for_project_signal:false,
};
}
export function buildRssView(payload, {now=Date.now(), projects=[], evidence=[], official=[], refreshError=null}={}) {
if(payload?.schema!=='pipelinenews.bbc-rss.v1' || !Array.isArray(payload.items) || !Array.isArray(payload.feeds)) throw Error('Unsupported BBC RSS product');
if(payload.items.length>500 || payload.feeds.length>100) throw Error('BBC RSS product exceeds bounded collection contract');
const checked=Date.parse(payload.checked_at), successful=Date.parse(payload.last_success_at);
const clockValid=Number.isFinite(now)&&Number.isFinite(checked)&&checked<=now+60000&&Number.isFinite(successful)&&successful<=now+60000;
const age=clockValid?Math.max(0,now-successful):null;
const good=payload.feeds.filter(feed=>feed.status==='ok').length;
const total=payload.feeds.length;
const collection=good===0?'FAILED':good<total||payload.status!=='ok'?'PARTIAL':'OK';
const freshness=!clockValid?'UNKNOWN':age>STALE_AFTER_MS?'STALE':'FRESH';
const unique=new Map();
let rejected=0;
for(const item of payload.items) {
const identity=articleIdentity(item.url);
if(!identity || typeof item.headline!=='string' || !item.headline.trim() || (item.id && item.id!==identity.id)) {rejected++;continue;}
if(unique.has(identity.id)) continue;
unique.set(identity.id,{...identity,headline:item.headline.trim(),published_at:item.source_published_at || null,observation:projectObservation(item,projects,evidence,official)});
}
return {items:[...unique.values()],rejected,collection,freshness,age_ms:age,checked_at:payload.checked_at || null,last_success_at:payload.last_success_at || null,feed_success:good,feed_total:total,feeds:payload.feeds.map(feed=>({url:String(feed.url || ''),status:String(feed.status || 'unknown')})),refresh_error:refreshError?String(refreshError):null};
}
// On any fetch/schema failure retain the previous product and visibly mark refresh failure.
export async function refreshRss(previous, {fetcher=fetch, ...options}={}) {
try {
const response=await fetcher(LIVE_RSS_URL,{cache:'no-store',credentials:'omit',redirect:'error',signal:AbortSignal.timeout(15000)});
if(!response.ok) throw Error('Source HTTP '+response.status);
const text=await response.text();
if(text.length>2*1024*1024) throw Error('Source exceeds 2 MiB limit');
const payload=JSON.parse(text);
return {payload,view:buildRssView(payload,options),live:true};
} catch(error) {
return {payload:previous,view:buildRssView(previous,{...options,refreshError:error.message}),live:false};
}
}BBC RSS Pipeline
A JavaScript module in the assets folder of GlobalGrid2050 that works with UK time (`ukTime`), covering the Renewable Energy Planning Database (REPD) register.
energy-dataglobalgrid2050 / testcode/202609060232/pipeline/assets/202609060232-bbc-rss-pipeline.mjs · lines 1–56 of 56 · version 2026-09-06 02:32 · Not reached from any entry point (candidate for review) · pattern ukTime (shared by 3 files)
- What it does
- It draws the REPD register. Defines 6 functions or classes, including mount, ukTime, create, options, render. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: the REPD register.
- What it achieves
- It is built from the UK time helper (`ukTime`), the options step (`options`) and the render step (`render`). Defines `mount`, `ukTime`, `create` and 3 more. It responds to click events.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609060232/pipeline/assets · JavaScript module
- Uses
- BBC RSS Pipeline Model (import)
- Used by
- none found
- Produces
- CONTRACT, mount
- Defines here
- mount, ukTime, create, options, render, update
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609060232/pipeline/assets/202609060232-bbc-rss-pipeline.mjs:1-56 · blob e4739a739d33a37be3c01e44c4e861fea0aa2830 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: duplicate_candidate
import {buildRssView,refreshRss} from './202609060232-bbc-rss-pipeline-model.mjs';
export const CONTRACT={schema:'pipelinenews.bbc-rss-pipeline.v1',generation:'202609060232'};
export function mount({host,payload,evidence=[],projects=[],official=[],fetcher=fetch}) {
const doc=host.ownerDocument;
const ukTime=value=>{const date=new Date(value);return Number.isFinite(date.getTime())?new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',day:'2-digit',month:'short',year:'numeric',hour:'2-digit',minute:'2-digit',timeZoneName:'short'}).format(date):'unknown';};
const create=(tag,text)=>{const el=doc.createElement(tag);if(text!==undefined)el.textContent=text;return el;};
const description=create('p','BBC RSS discovery runs every two hours. This panel checks the latest collected headlines on opening; article pages are not fetched. News reports do not establish consent, firm capacity or connection headroom.');
const controls=create('div');controls.style.cssText='display:flex;gap:8px;flex-wrap:wrap;margin:12px 0';
const refresh=create('button','Refresh collected RSS'),snapshot=create('button','Publication snapshot');
for(const button of [refresh,snapshot]){button.type='button';button.style.cssText='min-height:44px;padding:8px 12px;cursor:pointer';}
controls.append(refresh,snapshot);
const status=create('p');status.setAttribute('role','status');status.setAttribute('aria-live','polite');
const list=create('div');list.style.overflowWrap='anywhere';
const details=create('details'),summary=create('summary','Source feed health'),feeds=create('ul');details.append(summary,feeds);
host.replaceChildren(description,controls,status,list,details);
let current=payload,mode='Publication snapshot',request=0,disposed=false;
const options=()=>({projects:typeof projects==='function'?projects():projects,evidence,official});
function render(view) {
host.dataset.rssReady='true';host.dataset.rssFreshness=view.freshness;host.dataset.rssCollection=view.collection;host.dataset.rssItems=String(view.items.length);
status.textContent=`${mode} | ${view.collection}: ${view.feed_success}/${view.feed_total} feeds | ${view.freshness} | checked ${view.checked_at?ukTime(view.checked_at):'unknown'} | last successful collection ${view.last_success_at?ukTime(view.last_success_at):'none'}.`+(view.refresh_error?' Refresh unavailable: '+view.refresh_error+'. Previous observations retained.':'');
list.replaceChildren();
if(!view.items.length)list.append(create('p','No matching headlines in this collection. An empty feed is not proof that a project does not exist.'));
for(const item of view.items) {
const article=create('article');article.style.cssText='border-top:1px solid currentColor;padding:12px 0';
const link=create('a',item.headline);link.href=item.url;link.rel='noopener noreferrer';
article.append(link,create('p','BBC News | '+(item.published_at?ukTime(item.published_at):'Publication date unavailable')));
const observation=item.observation;
if(observation.name) {
const identity=observation.repd_ref?'Verified official REPD identity '+observation.repd_ref:'Awaiting verified REPD match'+(observation.temporary_ref?' | '+observation.temporary_ref:'');
article.append(create('p',observation.name+' | '+identity+(observation.gg_project_id?' | '+observation.gg_project_id:'')));
const claims=create('ul');
for(const claim of observation.claims)claims.append(create('li',claim.metric.replaceAll('_',' ')+': '+(claim.value===true?'reported included':String(claim.value))+(claim.unit?' '+claim.unit:'')+(claim.qualifier?' — '+claim.qualifier:'')));
article.append(claims,create('p','These statements remain reported evidence, even after an official identity match. '+observation.capacity_basis+'.'));
if(observation.related_projects.length)article.append(create('p','Separate related project: '+observation.related_projects.map(project=>project.name).join(', ')+'. Its capacity and cost are not attributed to '+observation.name+'.'));
if(observation.unknowns.length)article.append(create('p','Not established by this report: '+observation.unknowns.join('; ')+'.'));
if(observation.evidence_basis)article.append(create('small',observation.evidence_basis));
} else article.append(create('p','REPD match unverified. Headline metadata only; no project capacity inferred.'));
list.append(article);
}
feeds.replaceChildren();for(const feed of view.feeds)feeds.append(create('li',feed.status+' | '+feed.url));
summary.textContent=`Source feed health (${view.feed_success}/${view.feed_total} successful)`;
}
async function update() {
const token=++request;refresh.disabled=true;status.textContent='Refreshing collected BBC RSS metadata…';
const result=await refreshRss(current,{...options(),fetcher});
if(disposed||token!==request)return;
current=result.payload;if(result.live)mode='Latest collected RSS';
refresh.disabled=false;render(result.view);
}
refresh.addEventListener('click',update);
snapshot.addEventListener('click',()=>{request++;refresh.disabled=false;current=payload;mode='Publication snapshot';render(buildRssView(current,options()));});
render(buildRssView(current,options()));
const ready=update();
return {ready,refresh:update,dispose(){disposed=true;request++;}};
}