GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Maps, GIS and field navigation / gridatlas / tools/proofs

Arrival Engine Sweep Browser and 8 more files

A JavaScript module in the proofs folder of GridAtlas that reads Renewable Energy Planning Database (REPD) browser registry, interconnector endpoints, interconnectors and the REPD register.

698 lines of JavaScript from gridatlas, in 9 files. Topic: Maps, GIS and field navigation. Section 649 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. Arrival Engine Sweep Browser render · gridatlas / tools/proofs/202609072356-arrival-engine-sweep.browser.mjs lines 1–311
  2. Streaming Parquet Bridge Proof render · gridatlas / tools/proofs/202609241251-streaming-parquet-bridge.proof.mjs lines 1–266
  3. UK Lightning Overlay Proof other · gridatlas / tools/proofs/202610312138-uk-lightning-overlay.proof.mjs lines 1–3
  4. Grid Journey Preview Proof other · gridatlas / tools/proofs/202611172355-grid-journey-preview.proof.mjs lines 1–2
  5. Grid Vicinity Proof other · gridatlas / tools/proofs/202611180026-grid-vicinity.proof.mjs lines 1–2
  6. UK Gazetteer Flyto Proof other · gridatlas / tools/proofs/202611180026-uk-gazetteer-flyto.proof.mjs lines 1–2
  7. Pipeline Vicinity Button Proof energy-data · gridatlas / tools/proofs/202611222000-pipeline-vicinity-button.proof.mjs lines 1–11
  8. Vicinity Entry Browser render · gridatlas / tools/proofs/202611222000-vicinity-entry.browser.mjs lines 1–55
  9. Vicinity Entry Proof ingest · gridatlas / tools/proofs/202611222000-vicinity-entry.proof.mjs lines 1–46

Arrival Engine Sweep Browser

A JavaScript module in the proofs folder of GridAtlas that reads Renewable Energy Planning Database (REPD) browser registry, interconnector endpoints, interconnectors and the REPD register.

rendergridatlas / tools/proofs/202609072356-arrival-engine-sweep.browser.mjs · lines 1–311 of 311 · version 2026-09-07 23:56 · Not reached from any entry point (candidate for review)

What it does
It loads REPD browser registry, interconnector endpoints, interconnectors and the REPD register. Defines arg, pad, n. Uses libraries node:http, node:fs/promises, node:path, node:module, node:url. Side effects: changes the web page (DOM); reads or writes files; starts processes; 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: interconnectors, the REPD register.
Inputs & outputs
In: JSON file repd_browser_registry_202608290716.json; JSON file current.json; JSON file interconnector-endpoints.json; DuckDB queries; command-line arguments.
What it achieves
It is built from the arg step (`arg`) and the pad step (`pad`). Which engine answered?
Why it matters
No other file in the estate was found to import it.
Application
gridatlas · tools/proofs · JavaScript module
Uses
node:http, node:fs/promises, node:path, node:module, node:url, playwright
Used by
none found
Produces
arg, pad, n
Defines here
arg, pad, n
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/proofs/202609072356-arrival-engine-sweep.browser.mjs:1-311 · blob 55c88b36024d26118a3a09cd5288047deaba7467 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, process, storage · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
/* 202609072356-arrival-engine-sweep.browser.mjs — does the engine answer, and
 * which engine answered?
 *
 * "Fix ventus grid engine so it launches each time" -- the architect,
 * 2026-09-08. That is a claim about every arrival, so it needs an instrument
 * that looks at every arrival rather than at five golden ones.
 *
 * v9.148 made the answer observable: every arrival is supposed to leave
 * `window.__GRIDATLAS_NEON_LINKS__.arrival_engine` behind, carrying which
 * engine answered (onshore, offshore, interconnector), whether it answered,
 * the reason if it did not, and what it fell back from if it fell back. This
 * sweep reads exactly that, so "the engine was silent" and "the engine said it
 * could not answer, and why" stop looking identical.
 *
 * It reports three outcomes per case and never conflates them:
 *
 *   ANSWERED   the sentinel exists and answered === true
 *   DECLINED   the sentinel exists and answered === false, with a named reason
 *   SILENT     the arrival finished and no sentinel was ever written
 *
 * SILENT is the defect. DECLINED is the engine working: an engine that cannot
 * answer and says why is doing its job, and the reason string is the map of
 * what to fix next. So the exit code is non-zero on SILENT or on a page error,
 * never on DECLINED, and never because a project is unusual.
 *
 * The corpus is the published register on disk, not a network fetch, and it is
 * stratified by technology rather than sampled evenly: wind_offshore is 97 rows
 * of 11,069, so an even sample of 40 would contain none of them and would have
 * reported the offshore engine as fine.
 *
 *   node tools/proofs/202609072356-arrival-engine-sweep.browser.mjs
 *     [--per-tech 4] [--engine chromium|webkit] [--width 393] [--height 852]
 *     [--only wind_offshore,tidal] [--timeout 40000] [--json out.json]
 *
 * 393x852 is the default because the phone is the environment the architect
 * asked to be prioritised, and because this estate's defects have repeatedly
 * been invisible at desktop width.
 */
import { createServer } from 'node:http';
import { readFile, writeFile } from 'node:fs/promises';
import path from 'node:path';
import { createRequire } from 'node:module';
import { fileURLToPath } from 'node:url';

const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
const require = createRequire(import.meta.url);
const playwright = require('playwright');

function arg(flag, fallback) {
  const i = process.argv.indexOf(flag);
  return i > -1 && process.argv[i + 1] ? process.argv[i + 1] : fallback;
}

const PER_TECH = Number(arg('--per-tech', '4'));
const ENGINE = arg('--engine', 'chromium');
const VIEWPORT = { width: Number(arg('--width', '393')), height: Number(arg('--height', '852')) };
const ONLY = arg('--only', '').split(',').map(s => s.trim()).filter(Boolean);
const TIMEOUT = Number(arg('--timeout', '40000'));
const JSON_OUT = arg('--json', '');

const REGISTRY = path.join(ROOT, 'data', 'repd_browser_registry_202608290716.json');

const MIME = new Map([
  ['.html', 'text/html; charset=utf-8'], ['.js', 'text/javascript; charset=utf-8'],
  ['.mjs', 'text/javascript; charset=utf-8'], ['.json', 'application/json; charset=utf-8'],
  ['.css', 'text/css; charset=utf-8'], ['.wasm', 'application/wasm'],
  ['.parquet', 'application/octet-stream'], ['.geojson', 'application/json; charset=utf-8']
]);

/* Range matters: the parquet reader asks for byte ranges, and a server that
   answers 200-with-everything makes DuckDB read the whole file or give up. */
const server = createServer(async (request, response) => {
  try {
    const url = new URL(request.url, 'http://127.0.0.1');
    const rel = decodeURIComponent(url.pathname).replace(/^\/+/, '');
    const file = path.join(ROOT, rel);
    if (!file.startsWith(ROOT)) { response.writeHead(403).end(); return; }
    const body = await readFile(file);
    const type = MIME.get(path.extname(file)) || 'application/octet-stream';
    const range = /^bytes=(\d*)-(\d*)$/.exec(request.headers.range || '');
    if (range) {
      const start = range[1] ? Number(range[1]) : 0;
      const end = range[2] ? Number(range[2]) : body.length - 1;
      const slice = body.subarray(start, end + 1);
      response.writeHead(206, {
        'content-type': type,
        'content-range': `bytes ${start}-${end}/${body.length}`,
        'accept-ranges': 'bytes',
        'content-length': String(slice.length)
      });
      response.end(slice);
      return;
    }
    response.writeHead(200, { 'content-type': type, 'accept-ranges': 'bytes' });
    response.end(body);
  } catch {
    response.writeHead(404).end();
  }
});

await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));
const base = `http://127.0.0.1:${server.address().port}`;

const current = JSON.parse(await readFile(path.join(ROOT, 'atlas', 'current.json'), 'utf8'));
const sld = (current.cartridges || []).find(c => c.id === 'sld-sandbox');

const registry = JSON.parse(await readFile(REGISTRY, 'utf8'));
const rows = (registry.records || []).filter(r => r && r.repd_ref);

/* Stratify. Even sampling hides the small technologies, and the small
   technologies are exactly where the offshore and interconnector engines
   live. */
const byTech = new Map();
for (const row of rows) {
  const tech = String(row.technology || row.repd_technology || 'unknown');
  if (ONLY.length && !ONLY.includes(tech)) continue;
  if (!byTech.has(tech)) byTech.set(tech, []);
  byTech.get(tech).push(row);
}
const sample = [];
for (const [tech, list] of [...byTech.entries()].sort()) {
  const step = Math.max(1, Math.floor(list.length / PER_TECH));
  for (let i = 0, taken = 0; i < list.length && taken < PER_TECH; i += step, taken += 1) {
    sample.push({ tech, row: list[i] });
  }
}

/* The interconnector engine is not in the register and never can be: the REPD
   is a register of generation and storage, and an interconnector is neither.
   Sampling the register alone therefore reported "the engine fires on every
   technology" while never once asking the interconnector engine anything -
   which is how it shipped leaving arrival_engine null in every one of its
   branches. Its corpus is its own endpoint file, and all ten links are used,
   not a sample: ten cases is not a sampling problem. */
const ENDPOINTS = path.join(ROOT, 'atlas', 'data', 'interconnector-endpoints.json');
if (!ONLY.length || ONLY.includes('interconnector')) {
  try {
    const endpoints = JSON.parse(await readFile(ENDPOINTS, 'utf8'));
    for (const row of (endpoints.endpoints || endpoints.records || endpoints.links || [])) {
      if (!row || !row.bmrs) continue;
      sample.push({
        tech: 'interconnector',
        row: {
          repd_ref: row.bmrs, name: row.link || row.bmrs,
          latitude: row.gb_lat, longitude: row.gb_lon,
          technology: 'interconnector', interconnector: row.bmrs
        }
      });
    }
  } catch (e) {
    console.log(`interconnector corpus unavailable (${String(e.message || e).slice(0, 80)}) — that stratum is not covered by this run`);
  }
}

console.log(`generation ${current.generation} · sld-sandbox ${sld ? sld.version : '(none)'} · ${ENGINE} · ${VIEWPORT.width}x${VIEWPORT.height}`);
console.log(`corpus ${rows.length} rows · ${byTech.size} technologies · ${sample.length} cases (${PER_TECH} per technology)\n`);

if (!sample.length) {
  console.error('no cases selected — the corpus filter matched nothing, which is a broken harness, not a green run');
  server.close();
  process.exit(2);
}

const browser = await playwright[ENGINE].launch();
const context = await browser.newContext({
  viewport: VIEWPORT, deviceScaleFactor: 3, isMobile: true, hasTouch: true
});

const results = [];
let done = 0;

for (const { tech, row } of sample) {
  const ref = String(row.repd_ref);
  /* An interconnector arrival is addressed by BMRS code, not by a REPD ref -
     that is the whole reason the project lane stands down on it. */
  const params = row.interconnector
    ? new URLSearchParams({ interconnector: String(row.interconnector) })
    : new URLSearchParams({ repd_ref: ref });
  if (tech) params.set('technology', tech);
  if (row.latitude != null && row.longitude != null) {
    params.set('latitude', String(row.latitude));
    params.set('longitude', String(row.longitude));
    params.set('zoom', '9');
  }

  const page = await context.newPage();
  const errors = [];
  page.on('pageerror', e => errors.push(String((e && e.message) || e)));

  const record = {
    ref, tech, name: String(row.name || '').slice(0, 60),
    latitude: row.latitude, longitude: row.longitude,
    outcome: 'SILENT', engine: null, answered: null, reason: null,
    fallback_from: null, links_drawn: null, page_error: null
  };

  try {
    await page.goto(`${base}/atlas/index.html?${params}`, { waitUntil: 'domcontentloaded', timeout: 45000 });
    /* Wait for the sentinel, not for a clock. An arrival that takes 20s and
       answers is working; an arrival that returns in 200ms with nothing is
       the defect this sweep exists to count.

       And wait for a TERMINAL record, not the first one written. An
       interconnector arrival is handed over within milliseconds and that
       handover is a receipt - stopping there would report every interconnector
       as unanswered while its measurement was still running. If the wait times
       out on a non-terminal record, that is reported as PENDING rather than
       silently graded either way: the engine took the arrival and did not
       finish inside the budget, which is a third thing and worth its own name. */
    const sentinel = await page.waitForFunction(
      () => {
        const a = window.__GRIDATLAS_NEON_LINKS__?.arrival_engine;
        return a && a.terminal !== false ? a : null;
      },
      undefined,
      { timeout: TIMEOUT }
    ).then(h => h.jsonValue()).catch(() => null);

    const anySentinel = sentinel || await page.evaluate(
      () => window.__GRIDATLAS_NEON_LINKS__?.arrival_engine || null
    ).catch(() => null);

    const surface = await page.evaluate(() => {
      const l = window.__GRIDATLAS_NEON_LINKS__ || {};
      return { links_drawn: l.links_drawn ?? null, installed: l.installed ?? null, deep_linked: l.deep_linked ?? null };
    }).catch(() => ({}));

    record.links_drawn = surface.links_drawn ?? null;
    if (errors.length) { record.page_error = errors[0].slice(0, 200); record.outcome = 'PAGE_ERROR'; }
    else if (anySentinel) {
      record.engine = anySentinel.engine ?? null;
      record.answered = Boolean(anySentinel.answered);
      record.reason = anySentinel.reason ?? null;
      record.fallback_from = anySentinel.fallback_from ?? null;
      record.terminal = anySentinel.terminal !== false;
      record.outcome = !record.terminal ? 'PENDING'
        : (record.answered ? 'ANSWERED' : 'DECLINED');
    }
  } catch (e) {
    record.outcome = 'PAGE_ERROR';
    record.page_error = String((e && e.message) || e).slice(0, 200);
  }

  await page.close();
  results.push(record);
  done += 1;
  process.stdout.write(`${done}/${sample.length}\r`);
}

await browser.close();
server.close();

/* Per technology, because "the engine fires every time" is false in a way that
   is specific to a technology, and an overall percentage would hide it. */
const techs = [...new Set(results.map(r => r.tech))].sort();
const pad = (s, n) => String(s).padEnd(n);
console.log(`\n${pad('technology', 16)} ${pad('cases', 6)} ${pad('answered', 9)} ${pad('declined', 9)} ${pad('pending', 8)} ${pad('silent', 7)} ${pad('error', 6)} engines / reasons`);
for (const tech of techs) {
  const list = results.filter(r => r.tech === tech);
  const n = o => list.filter(r => r.outcome === o).length;
  const engines = [...new Set(list.map(r => r.engine).filter(Boolean))].join(',') || '-';
  const reasons = [...new Set(list.map(r => r.reason).filter(Boolean))].join(',');
  console.log(`${pad(tech, 16)} ${pad(list.length, 6)} ${pad(n('ANSWERED'), 9)} ${pad(n('DECLINED'), 9)} ${pad(n('PENDING'), 8)} ${pad(n('SILENT'), 7)} ${pad(n('PAGE_ERROR'), 6)} ${engines}${reasons ? ' | ' + reasons : ''}`);
}

const silent = results.filter(r => r.outcome === 'SILENT');
const errored = results.filter(r => r.outcome === 'PAGE_ERROR');
const declined = results.filter(r => r.outcome === 'DECLINED');
const pendingCases = results.filter(r => r.outcome === 'PENDING');

console.log(`\nanswered ${results.filter(r => r.outcome === 'ANSWERED').length} · declined ${declined.length} · pending ${pendingCases.length} · silent ${silent.length} · page error ${errored.length}  (of ${results.length})`);

if (pendingCases.length) {
  console.log(`\nPENDING — an engine took the arrival and had not finished within ${TIMEOUT} ms:`);
  for (const r of pendingCases.slice(0, 30)) {
    console.log(`  ${pad(r.tech, 15)} ref ${pad(r.ref, 7)} ${r.engine} · ${r.reason}  ${r.name}`);
  }
}

if (declined.length) {
  console.log('\ndeclined, with the reason the engine gave:');
  for (const r of declined.slice(0, 30)) {
    console.log(`  ${pad(r.tech, 15)} ref ${pad(r.ref, 7)} ${r.engine} · ${r.reason}${r.fallback_from ? ` · fell back from ${r.fallback_from}` : ''}  ${r.name}`);
  }
  if (declined.length > 30) console.log(`  … and ${declined.length - 30} more`);
}
if (silent.length) {
  console.log('\nSILENT — the arrival finished and never named an engine:');
  for (const r of silent.slice(0, 30)) {
    console.log(`  ${pad(r.tech, 15)} ref ${pad(r.ref, 7)} links_drawn=${r.links_drawn}  ${r.name}`);
  }
  if (silent.length > 30) console.log(`  … and ${silent.length - 30} more`);
}
if (errored.length) {
  console.log('\npage errors:');
  for (const r of errored.slice(0, 15)) console.log(`  ${pad(r.tech, 15)} ref ${pad(r.ref, 7)} ${r.page_error}`);
}

if (JSON_OUT) {
  await writeFile(JSON_OUT, JSON.stringify({
    schema: 'gridatlas.arrival-engine-sweep.v1',
    generation: current.generation,
    sld_sandbox: sld ? sld.version : null,
    engine: ENGINE, viewport: VIEWPORT, per_tech: PER_TECH,
    run_utc: new Date().toISOString(),
    results
  }, null, 1) + '\n', 'utf8');
  console.log(`\nwrote ${JSON_OUT}`);
}

process.exit(silent.length || errored.length ? 1 : 0);

Streaming Parquet Bridge Proof

A JavaScript module in the proofs folder of GridAtlas that fetches grid 400kV, not grid and UK metros trams local unwired, using SHA-256 from example.test.

rendergridatlas / tools/proofs/202609241251-streaming-parquet-bridge.proof.mjs · lines 1–266 of 266 · version 2026-09-24 12:51 · Entry point

What it does
It fetches grid 400kV, not grid, UK metros trams local unwired and REPD master. Defines nativeFetch, nativeFetch2. Uses libraries node:assert/strict, node:crypto, node:fs/promises, node:path, node:process. Side effects: changes the web page (DOM); reads or writes files; makes network requests; 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: 400kV.
Inputs & outputs
In: data source: example.test; JSON file current.json; GeoJSON file grid_400kv.geojson; JSON file not-grid-data.json; GeoJSON file uk_metros_trams.geojson; Parquet file uk_metros_trams_local_unwired.parquet; JSON file repd_master.json; DuckDB queries. 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 is built from the native fetch helper (`nativeFetch`) and the native fetch2 helper (`nativeFetch2`). Defines `nativeFetch` and `nativeFetch2`.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
gridatlas · tools/proofs · JavaScript module
Uses
GridAtlas — Atlas Page (estate URL), node:assert/strict, node:crypto, node:fs/promises, node:path, node:process, node:vm, node:url
Used by
none found
Produces
nativeFetch, nativeFetch2
Defines here
nativeFetch, nativeFetch2
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/proofs/202609241251-streaming-parquet-bridge.proof.mjs:1-266 · blob 8e0c531d1ee48c290c7fcf8f6f64ac7a60c410a4 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom, filesystem, network, 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 { readFile } from 'node:fs/promises';
import path from 'node:path';
import process from 'node:process';
import vm from 'node:vm';
import { fileURLToPath } from 'node:url';

const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
/* Two generations, deliberately, because they are two different things.
   The RUNTIME is restamped every time these bytes change - at 202609241251 it
   gained the shared DuckDB broker. The CONTRACT is the behavioural promise the
   cartridge makes, which did not change, so current.json still points at
   202608301825 and this proof must too. Folding them back into one constant is
   how a proof ends up asserting against a file that does not exist. */
const GENERATION = '202609241251';
const CONTRACT_GENERATION = '202609241251';
const ID = 'streaming-parquet-bridge';
const RUNTIME = `atlas/cartridges/${GENERATION}-streaming-parquet-bridge-v9-5.js`;
const CONTRACT = `ui/cartridges/${CONTRACT_GENERATION}-streaming-parquet-bridge-v9-5.mjs`;

const source = await readFile(path.join(ROOT, RUNTIME), 'utf8');
const contractSource = await readFile(path.join(ROOT, CONTRACT), 'utf8');
const current = JSON.parse(await readFile(path.join(ROOT, 'atlas', 'current.json'), 'utf8'));
const entry = current.cartridges.find(({ id }) => id === ID);
assert.ok(entry, `${ID} is not in the current composition`);
assert.equal(entry.generation, GENERATION);
assert.equal(entry.path, `./cartridges/${GENERATION}-streaming-parquet-bridge-v9-5.js`);
const servedSource = source.replace(/\r\n/g, '\n');
assert.equal(createHash('sha256').update(servedSource).digest('hex'), entry.sha256,
  'the proof is not reading the composed runtime bytes');

assert.match(contractSource, /responseEstablishedBeforeBodyReconstruction: true/);
assert.match(contractSource, /payloadCacheReleasedAfterSerialisation: true/);
assert.match(contractSource, /duckdbPrewarm: 'after-critical-400kv-source'/);
assert.match(contractSource, /metroPartitionAlias: 'uk_metros_trams_local_unwired'/);

let nativeCalls = 0;
let manifestRequested = false;
const never = new Promise(() => {});
const nativeFetch = async (input, init) => {
  nativeCalls += 1;
  const url = String(input?.url || input);
  if (url.includes('manifest.json')) {
    manifestRequested = true;
    return never;
  }
  return { native: true, input, init };
};

const windowObject = {
  location: { href: 'https://ventusltd.github.io/gridatlas/atlas/' },
  fetch: nativeFetch,
};
windowObject.window = windowObject;
const context = vm.createContext({
  window: windowObject,
  URL,
  TextEncoder,
  TextDecoder,
  ReadableStream,
  Response,
  DOMException,
  Promise,
  Map,
  Set,
  JSON,
  console,
  performance,
  queueMicrotask() {}, // prewarm is orthogonal; do not leave a 60 s interval alive
  setInterval,
  clearInterval,
  setTimeout,
  clearTimeout,
});
vm.runInContext(source, context, { filename: RUNTIME });

const state = windowObject.__GRIDATLAS_MAP_READY__;
assert.equal(state.schema, 'gridatlas.maplibre-worker-fetch-bridge.v1');
assert.equal(state.generation, GENERATION);
assert.equal(state.critical_source.eager_window_prefetch, false);
assert.equal(state.duckdb_runtime_started, false);
assert.notEqual(windowObject.fetch, nativeFetch, 'the composed bridge did not install');

const critical = await windowObject.fetch(
  'https://ventusltd.github.io/gridatlas/atlas/data/grid_400kv.geojson',
  { cache: 'no-store' },
);
assert.equal(critical.native, true);
assert.equal(critical.init.cache, 'force-cache');
assert.equal(state.map_ready_requests, 1);
assert.equal(state.critical_source.window_fetch_hits, 1);
assert.equal(state.duckdb_runtime_started, false,
  'a map-ready source must not boot DuckDB on the main path');

const unrelated = await windowObject.fetch('https://example.test/not-grid-data.json', { method: 'GET' });
assert.equal(unrelated.native, true);
assert.equal(unrelated.init.method, 'GET');

const before = performance.now();
const streamed = await windowObject.fetch(
  'https://ventusltd.github.io/gridatlas/atlas/data/uk_metros_trams.geojson',
);
const establishmentMs = performance.now() - before;
assert.ok(streamed instanceof Response);
assert.equal(streamed.status, 200);
assert.equal(streamed.headers.get('X-GridAtlas-Data-Plane'),
  'V9-PARQUET-DUCKDB-STREAMED-RESPONSE');
assert.equal(state.streamed_responses, 1);
assert.equal(state.intercepted_on_demand, 1);
assert.equal(manifestRequested, true,
  'the body producer should have begun while response headers were already available');
assert.equal(state.duckdb_runtime_started, false,
  'response establishment must not wait for the DuckDB import');
assert.ok(establishmentMs < 1000, `streamed response establishment took ${establishmentMs} ms`);
await streamed.body.cancel();

/* The fast-header check above deliberately leaves the manifest unresolved, so
   it cannot prove that the historic V8 URL actually reaches the differently
   named V9 partition. Execute a second, deterministic copy of the composed
   bridge with only its external DuckDB/manifest dependencies replaced. This
   runs the real legacyStem -> alias -> resolvePartition -> query -> streamed
   GeoJSON path through to a populated source payload. */
const fixtureManifest = {
  schema: 'data-gridatlas.v8-transplant-manifest.v1',
  closure: { sources: 56, layers: 60, features: 541282 },
  artifacts: [{
    path: 'partitions/uk_metros_trams_local_unwired.parquet',
    sha256: 'a'.repeat(64),
  }],
};
const fixtureBytes = new TextEncoder().encode(JSON.stringify(fixtureManifest));
const fixtureSha = createHash('sha256').update(fixtureBytes).digest('hex');
const pinnedManifestSha = '3246dbdaa042ae8352ec9b7128cb6c2fe65e4f1aba0534302510661828df2526';
assert.equal(source.split(pinnedManifestSha).length - 1, 1,
  'the composed bridge manifest pin changed without this proof changing');
/* The seam moved at 202609241251 and this proof moved with it, deliberately.
   The import now lives inside sharedDuckDBRuntime(moduleUrl) - the broker that
   makes this cartridge and the search lane share ONE runtime instead of each
   building their own, which was costing a phone two 5.92 MB WebAssembly heaps.
   So the injection point is the broker's import, not the old direct one, and
   the assertion below still insists there is exactly ONE place a runtime can
   enter this cartridge. That is the property worth guarding: not the literal
   text, but that the seam is singular. */
assert.equal(source.split('const duckdb = await import(moduleUrl);').length - 1, 1,
  'the DuckDB seam changed without this proof changing');
assert.equal(source.split('await import(DUCKDB_MODULE)').length - 1, 0,
  'a second, direct DuckDB import reappeared alongside the shared broker');
const instrumentedSource = source
  .replace(pinnedManifestSha, fixtureSha)
  .replace('const duckdb = await import(moduleUrl);',
    'const duckdb = window.__GRIDATLAS_TEST_DUCKDB__;');

let querySql = '';
let manifestCalls = 0;
const fakeDuckdb = {
  getJsDelivrBundles: () => ({}),
  selectBundle: async () => ({ mainModule: 'fixture.wasm', mainWorker: 'fixture.worker.js' }),
  LogLevel: { WARNING: 'warning' },
  ConsoleLogger: class ConsoleLogger {},
  AsyncDuckDB: class AsyncDuckDB {
    async instantiate() {}
    async connect() {
      return {
        query: async (sql) => {
          querySql = String(sql);
          return {
            toArray: () => [{
              source_id: 'uk_metros_trams_local_unwired',
              feature_index: 0,
              feature_id: 'dlr-fixture-0',
              geometry_json: JSON.stringify({
                type: 'LineString',
                coordinates: [[-0.1, 51.5], [-0.08, 51.51]],
              }),
              properties_json: JSON.stringify({ operator: 'Docklands Light Railway' }),
            }],
          };
        },
        close: async () => {},
      };
    }
  },
};
const nativeFetch2 = async (input) => {
  const url = String(input?.url || input);
  assert.match(url, /202608291237-data-gridatlas\/data\/manifest\.json$/);
  manifestCalls += 1;
  return new Response(fixtureBytes, { status: 200 });
};
const windowObject2 = {
  location: { href: 'https://ventusltd.github.io/gridatlas/atlas/' },
  fetch: nativeFetch2,
  __GRIDATLAS_TEST_DUCKDB__: fakeDuckdb,
};
windowObject2.window = windowObject2;
const context2 = vm.createContext({
  window: windowObject2,
  URL,
  Blob,
  Worker: class Worker {},
  crypto: globalThis.crypto,
  TextEncoder,
  TextDecoder,
  ReadableStream,
  Response,
  DOMException,
  Promise,
  Map,
  Set,
  JSON,
  console,
  performance,
  queueMicrotask() {},
  setInterval,
  clearInterval,
  setTimeout,
  clearTimeout,
});
vm.runInContext(instrumentedSource, context2, { filename: `${RUNTIME}:full-source-load` });
const fullResponse = await windowObject2.fetch(
  'https://ventusltd.github.io/gridatlas/atlas/data/uk_metros_trams.geojson',
);
const fullPayload = await fullResponse.json();
const fullState = windowObject2.__GRIDATLAS_MAP_READY__;
const metroPath = '/gridatlas/atlas/data/uk_metros_trams.geojson';
assert.equal(fullPayload.type, 'FeatureCollection');
assert.equal(fullPayload.features.length, 1);
assert.equal(fullPayload.features[0].properties.operator, 'Docklands Light Railway');
assert.match(querySql,
  /read_parquet\('https:\/\/ventusltd\.github\.io\/data-gridatlas\/202608291237-data-gridatlas\/data\/partitions\/uk_metros_trams_local_unwired\.parquet'\)/);
assert.equal(fullState.loaded_on_demand[metroPath].parquet,
  'partitions/uk_metros_trams_local_unwired.parquet');
assert.equal(fullState.loaded_on_demand[metroPath].rows, 1);
assert.equal(fullState.loaded_on_demand[metroPath].sha256, 'a'.repeat(64));
assert.equal(fullState.parquet_requests, 1);
assert.equal(fullState.released_payloads, 1);
assert.equal(fullState.failures.length, 0);
assert.equal(fullState.stream_failures.length, 0);
assert.equal(manifestCalls, 1);

const controller = new AbortController();
controller.abort();
await assert.rejects(
  windowObject.fetch('https://ventusltd.github.io/gridatlas/atlas/data/repd_master.json', {
    signal: controller.signal,
  }),
  (error) => error?.name === 'AbortError',
);
assert.equal(state.intercepted_on_demand, 2);
assert.equal(nativeCalls, 3,
  'only the critical source, unrelated URL and manifest should reach native fetch');

console.log(JSON.stringify({
  status: 'PASS',
  generation: GENERATION,
  composed_sha256: entry.sha256,
  response_establishment_ms: Number(establishmentMs.toFixed(3)),
  map_ready_requests: state.map_ready_requests,
  streamed_responses: state.streamed_responses,
  duckdb_started_before_body: state.duckdb_runtime_started,
  metro_partition: fullState.loaded_on_demand[metroPath].parquet,
  metro_rows_reconstructed: fullPayload.features.length,
}, null, 2));

UK Lightning Overlay Proof

A JavaScript module in the proofs folder of GridAtlas.

othergridatlas / tools/proofs/202610312138-uk-lightning-overlay.proof.mjs · lines 1–3 of 3 · version 2026-10-31 21:38 · Not reached from any entry point (candidate for review)

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.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name. Described from its file name only (a candidate, not yet checked against the code).
Why it matters
No other file in the estate was found to import it.
Application
gridatlas · tools/proofs · JavaScript module
Uses
Lightning Cartridge (import)
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
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/proofs/202610312138-uk-lightning-overlay.proof.mjs:1-3 · blob 29acca553fd3beb73ae17995e43321aac812be44 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: unknown · effects: none found · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
/** 202610312138: the UK lightning overlay as its own cartridge (module 202610291043, unchanged), re-identified at 202610312138; sld-sandbox is the original 202609241334. tools/proofs/lightning-cartridge.mjs */
import { proveLightningCartridge } from './lightning-cartridge.mjs';
await proveLightningCartridge('202610312138');

Grid Journey Preview Proof

A JavaScript module in the proofs folder of GridAtlas.

othergridatlas / tools/proofs/202611172355-grid-journey-preview.proof.mjs · lines 1–2 of 2 · version 2026-11-17 23:55 · Not reached from any entry point (candidate for review)

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.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name. Described from its file name only (a candidate, not yet checked against the code).
Why it matters
No other file in the estate was found to import it.
Application
gridatlas · tools/proofs · JavaScript module
Uses
Grid Explorer Proof (import)
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
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/proofs/202611172355-grid-journey-preview.proof.mjs:1-2 · blob 07ee4716233dafe31f52b43936b756dccfbb75f3 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: unknown · effects: none found · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
import {proveExplorerGeneration} from '../release/grid-explorer-proof.mjs';
await proveExplorerGeneration('202611172355', 'grid-journey-preview');

Grid Vicinity Proof

A JavaScript module in the proofs folder of GridAtlas.

othergridatlas / tools/proofs/202611180026-grid-vicinity.proof.mjs · lines 1–2 of 2 · version 2026-11-18 00:26 · Not reached from any entry point (candidate for review)

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.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name. Described from its file name only (a candidate, not yet checked against the code).
Why it matters
No other file in the estate was found to import it.
Application
gridatlas · tools/proofs · JavaScript module
Uses
Grid Explorer Proof (import)
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
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/proofs/202611180026-grid-vicinity.proof.mjs:1-2 · blob c440229123280add82ad2a2b3e254f67b943757e · GitHub at these lines
State
achieves: name · context: readme_derived · stage: unknown · effects: none found · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
import {proveExplorerGeneration} from '../release/grid-explorer-proof.mjs';
await proveExplorerGeneration('202611180026', 'grid-vicinity');

UK Gazetteer Flyto Proof

A JavaScript module in the proofs folder of GridAtlas.

othergridatlas / tools/proofs/202611180026-uk-gazetteer-flyto.proof.mjs · lines 1–2 of 2 · version 2026-11-18 00:26 · Not reached from any entry point (candidate for review)

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.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name. Described from its file name only (a candidate, not yet checked against the code).
Why it matters
No other file in the estate was found to import it.
Application
gridatlas · tools/proofs · JavaScript module
Uses
Grid Explorer Proof (import)
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
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/proofs/202611180026-uk-gazetteer-flyto.proof.mjs:1-2 · blob 076405f1fd2bb4aa04e17a3a30ce9881992aa24a · GitHub at these lines
State
achieves: name · context: readme_derived · stage: unknown · effects: none found · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
import {proveExplorerGeneration} from '../release/grid-explorer-proof.mjs';
await proveExplorerGeneration('202611180026','uk-gazetteer-flyto');

Pipeline Vicinity Button Proof

A JavaScript module in the proofs folder of GridAtlas that uses SHA-256.

energy-datagridatlas / tools/proofs/202611222000-pipeline-vicinity-button.proof.mjs · lines 1–11 of 11 · version 2026-11-22 20:00 · Not reached from any entry point (candidate for review)

What it does
It loads data. Uses libraries node:fs, node:assert/strict. Side effects: reads or writes files.
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.
Inputs & outputs
In: JSON file current.json.
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.
Application
gridatlas · tools/proofs · JavaScript module
Uses
Vicinity Entry Proof (import), node:fs, node:assert/strict
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
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/proofs/202611222000-pipeline-vicinity-button.proof.mjs:1-11 · blob 6d2f32cbe6397e1b36c8f061142ce8bfd142c50a · GitHub at these lines
State
achieves: name · context: readme_derived · stage: ingest · effects: filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
import './202611222000-vicinity-entry.proof.mjs';
import fs from 'node:fs';import path from 'node:path';
import assert from 'node:assert/strict';import {createHash} from 'node:crypto';
const root=path.resolve(import.meta.dirname,'../..'),G='202611222000';
const manifest=JSON.parse(fs.readFileSync(path.join(root,'atlas/v',G,'current.json'),'utf8'));
const pin=manifest.cartridges.find(x=>x.id==='pipeline-vicinity-button');
assert.ok(pin&&pin.generation===G&&pin.slot==='after-cartridge'&&pin.after==='uk-offtakers-overlay');
const served=fs.readFileSync(path.join(root,'atlas/modules',G+'-vicinity-entry.js'));
assert.equal(createHash('sha256').update(served).digest('hex'),pin.sha256);
assert.equal(Buffer.compare(served,fs.readFileSync(path.join(root,'tools/pipeline-vicinity/src',G+'-entry.js'))),0);
console.log('PASS V9.194 native VICINITY entry source bytes');

Vicinity Entry Browser

A JavaScript module in the proofs folder of GridAtlas covering the Renewable Energy Planning Database (REPD) register and substations.

rendergridatlas / tools/proofs/202611222000-vicinity-entry.browser.mjs · lines 1–55 of 55 · version 2026-11-22 20:00 · Entry point

What it does
It lists and searches the REPD register and substations. Uses libraries node:assert/strict, node:fs, node:path, 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 '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, substations.
Inputs & outputs
Out: JSON file receipt.json.
Downstream impact
Used directly by 1 file: GridAtlas PR File Size Guard Workflow (gridatlas).
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
Why it matters
Run by GridAtlas PR File Size Guard Workflow.
Application
gridatlas · tools/proofs · JavaScript module
Uses
Serve (import), node:assert/strict, node:fs, node:path, playwright
Used by
run by GridAtlas PR File Size Guard Workflow (workflow run)
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
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/proofs/202611222000-vicinity-entry.browser.mjs:1-55 · blob 61510bbdb3774b76f21bd17dc92b4d903740a0d0 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import {chromium,webkit} from 'playwright';
import {createPreviewServer} from '../journey/serve.mjs';
const engine=process.env.VICINITY_BROWSER||'chromium';
assert.ok(['chromium','webkit'].includes(engine));
const browser=await (engine==='webkit'?webkit:chromium).launch({headless:true,...(engine==='chromium'?{args:['--use-gl=angle','--use-angle=swiftshader','--enable-webgl','--ignore-gpu-blocklist']}: {})});
const server=await createPreviewServer();
const width=393,height=852;
const context=await browser.newContext({viewport:{width,height},hasTouch:true,isMobile:true});
const page=await context.newPage(),errors=[];
page.on('pageerror',e=>errors.push(String(e)));
const out=path.resolve('work/vicinity-v9194-'+engine);fs.mkdirSync(out,{recursive:true});
const origin='repd_ref=12588&latitude=51.8132088&longitude=-1.3489728&project=Botley%20West&technology=solar&journey=vicinity&origin_type=repd&origin_id=repd%3A12588&radius_km=10';
const url='http://127.0.0.1:'+server.address().port+'/atlas/v/202611222000/?'+origin;
let receipt={engine,width,height,url,softwareEmulation:true,physicalSafari:false};
try{
 await page.goto(url,{waitUntil:'domcontentloaded',timeout:90000});
 await page.waitForFunction(()=>window.__GRIDATLAS_ATLAS__?.generation==='202611222000'&&!!window.__GRIDATLAS_V9_MAP__&&!!window.__GRIDATLAS_MODULES__?.ukOfftakers?.openProjectVicinity,null,{timeout:120000});
 const before=await page.evaluate(()=>({dash:window.__GRIDATLAS_DASH__?.installed,map:!!window.__GRIDATLAS_V9_MAP__,journey:!!window.__GRIDATLAS_MODULES__?.gridJourneyPreview,offtakers:window.__GRIDATLAS_MODULES__.ukOfftakers.generation}));
 assert.equal(before.dash,true);assert.equal(before.map,true);assert.equal(before.journey,false,'discontinued Journey is not composed');
 const button=page.locator('#gridatlas-pipeline-vicinity-button');await button.waitFor({timeout:10000});
 const target=await button.evaluate(el=>{const r=el.getBoundingClientRect(),hit=document.elementFromPoint(r.x+r.width/2,r.y+r.height/2);return{width:r.width,height:r.height,visible:r.width>0&&r.height>0,uncovered:hit===el||el.contains(hit),position:{x:r.x,y:r.y}}});
 assert.ok(target.visible&&target.uncovered&&target.height>=44,'VICINITY must be a fully clickable touch target');
 await (engine==='webkit'?button.tap():button.click());
 const card=page.locator('[data-offtakers-card]');await card.waitFor({timeout:30000});
 assert.match(await card.innerText(),/Project vicinity/i);
 await page.waitForFunction(()=>window.__GRIDATLAS_MODULES__.ukOfftakers.state.pp?.swipe?.entries?.length>=2,null,{timeout:120000});
 const source=await page.evaluate(()=>{const s=window.__GRIDATLAS_MODULES__.ukOfftakers.state.pp;const entries=s.swipe.entries;return{total:entries.length,substations:entries.filter(e=>e.tab==='s').length,repd:entries.filter(e=>e.tab==='r').length,conventional:entries.filter(e=>e.tab==='v').length,origin:s.r.p.repd_ref}});
 assert.ok(source.total<=90&&source.total>=2,'30/30/30 total is bounded to 90');
 assert.equal(source.origin,'12588');
 assert.ok(source.substations<=30&&source.repd<=30&&source.conventional<=30);
 await page.screenshot({path:path.join(out,'01-vicinity-open.png'),fullPage:false});
 const next=card.getByRole('button',{name:'Next vicinity point'});await next.click();
 assert.equal(await page.evaluate(()=>window.__GRIDATLAS_MODULES__.ukOfftakers.state.pp.swipe.index),1);
 const prev=card.getByRole('button',{name:'Previous vicinity point'});await prev.click();
 assert.equal(await page.evaluate(()=>window.__GRIDATLAS_MODULES__.ukOfftakers.state.pp.swipe.index),0);
 const tabs=card.locator('[data-offtakers-tab]');assert.equal(await tabs.count(),4);
 assert.match(await card.innerText(),/Area|5 km|10 km|20 km/);
 await page.screenshot({path:path.join(out,'02-swiping.png'),fullPage:false});
 const close=card.getByRole('button',{name:'Close'});await close.click();
 assert.equal(await page.locator('[data-offtakers-card]').count(),0,'own card removed');
 const toggle=page.locator('#gridatlas-dash-toggle');await toggle.waitFor();
 const a=await page.evaluate(()=>window.__GRIDATLAS_DASH__.collapsed);
 await toggle.click();const b=await page.evaluate(()=>window.__GRIDATLAS_DASH__.collapsed);
 assert.notEqual(a,b,'Hide Layers button must change actual collapsed state');
 await toggle.click();assert.equal(await page.evaluate(()=>window.__GRIDATLAS_DASH__.collapsed),a);
 assert.equal(await button.isVisible(),true);
 await page.screenshot({path:path.join(out,'03-layers-restored.png'),fullPage:false});
 receipt={...receipt,result:'PASS',target,source,hideLayersPassed:true,journeyAbsent:true,errors};
 assert.deepEqual(errors,[],'no uncaught browser errors');
 console.log('PASS',engine,JSON.stringify({source,target,layerToggle:'PASS'}));
}catch(e){receipt={...receipt,result:'FAIL',error:String(e),errors};try{await page.screenshot({path:path.join(out,'failure.png'),fullPage:false})}catch{}throw e}
finally{fs.writeFileSync(path.join(out,'receipt.json'),JSON.stringify(receipt,null,2));await context.close();await browser.close();await new Promise(resolve=>server.close(resolve))}

Vicinity Entry Proof

A JavaScript module in the proofs folder of GridAtlas that uses SHA-256.

ingestgridatlas / tools/proofs/202611222000-vicinity-entry.proof.mjs · lines 1–46 of 46 · version 2026-11-22 20:00 · Entry point

What it does
It loads data. Uses libraries node:fs, node:path, node:assert/strict, node:crypto, node:vm. Side effects: reads or writes files.
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.
Inputs & outputs
In: JSON file current.json.
Downstream impact
Used directly by 2 files: Pipeline Vicinity Button Proof (gridatlas); GridAtlas PR File Size Guard Workflow (gridatlas).
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
Why it matters
Imported by Pipeline Vicinity Button Proof. Run by GridAtlas PR File Size Guard Workflow.
Application
gridatlas · tools/proofs · JavaScript module
Uses
node:fs, node:path, node:assert/strict, node:crypto, node:vm
Used by
imported by Pipeline Vicinity Button Proof (import), run by GridAtlas PR File Size Guard Workflow (workflow run)
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
gridatlas@98b5004c5eda9f2ed915fb6fca4b9bbcaa426ca5 tools/proofs/202611222000-vicinity-entry.proof.mjs:1-46 · blob c71fa37ef7531ebc087d1e3b5a78bd4a04933fcd · GitHub at these lines
State
achieves: name · context: readme_derived · stage: ingest · effects: filesystem · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
import crypto from 'node:crypto';
import vm from 'node:vm';
const root=path.resolve(import.meta.dirname,'../..');
const gen='202611222000';
const live=JSON.parse(fs.readFileSync(path.join(root,'atlas/current.json'),'utf8'));
const candidate=JSON.parse(fs.readFileSync(path.join(root,'atlas/v',gen,'current.json'),'utf8'));
const predecessor=JSON.parse(fs.readFileSync(path.join(root,'atlas/v/202611161720/current.json'),'utf8'));
const approved195=['202611222130','202611222325','202611222343','202611280016','202612010912'].includes(live.generation)&&['pipeline-vicinity-button','uk-offtakers-overlay'].every(id=>{
 const active=live.cartridges.find(x=>x.id===id),approved=candidate.cartridges.find(x=>x.id===id);
 return active&&approved&&active.sha256===approved.sha256;
});
assert.ok(['202611161720',gen].includes(live.generation)||approved195,'later live may carry V9.194 only with both approved exact cartridge pins');
if(live.generation===gen||approved195)for(const c of candidate.cartridges.filter(x=>!approved195||x.id!=='sld-sandbox')){
 const active=live.cartridges.find(x=>x.id===c.id);
 assert.ok(active&&active.sha256===c.sha256,'promoted '+c.id+' must have exact candidate SHA');
}
assert.equal(candidate.generation,gen);
assert.deepEqual(candidate.cartridge_order.slice(0,6),predecessor.cartridge_order,'preserve accepted cartridge order');
assert.deepEqual(candidate.cartridge_order.slice(6),['pipeline-vicinity-button'],'no Journey');
assert.equal(candidate.cartridges.length,predecessor.cartridges.length+1);
for(const c of candidate.cartridges){
  const p=path.resolve(root,'atlas/v',gen,c.path);
  assert.ok(p.startsWith(root+path.sep),'path confined to checkout');
  assert.ok(fs.existsSync(p),c.id+' path missing');
  assert.equal(crypto.createHash('sha256').update(fs.readFileSync(p)).digest('hex'),c.sha256,c.id+' digest');
  new vm.Script(fs.readFileSync(p,'utf8'),{filename:p});
}
const owner=fs.readFileSync(path.join(root,'atlas/modules',gen+'-uk-offtakers-overlay.js'),'utf8');
const button=fs.readFileSync(path.join(root,'atlas/modules',gen+'-vicinity-entry.js'),'utf8');
for(const part of ['openProjectVicinity','initProjectSwipe','updateProjectSwipe','stepProjectSwipe','S.pp.swipe','GRID']){}
assert.match(owner,/openProjectVicinity/);
assert.match(owner,/const subs=\(card.k\|\|\[\]\)/);
assert.match(owner,/const repd=\(card.P\|\|\[\]\)\.slice\(0,N3\)/);
assert.match(owner,/const power=\(card.cv\|\|\[\]\)\.slice\(0,N3\)/);
assert.match(owner,/Math\.abs\(x\)>54/,'horizontal swipe threshold');
assert.match(button,/gridatlas-pipeline-vicinity-button/);
assert.match(button,/repd_ref/);
assert.doesNotMatch(button,/gridJourneyPreview|journey=vicinity/,'the discontinued Journey must not be coupled');
const original=predecessor.cartridges.find(c=>c.id==='uk-offtakers-overlay');
const next=candidate.cartridges.find(c=>c.id==='uk-offtakers-overlay');
assert.equal(original.path,'../../modules/202611132345-uk-offtakers-overlay.js');
assert.notEqual(next.sha256,original.sha256);
console.log('PASS V9.194: seven byte-pinned cartridges, 90-point swipe ceiling, unchanged V9.191 and no Journey');