GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Electricity markets and data pipelines / pipelinenews / archive/202608261547-pipelinenews/tooling

Browser Proof and 3 more files

A JavaScript module in the atman folder of PipelineNews that caches busted URL (`cacheBustedUrl`), covering the Renewable Energy Planning Database (REPD) register.

575 lines of JavaScript from pipelinenews, in 4 files. Topic: Electricity markets and data pipelines. Section 996 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. Poll Official Sources storage · pipelinenews / archive/202608261547-pipelinenews/tooling/poll-official-sources.mjs lines 1–126
  2. Sanitise News storage · pipelinenews / archive/202608261547-pipelinenews/tooling/sanitise-202608260159-news.mjs lines 1–79
  3. Compare V9 6 2 to Compiled storage · pipelinenews / atman/202608261830-compare-v9-6-2-to-compiled.mjs lines 1–176
  4. Browser Proof render · pipelinenews / atman/202608262014-browser-proof.mjs lines 1–194

Poll Official Sources

A JavaScript module in the tooling folder of PipelineNews that fetches official cursor and search.

storagepipelinenews / archive/202608261547-pipelinenews/tooling/poll-official-sources.mjs · lines 1–126 of 126 · version 2026-08-26 15:47 · Not reached from any entry point (candidate for review) · pattern optionalJson (shared by 6 files)

What it does
It fetches official cursor and search. Defines readJson, sleep, optionalJson, atomicJson. Uses libraries node:fs/promises. Side effects: reads or writes files; makes network requests.
Why it exists in the grid workflow
Domain stage experimental (path word 'archive'): 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 current.json; JSON file official-source-cursor.json; JSON file latest.json; JSON file search.json.
What it achieves
It reads JSON (`readJson`) and is built from the optional JSON helper (`optionalJson`) and the atomic JSON helper (`atomicJson`). Defines `readJson`, `sleep`, `optionalJson` and 1 more. It reads `releases/current.json`.
Why it matters
No other file in the estate was found to import it.
Application
pipelinenews · archive/202608261547-pipelinenews/tooling · JavaScript module
Uses
node:fs/promises
Used by
none found
Produces
readJson, sleep, optionalJson, atomicJson
Defines here
readJson, sleep, optionalJson, atomicJson
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 archive/202608261547-pipelinenews/tooling/poll-official-sources.mjs:1-126 · blob b54df4e72aed4b487e79e512d1dd34dc8f76e6cd · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem, network · domain stage: experimental · users: none · canonical: duplicate_candidate
import { readFile, mkdir, rename, writeFile } from "node:fs/promises";

const root = new URL("../", import.meta.url);
const readJson = async (path) => JSON.parse(await readFile(new URL(path, root), "utf8"));
const pointer = await readJson("releases/current.json");
const manifest = await readJson(pointer.manifest);
const engineObject = manifest.objects.modules.find((item) => item.role === "official_frontier_engine");
if (!engineObject) throw new Error("current release does not expose official_frontier_engine");
const { buildReferenceGroups, normalisePlanningReference, resolvePlanningBinding, selectFrontier, sourceHealth } = await import(new URL(engineObject.path, root));

const statePath = "state/official-source-cursor.json";
const snapshotPath = "data/official-source/latest.json";
const now = new Date().toISOString();
const deadline = Date.now() + 165_000;
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

async function optionalJson(path, fallback) {
  try { return await readJson(path); } catch (error) { if (error.code === "ENOENT") return fallback; throw error; }
}

async function atomicJson(path, value) {
  const target = new URL(path, root);
  await mkdir(new URL("./", target), { recursive: true });
  const temporary = new URL(`${target.pathname}.tmp-${process.pid}`, target);
  await writeFile(temporary, `${JSON.stringify(value, null, 2)}\n`, { flag: "wx" });
  await rename(temporary, target);
}

const projects = [];
for (let part = 1; part <= 16; part += 1) {
  const payload = await readJson(`newsv7/data/v9.1/projects/part-${String(part).padStart(3, "0")}.json`);
  const rows = Array.isArray(payload) ? payload : payload.projects || payload.items || [];
  projects.push(...rows);
}
if (projects.length !== 7680) throw new Error(`REPD spine must contain 7680 projects, got ${projects.length}`);
const groups = buildReferenceGroups(projects);
const state = await optionalJson(statePath, { schema: "pipelinenews.official-source-cursor.v1", next_index: 0, last_good_at: null });
const previous = await optionalJson(snapshotPath, { planit_by_reference: {}, govuk_items: [] });
const frontier = selectFrontier(groups, state, Number(process.env.PLANIT_BUDGET || 48));

const planitByReference = { ...previous.planit_by_reference };
let planitAttempted = 0;
let planitSucceeded = 0;
let lastPlanitStatus = null;
let stopForRateLimit = false;
for (let offset = 0; offset < frontier.selected.length && Date.now() < deadline && !stopForRateLimit; offset += 2) {
  const pair = frontier.selected.slice(offset, offset + 2);
  await Promise.all(pair.map(async (group) => {
    planitAttempted += 1;
    const url = new URL("https://www.planit.org.uk/api/applics/json");
    url.searchParams.set("id_match", group.query_reference);
    url.searchParams.set("pg_sz", "10");
    url.searchParams.set("compress", "on");
    try {
      const response = await fetch(url, { headers: { "User-Agent": "PipelineNews/1.0 (+https://github.com/Ventusltd/pipelinenews)" }, signal: AbortSignal.timeout(10_000) });
      lastPlanitStatus = response.status;
      if (response.status === 429) { stopForRateLimit = true; return; }
      if (!response.ok) return;
      const payload = await response.json();
      const records = Array.isArray(payload.records) ? payload.records : [];
      planitSucceeded += 1;
      planitByReference[group.normalised_reference] = {
        checked_at: now,
        query_reference: group.query_reference,
        records: records.map((record) => ({
          uid: record.uid ?? null,
          reference: record.reference ?? null,
          name: record.name ?? null,
          area_name: record.area_name ?? null,
          description: record.description ?? null,
          app_state: record.app_state ?? null,
          start_date: record.start_date ?? null,
          decided_date: record.decided_date ?? null,
          last_changed: record.last_changed ?? null,
          url: record.url ?? record.link ?? null,
          binding: resolvePlanningBinding(record, group),
        })),
      };
    } catch { /* health below records the failure; prior good data is retained */ }
  }));
  if (!stopForRateLimit) await sleep(250);
}

let govukAttempted = 0;
let govukSucceeded = 0;
let lastGovukStatus = null;
let govukItems = previous.govuk_items || [];
try {
  govukAttempted = 1;
  const url = new URL("https://www.gov.uk/api/search.json");
  url.searchParams.set("q", "renewable energy planning");
  url.searchParams.set("filter_organisations", "department-for-energy-security-and-net-zero");
  url.searchParams.set("count", "100");
  url.searchParams.set("order", "-public_timestamp");
  url.searchParams.set("fields", "title,description,link,public_timestamp");
  const response = await fetch(url, { signal: AbortSignal.timeout(10_000) });
  lastGovukStatus = response.status;
  if (response.ok) {
    const payload = await response.json();
    govukSucceeded = 1;
    govukItems = (payload.results || []).map((item) => {
      const haystack = normalisePlanningReference(`${item.title || ""} ${item.description || ""}`);
      const matches = groups.filter((group) => group.normalised_reference.length >= 6 && haystack.includes(group.normalised_reference));
      const bindings = matches.map((group) => resolvePlanningBinding({ reference: group.query_reference, name: item.title, description: item.description }, group));
      return { title: item.title, description: item.description, url: new URL(item.link, "https://www.gov.uk").toString(), public_timestamp: item.public_timestamp, bindings };
    });
  }
} catch { /* health below records the failure; prior good data is retained */ }

const planitHealth = sourceHealth({ attempted: planitAttempted, succeeded: planitSucceeded, statusCode: lastPlanitStatus, priorGoodAt: state.last_good_at, message: stopForRateLimit ? "rate limited; cursor retained for unfinished work" : null });
const govukHealth = sourceHealth({ attempted: govukAttempted, succeeded: govukSucceeded, statusCode: lastGovukStatus, priorGoodAt: state.last_good_at });
if (planitSucceeded === 0 && govukSucceeded === 0) throw new Error("all official adapters unavailable; refusing an empty-success snapshot");

const completedGroups = planitSucceeded;
const nextIndex = groups.length ? (Number(state.next_index || 0) + completedGroups) % groups.length : 0;
await atomicJson(snapshotPath, {
  schema: "pipelinenews.official-source-snapshot.v1",
  generated_at: now,
  spine: { projects: projects.length, reference_groups: groups.length },
  source_health: { planit: planitHealth, govuk: govukHealth },
  planit_by_reference: planitByReference,
  govuk_items: govukItems,
  google_news: { enabled: true, credibility_score: 30, role: "noisy discovery only" },
});
await atomicJson(statePath, { schema: "pipelinenews.official-source-cursor.v1", next_index: nextIndex, total_groups: groups.length, last_run_at: now, last_good_at: now });
console.log(`official-source poll: ${projects.length} projects; PlanIt ${planitSucceeded}/${planitAttempted}; GOV.UK ${govukSucceeded}/${govukAttempted}; next=${nextIndex}`);

Sanitise News

A JavaScript module in the tooling folder of PipelineNews that reads major project news and the Renewable Energy Planning Database (REPD) register.

storagepipelinenews / archive/202608261547-pipelinenews/tooling/sanitise-202608260159-news.mjs · lines 1–79 of 79 · version 2026-08-26 01:59 · Not reached from any entry point (candidate for review) · pattern safeUrl (shared by 5 files)

What it does
It loads major project news and the REPD register. Defines cleanToken, safeUrl, safeItem. Uses libraries node:assert/strict, node:fs/promises. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage experimental (path word 'archive'): 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 major_project_news_v9_5_1.json.
What it achieves
It cleans token (`cleanToken`) and is built from the safe URL helper (`safeUrl`) and the safe item helper (`safeItem`). Defines `cleanToken`, `safeUrl` and `safeItem`.
Why it matters
No other file in the estate was found to import it.
Application
pipelinenews · archive/202608261547-pipelinenews/tooling · JavaScript module
Uses
PipelineNews News Regions V9 6 2 (import), node:assert/strict, node:fs/promises
Used by
none found
Produces
cleanToken, safeUrl, safeItem
Defines here
cleanToken, safeUrl, safeItem
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 archive/202608261547-pipelinenews/tooling/sanitise-202608260159-news.mjs:1-79 · blob 25cd658783ca7525b388c6f7c4ce188915b74c58 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem · domain stage: experimental · users: none · canonical: unreached_review
import assert from "node:assert/strict";
import { readFile, writeFile } from "node:fs/promises";
import { classifyInternationalV9_6_2, regionalCountsV9_6_2 } from "../202608260159-pipelinenews/scripts/core/news-regions-v9-6-2.js";

const path = new URL("../202608260159-pipelinenews/dist/major_project_news_v9_5_1.json", import.meta.url);
const source = JSON.parse(await readFile(path, "utf8"));
const cleanToken = (value, fallback) => {
  const token = String(value || "").toUpperCase().replace(/[^A-Z0-9 +&/-]/gu, " ").replace(/\s+/gu, " ").trim();
  return token || fallback;
};
const safeUrl = (value) => {
  try { return `${new URL(value).origin}/`; } catch { return "https://globalgrid2050.com/"; }
};
const safeItem = (item) => {
  const classification = classifyInternationalV9_6_2(item);
  const geography = item.canonical_relevant === true
    ? "UK"
    : classification?.region === "INTERNATIONAL_OTHER" ? "INTERNATIONAL" : classification?.region || "DISCOVERY";
  const technology = cleanToken(item.canonical_technology || item.technology, "RENEWABLES");
  const event = cleanToken(item.event, "PROJECT UPDATE");
  const repdRef = String(item.repd_ref || "");
  const projectId = repdRef && item.gg_project_id === `GG2050-REPD-${repdRef}` ? item.gg_project_id : "";
  const url = safeUrl(item.url);
  return {
    role: projectId && item.role === "PRIMARY_MATCH" ? "PRIMARY_MATCH" : "ABSTAIN",
    eligible_for_news_signal: Boolean(projectId && item.eligible_for_news_signal === true),
    canonical_relevant: Boolean(projectId && item.canonical_relevant === true),
    repd_ref: projectId ? repdRef : null,
    gg_project_id: projectId || null,
    canonical_project: projectId || "ABSTAIN",
    project: projectId || "ABSTAIN",
    operator: "",
    canonical_technology: technology,
    technology,
    event,
    published: /^\d{4}-\d{2}-\d{2}$/u.test(String(item.published || "")) ? item.published : "",
    confidence: Number(item.confidence || 0),
    canonical_capacity_mw: Number(item.canonical_capacity_mw || 0),
    capacity_mw: Number(item.canonical_capacity_mw || item.capacity_mw || 0),
    headline: `${geography} · ${technology} · ${event} · ${projectId || "ABSTAIN"}`,
    source: new URL(url).hostname,
    url,
  };
};

const allItems = source.all_items.map(safeItem);
const canonicalItems = allItems.filter((item) => item.canonical_relevant === true);
const output = {
  schema: "globalgrid2050.major-project-news.v9.5.1",
  release: "9.5.1",
  updated: source.updated,
  all_headline_count: allItems.length,
  relevant_headline_count: canonicalItems.length,
  v9_4_baseline_headline_count: 125,
  v6_canonical_headline_count: source.v6_canonical_headline_count,
  v5_revalidated_primary_count: source.v5_revalidated_primary_count,
  privacy: {
    raw_headlines_published: false,
    raw_project_labels_published: false,
    operator_labels_published: false,
    individual_people_names_published: false,
    source_links_reduced_to_origins: true,
  },
  beacon_fen_contract: {
    repd_ref: "13599",
    gg_project_id: "GG2050-REPD-13599",
    official_capacity_mw: 400,
  },
  canonical_items: canonicalItems,
  all_items: allItems,
};

assert.equal(allItems.length, 133);
assert.equal(canonicalItems.length, 45);
assert.deepEqual(regionalCountsV9_6_2(allItems), { international: 19, us: 4, europe: 9, other: 6 });
assert.ok(canonicalItems.some((item) => item.repd_ref === "13599"));
assert.ok(allItems.every((item) => item.operator === "" && !item.headline.includes("undefined")));
await writeFile(path, `${JSON.stringify(output, null, 2)}\n`);
console.log("PASS privacy-safe V9.6.2 newspaper: 133 total · 45 UK · 19 international");

Compare V9 6 2 to Compiled

A JavaScript module in the atman folder of PipelineNews that compares module (`compareModule`) and style (`compareStyle`), using SHA-256. It compares module (`compareModule`) and compares style (`compareStyle`).

storagepipelinenews / atman/202608261830-compare-v9-6-2-to-compiled.mjs · lines 1–176 of 176 · version 2026-08-26 18:30 · Not reached from any entry point (candidate for review) · pattern exists (shared by 14 files)

What it does
It loads data. Defines digest, exists, compareModule, compareStyle, main. Uses libraries node:assert/strict, node:crypto, node:child_process, node:fs/promises, node:path. Side effects: reads or writes files; starts processes.
Why it exists in the grid workflow
Domain stage upstream_foresight (repository name word 'pipelinenews'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
Inputs & outputs
In: command-line arguments.
What it achieves
Defines `digest`, `exists`, `compareModule` and 1 more.
Why it matters
No other file in the estate was found to import it.
Application
pipelinenews · atman · JavaScript module
Uses
Compile Index (script call), JavaScript News Regions (script call), JavaScript Canonical Projects V9 5 1 (script call), JavaScript Newspaper V9 5 1 (script call), JavaScript Newspaper V9 6 2 (script call), JavaScript Projects V9 5 1 (script call), JavaScript App V9 6 2 (script call), node:assert/strict, node:crypto, node:child_process, node:fs/promises, node:path, node:url
Used by
none found
Produces
digest, exists, compareModule, compareStyle, main
Defines here
digest, exists, compareModule, compareStyle, main
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 atman/202608261830-compare-v9-6-2-to-compiled.mjs:1-176 · blob ab23308abbc8158d8f48f058b9f2609ef5f6b5ab · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem, process · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { execFileSync } from "node:child_process";
import { access, readFile, writeFile } from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";

const ATMAN_GENERATION = "202608261830";
const REPOSITORY_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const TRUSTED_ROOT = path.resolve(
  REPOSITORY_ROOT,
  process.env.PIPELINENEWS_TRUSTED_ROOT
    || "../estate/globalgrid2050/uk_renewables_pipeline/v9.6.2",
);
const COMPILER = "index/202608261812-compile-index.mjs";
const COMPILED_RELEASE = "releases/202608261812-index";
const REPORT = `atman/${ATMAN_GENERATION}-precision-report.json`;

const MODULES = Object.freeze([
  ["scripts/core/plugin-host.js", "ui/javascript/202608261557-startplugins.js", []],
  ["scripts/core/utils.js", "ui/javascript/202608261630-utils.js", []],
  ["scripts/core/state.js", "ui/javascript/202608261632-state.js", []],
  ["scripts/core/project-filter-v9-2.js", "ui/javascript/202608261640-filters.js", []],
  ["scripts/plugins/capacity-presentation-v9-3.js", "ui/javascript/202608261723-capacity-presentation.js", []],
  ["scripts/plugins/gauges-v9-2.js", "ui/javascript/202608261725-gauges.js", []],
  ["scripts/core/news-regions-v9-6-2.js", "ui/javascript/202608261742-news-regions.js", [
    ["./utils.js", "./202608261630-utils.js"],
  ]],
  ["scripts/data/canonical-projects-v9-1.js", "ui/javascript/202608261752-canonical-projects-v9-1.js", []],
  ["scripts/data/canonical-projects-v9-5-1.js", "ui/javascript/202608261754-canonical-projects-v9-5-1.js", [
    ["./canonical-projects-v9-1.js", "./202608261752-canonical-projects-v9-1.js"],
  ]],
  ["scripts/plugins/newspaper-v9-5-1.js", "ui/javascript/202608261755-newspaper-v9-5-1.js", [
    ["../core/state.js", "./202608261632-state.js"],
    ["../core/utils.js", "./202608261630-utils.js"],
  ]],
  ["scripts/plugins/newspaper-v9-6-2.js", "ui/javascript/202608261802-newspaper-v9-6-2.js", [
    ["../core/state.js", "./202608261632-state.js"],
    ["../core/utils.js", "./202608261630-utils.js"],
    ["../core/news-regions-v9-6-2.js", "./202608261742-news-regions.js"],
    ["./newspaper-v9-5-1.js", "./202608261755-newspaper-v9-5-1.js"],
  ]],
  ["scripts/plugins/projects-v9-5-1.js", "ui/javascript/202608261804-projects-v9-5-1.js", [
    ["../core/utils.js", "./202608261630-utils.js"],
    ["../core/state.js", "./202608261632-state.js"],
    ["../core/project-filter-v9-2.js", "./202608261640-filters.js"],
    ["../data/canonical-projects-v9-5-1.js", "./202608261754-canonical-projects-v9-5-1.js"],
    ["./gauges-v9-2.js", "./202608261725-gauges.js"],
    ["./newspaper-v9-5-1.js", "./202608261755-newspaper-v9-5-1.js"],
  ]],
  ["scripts/app-v9-6-2.js", "ui/javascript/202608261806-app-v9-6-2.js", [
    ["./plugins/gauges-v9-2.js", "./202608261725-gauges.js"],
    ["./plugins/newspaper-v9-6-2.js", "./202608261802-newspaper-v9-6-2.js"],
    ["./plugins/projects-v9-5-1.js", "./202608261804-projects-v9-5-1.js"],
    ["./core/plugin-host.js", "./202608261557-startplugins.js"],
  ]],
]);

const STYLES = Object.freeze([
  ["styles/mobile.css", "ui/styles/202608261614-mobile.css"],
  ["styles/v7.css", "ui/styles/202608261740-v7-foundation.css"],
]);

const MISSING_STYLES = Object.freeze([
  "styles/v9-3.css",
  "styles/v9-4.css",
  "styles/v9-5-1.css",
  "styles/v9-6-1.css",
]);

function digest(bytes) {
  return createHash("sha256").update(bytes).digest("hex");
}

async function exists(absolutePath) {
  try {
    await access(absolutePath);
    return true;
  } catch {
    return false;
  }
}

async function compareModule([trustedPath, modularPath, replacements]) {
  const trusted = await readFile(path.join(TRUSTED_ROOT, trustedPath), "utf8");
  const modular = await readFile(path.join(REPOSITORY_ROOT, modularPath), "utf8");
  let expected = trusted;
  for (const [from, to] of replacements) {
    assert.equal(expected.split(from).length - 1, 1, `${trustedPath} must contain one ${from}`);
    expected = expected.replace(from, to);
  }
  assert.equal(modular, expected, `${modularPath} differs beyond declared import rewrites`);
  return {
    trusted: trustedPath,
    modular: modularPath,
    status: replacements.length ? "IMPORT_REWRITTEN_EXACT" : "BYTE_EXACT",
    import_rewrites: replacements.length,
    trusted_sha256: digest(trusted),
    modular_sha256: digest(modular),
  };
}

async function compareStyle([trustedPath, modularPath]) {
  const trusted = await readFile(path.join(TRUSTED_ROOT, trustedPath));
  const modular = await readFile(path.join(REPOSITORY_ROOT, modularPath));
  assert.deepEqual(modular, trusted, `${modularPath} is not byte-exact`);
  return {
    trusted: trustedPath,
    modular: modularPath,
    status: "BYTE_EXACT",
    sha256: digest(trusted),
  };
}

async function main() {
  assert.equal(path.basename(fileURLToPath(import.meta.url)), `${ATMAN_GENERATION}-compare-v9-6-2-to-compiled.mjs`);
  assert.equal(await exists(path.join(TRUSTED_ROOT, "index.html")), true, "trusted V9.6.2 source is unavailable");

  const modules = [];
  for (const specification of MODULES) modules.push(await compareModule(specification));
  const styles = [];
  for (const specification of STYLES) styles.push(await compareStyle(specification));

  const compilerReport = JSON.parse(execFileSync(
    process.execPath,
    [path.join(REPOSITORY_ROOT, COMPILER), "--modules"],
    { encoding: "utf8" },
  ));
  const compiledReleasePresent = await exists(path.join(REPOSITORY_ROOT, COMPILED_RELEASE));
  const status = compiledReleasePresent
    ? "COMPILED_RELEASE_PRESENT_REQUIRES_BROWSER_PARITY"
    : "INCOMPLETE_NO_COMPILED_RELEASE";

  const report = {
    schema: "pipelinenews.atman-precision-report.v1",
    atman_generation: ATMAN_GENERATION,
    trusted_release: "V9.6.2",
    compiler_generation: compilerReport.generation,
    status,
    conclusion: compiledReleasePresent
      ? "A compiled release exists but visual and browser parity remain unproved."
      : "No compiled release exists. The modular JavaScript is faithful, but V9.6.2 parity cannot yet be claimed.",
    comparison: {
      javascript: {
        trusted_total: MODULES.length,
        matched_total: modules.length,
        modules,
      },
      styles: {
        trusted_total: STYLES.length + MISSING_STYLES.length,
        matched_total: styles.length,
        matched: styles,
        missing: MISSING_STYLES,
      },
      compiler_assets: {
        resolved_total: compilerReport.assets.resolved.length,
        missing_total: compilerReport.assets.missing.length,
        missing: compilerReport.assets.missing,
        ambiguous: compilerReport.assets.ambiguous,
      },
      compiled_release: {
        path: COMPILED_RELEASE,
        present: compiledReleasePresent,
      },
    },
  };

  const serialised = `${JSON.stringify(report, null, 2)}\n`;
  if (process.argv.includes("--stdout")) process.stdout.write(serialised);
  else await writeFile(path.join(REPOSITORY_ROOT, REPORT), serialised, { flag: "wx" });
}

main().catch((error) => {
  process.stderr.write(`${error.stack || error.message}\n`);
  process.exitCode = 1;
});

Browser Proof

A JavaScript module in the atman folder of PipelineNews that caches busted URL (`cacheBustedUrl`), covering the Renewable Energy Planning Database (REPD) register.

renderpipelinenews / atman/202608262014-browser-proof.mjs · lines 1–194 of 194 · version 2026-08-26 20:14 · Entry point · pattern pageAt (shared by 5 files)

What it does
It draws the REPD register. Defines cacheBustedUrl, pageAt, isFavicon, clickNewsCount, clickTechnologyCount. Uses libraries node:assert/strict, node:fs/promises, playwright. Side effects: changes the web page (DOM); reads or writes files.
Why it exists in the grid workflow
Domain stage upstream_foresight (repository name word 'pipelinenews'): 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
Out: JSON file browser-proof.json.
Downstream impact
Used directly by 1 file: PipelineNews Pages V2 Workflow (pipelinenews). Reached from 1 other entry point, including PipelineNews Pages Workflow (pipelinenews).
What it achieves
It caches busted URL (`cacheBustedUrl`) and is built from the page at helper (`pageAt`) and the is favicon helper (`isFavicon`). Defines `cacheBustedUrl`, `pageAt`, `isFavicon` and 2 more.
Why it matters
Run by PipelineNews Pages V2 Workflow.
Application
pipelinenews · atman · JavaScript module
Uses
node:assert/strict, node:fs/promises, playwright
Used by
run by PipelineNews Pages V2 Workflow (workflow run)
Produces
cacheBustedUrl, pageAt, isFavicon, clickNewsCount, clickTechnologyCount
Defines here
cacheBustedUrl, pageAt, isFavicon, clickNewsCount, clickTechnologyCount
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 atman/202608262014-browser-proof.mjs:1-194 · blob 2c0b0ebbaa2129b9c169f4de73b420c6bbaeedb4 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
import assert from "node:assert/strict";
import { mkdir, writeFile } from "node:fs/promises";
import { chromium } from "playwright";

const generation = process.env.PIPELINENEWS_GENERATION || "202608261927";
const pageUrl = process.env.PIPELINENEWS_PAGE_URL
  || `http://127.0.0.1:4173/releases/${generation}-index.html`;
const evidenceDir = process.env.PIPELINENEWS_EVIDENCE_DIR || "/tmp/pipelinenews-browser-proof";
const deployment = process.env.PIPELINENEWS_DEPLOY_SHA || "local-preview";
await mkdir(evidenceDir, { recursive: true });

function cacheBustedUrl() {
  const target = new URL(pageUrl);
  target.searchParams.set("deployment", deployment);
  return target.href;
}

async function pageAt(browser, width) {
  const context = await browser.newContext({
    viewport: { width, height: width < 800 ? 1000 : 1100 },
    acceptDownloads: true,
  });
  const page = await context.newPage();
  const errors = [];
  const isFavicon = (url) => new URL(url).pathname.endsWith("/favicon.ico");
  page.on("console", (message) => {
    if (message.type() === "error") errors.push(`console: ${message.text()}`);
  });
  page.on("pageerror", (error) => errors.push(`page: ${error.message}`));
  page.on("requestfailed", (request) => {
    if (!isFavicon(request.url())) errors.push(`request: ${request.url()} ${request.failure()?.errorText || "failed"}`);
  });
  page.on("response", (response) => {
    if (response.status() >= 400 && !isFavicon(response.url())) errors.push(`response: ${response.status()} ${response.url()}`);
  });
  const response = await page.goto(cacheBustedUrl(), { waitUntil: "domcontentloaded", timeout: 120_000 });
  assert.ok(response?.ok(), `page returned HTTP ${response?.status()}`);
  await page.waitForFunction(
    () => document.querySelectorAll("#tbody tr").length === 7680
      && document.querySelectorAll("#stories .story").length === 133,
    null,
    { timeout: 120_000 },
  );
  return { context, page, errors };
}

async function clickNewsCount(page, mode) {
  await page.locator(`button[data-news="${mode}"]`).click();
  await page.waitForFunction(() => !document.querySelector("#stories .news-empty"));
  return page.locator("#stories .story").count();
}

async function clickTechnologyCount(page, technology, expected) {
  await page.locator(`button[data-technology="${technology}"]`).click();
  await page.waitForFunction(
    (count) => document.querySelectorAll("#tbody tr").length === count,
    expected,
  );
  assert.equal(await page.locator("#tbody tr").count(), expected);
}

const browser = await chromium.launch({ headless: true });
try {
  const desktop = await pageAt(browser, 1440);
  const page = desktop.page;
  assert.equal(await page.locator("#tbody tr").count(), 7680);
  assert.equal(await page.locator("#v1").innerText(), "356,474");
  assert.equal(await page.locator("#v2").innerText(), "7,680");
  assert.equal(await page.locator("#v3").innerText(), "4,100");
  assert.equal(await page.locator("#stories .story").count(), 133);
  assert.equal(await page.locator("thead th").count(), 11);
  assert.match(await page.locator("#newsMeta").innerText(), /45 UK · 19 international \(4 US · 9 Europe · 6 other\) · 133 headlines/i);

  assert.equal(await clickNewsCount(page, "UK"), 45);
  const uk = await page.locator("#stories").innerText();
  assert.match(uk, /Beacon Fen Energy Park development consent decision announced/);
  assert.doesNotMatch(uk, /New Jersey/);

  assert.equal(await clickNewsCount(page, "INTERNATIONAL"), 19);
  const international = await page.locator("#stories").innerText();
  assert.match(international, /New Jersey/);
  assert.match(international, /County Kerry, Ireland/);
  assert.match(international, /Australia/);
  assert.doesNotMatch(international, /Kintore/);

  assert.equal(await clickNewsCount(page, "US"), 4);
  assert.match(await page.locator("#stories").innerText(), /New Jersey/);
  assert.equal(await clickNewsCount(page, "EUROPE"), 9);
  assert.match(await page.locator("#stories").innerText(), /County Kerry, Ireland/);

  await clickTechnologyCount(page, "solar", 3563);
  await clickTechnologyCount(page, "bess", 1609);
  await clickTechnologyCount(page, "wind_onshore", 2399);
  await clickTechnologyCount(page, "wind_offshore", 109);
  await page.locator("#clearFilters").click();
  await page.waitForFunction(() => document.querySelectorAll("#tbody tr").length === 7680);

  await page.locator("#search").fill("GG2050-REPD-17494");
  await page.waitForFunction(() => document.querySelectorAll("#tbody tr").length === 1);
  assert.equal(await page.locator("#tbody tr").count(), 1);
  await page.locator("#clearFilters").click();
  await page.waitForFunction(() => document.querySelectorAll("#tbody tr").length === 7680);
  await page.locator("#sortProjects").selectOption("updated_asc");
  const sortedDates = await page.locator("#tbody tr").evaluateAll((rows) => rows
    .map((row) => row.dataset.repdUpdated)
    .filter(Boolean));
  assert.ok(sortedDates.length > 1);
  assert.ok(sortedDates.every((value, index) => index === 0 || sortedDates[index - 1] <= value));
  assert.equal(await page.locator("#repdUpdatedHeader").getAttribute("aria-sort"), "ascending");
  const [year, month, day] = sortedDates[0].split("-");
  assert.equal(await page.locator("#tbody tr").first().locator("td").nth(8).innerText(), `${day}/${month}/${year}`);

  const [download] = await Promise.all([
    page.waitForEvent("download"),
    page.locator("#exportInline").click(),
  ]);
  const stream = await download.createReadStream();
  let csv = "";
  for await (const chunk of stream) csv += chunk;
  assert.match(csv, /"Site Name","REPD Ref","GlobalGrid Project ID"/);
  assert.match(csv, /GG2050-REPD-17494/);
  assert.ok(await page.locator("a.atlaslink").first().getAttribute("href"));
  await page.evaluate(() => window.scrollTo(0, 0));
  await page.screenshot({ path: `${evidenceDir}/desktop.png` });
  assert.deepEqual(desktop.errors, []);
  await desktop.context.close();

  for (const width of [390, 430, 440, 768]) {
    const mobile = await pageAt(browser, width);
    const layout = await mobile.page.evaluate(() => {
      const wrap = document.querySelector(".tablewrap");
      const table = wrap.querySelector("table");
      return {
        clientWidth: document.documentElement.clientWidth,
        scrollWidth: document.documentElement.scrollWidth,
        wrapClientWidth: wrap.clientWidth,
        wrapScrollWidth: wrap.scrollWidth,
        overflowX: getComputedStyle(wrap).overflowX,
        tableDisplay: getComputedStyle(table).display,
        columns: table.tHead.rows[0].cells.length,
        displays: [...table.tHead.rows[0].cells].map((cell) => getComputedStyle(cell).display),
      };
    });
    assert.ok(layout.scrollWidth <= layout.clientWidth, `${width}px document overflow`);
    assert.equal(layout.overflowX, "auto");
    assert.ok(layout.wrapScrollWidth > layout.wrapClientWidth, `${width}px table is not horizontally scrollable`);
    assert.equal(layout.tableDisplay, "table");
    assert.equal(layout.columns, 11);
    assert.ok(layout.displays.every((display) => display === "table-cell"));
    assert.equal(await clickNewsCount(mobile.page, "INTERNATIONAL"), 19);
    assert.deepEqual(mobile.errors, []);
    if (width === 390) {
      await mobile.page.screenshot({ path: `${evidenceDir}/mobile-390.png` });
    }
    await mobile.context.close();
  }

  const failContext = await browser.newContext({ viewport: { width: 390, height: 844 } });
  const failClosed = await failContext.newPage();
  let failedNewsRequests = 0;
  await failClosed.route("**/data/news/*-major-project-news-v9-5-1.json*", (route) => {
    failedNewsRequests += 1;
    return route.fulfill({
      status: 503,
      contentType: "application/json",
      body: "{}",
    });
  });
  await failClosed.goto(cacheBustedUrl(), { waitUntil: "domcontentloaded", timeout: 120_000 });
  await failClosed.waitForFunction(() => document.querySelectorAll("#tbody tr").length === 7680, null, { timeout: 120_000 });
  assert.equal(await failClosed.locator("#tbody tr").count(), 7680);
  assert.equal(failedNewsRequests, 1, "expected to intercept exactly one immutable news payload request");
  assert.match(await failClosed.locator("#stories").innerText(), /unavailable|No location-verified|No headlines match/i);
  await failClosed.screenshot({ path: `${evidenceDir}/mobile-390-fail-closed.png` });
  await failContext.close();

  await writeFile(`${evidenceDir}/browser-proof.json`, `${JSON.stringify({
    schema: "pipelinenews.browser-proof.v1",
    status: "PASS",
    generation,
    page_url: pageUrl,
    deployment,
    projects: 7680,
    headlines: 133,
    uk_headlines: 45,
    international_headlines: 19,
    widths: [1440, 390, 430, 440, 768],
    fail_closed_news: true,
  }, null, 2)}\n`);
} finally {
  await browser.close();
}

console.log("PIPELINENEWS V9.6.2 BROWSER PROOF: PASS · desktop · 390/430/440/768 · interactions · fail-closed");