In this section
- Compare Renewable Energy Planning Database (REPD) Coverage energy-data · gridatlas / atman/202608291430-compare-repd-coverage.mjs lines 1–178
- Public Browser Readback render · gridatlas / atman/202608291430-public-browser-readback.mjs lines 1–215
- Rendered Browser Audit render · gridatlas / atman/202608291430-rendered-browser-audit.mjs lines 1–241
Compare Renewable Energy Planning Database (REPD) Coverage
A JavaScript module in the atman folder of GridAtlas that reads REPD browser registry and the REPD register, using SHA-256. It parses args (`parseArgs`) and sets hash (`setHash`).
energy-datagridatlas / atman/202608291430-compare-repd-coverage.mjs · lines 1–178 of 178 · version 2026-08-29 14:30 · Entry point · pattern setHash (shared by 4 files)
- What it does
- It loads REPD browser registry and the REPD register. Defines parseArgs, sha256, tree, setHash. 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 (path word 'repd'): 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: JSON file repd_browser_registry_202608290716.json; command-line arguments.
- Downstream impact
- It is itself an entry point (JavaScript module); no other file was found loading it.
- What it achieves
- Defines `parseArgs`, `sha256`, `tree` and 1 more.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- gridatlas · atman · JavaScript module
- Uses
- node:assert/strict, node:crypto, node:fs/promises, node:path, node:url
- Used by
- none found
- Produces
- parseArgs, sha256, tree, setHash
- Defines here
- parseArgs, sha256, tree, setHash
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 atman/202608291430-compare-repd-coverage.mjs:1-178 · blob e6124c6ebf7598a2ff256bfb277debc25d89bdeb · 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 { mkdir, readFile, readdir, stat, writeFile } from "node:fs/promises";
import path from "node:path";
import { pathToFileURL } from "node:url";
function parseArgs(argv) {
const args = { repository: ".", buildA: null, buildB: null, routingProjects: null, output: null };
for (let index = 2; index < argv.length; index += 1) {
if (argv[index] === "--repository") args.repository = argv[++index];
else if (argv[index] === "--build-a") args.buildA = argv[++index];
else if (argv[index] === "--build-b") args.buildB = argv[++index];
else if (argv[index] === "--routing-projects") args.routingProjects = argv[++index];
else if (argv[index] === "--output") args.output = argv[++index];
else throw new Error(`unknown argument: ${argv[index]}`);
}
for (const key of ["buildA", "buildB", "routingProjects", "output"]) assert(args[key], `${key} is required`);
return args;
}
function sha256(value) { return createHash("sha256").update(value).digest("hex"); }
async function tree(root, prefix = "") {
const output = {};
for (const entry of await readdir(root, { withFileTypes: true })) {
const relative = prefix ? `${prefix}/${entry.name}` : entry.name;
const target = path.join(root, entry.name);
if (entry.isDirectory()) Object.assign(output, await tree(target, relative));
else if (entry.isFile()) {
const bytes = await readFile(target);
output[relative] = { bytes: bytes.length, sha256: sha256(bytes) };
} else throw new Error(`non-regular build entry: ${relative}`);
}
return output;
}
function setHash(values) {
const ordered = [...values].sort((left, right) => Number(left) - Number(right));
return sha256(Buffer.from(JSON.stringify(ordered) + "\n"));
}
const args = parseArgs(process.argv);
const repository = path.resolve(args.repository);
const buildA = path.resolve(args.buildA);
const buildB = path.resolve(args.buildB);
const routingPath = path.resolve(args.routingProjects);
const routingModule = await import(pathToFileURL(path.join(buildA, "assets/repd-routing-client.mjs")));
const normalBytes = await readFile(path.join(repository, "data/repd_browser_registry_202608290716.json"));
assert.equal(sha256(normalBytes), "c8a5c59be878c52014a272eb0e4d09af06a0d301d10a8d6b5d0b116b5d1bb6bc");
const normal = JSON.parse(normalBytes);
assert.equal(normal.records.length, 11069);
const normalByRef = new Map(normal.records.map(record => [String(record.repd_ref), record]));
assert.equal(normalByRef.size, 11069);
const safeNormalByRef = new Map();
const excludedFalseOrigin = new Set();
for (const record of normal.records) {
assert.equal(typeof record.latitude, "number", `normal latitude type: ${record.repd_ref}`);
assert.equal(typeof record.longitude, "number", `normal longitude type: ${record.repd_ref}`);
assert(Number.isFinite(record.latitude) && Number.isFinite(record.longitude), `normal non-finite: ${record.repd_ref}`);
assert(!(record.latitude === 0 && record.longitude === 0), `normal zero-origin: ${record.repd_ref}`);
if (record.latitude === 49.766807 && record.longitude === -7.55716) excludedFalseOrigin.add(String(record.repd_ref));
else safeNormalByRef.set(String(record.repd_ref), record);
}
assert.equal(excludedFalseOrigin.size, 36);
assert.equal(setHash(excludedFalseOrigin), "acdee510ef7f29855ea07b376cdc1519835d498184c5d14ea2a8a06d756365d9");
assert.equal(safeNormalByRef.size, 11033);
assert.equal(setHash(safeNormalByRef.keys()), "fc8b3bedf4f39c2eaa534d45a30806053cc931fdf7ced4a703f7275e43d27b21");
const routingBytes = await readFile(routingPath);
assert.equal(routingBytes.length, 979338);
assert.equal(sha256(routingBytes), "c06aedef176d2d38fd135806306a8ef81b4af9994c7be31e8bd760304149f862");
const payload = JSON.parse(routingBytes);
const decoded = routingModule.decodeRoutingProjects(payload);
assert.equal(decoded.records.length, 7680);
assert.equal(decoded.byRef.size, 7680);
const mapRefs = decoded.records.filter(record => record.selectable).map(record => record.repd_ref);
const noMapRefs = decoded.records.filter(record => !record.selectable).map(record => record.repd_ref);
assert.equal(mapRefs.length, 7652);
assert.equal(noMapRefs.length, 28);
assert.equal(setHash(mapRefs), "4199f74165ed049c382ae322c5b5577a06a01c72dde0df9711a0bc368a918834");
assert.equal(setHash(noMapRefs), "4e172523b8b352c73f98e7533cbb814559dd5d1dd9c2c04d1ee3904df26303e6");
assert.equal(decoded.records.filter(record => record.geometry_status === "missing").length, 26);
assert.equal(decoded.records.filter(record => record.geometry_status === "invalid").length, 2);
assert(decoded.records.filter(record => !record.selectable).every(record => record.latitude === null && record.longitude === null));
assert(decoded.records.filter(record => record.selectable).every(record => !(record.latitude === 0 && record.longitude === 0)));
const mapSet = new Set(mapRefs);
const overlap = [...mapSet].filter(repdRef => normalByRef.has(repdRef));
const fallbacks = [...mapSet].filter(repdRef => !safeNormalByRef.has(repdRef));
const finalSelectable = new Set([...safeNormalByRef.keys(), ...fallbacks]);
const nonMapNormal = noMapRefs.filter(repdRef => safeNormalByRef.has(repdRef));
const nonMapOnly = noMapRefs.filter(repdRef => !normalByRef.has(repdRef));
assert.equal(overlap.length, 5233);
assert.equal(fallbacks.length, 2419);
assert.equal(setHash(fallbacks), "5cbd8e6fc2f24f9fab897e9fb558c01e5886d0868db405f73260713ae3542a3b");
assert.equal(finalSelectable.size, 13452);
assert.equal(setHash(finalSelectable), "1ed30d2eef18b75d4b4064f971d2b1ea3fd41ef618fc585b3a3ff0723462ac5f");
assert.equal([...mapSet].filter(repdRef => !finalSelectable.has(repdRef)).length, 0);
assert.equal(noMapRefs.filter(repdRef => finalSelectable.has(repdRef)).length, 0);
assert.equal(nonMapNormal.length, 0);
assert.deepEqual(nonMapOnly.sort((a, b) => Number(a) - Number(b)), ["12780", "15088"]);
const sentinels = {
"17494": { authority: "normal", latitude: 52.47333, longitude: 1.243276 },
"13599": { authority: "normal", latitude: 52.998999, longitude: -0.409234 },
"12453": { authority: "routing", latitude: 53.5802575, longitude: -1.0850616 },
"2484": { authority: "routing", latitude: 52.6199968, longitude: 2.5499934 },
"2535": { authority: "routing", latitude: 50.3929991, longitude: -1.8390082 },
"12780": { authority: "no-map", latitude: null, longitude: null },
"13429": { authority: "no-map", latitude: null, longitude: null }
};
for (const [repdRef, expected] of Object.entries(sentinels)) {
const routing = routingModule.resolveRoutingRecord(decoded, repdRef);
if (expected.authority === "normal") {
assert(safeNormalByRef.has(repdRef), `normal sentinel missing: ${repdRef}`);
assert.equal(safeNormalByRef.get(repdRef).latitude, expected.latitude);
assert.equal(safeNormalByRef.get(repdRef).longitude, expected.longitude);
} else if (expected.authority === "routing") {
assert(!safeNormalByRef.has(repdRef), `fallback sentinel unexpectedly normal: ${repdRef}`);
assert.equal(routing.selectable, true);
assert.equal(routing.record.latitude, expected.latitude);
assert.equal(routing.record.longitude, expected.longitude);
} else {
assert(!safeNormalByRef.has(repdRef));
assert.equal(routing.found, true);
assert.equal(routing.selectable, false);
assert.equal(routing.record.latitude, null);
assert.equal(routing.record.longitude, null);
}
}
assert.equal(routingModule.resolveRoutingRecord(decoded, "012453").found, false, "leading-zero identity matched non-exact repd_ref");
assert.equal(routingModule.resolveRoutingRecord(decoded, "East Pye Solar Farm").found, false, "name matched routing identity");
const app = await readFile(path.join(buildA, "assets/atlas-v9.mjs"), "utf8");
assert(app.indexOf("const normal = featureByRef.get(requested)") < app.indexOf("loadRoutingDeepLinkFallback(release, requested)"), "normal-first precedence drift");
assert(!app.includes('get("longitude")') && !app.includes('get("latitude")'), "runtime trusts query coordinates");
const treeA = await tree(buildA);
const treeB = await tree(buildB);
assert.deepEqual(treeA, treeB, "A/B compiler output differs");
assert.equal(Object.keys(treeA).length, 8);
const report = {
schema: "gridatlas.exhaustive-repd-coverage-comparator.v1",
classification: "VERIFIED_EXHAUSTIVE_REPD_ROUTING_COVERAGE",
release_id: "202608291430-atlas-v9",
promotion_eligible: true,
failed: 0,
deterministic_ab: true,
normal_registry: { source_records: 11069, selectable_records: 11033, excluded_false_origin_records: 36, role: "NORMAL_SEARCH_AND_BASE_MAP" },
routing: {
projects: 7680,
map_identities: 7652,
no_map_identities: 28,
missing: 26,
invalid: 2,
normal_map_overlap: 5233,
routing_only_map_fallbacks: 2419,
normal_selectable: 11033,
excluded_false_origin: 36,
excluded_false_origin_set_sha256: setHash(excludedFalseOrigin),
routing_only_map_fallbacks_set_sha256: setHash(fallbacks),
normal_plus_fallback_union: 13452,
normal_plus_fallback_union_set_sha256: setHash(finalSelectable),
missing_map_identities: 0,
no_map_selectable_intersection: 0,
false_zero_origin: 0,
map_set_sha256: setHash(mapRefs),
no_map_set_sha256: setHash(noMapRefs)
},
sentinels,
exact_repd_ref_only: true,
query_coordinates_ignored: true,
files: treeA
};
await mkdir(path.dirname(path.resolve(args.output)), { recursive: true });
await writeFile(path.resolve(args.output), JSON.stringify(report, null, 2) + "\n");
console.log(JSON.stringify(report));Public Browser Readback
A JavaScript module in the atman folder of GridAtlas that draws grid 400kV snapped, membership and public browser claim, and uses data from the data-GridAtlas repository.
rendergridatlas / atman/202608291430-public-browser-readback.mjs · lines 1–215 of 215 · version 2026-08-29 14:30 · Entry point · pattern waitReady (shared by 3 files)
- What it does
- It draws grid 400kV snapped, membership, public browser claim and the REPD register. Defines collect, waitReady, proveSentinel. Uses libraries node:assert/strict, node:fs, node:path, playwright. Side effects: changes the web page (DOM); reads or writes files; uses storage (browser storage, DuckDB or Parquet).
- Why it exists in the grid workflow
- Domain stage upstream_foresight (repository name word 'gridatlas'): 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, 400kV.
- Inputs & outputs
- In: data source: data-gridatlas data; Parquet file grid_400kv_snapped.parquet; Parquet file layer_membership.parquet; DuckDB queries; command-line arguments. Out: JSON file 202608291430-public-browser-readback.json; JSON file 202608291430-public-browser-claim.json. Voltage levels named: 400kV.
- Downstream impact
- It is itself an entry point (JavaScript module); no other file was found loading it.
- What it achieves
- It proves sentinel (`proveSentinel`) and is built from the wait ready helper (`waitReady`). Defines `collect`, `waitReady` and `proveSentinel`. Its code works with 400 kV.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- gridatlas · atman · JavaScript module
- Uses
- node:assert/strict, node:fs, node:path, playwright
- Used by
- none found
- Produces
- collect, waitReady, proveSentinel
- Defines here
- collect, waitReady, proveSentinel
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 atman/202608291430-public-browser-readback.mjs:1-215 · blob bc7b95fdaa4cca817494b230da7d925f2663b487 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, filesystem, storage · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
#!/usr/bin/env node
import assert from "node:assert/strict";
import fs from "node:fs";
import path from "node:path";
import { chromium } from "playwright";
const releaseId = "202608291430-atlas-v9";
const liveUrl = new URL(process.argv[2] || `https://ventusltd.github.io/gridatlas/${releaseId}/`);
const evidence = path.resolve(process.argv[3] || "work/public/browser");
const routingBase = "https://ventusltd.github.io/data-gridatlas/202608291410-repd-routing/";
const dataPrefix = "/data-gridatlas/202608291237-data-gridatlas/data/";
assert.equal(liveUrl.protocol, "https:");
assert.equal(liveUrl.hostname, "ventusltd.github.io");
assert.equal(liveUrl.pathname, `/gridatlas/${releaseId}/`);
fs.mkdirSync(evidence, { recursive: true });
const sentinels = Object.freeze({
"17494": { source: "normal", geometryStatus: null, center: [1.243276, 52.47333] },
"13599": { source: "normal", geometryStatus: null, center: [-0.409234, 52.998999] },
"12453": { source: "routing", geometryStatus: "valid", center: [-1.0850616, 53.5802575] },
"2484": { source: "routing", geometryStatus: "valid", center: [2.5499934, 52.6199968] },
"2535": { source: "routing", geometryStatus: "valid", center: [-1.8390082, 50.3929991] },
"12780": { source: "routing", geometryStatus: "invalid", center: null },
"13429": { source: "routing", geometryStatus: "missing", center: null }
});
function collect(page) {
const requests = [];
const parquetResponses = [];
const errors = [];
page.setDefaultTimeout(120_000);
page.on("request", request => requests.push({ url: request.url(), method: request.method() }));
page.on("response", response => {
const url = new URL(response.url());
if (url.hostname === "ventusltd.github.io" && url.pathname.startsWith(dataPrefix) && url.pathname.endsWith(".parquet")) {
parquetResponses.push({ url: url.href, method: response.request().method(), status: response.status(), headers: response.headers() });
}
});
page.on("pageerror", error => errors.push(`pageerror: ${error.message}`));
page.on("console", message => { if (message.type() === "error") errors.push(`console: ${message.text()}`); });
return { requests, parquetResponses, errors };
}
async function waitReady(page) {
await page.waitForFunction(() => document.querySelector("[data-registry-status]")?.textContent.includes("11,033"));
await page.waitForFunction(() => document.querySelector("[data-data-status]")?.textContent.includes("60 V8 parity layers ready"));
await page.waitForFunction(() => document.querySelectorAll("[data-layer-id]").length === 60);
await page.waitForFunction(() => document.querySelector("[data-map-state]")?.dataset.mapState === "ready");
}
async function proveSentinel(browser, repdRef, expected) {
const context = await browser.newContext({ viewport: { width: 1024, height: 768 }, reducedMotion: "reduce", locale: "en-GB" });
const page = await context.newPage();
const telemetry = collect(page);
const url = new URL(liveUrl);
url.searchParams.set("repd_ref", repdRef);
url.searchParams.set("longitude", "0");
url.searchParams.set("latitude", "0");
await page.goto(url.href, { waitUntil: "domcontentloaded" });
await waitReady(page);
const route = await page.evaluate(() => globalThis.__GRIDATLAS_REPD_ROUTE__);
assert.equal(route.requested, repdRef);
assert.equal(route.source, expected.source);
assert.equal(route.found, true);
assert.equal(route.selectable, Boolean(expected.center));
assert.equal(route.geometry_status || null, expected.geometryStatus);
const routingRequests = telemetry.requests.filter(item => item.url.startsWith(routingBase));
if (expected.source === "normal") {
assert.equal(routingRequests.length, 0, `normal sentinel fetched routing: ${repdRef}`);
} else {
assert.deepEqual(
routingRequests.map(item => item.url).sort(),
[`${routingBase}projects.json`, `${routingBase}release.json`].sort(),
`routing request closure drift: ${repdRef}`
);
}
assert.equal(telemetry.requests.filter(item => new URL(item.url).pathname.endsWith(".parquet")).length, 0, `sentinel fetched Parquet: ${repdRef}`);
if (expected.center) {
assert.deepEqual([route.longitude, route.latitude], expected.center, `selected coordinates drift: ${repdRef}`);
assert.notDeepEqual([route.longitude, route.latitude], [0, 0]);
assert.notDeepEqual([route.longitude, route.latitude], [-7.55716, 49.766807]);
} else {
assert.equal(route.longitude, null);
assert.equal(route.latitude, null);
assert.match(await page.locator("[data-atlas-live]").innerText(), /NO MAP geometry and is not selectable/);
}
assert.deepEqual(telemetry.errors, []);
const proof = {
source: route.source,
found: route.found,
selectable: route.selectable,
geometry_status: route.geometry_status || null,
center: expected.center,
routing_requests: routingRequests.length,
initial_parquet_requests: 0,
query_coordinates_ignored: true
};
await context.close();
return proof;
}
let browser;
try {
browser = await chromium.launch({ headless: true });
const baseContext = await browser.newContext({ viewport: { width: 1440, height: 900 }, reducedMotion: "reduce", locale: "en-GB" });
const basePage = await baseContext.newPage();
const baseTelemetry = collect(basePage);
await basePage.goto(liveUrl.href, { waitUntil: "domcontentloaded" });
await basePage.waitForFunction(() => performance.getEntriesByName("first-contentful-paint").length === 1);
const firstContentfulPaintMs = await basePage.evaluate(() => performance.getEntriesByName("first-contentful-paint")[0].startTime);
assert(firstContentfulPaintMs <= 5000, `first contentful paint exceeded 5 seconds: ${firstContentfulPaintMs}`);
await waitReady(basePage);
assert.deepEqual(await basePage.evaluate(() => globalThis.__GRIDATLAS_RUNTIME__), {
normalRegistrySourceRows: 11069,
normalSelectableRows: 11033,
excludedFalseOriginRows: 36,
baseMapFeatures: 11033,
routingProjectsWithoutDeepLink: 0
});
assert.equal(baseTelemetry.requests.filter(item => item.url.startsWith(routingBase)).length, 0, "routing fetched without a deep link");
assert.equal(baseTelemetry.requests.filter(item => new URL(item.url).pathname.endsWith(".parquet")).length, 0, "Parquet fetched before user activation");
await basePage.locator("[data-atlas-query]").fill("MK430ZY");
await basePage.locator("[data-atlas-query]").press("Enter");
assert.match(await basePage.locator(".result-card").first().innerText(), /REPD 16135/);
assert.equal(await basePage.locator('[data-layer-disposition^="QUARANTINED_"]').count(), 5);
const activationRequestIndex = baseTelemetry.requests.length;
await basePage.locator('[data-layer-id="400"]').check();
await basePage.waitForFunction(
() => /400kV: [1-9][0-9,]* visible features/.test(document.querySelector("[data-data-status]")?.textContent || ""),
null,
{ timeout: 180_000 }
);
const visibleText = await basePage.locator("[data-data-status]").innerText();
const visibleFeatures = Number(visibleText.match(/400kV: ([0-9,]+) visible features/)?.[1].replaceAll(",", ""));
assert(Number.isInteger(visibleFeatures) && visibleFeatures > 0, `real DuckDB returned no 400kV features: ${visibleText}`);
assert.equal(await basePage.evaluate(() => globalThis.__GRIDATLAS_DUCKDB_MODE__), "real");
assert.equal(await basePage.evaluate(() => Boolean(globalThis.__GRIDATLAS_DUCKDB_TEST_MODULE__)), false);
const activatedParquetRequests = baseTelemetry.requests.slice(activationRequestIndex).filter(item => new URL(item.url).pathname.endsWith(".parquet"));
assert(activatedParquetRequests.some(item => new URL(item.url).pathname.endsWith("/data/derived/grid_400kv_snapped.parquet")), "real DuckDB did not request 400kV Parquet");
assert(activatedParquetRequests.some(item => new URL(item.url).pathname.endsWith("/data/layer_membership.parquet")), "real DuckDB did not request membership Parquet");
const parquetGets = baseTelemetry.parquetResponses.filter(item => item.method === "GET");
assert(parquetGets.length >= 2, "real DuckDB produced fewer than two Parquet GET responses");
assert(parquetGets.every(item => item.status === 206 && /^bytes /i.test(item.headers["content-range"] || "")), `full/non-range Parquet GET: ${JSON.stringify(parquetGets)}`);
const parquetMetadata = baseTelemetry.parquetResponses.filter(item => item.method !== "GET");
assert(parquetMetadata.every(item => ["HEAD", "OPTIONS"].includes(item.method) && [200, 204].includes(item.status)), `unexpected Parquet metadata response: ${JSON.stringify(parquetMetadata)}`);
assert.deepEqual(baseTelemetry.errors, []);
await basePage.screenshot({ path: path.join(evidence, "202608291430-public-live-duckdb.png"), fullPage: true });
await baseContext.close();
const sentinelProof = {};
for (const [repdRef, expected] of Object.entries(sentinels)) sentinelProof[repdRef] = await proveSentinel(browser, repdRef, expected);
const report = {
schema: "gridatlas.public-routing-duckdb-browser-readback.v1",
classification: "VERIFIED_PUBLIC_ROUTING_AND_DUCKDB_BROWSER",
release_id: releaseId,
failed: 0,
live_url: liveUrl.href,
first_contentful_paint_ms: firstContentfulPaintMs,
normal_registry_source_rows: 11069,
normal_registry_selectable_rows: 11033,
base_map_features: 11033,
excluded_false_origin_rows: 36,
routing_without_deep_link_requests: 0,
initial_v8_parquet_requests: 0,
normal_search_golden_repd_ref: "16135",
layer_controls: 60,
quarantined_visible_badges: 5,
duckdb_mode: "real",
real_layer_id: "400",
real_visible_features: visibleFeatures,
real_parquet_range_206: true,
sentinels: sentinelProof,
query_coordinates_ignored: true,
console_errors: 0
};
fs.writeFileSync(path.join(evidence, "202608291430-public-browser-readback.json"), JSON.stringify(report, null, 2) + "\n");
const claim = {
schema: "gridatlas.public-routing-duckdb-browser-claim.v1",
classification: "VERIFIED_PUBLIC_ROUTING_AND_DUCKDB_BROWSER",
release_id: releaseId,
live_url: liveUrl.href,
normal_registry_source_rows: 11069,
normal_registry_selectable_rows: 11033,
excluded_false_origin_rows: 36,
routing_map_identities: 7652,
routing_no_map_identities: 28,
missing_map_identities: 0,
no_map_selectable_intersection: 0,
routing_without_deep_link_requests: 0,
initial_v8_parquet_requests: 0,
sentinels: Object.fromEntries(Object.entries(sentinelProof).map(([repdRef, proof]) => [repdRef, { source: proof.source, selectable: proof.selectable, geometry_status: proof.geometry_status }])),
duckdb_mode: "real",
real_layer_id: "400",
real_result_nonempty: true,
real_parquet_range_206: true,
console_errors: 0
};
fs.writeFileSync(path.join(evidence, "202608291430-public-browser-claim.json"), JSON.stringify(claim, null, 2) + "\n");
console.log(JSON.stringify(report));
} catch (error) {
const report = {
schema: "gridatlas.public-routing-duckdb-browser-readback.v1",
classification: "REJECTED",
release_id: releaseId,
failed: 1,
error: error instanceof Error ? error.stack : String(error)
};
fs.writeFileSync(path.join(evidence, "202608291430-public-browser-readback.json"), JSON.stringify(report, null, 2) + "\n");
console.error(report.error);
process.exitCode = 1;
} finally {
if (browser) await browser.close();
}Rendered Browser Audit
A JavaScript module in the atman folder of GridAtlas that maps projects and Renewable Energy Planning Database (REPD) browser registry, using SHA-256, and uses data from the data-GridAtlas repository.
rendergridatlas / atman/202608291430-rendered-browser-audit.mjs · lines 1–241 of 241 · version 2026-08-29 14:30 · Entry point · pattern MapStub (shared by 2 files)
- What it does
- It maps projects, REPD browser registry and the REPD register. Defines 9 functions or classes, including sha256, canonical, jsonBytes, Source, MapStub. Uses libraries node:assert/strict, node:crypto, node:fs, node:http, node:path. Side effects: changes the web page (DOM); reads or writes files; uses storage (browser storage, DuckDB or Parquet).
- Why it exists in the grid workflow
- Domain stage upstream_foresight (repository name word 'gridatlas'): 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: data-gridatlas data; JSON file projects.json; JSON file release-manifest.json; JSON file repd_browser_registry_202608290716.json; JSON file release.json; JSON file browser-layer-registry.json; command-line arguments. Out: JSON file 202608291430-browser-audit.json.
- Downstream impact
- It is itself an entry point (JavaScript module); no other file was found loading it.
- What it achieves
- It maps stub (`MapStub`) and is built from the JSON bytes helper (`jsonBytes`) and the source class (`Source`). Defines `sha256`, `canonical`, `jsonBytes` and 6 more.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- gridatlas · atman · JavaScript module
- Uses
- Data GridAtlas — Data GridAtlas Page (estate URL), node:assert/strict, node:crypto, node:fs, node:http, node:path, playwright
- Used by
- none found
- Produces
- sha256, canonical, jsonBytes, Source, MapStub, Popup, captureErrors, configure, waitReady
- Defines here
- sha256, canonical, jsonBytes, Source, MapStub, Popup, captureErrors, configure, waitReady
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 atman/202608291430-rendered-browser-audit.mjs:1-241 · blob 31bd4b83cb7cac3f517c8f2a1bdc5269b0c83640 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: dom, filesystem, storage · 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 fs from "node:fs";
import http from "node:http";
import path from "node:path";
import { chromium } from "playwright";
const repository = path.resolve(process.argv[2] || ".");
const site = path.resolve(process.argv[3] || "work/build-a/202608291430-atlas-v9");
const dataReleaseDirectory = path.resolve(process.argv[4] || "work/data-release/202608291237-data-gridatlas");
const routingProjectsPath = path.resolve(process.argv[5] || "work/routing/projects.json");
const evidence = path.resolve(process.argv[6] || "work/rendered");
const releaseId = "202608291430-atlas-v9";
const dataBase = "https://ventusltd.github.io/data-gridatlas/202608291237-data-gridatlas/";
const routingBase = "https://ventusltd.github.io/data-gridatlas/202608291410-repd-routing/";
fs.mkdirSync(evidence, { recursive: true });
function sha256(body) { return createHash("sha256").update(body).digest("hex"); }
function canonical(value) {
if (Array.isArray(value)) return value.map(canonical);
if (value && typeof value === "object") return Object.fromEntries(Object.keys(value).sort().map(key => [key, canonical(value[key])]));
return value;
}
function jsonBytes(value) { return Buffer.from(JSON.stringify(canonical(value), null, 2) + "\n"); }
const appManifest = JSON.parse(fs.readFileSync(path.join(site, "release-manifest.json"), "utf8"));
const normalRegistryBytes = fs.readFileSync(path.join(repository, "data/repd_browser_registry_202608290716.json"));
const normalRegistry = JSON.parse(normalRegistryBytes);
const dataReleaseBytes = fs.readFileSync(path.join(dataReleaseDirectory, "release.json"));
const dataRegistryBytes = fs.readFileSync(path.join(dataReleaseDirectory, "browser-layer-registry.json"));
const routingProjectsBytes = fs.readFileSync(routingProjectsPath);
assert.equal(routingProjectsBytes.length, 979338);
assert.equal(sha256(routingProjectsBytes), "c06aedef176d2d38fd135806306a8ef81b4af9994c7be31e8bd760304149f862");
const routing = appManifest.repd_routing;
const routingReleaseBytes = jsonBytes({
schema: "data-gridatlas.repd-routing-release.v1",
generation: "202608291410",
release_id: routing.release_id,
source_commit: routing.source_commit,
classification: "IMMUTABLE_REPD_ROUTING_RELEASE",
immutable: true,
public_url: routing.base_url,
coverage: {
projects: 7680,
unique_numeric_repd_refs: 7680,
map_identities: 7652,
no_map_identities: 28,
map_set_sha256: routing.map_set_sha256,
no_map_set_sha256: routing.no_map_set_sha256
},
files: { projects: { path: "projects.json", bytes: routingProjectsBytes.length, sha256: sha256(routingProjectsBytes) } }
});
const servedManifest = structuredClone(appManifest);
servedManifest.repd_routing.release_sha256 = sha256(routingReleaseBytes);
const servedManifestBytes = jsonBytes(servedManifest);
const mime = new Map([[".html", "text/html"], [".mjs", "text/javascript"], [".css", "text/css"], [".json", "application/json"]]);
const server = http.createServer((request, response) => {
const url = new URL(request.url, "http://127.0.0.1");
const pathname = decodeURIComponent(url.pathname);
let target = null;
let body = null;
if (pathname === `/${releaseId}/release-manifest.json`) body = servedManifestBytes;
else if (pathname === `/${releaseId}` || pathname === `/${releaseId}/`) target = path.join(site, "index.html");
else if (pathname.startsWith(`/${releaseId}/`)) target = path.resolve(site, pathname.slice(releaseId.length + 2));
else if (pathname.startsWith("/data/")) target = path.resolve(repository, pathname.slice(1));
if (target && !target.startsWith(site + path.sep) && !target.startsWith(repository + path.sep)) {
response.writeHead(403).end("forbidden");
return;
}
try { body ||= target ? fs.readFileSync(target) : null; } catch { body = null; }
if (!body) { response.writeHead(404).end("not found"); return; }
response.writeHead(200, { "content-type": mime.get(path.extname(target || pathname)) || "application/octet-stream", "content-length": body.length, "cache-control": "no-store" });
response.end(body);
});
const maplibreStub = `
globalThis.__atlasAudit = { flyTo: [], jumpTo: [], selected: [], popups: [], sources: [], layers: [] };
class Source { constructor(id, options) { this.id=id; this.data=options.data; } setData(data) { this.data=data; if(this.id==="repd-selected") globalThis.__atlasAudit.selected.push(data); } getClusterExpansionZoom(_id, cb) { cb(null,10); } }
class MapStub {
constructor(options) { this.options=options; this.sources=new globalThis.Map(); this.layers=new globalThis.Map(); this.handlers={}; this.zoom=options.zoom; globalThis.__atlasAudit.map=this; setTimeout(()=>this.emit("load",{}),0); }
addControl() {} addSource(id,options) { this.sources.set(id,new Source(id,options)); this.__push("sources",id); }
addLayer(layer) { this.layers.set(layer.id,layer); this.__push("layers",layer.id); }
__push(key,value) { globalThis.__atlasAudit[key].push(value); }
getSource(id) { return this.sources.get(id); } getLayer(id) { return this.layers.get(id); }
removeLayer(id) { this.layers.delete(id); } removeSource(id) { this.sources.delete(id); }
getZoom() { return this.zoom; } getBounds() { return {getWest:()=>-8,getSouth:()=>49,getEast:()=>2,getNorth:()=>61}; }
on(event, layerOrHandler, possibleHandler) { const layer=typeof layerOrHandler==="function"?null:layerOrHandler; const handler=layer?possibleHandler:layerOrHandler; (this.handlers[event]||=[]).push({layer,handler}); }
off(event, layerOrHandler, possibleHandler) { const layer=typeof layerOrHandler==="function"?null:layerOrHandler; const handler=layer?possibleHandler:layerOrHandler; this.handlers[event]=(this.handlers[event]||[]).filter(item=>item.layer!==layer||item.handler!==handler); }
emit(event,payload) { for(const item of this.handlers[event]||[]) if(!item.layer) item.handler(payload); }
flyTo(options) { globalThis.__atlasAudit.flyTo.push(options); } jumpTo(options) { this.zoom=options.zoom; globalThis.__atlasAudit.jumpTo.push(options); } easeTo() {}
}
class Popup { setLngLat(value){this.lngLat=value;return this;} setDOMContent(node){this.text=node.textContent;return this;} addTo(){globalThis.__atlasAudit.popups.push({lngLat:this.lngLat,text:this.text});return this;} }
globalThis.maplibregl={Map:MapStub,Popup,NavigationControl:class{}};
`;
function captureErrors(page) {
const errors = [];
page.on("pageerror", error => errors.push(`pageerror: ${error.message}`));
page.on("console", message => { if (message.type() === "error") errors.push(`console: ${message.text()}`); });
return errors;
}
async function configure(context, requests) {
await context.route("**/*", async route => {
const url = new URL(route.request().url());
if (url.hostname === "127.0.0.1") return route.continue();
requests.push(url.href);
if (url.href === `${dataBase}release.json`) return route.fulfill({ status: 200, contentType: "application/json", body: dataReleaseBytes });
if (url.href === `${dataBase}browser-layer-registry.json`) return route.fulfill({ status: 200, contentType: "application/json", body: dataRegistryBytes });
if (url.href === `${routingBase}release.json`) return route.fulfill({ status: 200, contentType: "application/json", body: routingReleaseBytes });
if (url.href === `${routingBase}projects.json`) return route.fulfill({ status: 200, contentType: "application/json", body: routingProjectsBytes });
if (url.hostname === "cdn.jsdelivr.net" && url.pathname.endsWith("maplibre-gl.js")) return route.fulfill({ status: 200, contentType: "text/javascript", body: maplibreStub });
if (url.hostname === "cdn.jsdelivr.net" && url.pathname.endsWith("maplibre-gl.css")) return route.fulfill({ status: 200, contentType: "text/css", body: "" });
if (url.hostname === "tile.openstreetmap.org") return route.abort();
return route.abort("blockedbyclient");
});
}
async function waitReady(page) {
await page.waitForFunction(() => document.querySelector("[data-registry-status]")?.textContent.includes("11,033"));
await page.waitForFunction(() => document.querySelector("[data-data-status]")?.textContent.includes("60 V8 parity layers ready"));
await page.waitForFunction(() => document.querySelectorAll("[data-layer-id]").length === 60);
await page.waitForFunction(() => document.querySelector("[data-map-state]")?.dataset.mapState === "ready");
}
const expected = {
"17494": { source: "normal", center: [1.243276, 52.47333] },
"13599": { source: "normal", center: [-0.409234, 52.998999] },
"12453": { source: "routing", center: [-1.0850616, 53.5802575] },
"2484": { source: "routing", center: [2.5499934, 52.6199968] },
"2535": { source: "routing", center: [-1.8390082, 50.3929991] },
"12780": { source: "routing", center: null },
"13429": { source: "routing", center: null }
};
let browser;
try {
await new Promise(resolve => server.listen(0, "127.0.0.1", resolve));
const base = `http://127.0.0.1:${server.address().port}/${releaseId}/`;
browser = await chromium.launch({ headless: true });
const context = await browser.newContext({ viewport: { width: 1440, height: 900 }, reducedMotion: "reduce", locale: "en-GB" });
const baseRequests = [];
await configure(context, baseRequests);
const page = await context.newPage();
const baseErrors = captureErrors(page);
await page.goto(base, { waitUntil: "domcontentloaded" });
await waitReady(page);
assert.equal(baseRequests.filter(url => url.startsWith(routingBase)).length, 0, "routing loaded without a missing deep link");
assert.equal(baseRequests.filter(url => url.endsWith(".parquet")).length, 0, "Parquet loaded on boot");
assert.deepEqual(await page.evaluate(() => globalThis.__GRIDATLAS_RUNTIME__), {
normalRegistrySourceRows: 11069,
normalSelectableRows: 11033,
excludedFalseOriginRows: 36,
baseMapFeatures: 11033,
routingProjectsWithoutDeepLink: 0
});
assert.equal(await page.evaluate(() => globalThis.__atlasAudit.map.getSource("repd-v9").data.features.length), 11033, "safe normal map registry closure drift");
assert.equal(await page.evaluate(() => globalThis.__atlasAudit.map.getSource("repd-v9").data.features.some(item => item.geometry.coordinates[0] === 0 && item.geometry.coordinates[1] === 0)), false);
assert.equal(await page.evaluate(() => globalThis.__atlasAudit.map.getSource("repd-v9").data.features.some(item => item.geometry.coordinates[0] === -7.55716 && item.geometry.coordinates[1] === 49.766807)), false);
await page.locator("[data-atlas-query]").fill("MK430ZY");
await page.locator("[data-atlas-query]").press("Enter");
assert.match(await page.locator(".result-card").first().innerText(), /REPD 16135/);
assert.deepEqual(baseErrors, []);
await page.screenshot({ path: path.join(evidence, "202608291430-browser-desktop.png"), fullPage: true });
await context.close();
const sentinelProof = {};
for (const [repdRef, claim] of Object.entries(expected)) {
const sentinelContext = await browser.newContext({ viewport: { width: repdRef === "12780" ? 390 : 1024, height: repdRef === "12780" ? 844 : 768 }, reducedMotion: "reduce", locale: "en-GB" });
const requests = [];
await configure(sentinelContext, requests);
const sentinelPage = await sentinelContext.newPage();
const errors = captureErrors(sentinelPage);
await sentinelPage.goto(`${base}?repd_ref=${repdRef}&longitude=0&latitude=0`, { waitUntil: "domcontentloaded" });
await waitReady(sentinelPage);
const state = await sentinelPage.evaluate(() => globalThis.__GRIDATLAS_REPD_ROUTE__);
const audit = await sentinelPage.evaluate(() => ({
jumps: globalThis.__atlasAudit.jumpTo,
selections: globalThis.__atlasAudit.selected,
live: document.querySelector("[data-atlas-live]")?.textContent || ""
}));
assert.equal(state.requested, repdRef);
assert.equal(state.source, claim.source);
const routingRequests = requests.filter(url => url.startsWith(routingBase));
if (claim.source === "normal") assert.equal(routingRequests.length, 0, `normal sentinel fetched routing: ${repdRef}`);
else assert.deepEqual(routingRequests.sort(), [`${routingBase}projects.json`, `${routingBase}release.json`].sort());
if (claim.center) {
assert.equal(state.selectable, true);
assert.deepEqual([state.longitude, state.latitude], claim.center);
assert.deepEqual(audit.jumps.at(-1)?.center, claim.center);
const selected = audit.selections.at(-1)?.geometry?.coordinates;
assert.deepEqual(selected, claim.center);
assert.notDeepEqual(selected, [0, 0]);
} else {
assert.equal(state.found, true);
assert.equal(state.selectable, false);
assert.equal(state.longitude, null);
assert.equal(state.latitude, null);
assert.equal(state.geometry_status, repdRef === "12780" ? "invalid" : "missing");
assert.equal(audit.jumps.length, 0);
assert.equal(audit.selections.length, 0);
assert.match(audit.live, /NO MAP geometry and is not selectable/);
}
assert.equal(requests.filter(url => url.endsWith(".parquet")).length, 0);
assert.deepEqual(errors, []);
sentinelProof[repdRef] = { ...state, center: claim.center, routing_requests: routingRequests.length, zero_origin: false };
if (repdRef === "12780") await sentinelPage.screenshot({ path: path.join(evidence, "202608291430-browser-mobile.png"), fullPage: true });
await sentinelContext.close();
}
const report = {
schema: "gridatlas.rendered-routing-browser-audit.v1",
classification: "VERIFIED_RENDERED_ROUTING_BROWSER",
release_id: releaseId,
failed: 0,
viewports: ["1440x900", "1024x768", "390x844"],
normal_registry_source_rows: normalRegistry.records.length,
normal_registry_selectable_rows: 11033,
excluded_false_origin_rows: 36,
normal_search_preserved: true,
routing_without_deep_link_requests: 0,
initial_v8_parquet_requests: 0,
layer_controls: 60,
sentinels: sentinelProof,
false_zero_origin_points: 0,
exact_repd_ref_only: true,
query_coordinates_ignored: true
};
fs.writeFileSync(path.join(evidence, "202608291430-browser-audit.json"), JSON.stringify(report, null, 2) + "\n");
console.log(JSON.stringify(report));
} catch (error) {
const report = { schema: "gridatlas.rendered-routing-browser-audit.v1", classification: "REJECTED", release_id: releaseId, failed: 1, error: error instanceof Error ? error.stack : String(error) };
fs.writeFileSync(path.join(evidence, "202608291430-browser-audit.json"), JSON.stringify(report, null, 2) + "\n");
console.error(report.error);
process.exitCode = 1;
} finally {
if (browser) await browser.close();
if (server.listening) await new Promise(resolve => server.close(resolve));
}