In this section
- Build Cumulative Intelligence storage · pipelinenews / archive/202608261547-pipelinenews/newsv7/scripts/build-cumulative-intelligence.mjs lines 1–207
- Canonical Projects News v7 Release automation · pipelinenews / archive/202608261547-pipelinenews/newsv7/scripts/data/canonical-projects-newsv7-release.js lines 1–34
- Canonical Projects News v7 render · pipelinenews / archive/202608261547-pipelinenews/newsv7/scripts/data/canonical-projects-newsv7.js lines 1–129
- Gauges V9 2 render · pipelinenews / archive/202608261547-pipelinenews/newsv7/scripts/plugins/gauges-v9-2.js lines 1–94
- Intelligence News v7 render · pipelinenews / archive/202608261547-pipelinenews/newsv7/scripts/plugins/intelligence-newsv7.js lines 1–111
Build Cumulative Intelligence
A JavaScript module in the scripts folder of PipelineNews that reads major project news, material event assertions and organisation role evidence, using SHA-256.
storagepipelinenews / archive/202608261547-pipelinenews/newsv7/scripts/build-cumulative-intelligence.mjs · lines 1–207 of 207 · version 2026-08-26 15:47 · Not reached from any entry point (candidate for review) · pattern readPinned (shared by 12 files)
- What it does
- It loads major project news, material event assertions and organisation role evidence. Defines sha256, invariant, readPinned, uniqueMap. Uses libraries node:crypto, node:fs/promises. Side effects: reads or writes files; uses storage (browser storage, DuckDB or Parquet).
- 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. README: "The cumulative product is generated deterministically by `scripts/build-cumulative-intelligence.mjs`."
- Inputs & outputs
- In: JSON file cumulative_intelligence.json; JSON file build_manifest.json; JSON file major_project_news_v9_5_1.json; JSON file material_event_assertions.json; JSON file organisation_role_evidence.json; JSON file source_health_context.json; JSON file reason_decision_ledger.json; JSON file data_centre_evidence.json.
- What it achieves
- It reads pinned (`readPinned`) and is built from the sha256 step (`sha256`) and the invariant step (`invariant`). The README says: The cumulative product is generated deterministically by `scripts/build-cumulative-intelligence.mjs`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- pipelinenews · archive/202608261547-pipelinenews/newsv7/scripts · JavaScript module
- Uses
- node:crypto, node:fs/promises
- Used by
- none found
- Produces
- sha256, invariant, readPinned, uniqueMap
- Defines here
- sha256, invariant, readPinned, uniqueMap
- 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/newsv7/scripts/build-cumulative-intelligence.mjs:1-207 · blob 687fc84a7cde220d842820544742d76b8365522e · GitHub at these lines
- State
- achieves: readme · context: readme_derived · stage: output · effects: filesystem, storage · domain stage: experimental · users: none · canonical: unreached_review
import { createHash } from "node:crypto";
import { readFile, writeFile } from "node:fs/promises";
const repository = new URL("../../", import.meta.url);
const outputPath = "newsv7/data/newsv7/cumulative_intelligence.json";
const manifestPath = "newsv7/data/newsv7/build_manifest.json";
const generatedAt = "2026-08-25T00:00:00Z";
const INPUTS = Object.freeze({
feed: ["newsv1/dist/major_project_news_v9_5_1.json", "cea104c3e9cfc07971680afdf5f64073e1d4825b63bfaf4e969266df8386ebbd"],
events: ["newsv2/data/material_event_assertions.json", "329ae3cdbecfaa486bfca435100604aae08e2be14f2732ad2da78ad075304e31"],
organisations: ["newsv3/data/organisation_role_evidence.json", "03a258e0b90c1d95e8a8582ff203676651bfc7d5cd33f8652aef17ddfc04da75"],
sourceHealth: ["newsv4/data/source_health_context.json", "5aa7f2bef3d99d2cc50c81695da406ccdd3f315c88237ecf0de2c0568deefd0d"],
reasons: ["newsv5/data/reason_decision_ledger.json", "fbce604f865341391316917cb14d6319f8b1fdbb503a971a19a7c7d0ecfec06a"],
dataCentres: ["newsv6/data/data_centre_evidence.json", "e5e984f763877f41fef5c39bce248ee74bb9f22706c87cd51d6fd2a2ce9cd5d5"],
parquetManifest: ["analytics_v1/data/parquet_manifest.json", "9ac1f894c9b1d7d51ea4d68cc35f8de0ad6fd4ac02b5b2b13b83d1c1dd69a91e"],
parquetAudit: ["analytics_v1/reports/parquet_audit.json", "2c2af8a38bcb9b6ce4127835b4e005a1dc22d097f2dd21b64c036b7ca38115be"],
consumerOverlay: ["consumer_v1/data/intelligence_overlay.json", "f9da6cc8b98a173abef7cf264b1f3a007ff3d2659beab281fbe535a207501bc9"],
interfaceGuard: ["consumer_v1/data/interface_guard.json", "6e570295f19a4fa1ea1c6731d372f25f9545940900acbfc1a6fa7a6ac91a8f11"],
});
function sha256(value) {
return createHash("sha256").update(value).digest("hex");
}
function invariant(condition, message) {
if (!condition) throw new Error(`NewsV7 cumulative build: ${message}`);
}
async function readPinned([path, expectedSha256]) {
const bytes = await readFile(new URL(path, repository));
const actualSha256 = sha256(bytes);
invariant(actualSha256 === expectedSha256, `${path} provenance mismatch`);
return { path, sha256: actualSha256, data: JSON.parse(bytes.toString("utf8")) };
}
function uniqueMap(rows, key, label) {
const map = new Map();
for (const row of rows) {
const value = row[key];
invariant(value, `${label} has a null key`);
invariant(!map.has(value), `${label} duplicate key ${value}`);
map.set(value, row);
}
return map;
}
const loaded = Object.fromEntries(await Promise.all(Object.entries(INPUTS).map(async ([name, input]) => [name, await readPinned(input)])));
const feed = loaded.feed.data;
const events = loaded.events.data;
const organisations = loaded.organisations.data;
const sourceHealth = loaded.sourceHealth.data;
const reasons = loaded.reasons.data;
const dataCentres = loaded.dataCentres.data;
const parquetManifest = loaded.parquetManifest.data;
const parquetAudit = loaded.parquetAudit.data;
const consumerOverlay = loaded.consumerOverlay.data;
const interfaceGuard = loaded.interfaceGuard.data;
invariant(feed.schema === "globalgrid2050.major-project-news.v9.5.1" && feed.all_headline_count === 133, "V9.7 headline baseline mismatch");
invariant(feed.relevant_headline_count === 45 && feed.beacon_fen_contract?.repd_ref === "13599", "UK headline or Beacon Fen baseline mismatch");
invariant(events.schema === "pipelinenews.material-event-assertions.v1" && events.assertions.length === 45, "NewsV2 event law mismatch");
invariant(organisations.counts?.organisation_labels === 28 && organisations.counts?.project_operator_role_assertions === 29, "NewsV3 organisation law mismatch");
invariant(organisations.counts?.transaction_role_decisions === 45, "NewsV3 abstention law mismatch");
invariant(sourceHealth.counts?.rows === 6 && sourceHealth.counts?.status?.CURRENT === 0, "NewsV4 source-health law mismatch");
invariant(reasons.counts?.rows === 45 && reasons.counts?.decisions?.HOLD_FOR_VERIFICATION === 45, "NewsV5 reason law mismatch");
invariant(reasons.counts?.decisions?.PUBLISH_REASON_TO_RESEARCH === 0, "unsupported NewsV5 reason became publishable");
invariant(dataCentres.counts?.sources === 6 && dataCentres.counts?.observations === 2, "NewsV6 data-centre law mismatch");
invariant(dataCentres.counts?.link_decisions === 2 && dataCentres.counts?.linked === 0, "NewsV6 identity boundary mismatch");
invariant(parquetManifest.schema === "pipelinenews.parquet-release-manifest.v1" && parquetManifest.status === "CANDIDATE", "AnalyticsV1 manifest mismatch");
invariant(parquetAudit.status === "PASS" && parquetAudit.counts?.tables === 9 && parquetAudit.counts?.source_rows === 208, "AnalyticsV1 physical audit mismatch");
invariant(parquetAudit.counts?.parquet_rows === 208 && parquetAudit.counts?.duplicate_key_groups === 0 && parquetAudit.counts?.required_null_key_rows === 0, "AnalyticsV1 keyed readback mismatch");
invariant(parquetAudit.counts?.schema_mismatches === 0 && parquetAudit.counts?.duckdb_view_mismatches === 0, "AnalyticsV1 schema or view mismatch");
invariant(parquetAudit.counts?.cross_domain_identity_links === 0, "AnalyticsV1 cross-domain leakage");
invariant(consumerOverlay.counts?.reasons_to_research === 0 && consumerOverlay.counts?.data_centre_observations === 2, "ConsumerV1 projection mismatch");
invariant(interfaceGuard.status === "PASS" && interfaceGuard.beacon_fen?.repd_ref === "13599", "ConsumerV1 interface guard mismatch");
invariant(interfaceGuard.interface?.project_table_columns === 11 && interfaceGuard.interface?.mobile_horizontal_scroll === true, "ConsumerV1 interface law mismatch");
const transactionByEvent = uniqueMap(organisations.transaction_role_decisions, "event_assertion_id", "transaction role decision");
const reasonByEvent = uniqueMap(reasons.reason_decisions, "event_assertion_id", "reason decision");
const roleRowsByRepd = new Map();
for (const role of organisations.project_operator_role_assertions) {
const rows = roleRowsByRepd.get(role.repd_ref) || [];
rows.push(role);
roleRowsByRepd.set(role.repd_ref, rows);
}
const articleIds = new Set();
const eventIntelligence = [...events.assertions]
.sort((left, right) => left.display_order - right.display_order)
.map((event, index) => {
invariant(event.display_order === index + 1, `event display order gap at ${index + 1}`);
invariant(!articleIds.has(event.article_id), `duplicate article ${event.article_id}`);
articleIds.add(event.article_id);
invariant(event.identity?.role === "PRIMARY_MATCH" && event.identity?.eligible_for_news_signal === true, `non-canonical event ${event.assertion_id}`);
invariant(event.claim?.verification_status === "HEADLINE_DERIVED_UNVERIFIED", `event verification drift ${event.assertion_id}`);
const transaction = transactionByEvent.get(event.assertion_id);
const reason = reasonByEvent.get(event.assertion_id);
invariant(transaction?.decision === "ABSTAIN_NO_DIRECT_ROLE_EVIDENCE", `transaction role drift ${event.assertion_id}`);
invariant(Object.values(transaction.roles).every((value) => value === null), `commercial role leakage ${event.assertion_id}`);
invariant(reason?.decision === "HOLD_FOR_VERIFICATION" && reason?.protections?.opportunity_claimed === false, `reason gate drift ${event.assertion_id}`);
const operatorRows = roleRowsByRepd.get(event.repd_ref) || [];
invariant(operatorRows.length >= 1, `missing REPD operator evidence ${event.repd_ref}`);
return {
display_order: event.display_order,
article_id: event.article_id,
event_assertion_id: event.assertion_id,
repd_ref: event.repd_ref,
project_id: event.project_id,
event_type: event.event_type,
event_claim_status: event.claim.verification_status,
event_evidence_class: event.claim.evidence_class,
identity_confidence: event.identity.confidence,
operator_labels: operatorRows.map((row) => ({
source_label: row.source_label,
claim_class: row.claim_class,
verification_status: row.verification_status,
})),
transaction_role_decision: transaction.decision,
research_decision: reason.decision,
research_capability: reason.capability,
publishable_reason: false,
};
});
invariant(eventIntelligence.length === 45 && eventIntelligence.some((row) => row.repd_ref === "13599"), "event projection count or Beacon Fen mismatch");
invariant(!eventIntelligence.some((row) => row.repd_ref === "13600"), "Beacon Fen leaked to forbidden BESS sibling");
const sourceHashes = Object.fromEntries(Object.entries(loaded).map(([name, value]) => [name, { path: value.path, sha256: value.sha256 }]));
const output = {
schema: "pipelinenews.cumulative-intelligence.newsv7.v1",
release: "newsv7",
status: "CANDIDATE",
generated_at: generatedAt,
baseline: {
release: "GlobalGrid V9.7 via frozen NewsV1 runtime",
source_commit: "824a23cd0cf9f90a9df942f1b37a09c2dc6472b7",
source_subtree: "4fca94ede95789ade9490258a2323c00c13ec2ea",
project_count: 7680,
capacity_mw: 356474.09,
all_headlines: 133,
uk_headlines: 45,
international_headlines: 19,
beacon_fen_repd_ref: "13599",
},
counts: {
material_event_assertions: 45,
organisation_labels: 28,
project_operator_role_assertions: 29,
transaction_role_abstentions: 45,
source_health_decisions: 6,
current_context_sources: 0,
publishable_reasons: 0,
held_reasons: 45,
data_centre_sources: 6,
data_centre_observations: 2,
data_centre_link_decisions: 2,
renewable_data_centre_identity_links: 0,
parquet_tables: 9,
parquet_rows: 208,
},
source_hashes: sourceHashes,
event_intelligence: eventIntelligence,
source_health: sourceHealth.decisions,
data_centres: {
sources: dataCentres.sources,
observations: dataCentres.observations,
link_decisions: dataCentres.link_decisions,
},
publication_law: {
official_repd_facts_changed: false,
headline_order_changed: false,
event_claims_remain_unverified: true,
commercial_roles_published: false,
opportunity_claims_published: false,
stale_context_used_as_event_proof: false,
data_centres_linked_to_renewable_projects: false,
},
};
const outputBytes = Buffer.from(`${JSON.stringify(output, null, 2)}\n`);
await writeFile(new URL(outputPath, repository), outputBytes);
const manifest = {
schema: "pipelinenews.newsv7-build-manifest.v1",
release: "newsv7",
status: "PASS",
generated_at: generatedAt,
source_hashes: sourceHashes,
output: {
path: outputPath,
sha256: sha256(outputBytes),
event_rows: eventIntelligence.length,
},
checks: {
baseline_counts_and_order: "PASS",
beacon_fen_13599_and_not_13600: "PASS",
keys_unique_and_non_null: "PASS",
commercial_roles_null: "PASS",
publishable_reasons_zero: "PASS",
current_context_sources_zero: "PASS",
cross_domain_identity_links_zero: "PASS",
analytics_physical_readback: "PASS",
},
};
await writeFile(new URL(manifestPath, repository), `${JSON.stringify(manifest, null, 2)}\n`);
console.log(`NewsV7 cumulative intelligence: PASS (${eventIntelligence.length} ordered event rows)`);Canonical Projects News v7 Release
A JavaScript module in the data folder of PipelineNews that fetches release newsv7. It fetches release (`fetchRelease`).
automationpipelinenews / archive/202608261547-pipelinenews/newsv7/scripts/data/canonical-projects-newsv7-release.js · lines 1–34 of 34 · version 2026-08-26 15:47 · pattern fetchRelease (shared by 9 files)
- What it does
- It fetches release newsv7. Defines invariant, fetchRelease, loadCanonicalProjectsNewsV7Release. Side effects: changes the web page (DOM); 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 release.newsv7.json.
- Downstream impact
- Used directly by 1 file: Projects News v7 (pipelinenews). Reached from 3 other entry points, including PipelineNews — News v7 Page (pipelinenews, https://ventusltd.github.io/pipelinenews/archive/202608261547-pipelinenews/newsv7/); PipelineNews — PipelineNews Page (pipelinenews, https://ventusltd.github.io/pipelinenews/archive/202608261547-pipelinenews/202608251651-PipelineNews/); App News v7 (pipelinenews).
- What it achieves
- Defines `invariant`, `fetchRelease` and `loadCanonicalProjectsNewsV7Release`.
- Why it matters
- Imported by Projects News v7.
- Application
- pipelinenews · archive/202608261547-pipelinenews/newsv7/scripts/data · JavaScript module
- Uses
- Canonical Projects News v7 (import)
- Used by
- imported by Projects News v7 (import)
- Produces
- loadCanonicalProjectsNewsV7Release
- Defines here
- invariant, fetchRelease, loadCanonicalProjectsNewsV7Release
- 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/newsv7/scripts/data/canonical-projects-newsv7-release.js:1-34 · blob b00ea6f875db8c94fe200edb71fe05ea85a81738 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, network · domain stage: experimental · users: none · canonical: production_core
import { loadCanonicalProjectsNewsV7 } from "./canonical-projects-newsv7.js";
const RELEASE_URL = "contracts/release.newsv7.json";
function invariant(condition, message) {
if (!condition) throw new Error(`News V7 canonical projects: ${message}`);
}
async function fetchRelease() {
const response = await fetch(RELEASE_URL, { cache: "default" });
invariant(response.ok, `${RELEASE_URL} returned HTTP ${response.status}`);
invariant(new URL(response.url).origin === window.location.origin, `${RELEASE_URL} redirected cross-origin`);
return response.json();
}
export async function loadCanonicalProjectsNewsV7Release({ onFirstPartition } = {}) {
const release = await fetchRelease();
invariant(release.release === "newsv7", "release contract mismatch");
invariant(release.frozen_source?.release === "9.7", "frozen-source release mismatch");
invariant(release.data_parent?.release === "9.1", "data-parent release mismatch");
const model = await loadCanonicalProjectsNewsV7({ onFirstPartition });
invariant(model.contract.release === "9.1", "canonical data contract mismatch");
invariant(model.projects.length === release.expected.project_count, "project count mismatch");
invariant(model.metadata.capacity_mw === release.expected.capacity_mw, "capacity mismatch");
invariant(model.metadata.largest_mw === release.expected.largest_mw, "largest project mismatch");
invariant(model.metadata.geometry_count === release.expected.valid_geometry_count, "valid geometry count mismatch");
invariant(model.metadata.missing_geometry_count === release.expected.missing_geometry_count, "missing geometry count mismatch");
return Object.freeze({
release: Object.freeze(release),
dataContract: model.contract,
metadata: Object.freeze({ ...model.metadata, ui_release: "newsv7" }),
projects: model.projects,
});
}Canonical Projects News v7
A JavaScript module in the data folder of PipelineNews that fetches solar, battery storage (BESS) and the Renewable Energy Planning Database (REPD) register.
Set aside from the main view: 98% of its lines are the same as archive/202608261547-pipelinenews/newsv1/scripts/data/canonical-projects-newsv1.js (pipelinenews), which stays. (near-copy-of, proposed by families.py). 98% of lines shared with Canonical Projects News v1; read that one first. All set-aside files, with reasons. Nothing was deleted.
Evidence
- line-jaccard 0.98 to pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 archive/202608261547-pipelinenews/newsv1/scripts/data/canonical-projects-newsv1.js:1-129 a381c1b4704865ea823a71c13b8de51837ba5a7a
- sha256 af4f4a36a4e9c018061ecc2f340a3a45ba370b6b9f51b6cfae13e8e1b6591cfb
- target sha256 5a4a9a87c2a682f22ec753bea1417d02b1becd57cac2c2afc0f2b7f0bcc727aa
- group of 2 (identity.json near-copy edges >= 0.9)
- canonical rule: reachable, newest stamp, core repo, most lines
renderpipelinenews / archive/202608261547-pipelinenews/newsv7/scripts/data/canonical-projects-newsv7.js · lines 1–129 of 129 · version 2026-08-26 15:47 · pattern loadCanonicalProjectsNews (shared by 2 files)
- What it does
- It fetches solar, battery storage (BESS) and the REPD register. Defines 10 functions or classes, including invariant, round2, fetchJson, mapWithConcurrency, worker. Side effects: changes the web page (DOM); 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. Domain terms in the code: solar, battery storage (BESS), the REPD register.
- Inputs & outputs
- In: JSON file release.v9.1.json; JSON file build_manifest.json.
- Downstream impact
- Used directly by 1 file: Canonical Projects News v7 Release (pipelinenews). Reached from 3 other entry points, including PipelineNews — News v7 Page (pipelinenews, https://ventusltd.github.io/pipelinenews/archive/202608261547-pipelinenews/newsv7/); PipelineNews — PipelineNews Page (pipelinenews, https://ventusltd.github.io/pipelinenews/archive/202608261547-pipelinenews/202608251651-PipelineNews/); App News v7 (pipelinenews).
- What it achieves
- It fetches JSON (`fetchJson`), maps concurrency (`mapWithConcurrency`) and validates partition (`validatePartition`). Defines `invariant`, `round2`, `fetchJson` and 7 more. Its code works with 1 MW.
- Why it matters
- Imported by Canonical Projects News v7 Release.
- Application
- pipelinenews · archive/202608261547-pipelinenews/newsv7/scripts/data · JavaScript module
- Uses
- none found
- Used by
- imported by Canonical Projects News v7 Release (import)
- Produces
- loadCanonicalProjectsNewsV7
- Defines here
- invariant, round2, fetchJson, mapWithConcurrency, worker, validatePartition, fetchPartition, validateProjects, loadCanonicalProjects, loadCanonicalProjectsNewsV7
- 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/newsv7/scripts/data/canonical-projects-newsv7.js:1-129 · blob ae0fe3fc29f014337a918b83d8ab091e488140d9 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, network · domain stage: experimental · users: none · canonical: production_core
const CONTRACT_URL = "contracts/release.v9.1.json";
const MANIFEST_URL = "data/v9.1/build_manifest.json";
const ALLOWED_TECHNOLOGIES = new Set(["solar", "bess", "wind_onshore", "wind_offshore"]);
const FETCH_CONCURRENCY = 4;
const FETCH_TIMEOUT_MS = 15000;
let canonicalLoadPromise = null;
function invariant(condition, message) {
if (!condition) throw new Error(`V9.1 canonical projects: ${message}`);
}
function round2(value) {
return Math.round((value + Number.EPSILON) * 100) / 100;
}
async function fetchJson(path) {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
try {
const response = await fetch(path, { cache: "default", signal: controller.signal });
invariant(response.ok, `${path} returned HTTP ${response.status}`);
invariant(new URL(response.url).origin === window.location.origin, `${path} redirected cross-origin`);
return await response.json();
} finally {
clearTimeout(timeout);
}
}
async function mapWithConcurrency(items, task) {
const output = new Array(items.length);
let next = 0;
async function worker() {
while (next < items.length) {
const index = next;
next += 1;
output[index] = await task(items[index], index);
}
}
await Promise.all(Array.from({ length: Math.min(FETCH_CONCURRENCY, items.length) }, worker));
return output;
}
function validatePartition(partition, part) {
invariant(part.schema === "globalgrid2050.v9.project-partition.v9.1", `${partition.path} schema mismatch`);
invariant(part.record_count === partition.record_count && part.projects.length === partition.record_count, `${partition.path} count mismatch`);
return part.projects;
}
async function fetchPartition(partition) {
return validatePartition(partition, await fetchJson(partition.path));
}
function validateProjects(sourceProjects) {
const refs = new Set();
const projectIds = new Set();
let capacity = 0;
let largest = 0;
const counts = { solar: 0, bess: 0, wind_onshore: 0, wind_offshore: 0 };
const projects = sourceProjects.map((project) => {
invariant(typeof project.repd_ref === "string" && project.repd_ref, "missing REPD Ref");
invariant(project.gg_project_id === `GG2050-REPD-${project.repd_ref}`, `invalid ID for ${project.repd_ref}`);
invariant(project.identity_status === "REPD_BOUND" && project.identity_confidence === "authoritative", `unbound identity for ${project.repd_ref}`);
invariant(ALLOWED_TECHNOLOGIES.has(project.technology), `out-of-scope technology for ${project.repd_ref}`);
invariant(Number.isFinite(project.capacity_mw) && project.capacity_mw >= 1, `capacity below 1 MW for ${project.repd_ref}`);
invariant(!refs.has(project.repd_ref), `duplicate REPD Ref ${project.repd_ref}`);
invariant(!projectIds.has(project.gg_project_id), `duplicate project ID ${project.gg_project_id}`);
refs.add(project.repd_ref);
projectIds.add(project.gg_project_id);
counts[project.technology] += 1;
capacity += project.capacity_mw;
largest = Math.max(largest, project.capacity_mw);
return Object.freeze({ ...project });
});
return { projects, capacity, largest, counts };
}
async function loadCanonicalProjects(onFirstPartition) {
const [contract, payload] = await Promise.all([fetchJson(CONTRACT_URL), fetchJson(MANIFEST_URL)]);
invariant(contract.release === "9.1", "release contract mismatch");
invariant(payload.schema === "globalgrid2050.v9.project-spine-build.v9.1", "project manifest schema mismatch");
invariant(payload.release === "9.1", "project release mismatch");
invariant(Array.isArray(payload.project_partitions) && payload.project_partitions.length > 0, "project partitions missing");
invariant(payload.source_identity_sha256 === contract.source.identity_fixture_sha256, "identity hash mismatch");
invariant(payload.source_coordinate_fixture_sha256 === contract.source.coordinate_fixture_sha256, "coordinate hash mismatch");
invariant(payload.source_workbook_sha256 === contract.source.workbook_sha256, "workbook hash mismatch");
const [firstDescriptor, ...remainingDescriptors] = payload.project_partitions;
const firstProjects = await fetchPartition(firstDescriptor);
const preview = validateProjects(firstProjects).projects;
if (typeof onFirstPartition === "function") {
onFirstPartition(Object.freeze({
projects: Object.freeze(preview),
loaded_count: preview.length,
total_count: payload.project_count,
}));
}
const remainingPartitions = await mapWithConcurrency(remainingDescriptors, fetchPartition);
const partitions = [firstProjects, ...remainingPartitions];
const sourceProjects = partitions.flat();
invariant(sourceProjects.length === payload.project_count, "partition total mismatch");
const { projects, capacity, largest, counts } = validateProjects(sourceProjects);
const actual = {
project_count: projects.length,
capacity_mw: round2(capacity),
largest_mw: largest,
solar_count: counts.solar,
bess_count: counts.bess,
wind_onshore_count: counts.wind_onshore,
wind_offshore_count: counts.wind_offshore,
};
Object.entries(contract.expected).forEach(([key, value]) => invariant(actual[key] === value, `${key} is ${actual[key]}, expected ${value}`));
return Object.freeze({
contract: Object.freeze(contract),
metadata: Object.freeze({ ...payload, projects: undefined }),
projects: Object.freeze(projects),
});
}
export function loadCanonicalProjectsNewsV7({ onFirstPartition } = {}) {
if (!canonicalLoadPromise) {
canonicalLoadPromise = loadCanonicalProjects(onFirstPartition).catch((error) => {
canonicalLoadPromise = null;
throw error;
});
}
return canonicalLoadPromise;
}Gauges V9 2
A JavaScript module in the plugins folder of PipelineNews that updates chart (`updateChart`) and formats capacity v9 (`formatCapacityV9_2`) and largest v9 (`formatLargestV9_2`) (units: MW).
Set aside from the main view: 97% of its lines are the same as archive/202608261547-pipelinenews/newsv1/scripts/plugins/gauges-v9-2.js (pipelinenews), which stays. (near-copy-of, proposed by families.py). 97% of lines shared with Gauges V9 2; read that one first. All set-aside files, with reasons. Nothing was deleted.
Evidence
- line-jaccard 0.9722 to pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 archive/202608261547-pipelinenews/newsv1/scripts/plugins/gauges-v9-2.js:1-94 b6c19d4766c7a90505773b521f67975b2a3a81e8
- sha256 9841f3fdaa5a257de90fdc2f21631750bd6d4e4d827788e122ddf947d1f72d6d
- target sha256 b706b907263ae56fbb03cd638c2422d01fcd016d3b09db7772a1683509fcc1c8
- group of 2 (identity.json near-copy edges >= 0.9)
- canonical rule: reachable, newest stamp, core repo, most lines
renderpipelinenews / archive/202608261547-pipelinenews/newsv7/scripts/plugins/gauges-v9-2.js · lines 1–94 of 94 · version 2026-08-26 15:47 · pattern loadGaugeChartsNews (shared by 2 files)
- What it does
- It draws its content. Defines 8 functions or classes, including createGauge, updateChart, formatCapacityV9_2, formatLargestV9_2, initialiseGaugesV9_2. Side effects: changes the web page (DOM).
- 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.
- Downstream impact
- Used directly by 2 files: App News v7 (pipelinenews); Projects News v7 (pipelinenews). Reached from 2 other entry points, including PipelineNews — News v7 Page (pipelinenews, https://ventusltd.github.io/pipelinenews/archive/202608261547-pipelinenews/newsv7/); PipelineNews — PipelineNews Page (pipelinenews, https://ventusltd.github.io/pipelinenews/archive/202608261547-pipelinenews/202608251651-PipelineNews/).
- What it achieves
- It creates gauge (`createGauge`), updates chart (`updateChart`) and formats capacity v9 (`formatCapacityV9_2`). Defines `createGauge`, `updateChart`, `formatCapacityV9_2` and 5 more.
- Why it matters
- Imported by App News v7 and Projects News v7.
- Application
- pipelinenews · archive/202608261547-pipelinenews/newsv7/scripts/plugins · JavaScript module
- Uses
- none found
- Used by
- imported by App News v7 (import), imported by Projects News v7 (import)
- Produces
- formatCapacityV9_2, formatLargestV9_2, initialiseGaugesV9_2, loadGaugeChartsNewsV7, setGaugeUniverseV9_2, updateGaugesV9_2
- Defines here
- createGauge, updateChart, formatCapacityV9_2, formatLargestV9_2, initialiseGaugesV9_2, loadGaugeChartsNewsV7, setGaugeUniverseV9_2, updateGaugesV9_2
- 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/newsv7/scripts/plugins/gauges-v9-2.js:1-94 · blob 2576c27b9b3b00476f9bf03e3e5e809aa22b143c · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: production_core
const charts = { capacity: null, projects: null, largest: null };
let universe = [];
let visible = [];
let gaugeOptions = null;
let chartLoadPromise = null;
const CHART_URL = "https://cdn.jsdelivr.net/npm/chart.js@4.5.1/dist/chart.umd.min.js";
function createGauge(canvasId, colour, options) {
const config = {
type: "doughnut",
data: { datasets: [{ data: [0, 1], backgroundColor: [colour, "#222"], borderWidth: 0 }] },
options,
};
if (typeof globalThis.Chart !== "function") return { data: config.data, update() {} };
return new globalThis.Chart(document.getElementById(canvasId), config);
}
function updateChart(chart, value, maximum) {
chart.data.datasets[0].data = [value, Math.max(maximum - value, 0)];
chart.update();
}
export function formatCapacityV9_2(value) {
const rounded = Math.round(((Number(value) || 0) + Number.EPSILON) * 100) / 100;
return rounded.toLocaleString("en-GB", {
minimumFractionDigits: 0,
maximumFractionDigits: 2,
});
}
export function formatLargestV9_2(value) {
return (Number(value) || 0).toLocaleString("en-GB", { maximumFractionDigits: 2 });
}
export function initialiseGaugesV9_2() {
gaugeOptions = {
responsive: true,
maintainAspectRatio: false,
circumference: 180,
rotation: 270,
cutout: "80%",
plugins: { tooltip: { enabled: false }, legend: { display: false } },
};
charts.capacity = createGauge("g1", "#ff00ff", gaugeOptions);
charts.projects = createGauge("g2", "#00ffff", gaugeOptions);
charts.largest = createGauge("g3", "#00ff88", gaugeOptions);
}
export function loadGaugeChartsNewsV7() {
if (typeof globalThis.Chart === "function") return Promise.resolve(true);
if (chartLoadPromise) return chartLoadPromise;
chartLoadPromise = new Promise((resolve) => {
const script = document.createElement("script");
const timeout = setTimeout(() => resolve(false), 15000);
script.src = CHART_URL;
script.async = true;
script.onload = () => {
clearTimeout(timeout);
if (typeof globalThis.Chart !== "function" || !gaugeOptions) return resolve(false);
initialiseGaugesV9_2();
updateGaugesV9_2(visible);
return resolve(true);
};
script.onerror = () => { clearTimeout(timeout); resolve(false); };
document.head.appendChild(script);
});
return chartLoadPromise;
}
export function setGaugeUniverseV9_2(projects) {
universe = projects;
}
export function updateGaugesV9_2(projects) {
visible = projects;
const total = projects.reduce((sum, project) => sum + project.capacity_mw, 0);
const largest = projects.length ? Math.max(...projects.map((project) => project.capacity_mw)) : 0;
const universeTotal = universe.reduce((sum, project) => sum + project.capacity_mw, 0) || 1;
const universeLargest = universe.length ? Math.max(...universe.map((project) => project.capacity_mw)) : 1;
const capacityValue = document.getElementById("v1");
const projectValue = document.getElementById("v2");
const largestValue = document.getElementById("v3");
capacityValue.textContent = formatCapacityV9_2(total);
projectValue.textContent = projects.length.toLocaleString("en-GB");
largestValue.textContent = formatLargestV9_2(largest);
capacityValue.setAttribute("aria-label", `${formatCapacityV9_2(total)} megawatts filtered capacity`);
projectValue.setAttribute("aria-label", `${projects.length.toLocaleString("en-GB")} filtered records`);
largestValue.setAttribute("aria-label", `${formatLargestV9_2(largest)} megawatts largest single site`);
updateChart(charts.capacity, total, universeTotal);
updateChart(charts.projects, projects.length, universe.length || 1);
updateChart(charts.largest, largest, universeLargest);
}Intelligence News v7
A JavaScript module in the plugins folder of PipelineNews that draws cumulative intelligence and the Renewable Energy Planning Database (REPD) register.
renderpipelinenews / archive/202608261547-pipelinenews/newsv7/scripts/plugins/intelligence-newsv7.js · lines 1–111 of 111 · version 2026-08-26 15:47 · pattern renderPanel (shared by 17 files)
- What it does
- It draws cumulative intelligence and the REPD register. Defines 8 functions or classes, including escapeHtml, validate, statusClass, renderPanel, fetchIntelligence. Side effects: changes the web page (DOM); 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. Domain terms in the code: the REPD register.
- Inputs & outputs
- In: JSON file cumulative_intelligence.json.
- Downstream impact
- Used directly by 2 files: App News v7 (pipelinenews); Newspaper News v7 Base (pipelinenews). Reached from 2 other entry points, including PipelineNews — News v7 Page (pipelinenews, https://ventusltd.github.io/pipelinenews/archive/202608261547-pipelinenews/newsv7/); PipelineNews — PipelineNews Page (pipelinenews, https://ventusltd.github.io/pipelinenews/archive/202608261547-pipelinenews/202608251651-PipelineNews/).
- What it achieves
- It renders panel (`renderPanel`), fetches intelligence (`fetchIntelligence`) and loads cumulative intelligence news v7 (`loadCumulativeIntelligenceNewsV7`). Defines `escapeHtml`, `validate`, `statusClass` and 5 more.
- Why it matters
- Imported by App News v7 and Newspaper News v7 Base.
- Application
- pipelinenews · archive/202608261547-pipelinenews/newsv7/scripts/plugins · JavaScript module
- Uses
- none found
- Used by
- imported by App News v7 (dynamic import), imported by Newspaper News v7 Base (import)
- Produces
- loadCumulativeIntelligenceNewsV7, intelligenceForArticleNewsV7, intelligenceForRepdNewsV7
- Defines here
- escapeHtml, validate, statusClass, renderPanel, fetchIntelligence, loadCumulativeIntelligenceNewsV7, intelligenceForArticleNewsV7, intelligenceForRepdNewsV7
- 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/newsv7/scripts/plugins/intelligence-newsv7.js:1-111 · blob 874816161ccec0150061efec937506586f8dd621 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, network · domain stage: experimental · users: none · canonical: production_core
const INTELLIGENCE_URL = "data/newsv7/cumulative_intelligence.json";
const FETCH_TIMEOUT_MS = 15000;
let intelligencePromise = null;
let model = null;
let byArticleId = new Map();
function escapeHtml(value) {
return String(value ?? "").replace(/[&<>'"]/g, (character) => ({
"&": "&",
"<": "<",
">": ">",
"'": "'",
'"': """,
}[character]));
}
function validate(payload) {
return payload
&& payload.schema === "pipelinenews.cumulative-intelligence.newsv7.v1"
&& payload.release === "newsv7"
&& payload.status === "CANDIDATE"
&& payload.baseline?.project_count === 7680
&& payload.baseline?.all_headlines === 133
&& payload.baseline?.beacon_fen_repd_ref === "13599"
&& payload.counts?.material_event_assertions === 45
&& payload.counts?.transaction_role_abstentions === 45
&& payload.counts?.publishable_reasons === 0
&& payload.counts?.held_reasons === 45
&& payload.counts?.current_context_sources === 0
&& payload.counts?.data_centre_observations === 2
&& payload.counts?.renewable_data_centre_identity_links === 0
&& Array.isArray(payload.event_intelligence)
&& payload.event_intelligence.length === 45
&& !payload.event_intelligence.some((row) => row.repd_ref === "13600");
}
function statusClass(status) {
if (status === "STALE") return "stale";
if (status === "UNAVAILABLE") return "unavailable";
return "degraded";
}
function renderPanel(payload) {
const counts = payload.counts;
document.getElementById("intelligenceStatus").textContent = "PASS · governed candidates loaded · no unsupported claim promoted";
document.getElementById("intelligenceCards").innerHTML = `
<article class="intelligence-card"><strong>${counts.material_event_assertions}</strong><span>MATERIAL EVENTS</span><small>Headline-derived assertions; event dates remain unverified.</small></article>
<article class="intelligence-card"><strong>${counts.organisation_labels} / ${counts.project_operator_role_assertions}</strong><span>ORGANISATION EVIDENCE</span><small>Exact source labels / direct REPD operator-label claims.</small></article>
<article class="intelligence-card warning"><strong>${counts.current_context_sources} CURRENT</strong><span>SOURCE HEALTH</span><small>1 stale · 4 degraded · 1 unavailable; context cannot prove project events.</small></article>
<article class="intelligence-card warning"><strong>${counts.publishable_reasons} / ${counts.held_reasons}</strong><span>RESEARCH REASONS</span><small>Published / held for direct public-record verification.</small></article>
<article class="intelligence-card"><strong>${counts.data_centre_observations}</strong><span>DATA-CENTRE OBSERVATIONS</span><small>6 governed sources · zero renewable-project identity links.</small></article>`;
document.getElementById("sourceHealthRows").innerHTML = payload.source_health.map((source) => `
<a href="${escapeHtml(source.source_page_url)}" target="_blank" rel="noopener">
<span class="health-state ${statusClass(source.status)}">${escapeHtml(source.status)}</span>
<b>${escapeHtml(source.source_product_id)}</b>
<small>${escapeHtml(source.decision_reason)}</small>
</a>`).join("");
document.getElementById("dataCentreRows").innerHTML = payload.data_centres.observations.map((observation) => `
<a href="${escapeHtml(observation.source_record_url)}" target="_blank" rel="noopener">
<b>${escapeHtml(observation.source_label)}</b>
<span>${escapeHtml(observation.operator_label || "operator not established")} · ${escapeHtml(observation.lifecycle)}</span>
<small>${escapeHtml(observation.observation_decision)} · capacity abstained unless typed public evidence exists</small>
</a>`).join("");
}
async function fetchIntelligence() {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
try {
const response = await fetch(new URL(`../../${INTELLIGENCE_URL}`, import.meta.url), {
cache: "default",
signal: controller.signal,
});
if (!response.ok) throw new Error(`cumulative intelligence ${response.status}`);
const payload = await response.json();
if (!validate(payload)) throw new Error("cumulative intelligence contract mismatch");
model = payload;
byArticleId = new Map(payload.event_intelligence.map((row) => [row.article_id, row]));
renderPanel(payload);
return payload;
} catch (error) {
document.getElementById("intelligenceStatus").textContent = "FAIL CLOSED · cumulative intelligence unavailable · V9.7 baseline remains usable";
document.getElementById("intelligenceCards").innerHTML = '<div class="intelligence-empty">No derived intelligence has been promoted. Official REPD facts and frozen newspaper remain available.</div>';
throw error;
} finally {
clearTimeout(timeout);
}
}
export function loadCumulativeIntelligenceNewsV7() {
if (!intelligencePromise) {
intelligencePromise = fetchIntelligence().catch((error) => {
intelligencePromise = null;
console.error("NewsV7 cumulative intelligence unavailable", error);
throw error;
});
}
return intelligencePromise;
}
export function intelligenceForArticleNewsV7(articleId) {
return byArticleId.get(articleId) || null;
}
export function intelligenceForRepdNewsV7(repdRef) {
if (!model) return null;
return model.event_intelligence.find((row) => row.repd_ref === String(repdRef)) || null;
}