In this section
- Compare Incumbent Successor storage · pipelinenews / atman/202608291504-compare-incumbent-successor.mjs lines 1–345
- Wake Up Ledger storage · pipelinenews / atman/202608291504-wake-up-ledger.mjs lines 1–122
- Public Browser Readback render · pipelinenews / atman/202608300309-public-browser-readback.mjs lines 1–104
Compare Incumbent Successor
A JavaScript module in the atman folder of PipelineNews that reads fast site, using SHA-256. It parses args (`parseArgs`), reads JSON (`readJson`) and decodes projects (`decodeProjects`).
storagepipelinenews / atman/202608291504-compare-incumbent-successor.mjs · lines 1–345 of 345 · version 2026-08-29 15:04 · Entry point · pattern decodeProjects (shared by 2 files)
- What it does
- It loads fast site. Defines 10 functions or classes, including parseArgs, sha256, readJson, fileTree, walk. Uses libraries node:assert/strict, node:crypto, node:fs/promises, node:path, node:url. Side effects: 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.
- Inputs & outputs
- In: JSON file release-manifest.json; JSON file current-v3.json; JSON file build-manifest.json; JSON file 202608282200-v8-fast-site-manifest.json; JSON file 202608270055-8ab1807551bc-v8-fast-projects.json; command-line arguments.
- Downstream impact
- Used directly by 2 files: Atlas V9 Deep Link Successor (pipelinenews); Atlas Pointer Deep Link Successor (pipelinenews).
- What it achieves
- Defines `parseArgs`, `sha256`, `readJson` and 5 more.
- Why it matters
- Run by Atlas V9 Deep Link Successor and Atlas Pointer Deep Link Successor.
- Application
- pipelinenews · atman · JavaScript module
- Uses
- node:assert/strict, node:crypto, node:fs/promises, node:path, node:url
- Used by
- run by Atlas V9 Deep Link Successor (workflow run), run by Atlas Pointer Deep Link Successor (workflow run)
- Produces
- parseArgs, sha256, readJson, fileTree, walk, item, classified, decodeProjects, main, al
- Defines here
- parseArgs, sha256, readJson, fileTree, walk, item, classified, decodeProjects, main, al
- 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/202608291504-compare-incumbent-successor.mjs:1-345 · blob 69b97f1844f4a0700357364b566aeb1d1de01f26 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
#!/usr/bin/env node
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { readFile, readdir, stat } from "node:fs/promises";
import path from "node:path";
import { pathToFileURL } from "node:url";
const GENERATION = "202608291504";
const RELEASE_ID = `${GENERATION}-pipelinenews`;
const PARENT_GENERATION = "202608282200";
let ATLAS_BASE = null;
const ALLOWED = new Set(["MATCH", "EXPECTED_CHANGE", "REGRESSION", "UNKNOWN"]);
function parseArgs(argv) {
const result = {};
for (let index = 0; index < argv.length; index += 2) {
assert.match(argv[index] || "", /^--[a-z-]+$/u);
assert.ok(argv[index + 1], `missing value for ${argv[index]}`);
result[argv[index].slice(2)] = argv[index + 1];
}
for (const key of ["release-a", "release-b", "browser-proof", "output"]) {
assert.ok(result[key], `missing --${key}`);
}
return result;
}
const sha256 = (raw) => createHash("sha256").update(raw).digest("hex");
async function readJson(filename) {
return JSON.parse(await readFile(filename, "utf8"));
}
async function fileTree(root) {
const result = {};
async function walk(directory) {
for (const entry of await readdir(directory, { withFileTypes: true })) {
const filename = path.join(directory, entry.name);
if (entry.isDirectory()) await walk(filename);
else if (entry.isFile()) {
const raw = await readFile(filename);
result[path.relative(root, filename).split(path.sep).join("/")] = { bytes: raw.length, sha256: sha256(raw) };
} else throw new Error(`non-file release entry: ${filename}`);
}
}
await walk(root);
return result;
}
function item(status, evidence) {
assert.ok(ALLOWED.has(status));
return { status, evidence };
}
function classified(condition, evidence, { expectedChange = false } = {}) {
return item(condition ? (expectedChange ? "EXPECTED_CHANGE" : "MATCH") : "REGRESSION", evidence);
}
function decodeProjects(payload) {
const fields = Object.fromEntries(payload.fields.map((name, index) => [name, index]));
return payload.rows.map((row) => ({
repd_ref: row[fields.repd_ref],
name: row[fields.name],
technology: payload.dictionaries.technology[row[fields.technology]],
capacity_mw: row[fields.capacity_mw],
geometry_status: payload.dictionaries.geometry_status[row[fields.geometry_status]],
latitude: row[fields.latitude],
longitude: row[fields.longitude],
}));
}
async function main() {
const args = parseArgs(process.argv.slice(2));
const releaseA = path.resolve(args["release-a"]);
const releaseB = path.resolve(args["release-b"]);
const proofPath = path.resolve(args["browser-proof"]);
const outputPath = path.resolve(args.output);
const releaseManifest = await readJson(path.join(releaseA, "release-manifest.json"));
ATLAS_BASE = releaseManifest.atlas_v9_deep_link?.base_url;
const atlasBase = new URL(ATLAS_BASE);
const contractualGoldenRef = String(releaseManifest.atlas_v9_deep_link?.golden_repd_ref || "");
assert.equal(atlasBase.protocol, "https:");
assert.equal(atlasBase.hostname, "ventusltd.github.io");
assert.match(contractualGoldenRef, /^\d+$/u);
assert.equal(releaseManifest.atlas_v9_deep_link?.pointer?.path, "releases/current-v3.json");
assert.match(String(releaseManifest.atlas_v9_deep_link?.pointer?.sha256 || ""), /^[0-9a-f]{64}$/u);
const buildManifest = await readJson(path.join(releaseA, "build-manifest.json"));
const permanentEvidence = buildManifest.parent_evidence;
assert.equal(permanentEvidence?.schema, "pipelinenews.parent-artifact-evidence.v1", "permanent parent evidence missing");
const permanentRelative = path.relative(`releases/${RELEASE_ID}`, permanentEvidence.exact_manifest.path);
const permanentRaw = await readFile(path.join(releaseA, permanentRelative));
assert.equal(permanentRaw.length, permanentEvidence.exact_manifest.bytes, "copied parent manifest byte count changed");
assert.equal(sha256(permanentRaw), permanentEvidence.exact_manifest.sha256, "copied parent manifest digest changed");
const permanentManifest = JSON.parse(permanentRaw);
let parentManifest;
if (args["parent-root"]) {
const parentRoot = path.resolve(args["parent-root"]);
const externalRaw = await readFile(path.join(parentRoot, "build/202608282200-v8-fast-site-manifest.json"));
assert.equal(Buffer.compare(externalRaw, permanentRaw), 0, "external parent differs from copied exact provenance");
parentManifest = JSON.parse(externalRaw);
} else {
const evidence = buildManifest.parent_evidence;
assert.equal(evidence?.schema, "pipelinenews.parent-artifact-evidence.v1", "self-contained parent evidence missing");
assert.equal(evidence.exact_manifest?.bytes, 25073, "parent manifest byte evidence changed");
assert.equal(evidence.exact_manifest?.sha256, "025daf70f1c4b9c9a7c84a70d41ceb50e96232771f736faa309ca92c2c9c134d", "parent manifest digest evidence changed");
parentManifest = permanentManifest;
}
const registry = await readJson(path.join(releaseA, `data/${GENERATION}-registry.json`));
const projectsPayload = await readJson(path.join(releaseA, "data/202608270055-8ab1807551bc-v8-fast-projects.json"));
const html = await readFile(path.join(releaseA, "index.html"), "utf8");
const runtime = await readFile(path.join(releaseA, `assets/${GENERATION}-app.mjs`), "utf8");
const textFiles = [];
for (const record of buildManifest.functional_files) {
if (!/\.(?:html|mjs|js|json|css)$/u.test(record.path)) continue;
const relative = path.relative(`releases/${RELEASE_ID}`, record.path);
textFiles.push(await readFile(path.join(releaseA, relative), "utf8"));
}
const combinedText = textFiles.join("\n");
const browserProof = await readJson(proofPath).catch(() => null);
const treeA = await fileTree(releaseA);
const treeB = await fileTree(releaseB);
const cartridgePath = path.join(releaseA, `assets/${GENERATION}-atlas-pointer-deep-link.mjs`);
const cartridge = await import(`${pathToFileURL(cartridgePath).href}?sha=${sha256(await readFile(cartridgePath))}`);
const projects = decodeProjects(projectsPayload);
let mapLinks = 0;
let noMap = 0;
let invalidUrls = 0;
for (const project of projects) {
const href = cartridge.buildAtlasV9DeepLink(project);
if (!href) {
noMap += 1;
if (project.geometry_status === "valid") invalidUrls += 1;
continue;
}
mapLinks += 1;
const url = new URL(href);
const valid = project.geometry_status === "valid"
&& url.origin === atlasBase.origin
&& url.pathname === atlasBase.pathname
&& [...url.searchParams.keys()].join(",") === "repd_ref"
&& url.searchParams.get("repd_ref") === String(project.repd_ref);
if (!valid) invalidUrls += 1;
}
const contractualGoldenInput = { repd_ref: contractualGoldenRef, geometry_status: "valid" };
const eastPye = projects.find((project) => String(project.repd_ref) === "17494");
const beaconFen = projects.find((project) => String(project.repd_ref) === "13599");
const invalidGeometry = projects.find((project) => String(project.repd_ref) === "12780");
const sections = {
parent_semantics: {
permanent_parent_evidence: classified(
permanentEvidence.exact_manifest.bytes === 25073
&& permanentEvidence.exact_manifest.sha256 === "025daf70f1c4b9c9a7c84a70d41ceb50e96232771f736faa309ca92c2c9c134d"
&& permanentRaw.length === 25073
&& sha256(permanentRaw) === permanentEvidence.exact_manifest.sha256,
buildManifest.parent_evidence,
),
exact_parent_artifact: classified(
parentManifest.source_commit === "1cbe1a9b205af3a2cf62bc7f8130f033423dfe1f"
&& String(parentManifest.github_run_id) === "33211041996"
&& parentManifest.outputs.length === 7,
{ source: parentManifest.source_commit, run: parentManifest.github_run_id, outputs: parentManifest.outputs.length },
),
canonical_product: classified(
parentManifest.canonical_product.projects === 7680
&& parentManifest.canonical_product.capacity_mw === 356474.09
&& parentManifest.canonical_product.headlines === 136
&& parentManifest.canonical_product.rows_per_page === 100
&& parentManifest.canonical_product.table_columns === 11,
parentManifest.canonical_product,
),
relationship_abstention: classified(
parentManifest.relationship_governance_status.rows === 3
&& parentManifest.relationship_governance_status.project_bindings === 0,
parentManifest.relationship_governance_status,
),
},
atlas_links: {
exact_map_no_map: classified(mapLinks === 7652 && noMap === 28 && invalidUrls === 0, { map_links: mapLinks, no_map: noMap, invalid_urls: invalidUrls }),
immutable_v9_base: classified(
cartridge.ATLAS_V9_DEEP_LINK_CONTRACT.target.base_url === ATLAS_BASE,
cartridge.ATLAS_V9_DEEP_LINK_CONTRACT.target,
{ expectedChange: true },
),
authenticated_pointer_binding: classified(
cartridge.ATLAS_V9_DEEP_LINK_CONTRACT.receiver_pointer.sha256 === releaseManifest.atlas_v9_deep_link.pointer.sha256
&& cartridge.ATLAS_V9_DEEP_LINK_CONTRACT.receiver_pointer.resolved_commit === releaseManifest.atlas_v9_deep_link.pointer_commit
&& cartridge.ATLAS_V9_DEEP_LINK_CONTRACT.receiver_contract.contractual_golden_repd_ref === contractualGoldenRef,
cartridge.ATLAS_V9_DEEP_LINK_CONTRACT.receiver_pointer,
{ expectedChange: true },
),
identity_only_query_contractual_golden: classified(
cartridge.buildAtlasV9DeepLink(contractualGoldenInput) === `${ATLAS_BASE}?repd_ref=${contractualGoldenRef}`,
{
href: cartridge.buildAtlasV9DeepLink(contractualGoldenInput),
dataset_presence_required: false,
authority: "authenticated GridAtlas current-v3 query contract",
},
{ expectedChange: true },
),
identity_only_query_east_pye_when_present: classified(
!eastPye || cartridge.buildAtlasV9DeepLink(eastPye) === `${ATLAS_BASE}?repd_ref=17494`,
eastPye ? cartridge.buildAtlasV9DeepLink(eastPye) : "not present; optional sentinel skipped",
{ expectedChange: true },
),
identity_only_query_beacon_fen_when_present: classified(
!beaconFen || cartridge.buildAtlasV9DeepLink(beaconFen) === `${ATLAS_BASE}?repd_ref=13599`,
beaconFen ? cartridge.buildAtlasV9DeepLink(beaconFen) : "not present; optional sentinel skipped",
{ expectedChange: true },
),
no_map_12780: classified(cartridge.buildAtlasV9DeepLink(invalidGeometry) === "", { repd_ref: "12780", href: cartridge.buildAtlasV9DeepLink(invalidGeometry) }),
old_domain_absent: classified(!combinedText.includes("globalgrid2050.com/repd_grid_atlasv8"), "no old Atlas receiver URL in release closure", { expectedChange: true }),
},
bidirectional_routing: {
inbound_alias: classified(
runtime.includes('const requestedRepdRef = parameters.get("repd_ref") || "";')
&& runtime.includes('/^\\d+$/u.test(requestedRepdRef)')
&& runtime.includes('"sort", "repd_ref"'),
"repd_ref hydrates exact project search and is bounded during URL synchronisation",
{ expectedChange: true },
),
header_target: classified((html.match(new RegExp(ATLAS_BASE.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&"), "gu")) || []).length === 2, "two header/menu Atlas V9 targets", { expectedChange: true }),
csv_label: classified(runtime.includes('"Atlas V9 URL"') && !runtime.includes('"Atlas V8 URL"'), "Atlas V9 URL"),
durable_product_state: classified(
html.includes("ATLAS V9 DEEP-LINK SUCCESSOR")
&& !combinedText.includes("DEEP-LINK CANDIDATE")
&& !combinedText.includes("fast candidate"),
"timestamped successor wording in browser-served functional closure",
{ expectedChange: true },
),
},
folder_closure: {
deterministic_ab: classified(JSON.stringify(treeA) === JSON.stringify(treeB), { files_a: Object.keys(treeA).length, files_b: Object.keys(treeB).length }),
index_in_folder: classified(path.basename(releaseA) === RELEASE_ID && (await stat(path.join(releaseA, "index.html"))).isFile(), path.join(releaseA, "index.html"), { expectedChange: true }),
public_manifests: classified(buildManifest.release_id === RELEASE_ID && releaseManifest.release_id === RELEASE_ID, { build: buildManifest.schema, release: releaseManifest.schema }),
full_dependency_closure: classified(
Object.keys(treeA).length === 40
&& buildManifest.functional_file_count === 37
&& buildManifest.inherited_functional_files === 33
&& buildManifest.shared_dependency_files === 29
&& buildManifest.inherited_parent_output_files === 4
&& buildManifest.provenance_files === 1,
{
files: Object.keys(treeA).length,
functional: buildManifest.functional_file_count,
inherited_functional_files: buildManifest.inherited_functional_files,
shared_dependency_files: buildManifest.shared_dependency_files,
inherited_parent_output_files: buildManifest.inherited_parent_output_files,
provenance_files: buildManifest.provenance_files,
},
),
pointer_state_external: classified(
releaseManifest.classification === "IMMUTABLE_TIMESTAMPED_RELEASE"
&& releaseManifest.folder_contract.pointer_state_encoded_in_release === false
&& releaseManifest.publication_control.pointer_and_attestation_live_outside_release_folder === true,
releaseManifest.publication_control,
),
},
runtime_contract: {
registry_identity: classified(registry.schema === "pipelinenews.v9.timestamp-folder-registry.v1" && registry.generation === GENERATION && registry.cache_contract.compiler_method === "pipelinenews-atlas-pointer-folder-deep-link-successor-v1", { schema: registry.schema, generation: registry.generation, compiler: registry.cache_contract.compiler_method }, { expectedChange: true }),
local_assets: classified(
registry.assets.projects.path.startsWith("data/")
&& registry.assets.search.path.startsWith("data/")
&& registry.assets.news.path.startsWith("data/")
&& registry.detail_partitions.every((entry) => entry.path.startsWith("data/projects/")),
{ assets: registry.assets, first_detail: registry.detail_partitions[0]?.path },
{ expectedChange: true },
),
reused_cartridge_generations: classified(
runtime.includes("SECTOR_INTELLIGENCE_CARTRIDGE_CONTRACT.generation === entry.generation")
&& runtime.includes("FEDERATED_RELATIONSHIP_CARTRIDGE_CONTRACT.generation === entry.generation"),
"immutable 202608272130 and 202608282200 cartridges validated against their own registry entries",
),
},
real_public_receiver: {
proof_available: browserProof === null ? item("UNKNOWN", "browser proof missing") : classified(browserProof.classification === "VERIFIED_REAL_ATLAS_V9_RECEIVER", browserProof.classification),
no_synthetic_receiver: browserProof === null ? item("UNKNOWN", "browser proof missing") : classified(browserProof.synthetic_receiver === false && browserProof.route_interceptions === 0, { synthetic_receiver: browserProof.synthetic_receiver, route_interceptions: browserProof.route_interceptions }),
contractual_receiver_golden: browserProof === null ? item("UNKNOWN", "browser proof missing") : classified(
browserProof.contractual_golden?.repd_ref === contractualGoldenRef
&& browserProof.contractual_golden?.receiver_present === true
&& browserProof.contractual_golden?.pipeline_present === false
&& browserProof.contractual_golden?.tested === true
&& browserProof.contractual_golden?.receiver_url === `${ATLAS_BASE}?repd_ref=${contractualGoldenRef}`
&& browserProof.contractual_golden?.receiver_evidence?.cards?.some((text) => text.includes(`REPD ${contractualGoldenRef}`)),
browserProof.contractual_golden,
),
selected_receiver: browserProof === null ? item("UNKNOWN", "browser proof missing") : classified(
browserProof.external_atlas_network_used === true
&& browserProof.atlas_repd_ref === contractualGoldenRef
&& browserProof.contractual_golden?.receiver_url === `${ATLAS_BASE}?repd_ref=${contractualGoldenRef}`
&& browserProof.contractual_golden?.receiver_evidence?.cards?.length,
browserProof.contractual_golden,
),
optional_sentinels_when_present: browserProof === null ? item("UNKNOWN", "browser proof missing") : classified(
[
["17494", eastPye],
["13599", beaconFen],
].every(([repdRef, project]) => {
const entry = (browserProof.optional_sentinels || []).find((candidate) => candidate.repd_ref === repdRef);
return entry
&& entry.present === Boolean(project)
&& (!project || (
entry.tested === true
&& entry.outbound_href === `${ATLAS_BASE}?repd_ref=${repdRef}`
&& entry.receiver_url === `${ATLAS_BASE}?repd_ref=${repdRef}`
&& entry.receiver_evidence?.cards?.some((text) => text.includes(`REPD ${repdRef}`))
));
}),
browserProof.optional_sentinels,
),
},
};
const statuses = Object.values(sections).flatMap((section) => Object.values(section).map(({ status }) => status));
const counts = Object.fromEntries([...ALLOWED].sort().map((status) => [status, statuses.filter((value) => value === status).length]));
const failed = counts.REGRESSION + counts.UNKNOWN;
const report = {
schema: "pipelinenews.incumbent-successor-comparator.v1",
generation: GENERATION,
release_id: RELEASE_ID,
classification: failed === 0 ? "VERIFIED_PIPELINENEWS_ATLAS_POINTER_SUCCESSOR" : "REJECTED_PIPELINENEWS_ATLAS_POINTER_SUCCESSOR",
promotion_eligible: failed === 0,
failed,
allowed_statuses: [...ALLOWED].sort(),
status_counts: counts,
baseline: { generation: PARENT_GENERATION, role: "accepted complete V9.6.2-equivalent artifact" },
successor: { generation: GENERATION, route: `/pipelinenews/releases/${RELEASE_ID}/`, atlas_receiver: ATLAS_BASE },
expected_changes: [
"flat candidate becomes immutable timestamp-folder index",
"Atlas V8 receiver becomes exact immutable Atlas V9 receiver",
"seven context parameters become canonical repd_ref-only identity",
"PipelineNews accepts inbound repd_ref compatibility deep links",
"runtime dependencies are copied inside the immutable folder",
],
sections,
};
await import("node:fs/promises").then(({ mkdir, writeFile }) => mkdir(path.dirname(outputPath), { recursive: true }).then(() => writeFile(outputPath, `${JSON.stringify(report, null, 2)}\n`)));
process.stdout.write(`${JSON.stringify({ classification: report.classification, status_counts: counts, failed })}\n`);
if (failed) process.exitCode = 1;
}
main().catch((error) => {
process.stderr.write(`${error.stack || error.message}\n`);
process.exitCode = 1;
});Wake Up Ledger
A JavaScript module in the atman folder of PipelineNews that reads fast site, using SHA-256. It parses args (`parseArgs`) and reads JSON if present (`readJsonIfPresent`).
storagepipelinenews / atman/202608291504-wake-up-ledger.mjs · lines 1–122 of 122 · version 2026-08-29 15:04 · Entry point · pattern parseArgs (shared by 14 files)
- What it does
- It loads fast site. Defines parseArgs, sha256, exists, readJsonIfPresent, 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: JSON file 202608271524-v8-fast-site-manifest.json; JSON file release-manifest.json; JSON file current-v3.json; JSON file live-set.json; command-line arguments.
- Downstream impact
- Used directly by 1 file: Atlas Pointer Deep Link Successor (pipelinenews).
- What it achieves
- Defines `parseArgs`, `sha256`, `exists` and 1 more.
- Why it matters
- Run by Atlas Pointer Deep Link Successor.
- Application
- pipelinenews · atman · JavaScript module
- Uses
- node:assert/strict, node:crypto, node:child_process, node:fs/promises, node:path, node:util
- Used by
- run by Atlas Pointer Deep Link Successor (workflow run)
- Produces
- parseArgs, sha256, exists, readJsonIfPresent, main
- Defines here
- parseArgs, sha256, exists, readJsonIfPresent, 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/202608291504-wake-up-ledger.mjs:1-122 · blob 85a976a5cc9930ca4de531d57445495d8e57407a · 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: production_core
#!/usr/bin/env node
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
import { execFile } from "node:child_process";
import { access, mkdir, readFile, writeFile } from "node:fs/promises";
import path from "node:path";
import { promisify } from "node:util";
const execFileAsync = promisify(execFile);
const GENERATION = "202608291504";
const RELEASE_ID = `${GENERATION}-pipelinenews`;
const FALLBACK = Object.freeze({
generation: "202608271524",
route: "/pipelinenews/releases/202608271524-v8-fast-candidate.html",
manifest: "build/202608271524-v8-fast-site-manifest.json",
manifest_sha256: "fef485accb1509297dbc64c5e30806c60d977bedb06591e8b324e7bbab06e818",
});
function parseArgs(argv) {
const args = {};
for (let index = 0; index < argv.length; index += 2) {
assert.match(argv[index] || "", /^--[a-z-]+$/u);
assert.ok(argv[index + 1], `missing value for ${argv[index]}`);
args[argv[index].slice(2)] = argv[index + 1];
}
for (const key of ["root", "output"]) assert.ok(args[key], `missing --${key}`);
return args;
}
const sha256 = (raw) => createHash("sha256").update(raw).digest("hex");
async function exists(relative) {
try { await access(relative); return true; } catch { return false; }
}
async function readJsonIfPresent(relative) {
if (!(await exists(relative))) return null;
return JSON.parse(await readFile(relative, "utf8"));
}
async function main() {
const args = parseArgs(process.argv.slice(2));
const root = path.resolve(args.root);
const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], { cwd: root, encoding: "utf8" });
const head = stdout.trim();
assert.match(head, /^[0-9a-f]{40}$/u);
const releaseManifestPath = path.join(root, "releases", RELEASE_ID, "release-manifest.json");
const pointerPaths = [path.join(root, "releases/current-v3.json"), path.join(root, "state/live-set.json")];
const releasePresent = await exists(releaseManifestPath);
const pointerPresence = await Promise.all(pointerPaths.map(exists));
assert.ok(pointerPresence[0] === pointerPresence[1], "PipelineNews pointer copies are split");
const livePointer = pointerPresence[0] ? JSON.parse(await readFile(pointerPaths[0], "utf8")) : null;
if (livePointer) assert.equal(await readFile(pointerPaths[0], "utf8"), await readFile(pointerPaths[1], "utf8"), "PipelineNews pointer copies differ");
let receiver = null;
let receiverStatus = "NOT_CAPTURED";
if (args["gridatlas-receiver"] && await exists(path.resolve(args["gridatlas-receiver"]))) {
receiver = await readJsonIfPresent(path.resolve(args["gridatlas-receiver"]));
receiverStatus = receiver?.classification === "VERIFIED_GRIDATLAS_LIVE_POINTER" ? "VERIFIED" : "INVALID";
}
const fallbackManifestRaw = await readFile(path.join(root, FALLBACK.manifest));
assert.equal(sha256(fallbackManifestRaw), FALLBACK.manifest_sha256, "last-known-green V8 fallback manifest drift");
const fallbackManifest = JSON.parse(fallbackManifestRaw);
assert.equal(fallbackManifest.generation, FALLBACK.generation);
const fallbackOutputPaths = new Set(fallbackManifest.outputs.map((entry) => entry.path));
assert.equal(fallbackOutputPaths.has(`releases/${FALLBACK.generation}-v8-fast-candidate.html`), true);
let classification;
let nextAction;
if (receiverStatus !== "VERIFIED") {
classification = "PRESERVE_LAST_KNOWN_GREEN_V8";
nextAction = "Repair or recapture GridAtlas current-v3; do not stage or promote PipelineNews.";
} else if (livePointer?.release_id === RELEASE_ID) {
classification = "LIVE_READ_ONLY_DRIFT_AUDIT";
nextAction = "Run receiver readback, comparator and inherited 420 checks without repository mutation.";
} else if (releasePresent) {
classification = "WAIT_PUBLIC_FOLDER_PROOF_OR_STAGE_POINTER";
nextAction = "Verify the exact immutable public folder, then stage only byte-identical live pointers.";
} else {
classification = "BUILD_IMMUTABLE_POINTER_SUCCESSOR";
nextAction = "Build and stage the 202608291504 immutable folder from the authenticated receiver receipt.";
}
const ledger = {
schema: "pipelinenews.wake-up-ledger.v1",
generation: GENERATION,
release_id: RELEASE_ID,
classification,
repository_head: head,
workflow: {
event: args.event || process.env.GITHUB_EVENT_NAME || "local",
run_id: args["run-id"] || process.env.GITHUB_RUN_ID || null,
repository_mutation_allowed: false,
dispatch_allowed: false,
purpose: "scheduled/read-only recovery consciousness",
},
observed: {
receiver_status: receiverStatus,
receiver_commit: receiver?.resolved_commit || null,
receiver_release_id: receiver?.receiver?.release_id || null,
immutable_release_present: releasePresent,
pipeline_pointer_present: Boolean(livePointer),
pipeline_pointer_release_id: livePointer?.release_id || null,
},
fallback: {
...FALLBACK,
verified: true,
rule: "Never replace this V8 fallback unless the full V9 receiver, comparator, browser and pointer gates are green.",
},
next_action: nextAction,
};
const output = path.resolve(args.output);
await mkdir(path.dirname(output), { recursive: true });
await writeFile(output, `${JSON.stringify(ledger, null, 2)}\n`);
process.stdout.write(`${JSON.stringify({ classification, receiver_status: receiverStatus, release_present: releasePresent, pointer_release: livePointer?.release_id || null })}\n`);
}
main().catch((error) => {
process.stderr.write(`${error.stack || error.message}\n`);
process.exitCode = 1;
});Public Browser Readback
A JavaScript module in the atman folder of PipelineNews covering the Renewable Energy Planning Database (REPD) register and uses data from the GridAtlas repository.
renderpipelinenews / atman/202608300309-public-browser-readback.mjs · lines 1–104 of 104 · version 2026-08-30 03:09 · Entry point
- What it does
- It lists and searches the REPD register. Defines value. Uses libraries 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
- In: data source: gridatlas data; command-line arguments.
- Downstream impact
- Used directly by 2 files: Atlas V9 Deep Link Successor (pipelinenews); Atlas Pointer Deep Link Successor (pipelinenews).
- What it achieves
- Defines `value`.
- Why it matters
- Run by Atlas V9 Deep Link Successor and Atlas Pointer Deep Link Successor.
- Application
- pipelinenews · atman · JavaScript module
- Uses
- node:fs/promises, playwright
- Used by
- run by Atlas V9 Deep Link Successor (workflow run), run by Atlas Pointer Deep Link Successor (workflow run)
- Produces
- value
- Defines here
- value
- 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/202608300309-public-browser-readback.mjs:1-104 · blob c8e2a84f66ae93700b77174b0e83be6993405842 · 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 fs from 'node:fs/promises';
import { chromium } from 'playwright';
const args = process.argv.slice(2);
const value = flag => {
const index = args.indexOf(flag);
if (index < 0 || index + 1 >= args.length) throw new Error(`${flag} is required`);
return args[index + 1];
};
const candidate = value('--candidate');
const output = value('--output');
const repdRef = '13599';
const expectedAtlas = `https://ventusltd.github.io/gridatlas/202608300453-atlas-v9/?repd_ref=${repdRef}`;
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage({ viewport: { width: 1440, height: 1000 }, serviceWorkers: 'block' });
const pipelineErrors = [];
const pipelineFailures = [];
page.on('pageerror', error => pipelineErrors.push(String(error?.message || error)));
page.on('console', message => { if (message.type() === 'error') pipelineErrors.push(message.text()); });
page.on('requestfailed', request => pipelineFailures.push({ url: request.url(), error: request.failure()?.errorText || 'unknown' }));
const probe = new URL(candidate);
probe.searchParams.set('repd_ref', repdRef);
await page.goto(probe.href, { waitUntil: 'domcontentloaded', timeout: 90000 });
await page.waitForFunction(() => document.body?.dataset?.fastReady === 'true', null, { timeout: 90000 });
await page.waitForSelector(`#repd-${repdRef}`, { timeout: 30000 });
await page.waitForFunction(({ rowId, expected }) => {
const anchor = document.getElementById(rowId)?.querySelector('a.atlaslink[href]');
return anchor?.href === expected;
}, { rowId: `repd-${repdRef}`, expected: expectedAtlas }, { timeout: 30000 });
const pipeline = await page.evaluate(({ rowId, expected }) => {
const row = document.getElementById(rowId);
const links = [...document.querySelectorAll('a[href*="repd_ref="]')].map(anchor => anchor.href);
return {
url: location.href,
release_id: document.body.dataset.releaseId,
fast_ready: document.body.dataset.fastReady,
search_value: document.querySelector('#search')?.value || null,
filtered_count: document.querySelector('#resultsMeta')?.dataset?.filteredCount || null,
row_text: row?.textContent?.replace(/\s+/gu, ' ').trim() || null,
atlas_href: row?.querySelector('a.atlaslink[href]')?.href || null,
generated_links: links,
runtime: globalThis.__PIPELINENEWS_FAST__ ? JSON.parse(JSON.stringify(globalThis.__PIPELINENEWS_FAST__)) : null,
expected
};
}, { rowId: `repd-${repdRef}`, expected: expectedAtlas });
if (pipeline.atlas_href !== expectedAtlas) throw new Error(`Atlas href mismatch: ${pipeline.atlas_href}`);
if (pipeline.generated_links.length !== 1) throw new Error(`expected one Atlas link, found ${pipeline.generated_links.length}`);
if (pipeline.search_value !== repdRef || pipeline.filtered_count !== '1') throw new Error('exact REPD filter did not resolve one row');
if (pipeline.runtime?.searchRequests !== 0 || pipeline.runtime?.searchReady !== false) throw new Error('exact REPD route touched broad search');
if (pipelineErrors.length || pipelineFailures.length) throw new Error(`Pipeline browser errors: ${JSON.stringify({ pipelineErrors, pipelineFailures })}`);
const receiver = await browser.newPage({ viewport: { width: 1440, height: 1000 }, serviceWorkers: 'block' });
const receiverErrors = [];
const receiverFailures = [];
receiver.on('pageerror', error => receiverErrors.push(String(error?.message || error)));
receiver.on('console', message => { if (message.type() === 'error') receiverErrors.push(message.text()); });
receiver.on('requestfailed', request => receiverFailures.push({ url: request.url(), error: request.failure()?.errorText || 'unknown' }));
await receiver.goto(expectedAtlas, { waitUntil: 'domcontentloaded', timeout: 90000 });
await receiver.waitForSelector('.dashboard', { timeout: 90000 });
await receiver.waitForSelector('#map canvas', { timeout: 90000 });
await receiver.waitForFunction(ref => window.__GRIDATLAS_PLACE_SEARCH__?.deep_link?.status === 'RESOLVED'
&& window.__GRIDATLAS_PLACE_SEARCH__?.deep_link?.repd_ref === ref
&& window.__GRIDATLAS_PLACE_SEARCH__?.deep_link?.mapped === true, repdRef, { timeout: 150000 });
const atlas = await receiver.evaluate(ref => ({
url: location.href,
body_text: document.body.innerText,
deep_link: JSON.parse(JSON.stringify(window.__GRIDATLAS_PLACE_SEARCH__?.deep_link || null)),
last_selection: JSON.parse(JSON.stringify(window.__GRIDATLAS_PLACE_SEARCH__?.last_selection || null)),
popup_text: document.querySelector('.maplibregl-popup')?.innerText || '',
body_dataset: { ...document.body.dataset },
ref_visible: document.body.innerText.includes(ref)
}), repdRef);
const known = receiverErrors.filter(message => message.includes('[V9 DEEP LINK FAILED] Error: canonical project technology is invalid') && message.includes('ventus-corev8engine.js'));
const unexpected = receiverErrors.filter(message => !known.includes(message));
if (atlas.url !== expectedAtlas) throw new Error(`Atlas URL changed: ${atlas.url}`);
if (!atlas.ref_visible || !atlas.body_text.includes('Beacon Fen Energy Park')) throw new Error('Atlas did not render Beacon Fen identity');
if (atlas.deep_link?.repd_ref !== repdRef || atlas.deep_link?.mapped !== true) throw new Error('Atlas exact receiver did not map Beacon Fen');
if (known.length > 1 || unexpected.length || receiverFailures.length) throw new Error(`Atlas browser errors: ${JSON.stringify({ known, unexpected, receiverFailures })}`);
const proof = {
schema: 'pipelinenews.pages-exact-atlas-readback.v1',
classification: 'VERIFIED_PIPELINENEWS_PAGES_EXACT_ATLAS_READBACK',
candidate_url: candidate,
pipeline_probe_url: probe.href,
atlas_url: expectedAtlas,
golden_repd_ref: repdRef,
pipeline,
atlas,
known_receiver_errors: known,
unexpected_receiver_errors: unexpected,
route_interceptions: 0,
synthetic_receiver: false,
privacy: 'NO_PERSONAL_DATA'
};
await fs.mkdir(output.split('/').slice(0, -1).join('/') || '.', { recursive: true });
await fs.writeFile(output, JSON.stringify(proof, null, 2) + '\n', 'utf8');
console.log(JSON.stringify(proof));
await browser.close();