In this section
- Check News v1 test · pipelinenews / archive/202608261547-pipelinenews/newsv1/tests/check_newsv1.mjs lines 1–268
- Run News v1 test · pipelinenews / archive/202608261547-pipelinenews/newsv1/tests/run_newsv1.sh lines 1–13
- Build Material Event Ledger storage · pipelinenews / archive/202608261547-pipelinenews/newsv2/scripts/build-material-event-ledger.mjs lines 1–164
- Check News v2 test · pipelinenews / archive/202608261547-pipelinenews/newsv2/tests/check_newsv2.mjs lines 1–100
- Run News v2 test · pipelinenews / archive/202608261547-pipelinenews/newsv2/tests/run_newsv2.sh lines 1–6
Check News v1
A JavaScript module in the tests folder of PipelineNews that tests migration, release newsv1, major project news and regional news, using SHA-256.
testpipelinenews / archive/202608261547-pipelinenews/newsv1/tests/check_newsv1.mjs · lines 1–268 of 268 · version 2026-08-26 15:47 · Not reached from any entry point (candidate for review) · pattern bytes (shared by 19 files)
- What it does
- It tests migration, release newsv1, major project news and regional news. Defines text, bytes, json, sha256, round2. Uses libraries node:assert/strict, node:crypto, node:fs/promises. Side effects: changes the web page (DOM); 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.
- Inputs & outputs
- In: JSON file MIGRATION_MANIFEST.json; JSON file release.newsv1.json; JSON file release.v9.1.json; JSON file build_manifest.json; JSON file major_project_news_v9_5_1.json; JSON file regional_news.json; JSON file regional_decisions.json; JSON file regional_manifest.json.
- What it achieves
- It is built from the sha256 step (`sha256`) and the round2 step (`round2`). Its name says it checks news. Defines `text`, `bytes`, `json` and 2 more.
- Why it matters
- No other file in the estate was found to import it.
- Application
- pipelinenews · archive/202608261547-pipelinenews/newsv1/tests · JavaScript module
- Uses
- PipelineNews — News v1 Page (new URL import.meta.url), node:assert/strict, node:crypto, node:fs/promises
- Used by
- none found
- Produces
- text, bytes, json, sha256, round2
- Defines here
- text, bytes, json, sha256, round2
- 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/newsv1/tests/check_newsv1.mjs:1-268 · blob e288f81e6d4b84b8c94fa221edc35d882c156068 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: experimental · users: none · canonical: unreached_review
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { readFile } from "node:fs/promises";
const base = new URL("../", import.meta.url);
const text = (path) => readFile(new URL(path, base), "utf8");
const bytes = (path) => readFile(new URL(path, base));
const json = async (path) => JSON.parse(await text(path));
const sha256 = (value) => createHash("sha256").update(value).digest("hex");
const round2 = (value) => Math.round((value + Number.EPSILON) * 100) / 100;
const EXPECTED = Object.freeze({
sourceCommit: "824a23cd0cf9f90a9df942f1b37a09c2dc6472b7",
sourceSubtree: "4fca94ede95789ade9490258a2323c00c13ec2ea",
feedSha256: "cea104c3e9cfc07971680afdf5f64073e1d4825b63bfaf4e969266df8386ebbd",
projectManifestSha256: "67976a1bbcaf383ed7121b13060db3b864db9ce33dfc721a88b59c8ca8b8e06c",
projectContractSha256: "bc21070f44aae1d32da333e4954816acd907aa8c9fa9cb639c64d651f7fd4259",
regionalNewsSha256: "905237ddcbc71761f21d8c78961931676ac0c585030d29af95c75c7772254a99",
regionalLedgerSha256: "66f9e8803c6d0d0e847950dc5002a2df3b1f1ac0451de0f76a931256ddcc7409",
frozenMobileCssSha256: "851b0827ca2aa0950438c98ae3cf6cc7dce33667d37458122ea38bb2c6da2f81",
projectCount: 7680,
capacityMw: 356474.09,
largestMw: 4100,
geometryCount: 7652,
missingGeometryCount: 28,
technologyCounts: {
solar: 3563,
bess: 1609,
wind_onshore: 2399,
wind_offshore: 109,
},
headlineCount: 133,
ukHeadlineCount: 45,
internationalHeadlineCount: 19,
regionalCounts: { US: 4, EUROPE: 9, INTERNATIONAL_OTHER: 6 },
rowsPerPage: 100,
columns: 11,
domElementBudget: 10000,
});
const [
migration,
release,
projectContract,
projectManifest,
feed,
regionalNews,
regionalLedger,
regionalManifest,
html,
projectsSource,
projectLoaderSource,
releaseLoaderSource,
appSource,
gaugesSource,
newsBaseSource,
regionalRuntimeSource,
mobileCss,
] = await Promise.all([
json("MIGRATION_MANIFEST.json"),
json("contracts/release.newsv1.json"),
json("contracts/release.v9.1.json"),
json("data/v9.1/build_manifest.json"),
json("dist/major_project_news_v9_5_1.json"),
json("data/v9.7/regional_news.json"),
json("data/v9.7/regional_decisions.json"),
json("data/v9.7/regional_manifest.json"),
text("index.html"),
text("scripts/plugins/projects-newsv1.js"),
text("scripts/data/canonical-projects-newsv1.js"),
text("scripts/data/canonical-projects-newsv1-release.js"),
text("scripts/app-newsv1.js"),
text("scripts/plugins/gauges-v9-2.js"),
text("scripts/plugins/newspaper-newsv1-base.js"),
text("scripts/plugins/newspaper-newsv1.js"),
text("styles/v9-6-1.css"),
]);
// Frozen source identity and independently addressable NewsV1 lineage.
assert.equal(migration.schema, "pipelinenews.migration-manifest.v1");
assert.equal(migration.release, "newsv1");
assert.deepEqual(migration.source, {
repository: "Ventusltd/globalgrid2050",
commit: EXPECTED.sourceCommit,
path: "uk_renewables_pipeline/v9.7",
subtree: EXPECTED.sourceSubtree,
});
assert.equal(migration.canonical_data_changed, false);
assert.equal(migration.news_content_or_order_changed, false);
assert.equal(release.release, "newsv1");
assert.equal(release.semantic_version, "1.0.0-rc.1");
assert.equal(release.status, "CANDIDATE");
assert.equal(release.frozen_source.commit, EXPECTED.sourceCommit);
assert.equal(release.frozen_source.subtree, EXPECTED.sourceSubtree);
assert.equal(release.frozen_source.must_remain_unchanged, true);
assert.equal(release.data_parent.release, "9.1");
assert.equal(release.data_parent.data_changed, false);
assert.equal(release.news_parent.ordering_changed, false);
// Exact source-artifact hashes prevent silent content or ordering changes.
assert.equal(sha256(await bytes("contracts/release.v9.1.json")), EXPECTED.projectContractSha256);
assert.equal(sha256(await bytes("data/v9.1/build_manifest.json")), EXPECTED.projectManifestSha256);
assert.equal(sha256(await bytes("dist/major_project_news_v9_5_1.json")), EXPECTED.feedSha256);
assert.equal(sha256(await bytes("data/v9.7/regional_news.json")), EXPECTED.regionalNewsSha256);
assert.equal(sha256(await bytes("data/v9.7/regional_decisions.json")), EXPECTED.regionalLedgerSha256);
assert.equal(sha256(await bytes("styles/v9-6-1.css")), EXPECTED.frozenMobileCssSha256);
assert.equal(release.news_parent.sha256, EXPECTED.feedSha256);
assert.equal(regionalManifest.hashes.input_sha256, EXPECTED.feedSha256);
assert.equal(regionalManifest.hashes.regional_news_sha256, EXPECTED.regionalNewsSha256);
assert.equal(regionalManifest.hashes.decision_ledger_sha256, EXPECTED.regionalLedgerSha256);
// Re-read and validate every canonical partition at its declared grain and key.
assert.equal(projectManifest.project_partitions.length, 16);
const partitions = await Promise.all(projectManifest.project_partitions.map(async (partition) => {
const raw = await bytes(partition.path);
assert.equal(sha256(raw), partition.sha256, `${partition.path} hash drift`);
const payload = JSON.parse(raw.toString("utf8"));
assert.equal(payload.schema, "globalgrid2050.v9.project-partition.v9.1");
assert.equal(payload.record_count, partition.record_count);
assert.equal(payload.projects.length, partition.record_count);
return payload.projects;
}));
const projects = partitions.flat();
const refs = new Set();
const projectIds = new Set();
const technologyCounts = { solar: 0, bess: 0, wind_onshore: 0, wind_offshore: 0 };
let capacityMw = 0;
let largestMw = 0;
let geometryCount = 0;
for (const project of projects) {
assert.equal(typeof project.repd_ref, "string");
assert.ok(project.repd_ref);
assert.equal(project.gg_project_id, `GG2050-REPD-${project.repd_ref}`);
assert.equal(project.identity_status, "REPD_BOUND");
assert.equal(project.identity_confidence, "authoritative");
assert.ok(!refs.has(project.repd_ref), `duplicate REPD Ref ${project.repd_ref}`);
assert.ok(!projectIds.has(project.gg_project_id), `duplicate project ID ${project.gg_project_id}`);
assert.ok(Object.hasOwn(technologyCounts, project.technology), `unexpected technology ${project.technology}`);
assert.ok(Number.isFinite(project.capacity_mw) && project.capacity_mw >= 1);
refs.add(project.repd_ref);
projectIds.add(project.gg_project_id);
technologyCounts[project.technology] += 1;
capacityMw += project.capacity_mw;
largestMw = Math.max(largestMw, project.capacity_mw);
if (project.geometry_status === "valid") geometryCount += 1;
}
assert.equal(projects.length, EXPECTED.projectCount);
assert.equal(refs.size, EXPECTED.projectCount);
assert.equal(projectIds.size, EXPECTED.projectCount);
assert.deepEqual(technologyCounts, EXPECTED.technologyCounts);
assert.equal(round2(capacityMw), EXPECTED.capacityMw);
assert.equal(largestMw, EXPECTED.largestMw);
assert.equal(geometryCount, EXPECTED.geometryCount);
assert.equal(projects.length - geometryCount, EXPECTED.missingGeometryCount);
assert.equal(projectManifest.projects_sha256, "24484ca837ac56520ba971fb2c2c1d29620e16a3c71bbaa5764e94c9b515ad52");
assert.equal(projectManifest.project_count, EXPECTED.projectCount);
assert.equal(projectManifest.capacity_mw, EXPECTED.capacityMw);
assert.equal(projectManifest.largest_mw, EXPECTED.largestMw);
assert.deepEqual(projectContract.expected, {
project_count: 7680,
capacity_mw: 356474.09,
largest_mw: 4100,
solar_count: 3563,
bess_count: 1609,
wind_onshore_count: 2399,
wind_offshore_count: 109,
});
assert.equal(projectManifest.source_identity_sha256, projectContract.source.identity_fixture_sha256);
assert.equal(projectManifest.source_coordinate_fixture_sha256, projectContract.source.coordinate_fixture_sha256);
assert.equal(projectManifest.source_workbook_sha256, projectContract.source.workbook_sha256);
// Frozen UK newspaper plus the V9.7 non-project regional ledger.
assert.equal(feed.schema, "globalgrid2050.major-project-news.v9.5.1");
assert.equal(feed.all_headline_count, EXPECTED.headlineCount);
assert.equal(feed.all_items.length, EXPECTED.headlineCount);
assert.equal(feed.relevant_headline_count, EXPECTED.ukHeadlineCount);
assert.equal(feed.canonical_items.length, EXPECTED.ukHeadlineCount);
assert.equal(feed.v9_4_baseline_headline_count, 125);
assert.equal(feed.beacon_fen_contract.repd_ref, "13599");
assert.equal(feed.beacon_fen_contract.official_capacity_mw, 400);
assert.ok(feed.canonical_items.every((item) => item.role === "PRIMARY_MATCH"
&& item.eligible_for_news_signal === true
&& item.gg_project_id === `GG2050-REPD-${item.repd_ref}`));
assert.equal(regionalNews.articles.length, EXPECTED.internationalHeadlineCount);
assert.equal(regionalLedger.decisions.length, EXPECTED.headlineCount);
assert.equal(new Set(regionalLedger.decisions.map((item) => item.article_id)).size, EXPECTED.headlineCount);
assert.deepEqual(regionalManifest.telemetry.by_region, EXPECTED.regionalCounts);
assert.equal(regionalManifest.telemetry.accepted_count, EXPECTED.internationalHeadlineCount);
assert.equal(regionalManifest.telemetry.by_decision.UK_CANONICAL, EXPECTED.ukHeadlineCount);
assert.equal(regionalManifest.telemetry.last_known_good, true);
assert.ok(regionalNews.articles.every((item) => item.project_signal_eligible === false
&& item.canonical_identity === false));
// Eleven-column table and frozen horizontal mobile viewport.
assert.equal((html.match(/<th(?:\s|>)/g) || []).length, EXPECTED.columns);
assert.match(html, /<tbody id="tbody"><\/tbody>/);
assert.match(html, /styles\/v9-6-1\.css\?v=newsv1/);
assert.match(mobileCss, /\.tablewrap\s*\{[^}]*overflow-x:\s*auto/s);
assert.match(mobileCss, /\.tablewrap \.hide-mobile\s*\{[^}]*display:\s*table-cell/s);
const rowStart = projectsSource.indexOf('return `<tr id="repd-');
const rowEnd = projectsSource.indexOf("</tr>`;", rowStart);
assert.ok(rowStart >= 0 && rowEnd > rowStart, "project row template not found");
const rowTemplate = projectsSource.slice(rowStart, rowEnd);
assert.equal((rowTemplate.match(/<td(?:\s|>)/g) || []).length, EXPECTED.columns);
assert.match(projectsSource, /colspan="11"/);
// Pagination limits the live DOM without truncating filter, gauge or CSV state.
assert.equal(release.interface.project_table_columns, EXPECTED.columns);
assert.equal(release.interface.rows_per_page, EXPECTED.rowsPerPage);
assert.equal(release.interface.all_records_remain_filterable_sortable_and_exportable, true);
assert.equal(release.interface.mobile_horizontal_scroll_preserved, true);
assert.equal(release.performance.initial_project_row_budget, EXPECTED.rowsPerPage);
assert.equal(release.performance.initial_dom_element_budget, EXPECTED.domElementBudget);
assert.equal(Math.ceil(EXPECTED.projectCount / EXPECTED.rowsPerPage), 77);
assert.equal(EXPECTED.projectCount % EXPECTED.rowsPerPage, 80);
assert.match(projectsSource, /const ROWS_PER_PAGE = 100;/);
assert.match(projectsSource, /const pageRows = filtered\.slice\(start, start \+ ROWS_PER_PAGE\);/);
const renderTableSource = projectsSource.slice(
projectsSource.indexOf("function renderTable()"),
projectsSource.indexOf("function renderPager()"),
);
assert.match(renderTableSource, /body\.innerHTML = pageRows\.map/);
assert.doesNotMatch(renderTableSource, /body\.innerHTML = filtered\.map/);
assert.match(projectsSource, /state\.filtered = filtered;/);
assert.match(projectsSource, /updateGaugesV9_2\(filtered\);/);
assert.match(projectsSource, /const rows = filtered\.map/);
assert.match(projectsSource, /previous\.disabled = pageIndex === 0/);
assert.match(projectsSource, /next\.disabled = pageIndex >= pageCount - 1/);
// Cache-safe singleton loaders, bounded hydration and local-first pinned fallback.
assert.equal(release.performance.project_loader_singleton, true);
assert.equal(release.performance.verified_first_partition_preview, true);
assert.equal(release.performance.first_partition_preview_records, 500);
assert.equal(release.performance.parser_blocking_third_party_scripts, 0);
assert.equal(release.performance.project_fetch_concurrency, 4);
assert.equal(release.performance.fetch_timeout_ms, 15000);
assert.match(projectLoaderSource, /const FETCH_CONCURRENCY = 4;/);
assert.match(projectLoaderSource, /const FETCH_TIMEOUT_MS = 15000;/);
assert.match(projectLoaderSource, /let canonicalLoadPromise = null;/);
assert.match(projectLoaderSource, /const firstProjects = await fetchPartition\(firstDescriptor\);/);
assert.match(projectLoaderSource, /onFirstPartition\(Object\.freeze/);
assert.match(projectsSource, /renderFirstPartitionPreview/);
assert.match(projectsSource, /dataset\.hydration = "complete"/);
assert.match(projectLoaderSource, /cache: "default"/);
assert.match(releaseLoaderSource, /cache: "default"/);
assert.doesNotMatch(`${projectLoaderSource}\n${releaseLoaderSource}`, /cache:\s*["']no-store["']/);
assert.equal(release.performance.same_origin_news_first, true);
assert.equal(release.performance.fallback_only_after_primary_failure, true);
const primaryPosition = newsBaseSource.indexOf('["PipelineNews release", "dist/major_project_news_v9_5_1.json"]');
const fallbackPosition = newsBaseSource.indexOf(EXPECTED.sourceCommit);
assert.ok(primaryPosition >= 0 && fallbackPosition > primaryPosition, "news sources are not local-first");
assert.match(newsBaseSource, new RegExp(`raw\\.githubusercontent\\.com/Ventusltd/globalgrid2050/${EXPECTED.sourceCommit}/dist/major_project_news_v9_5_1\\.json`));
assert.match(newsBaseSource, /for \(const \[label, url\] of NEWS_SOURCES\)/);
assert.doesNotMatch(newsBaseSource, /Promise\.allSettled|\/main\/dist\/major_project_news|Date\.now\(\)|cache:\s*["']no-store["']/);
assert.match(newsBaseSource, /cache: "default"/);
assert.match(regionalRuntimeSource, /cache: "default"/);
assert.doesNotMatch(regionalRuntimeSource, /Date\.now\(\)|cache:\s*["']no-store["']/);
// Chart.js is pinned but loaded asynchronously by the app, never parser-blocking.
assert.doesNotMatch(html, /cdn\.jsdelivr\.net\/npm\/chart\.js/);
assert.match(gaugesSource, /chart\.js@4\.5\.1\/dist\/chart\.umd\.min\.js/);
assert.match(gaugesSource, /script\.async = true/);
assert.match(appSource, /loadGaugeChartsNewsV1\(\);/);
console.log("NewsV1 verification: PASS");
console.log("projects=7,680 capacity=356,474.09MW rows/page=100 columns=11 DOM-budget=10,000");
console.log("news=133 UK=45 international=19 (US=4 Europe=9 other=6)");
console.log(`source=${EXPECTED.sourceCommit.slice(0, 12)} subtree=${EXPECTED.sourceSubtree.slice(0, 12)} feed=${EXPECTED.feedSha256.slice(0, 12)}`);Run News v1
A shell script in the tests folder of PipelineNews.
testpipelinenews / archive/202608261547-pipelinenews/newsv1/tests/run_newsv1.sh · lines 1–13 of 13 · version 2026-08-26 15:47 · Entry point
- What it does
- It tests its inputs. Side effects: starts processes.
- 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
- It is itself an entry point (shell script); no other file was found loading it.
- 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; it is an entry point.
- Application
- pipelinenews · archive/202608261547-pipelinenews/newsv1/tests · shell script
- Uses
- none found
- Used by
- none found
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 archive/202608261547-pipelinenews/newsv1/tests/run_newsv1.sh:1-13 · blob 102238b764e3534f5deaf3b378c288a774437dd9 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: unknown · effects: process · domain stage: experimental · users: none · canonical: production_core
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
node --check scripts/data/canonical-projects-newsv1.js
node --check scripts/data/canonical-projects-newsv1-release.js
node --check scripts/plugins/newspaper-newsv1-base.js
node --check scripts/plugins/newspaper-newsv1.js
node --check scripts/plugins/projects-newsv1.js
node --check scripts/app-newsv1.js
node tests/check_newsv1.mjsBuild Material Event Ledger
A JavaScript module in the scripts folder of PipelineNews that reads major project news, material event assertions and release newsv2, using SHA-256.
storagepipelinenews / archive/202608261547-pipelinenews/newsv2/scripts/build-material-event-ledger.mjs · lines 1–164 of 164 · version 2026-08-26 15:47 · Not reached from any entry point (candidate for review)
- What it does
- It loads major project news, material event assertions and release newsv2. Defines sha256, stableAssertionId, normaliseEventType. Uses libraries node:crypto, 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. README: "It adds a deterministic material-event assertion ledger without changing the NewsV1 interface, visible ordering or frozen bytes."
- Inputs & outputs
- In: JSON file major_project_news_v9_5_1.json; JSON file material_event_assertions.json; JSON file build_manifest.json; JSON file release.newsv2.json.
- Downstream impact
- Used directly by 1 file: Check News v2 (pipelinenews).
- What it achieves
- It normalises event type (`normaliseEventType`) and is built from the sha256 step (`sha256`) and the stable assertion id helper (`stableAssertionId`). The README says: It adds a deterministic material-event assertion ledger without changing the NewsV1 interface, visible ordering or frozen bytes.
- Why it matters
- Checked by Check News v2.
- Application
- pipelinenews · archive/202608261547-pipelinenews/newsv2/scripts · JavaScript module
- Uses
- node:crypto, node:fs/promises
- Used by
- referenced by Check News v2 (new URL import.meta.url)
- Produces
- sha256, stableAssertionId, normaliseEventType
- Defines here
- sha256, stableAssertionId, normaliseEventType
- 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/newsv2/scripts/build-material-event-ledger.mjs:1-164 · blob 0c4debf8ee7444ae094467b257ae0de6f4c2a1e8 · GitHub at these lines
- State
- achieves: readme · context: readme_derived · stage: output · effects: filesystem · domain stage: experimental · users: none · canonical: unreached_review
import { createHash } from "node:crypto";
import { mkdir, readFile, writeFile } from "node:fs/promises";
const SOURCE_PATH = new URL(
"../../newsv1/dist/major_project_news_v9_5_1.json",
import.meta.url,
);
const OUTPUT_PATH = new URL("../data/material_event_assertions.json", import.meta.url);
const MANIFEST_PATH = new URL("../data/build_manifest.json", import.meta.url);
const CONTRACT_PATH = new URL("../contracts/release.newsv2.json", import.meta.url);
const EXPECTED_SOURCE_SHA256 =
"cea104c3e9cfc07971680afdf5f64073e1d4825b63bfaf4e969266df8386ebbd";
const sha256 = (value) =>
createHash("sha256").update(value).digest("hex");
const stableAssertionId = (item) => {
const identity = [
item.gg_article_id,
item.gg_project_id,
item.event,
item.published,
item.url,
].join("|");
return `PN-EVT-${sha256(identity).slice(0, 20).toUpperCase()}`;
};
const normaliseEventType = (event) => event.trim().replaceAll(" ", "_");
const sourceBytes = await readFile(SOURCE_PATH);
const sourceSha256 = sha256(sourceBytes);
if (sourceSha256 !== EXPECTED_SOURCE_SHA256) {
throw new Error(
`Frozen source hash mismatch: expected ${EXPECTED_SOURCE_SHA256}, got ${sourceSha256}`,
);
}
const source = JSON.parse(sourceBytes.toString("utf8"));
const assertions = source.canonical_items.map((item, index) => ({
assertion_id: stableAssertionId(item),
display_order: index + 1,
article_id: item.gg_article_id,
project_id: item.gg_project_id,
repd_ref: item.repd_ref,
development_id: item.gg_development_id,
event_type: normaliseEventType(item.event),
event_effective_at: null,
event_confidence: null,
identity: {
status: item.identity_status,
role: item.role,
eligible_for_news_signal: item.eligible_for_news_signal,
confidence: item.confidence,
method: item.news_binding_rule,
},
claim: {
verification_status: "HEADLINE_DERIVED_UNVERIFIED",
evidence_class: "PUBLISHER_HEADLINE_CLAIM",
headline: item.headline,
published_at: item.published,
source_name: item.source,
source_homepage: item.source_url,
article_url: item.url,
},
commercial: {
buyer: null,
seller: null,
lender: null,
epc: null,
icp: null,
oem: null,
supplier: null,
adviser: null,
deal_value: null,
currency: null,
},
decision: "INCLUDE_AS_UNVERIFIED_ASSERTION",
limitations: [
"The project identity is canonical, but the material event has not been independently verified.",
"Publication date is not treated as the event effective date.",
"No commercial party, role or deal value is inferred from the headline.",
],
}));
const eventCounts = Object.fromEntries(
[...new Set(assertions.map(({ event_type }) => event_type))]
.sort()
.map((eventType) => [
eventType,
assertions.filter(({ event_type }) => event_type === eventType).length,
]),
);
const assertionPayloadSha256 = sha256(JSON.stringify(assertions));
const product = {
schema: "pipelinenews.material-event-assertions.v1",
release: "newsv2",
status: "CANDIDATE",
generated_at: "2026-08-25T00:00:00Z",
grain: "one row per canonical project-bound publisher-headline event claim",
primary_key: ["assertion_id"],
source: {
repository: "Ventusltd/pipelinenews",
release: source.release,
artifact: "newsv1/dist/major_project_news_v9_5_1.json",
sha256: sourceSha256,
},
row_count: assertions.length,
event_counts: eventCounts,
assertion_payload_sha256: assertionPayloadSha256,
assertions,
};
const outputBytes = Buffer.from(`${JSON.stringify(product, null, 2)}\n`);
const [builderBytes, contractBytes] = await Promise.all([
readFile(new URL(import.meta.url)),
readFile(CONTRACT_PATH),
]);
const manifest = {
schema: "pipelinenews.build-manifest.v1",
release: "newsv2",
status: "CANDIDATE",
built_at: "2026-08-25T00:00:00Z",
modules: [
{
module_id: "material-event-ledger-builder.v1",
path: "newsv2/scripts/build-material-event-ledger.mjs",
sha256: sha256(builderBytes),
},
],
inputs: [
{
path: "newsv1/dist/major_project_news_v9_5_1.json",
sha256: sourceSha256,
},
{
path: "newsv2/contracts/release.newsv2.json",
sha256: sha256(contractBytes),
},
],
artifacts: [
{
path: "newsv2/data/material_event_assertions.json",
sha256: sha256(outputBytes),
bytes: outputBytes.byteLength,
rows: assertions.length,
},
],
checks: {
total_rows: assertions.length,
distinct_declared_keys: new Set(assertions.map(({ assertion_id }) => assertion_id)).size,
duplicate_key_groups: 0,
required_null_key_rows: assertions.filter(({ assertion_id }) => !assertion_id).length,
source_order_preserved: true,
independent_verifier: "newsv2/tests/check_newsv2.mjs",
},
};
await mkdir(new URL("../data/", import.meta.url), { recursive: true });
await writeFile(OUTPUT_PATH, outputBytes);
await writeFile(MANIFEST_PATH, `${JSON.stringify(manifest, null, 2)}\n`);
console.log(
`Built ${product.row_count} NewsV2 assertions (${product.assertion_payload_sha256})`,
);Check News v2
A JavaScript module in the tests folder of PipelineNews that tests material event assertions and major project news, using SHA-256.
testpipelinenews / archive/202608261547-pipelinenews/newsv2/tests/check_newsv2.mjs · lines 1–100 of 100 · version 2026-08-26 15:47 · Not reached from any entry point (candidate for review)
- What it does
- It tests material event assertions and major project news. Defines sha256. Uses libraries node:assert/strict, node:crypto, 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.
- Inputs & outputs
- In: JSON file material_event_assertions.json; JSON file build_manifest.json; JSON file major_project_news_v9_5_1.json.
- What it achieves
- Its name says it checks news. Defines `sha256`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- pipelinenews · archive/202608261547-pipelinenews/newsv2/tests · JavaScript module
- Uses
- Build Material Event Ledger (new URL import.meta.url), node:assert/strict, node:crypto, node:fs/promises
- Used by
- none found
- Produces
- sha256
- Defines here
- sha256
- 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/newsv2/tests/check_newsv2.mjs:1-100 · blob 8f5d27f194e6caf9d50f23601d7a38278d05c206 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: ingest · effects: filesystem · domain stage: experimental · users: none · canonical: unreached_review
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { readFile } from "node:fs/promises";
const ARTIFACT_PATH = new URL("../data/material_event_assertions.json", import.meta.url);
const MANIFEST_PATH = new URL("../data/build_manifest.json", import.meta.url);
const BUILDER_PATH = new URL("../scripts/build-material-event-ledger.mjs", import.meta.url);
const SOURCE_PATH = new URL(
"../../newsv1/dist/major_project_news_v9_5_1.json",
import.meta.url,
);
const EXPECTED_SOURCE_SHA256 =
"cea104c3e9cfc07971680afdf5f64073e1d4825b63bfaf4e969266df8386ebbd";
const EXPECTED_EVENT_COUNTS = {
ACQUISITION: 8,
CONSENT: 13,
CONTRACT: 2,
FINANCIAL_CLOSE: 4,
PROJECT_UPDATE: 17,
REFUSAL: 1,
};
const sha256 = (value) => createHash("sha256").update(value).digest("hex");
const [artifactBytes, manifestBytes, builderBytes, sourceBytes] = await Promise.all([
readFile(ARTIFACT_PATH),
readFile(MANIFEST_PATH),
readFile(BUILDER_PATH),
readFile(SOURCE_PATH),
]);
const product = JSON.parse(artifactBytes.toString("utf8"));
const manifest = JSON.parse(manifestBytes.toString("utf8"));
const source = JSON.parse(sourceBytes.toString("utf8"));
assert.equal(product.schema, "pipelinenews.material-event-assertions.v1");
assert.equal(product.release, "newsv2");
assert.equal(product.status, "CANDIDATE");
assert.equal(product.row_count, 45);
assert.equal(product.assertions.length, 45);
assert.equal(source.canonical_items.length, 45);
assert.equal(sha256(sourceBytes), EXPECTED_SOURCE_SHA256);
assert.equal(product.source.sha256, EXPECTED_SOURCE_SHA256);
assert.deepEqual(product.event_counts, EXPECTED_EVENT_COUNTS);
assert.equal(
product.assertion_payload_sha256,
sha256(JSON.stringify(product.assertions)),
);
assert.equal(manifest.schema, "pipelinenews.build-manifest.v1");
assert.equal(manifest.artifacts[0].sha256, sha256(artifactBytes));
assert.equal(manifest.artifacts[0].bytes, artifactBytes.byteLength);
assert.equal(manifest.modules[0].sha256, sha256(builderBytes));
assert.deepEqual(manifest.checks, {
total_rows: 45,
distinct_declared_keys: 45,
duplicate_key_groups: 0,
required_null_key_rows: 0,
source_order_preserved: true,
independent_verifier: "newsv2/tests/check_newsv2.mjs",
});
const ids = product.assertions.map(({ assertion_id }) => assertion_id);
assert.equal(new Set(ids).size, ids.length, "assertion IDs must be unique");
assert.deepEqual(
product.assertions.map(({ article_id }) => article_id),
source.canonical_items.map(({ gg_article_id }) => gg_article_id),
"source display order must remain unchanged",
);
const beacon = product.assertions.filter(({ repd_ref }) => repd_ref === "13599");
assert.equal(beacon.length, 1);
assert.equal(beacon[0].project_id, "GG2050-REPD-13599");
assert.equal(beacon[0].event_type, "CONSENT");
assert.equal(beacon[0].identity.role, "PRIMARY_MATCH");
assert.equal(beacon[0].identity.confidence, 91);
assert.equal(
product.assertions.some(({ repd_ref }) => repd_ref === "13600"),
false,
"Beacon Fen BESS sibling must not acquire the solar article",
);
for (const assertion of product.assertions) {
assert.match(assertion.assertion_id, /^PN-EVT-[A-F0-9]{20}$/);
assert.equal(assertion.identity.role, "PRIMARY_MATCH");
assert.equal(assertion.identity.eligible_for_news_signal, true);
assert.equal(assertion.event_effective_at, null);
assert.equal(assertion.event_confidence, null);
assert.equal(
assertion.claim.verification_status,
"HEADLINE_DERIVED_UNVERIFIED",
);
assert.match(assertion.claim.article_url, /^https:\/\//);
assert.equal(assertion.decision, "INCLUDE_AS_UNVERIFIED_ASSERTION");
assert.ok(
Object.values(assertion.commercial).every((value) => value === null),
"commercial roles and values must not be inferred",
);
}
console.log(
`PASS NewsV2: ${product.row_count} deterministic assertions; Beacon Fen 13599 canary; no inferred commercial roles`,
);Run News v2
A shell script in the tests folder of PipelineNews.
testpipelinenews / archive/202608261547-pipelinenews/newsv2/tests/run_newsv2.sh · lines 1–6 of 6 · version 2026-08-26 15:47 · Entry point
- What it does
- It tests its inputs. Side effects: starts processes.
- 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
- It is itself an entry point (shell script); no other file was found loading it.
- 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; it is an entry point.
- Application
- pipelinenews · archive/202608261547-pipelinenews/newsv2/tests · shell script
- Uses
- none found
- Used by
- none found
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- pipelinenews@45c944c8640a9d7ae65edb51d66032ba204f3f46 archive/202608261547-pipelinenews/newsv2/tests/run_newsv2.sh:1-6 · blob fecbd51d9c05b66cb7fd8435517bfe7eff542c1c · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: unknown · effects: process · domain stage: experimental · users: none · canonical: production_core
#!/usr/bin/env bash
set -euo pipefail
newsv2_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
node "$newsv2_dir/scripts/build-material-event-ledger.mjs"
node "$newsv2_dir/tests/check_newsv2.mjs"