GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Cables and conductors / globalgrid2050 / testcode/wafer-development-environment/202609190330-cable-cross-sections

Wafer Development Environment — Cable Cross Sections and 2 more files

A JavaScript module in the testcode folder of GlobalGrid2050 that draws lines meta and families, using SHA-256. Served with the page at https://globalgrid2050.com/testcode/wafer-development-environment/202609190330-cable-cross-sections/.

513 lines of JavaScript and HTML from globalgrid2050, in 3 files. Topic: Cables and conductors. Section 29 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. Wafer Development Environment — Cable Cross Sections render · globalgrid2050 / testcode/wafer-development-environment/202609190330-cable-cross-sections/app.mjs lines 701–980
  2. Wafer Development Environment — Cable Cross Sections Page render · globalgrid2050 / testcode/wafer-development-environment/202609190330-cable-cross-sections/index.html lines 1–160
  3. Kuiper Weigh storage · globalgrid2050 / testcode/wafer-development-environment/202609190330-cable-cross-sections/kuiper-weigh.mjs lines 1–73

Wafer Development Environment — Cable Cross Sections

A JavaScript module in the testcode folder of GlobalGrid2050 that draws lines meta and families, using SHA-256. Served with the page at https://globalgrid2050.com/testcode/wafer-development-environment/202609190330-cable-cross-sections/.

renderglobalgrid2050 / testcode/wafer-development-environment/202609190330-cable-cross-sections/app.mjs · lines 701–980 of 980 · version 2026-09-19 03:30 (continued from section 28) · Entry point · pattern fileAt (shared by 2 files)

What it does
It draws lines meta and families. Defines 63 functions or classes, including $, indexOfKey, bin, tier1, tier2. Side effects: changes the web page (DOM); makes network requests.
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Inputs & outputs
In: JSON file all-lines.meta.json; JSON file families.json; JSON file line-index.json. Out: WebGL/WebGPU drawing.
Downstream impact
Used directly by 1 file: Wafer Development Environment — Cable Cross Sections Page (globalgrid2050, https://globalgrid2050.com/testcode/wafer-development-environment/202609190330-cable-cross-sections/). Reached from 88 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); Homepage V037 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v037.html). It is itself an entry point, published at https://globalgrid2050.com/testcode/wafer-development-environment/202609190330-cable-cross-sections/.
What it achieves
It indexes key (`indexOfKey`), builds gl (`buildGL`) and draws marks (`drawMarks`). WHAT THIS IS. Every line of code in the estate that has been given a permanent number is one point on one surface. It responds to pointerdown, pointermove and pointerup events.
Why it matters
Loaded by the page of the same name at https://globalgrid2050.com/testcode/wafer-development-environment/202609190330-cable-cross-sections/.
Application
globalgrid2050 · testcode/wafer-development-environment/202609190330-cable-cross-sections · JavaScript module
Uses
Galaxies Wafers — Lib (import), Pick (import), Read (import)
Used by
loaded by Wafer Development Environment — Cable Cross Sections Page (script src)
Produces
$, indexOfKey, bin, tier1, tier2, compile, initGL, fallback2d, buildGL, put, resize, ensureOverlay
Defines here
fold, paintPanel, are, openFamily, connect, famLine, s, gestures, up, readURL, refuse, writeURL
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/wafer-development-environment/202609190330-cable-cross-sections/app.mjs:701-980 · blob 6f113e8bc53760b4ac522fa9b9cc17f42b6936d3 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, network · domain stage: experimental · users: none · canonical: production_core
  const fold = () => { el.classList.remove('max'); el.classList.toggle('min'); clampPanel(); };
  bar.addEventListener('dblclick', fold);
  $('panelmin').addEventListener('click', fold);
  $('panelmax').addEventListener('click', () => {
    el.classList.remove('min');
    if (el.classList.toggle('max')) { placed = el.style.cssText; el.style.cssText = ''; }
    else { el.style.cssText = placed || ''; clampPanel(); }
  });
  addEventListener('resize', clampPanel);
}

function paintPanel(key) {
  const i = indexOfKey(key);
  const p = $('panelbody');
  if (i < 0) {
    p.innerHTML =
      `<h2>Line <span class="n">${fmt(key)}</span></h2>
       <p class="refuse">This number was never issued. The numbering runs 1 to ${fmt(U.meta.max)} and
       ${fmt(U.meta.max - U.n)} of those numbers were skipped, so a gap is a real answer rather than a
       missing record. The surface still has a place for it, and the beam is pointing at it.</p>`;
    openPanel(`line ${fmt(key)} — never issued`); return;
  }
  /* THE CARD CARRIES THE CODE AND NOTHING ELSE. It used to print the character
     count, a sentence about permanence and a list of up to twelve function
     families, most of them unnamed, and that filled the window with rows that
     did not carry a name and pushed the code out of sight. The card is now the
     line number, the code with the lines around it, and the way to the source.
     The family index is still built and still answers `connect`; it is simply
     not printed here. */
  p.innerHTML =
    `<h2>Line <span class="n">${fmt(key)}</span></h2>
     <pre class="code loading" data-key="${key}">reading this line from the numbered database…</pre>
     <p class="ctxnote" data-key="${key}">looking for the file this line came from…</p>
     <a class="srclink" data-key="${key}" target="_blank" rel="noopener" href="" hidden></a>`;
  openPanel(`line ${fmt(key)}`);
  const code = p.querySelector('.code[data-key]');
  if (code) fillCode(code, key);
}

/* ── a family, as a block of code ────────────────────────────────────────────
   CO-MEMBERSHIP MADE READABLE. A family is the lines of one function, in
   numbering order, and until now the page could only say how many there were.
   Each line is read on its own and they arrive together, because lines of one
   function are numbered near each other and therefore sit in the same block of
   the document: opening a family is usually the one request that opening any
   one of its lines would have cost anyway. Every row is itself a line number,
   so every row is clickable and the wafer flies there. */
async function openFamily(fIdx) {
  const fa = U.families?.[fIdx];
  const host = $('panelbody')?.querySelector('.famblock[data-fam="' + fIdx + '"]');
  if (!fa || !host) return;
  const keys = [];
  for (let i = fa.lineOffset; i < fa.lineOffset + fa.lineCount; i++) keys.push(U.famLines[i]);
  host.innerHTML = '<p class="dim">reading ' + fmt(keys.length) + ' lines…</p>';
  const store = await reader();
  if (!store) { host.innerHTML = '<p class="refuse">' + esc(readerWhy) + '</p>'; return; }
  const rows = await Promise.all(keys.map(k => store.get(k)));
  if (!host.isConnected) return;
  host.innerHTML =
    '<div class="famhead">' + esc(famName(fa)) + ' <span class="dim">' + esc(fa.kind) +
    ' · ' + fmt(fa.lineCount) + ' lines · in ' + fmt(fa.files) + ' files across ' + fmt(fa.repos) + ' repos</span></div>' +
    '<ol class="block">' + rows.map(r =>
      '<li><button type="button" class="blockline" data-key="' + r.key + '">' +
      '<span class="n">' + fmt(r.key) + '</span>' +
      '<code>' + (r.text === null ? '<span class="refuse">' + esc(r.why) + '</span>' : esc(r.text) || '&nbsp;') + '</code>' +
      '</button></li>').join('') + '</ol>';
  const st = store.stats();
  setStoreLine(fmt(st.bytes) + ' bytes read in ' + st.requests + ' request' + (st.requests === 1 ? '' : 's') +
    ' · ' + st.blocksHeld + ' block' + (st.blocksHeld === 1 ? '' : 's') + ' held');
}

/* One delegated listener for the whole panel: opening a family, and flying to a
   line from inside a block. */
document.addEventListener('click', e => {
  const open = e.target.closest?.('.famopen');
  if (open) {
    const fIdx = Number(open.dataset.fam);
    const li = open.closest('li');
    let host = li.querySelector('.famblock');
    if (host) { host.remove(); open.classList.remove('open'); return; }
    host = document.createElement('div');
    host.className = 'famblock';
    host.dataset.fam = String(fIdx);
    li.appendChild(host);
    open.classList.add('open');
    openFamily(fIdx);
    return;
  }
  const row = e.target.closest?.('.blockline');
  if (row) {
    const key = Number(row.dataset.key);
    view.focus = key; view.link = null;
    paintPanel(key); flyTo(key); writeURL(key, null);
  }
});

function connect(ka, kb) {
  view.link = [ka, kb];
  const p = $('panelbody');
  const head = `<h2>Connect <span class="n">${fmt(ka)}</span> to <span class="n">${fmt(kb)}</span></h2>`;

  /* The index is the only thing that can be missing; everything else is decided
     by lib.mjs so the page cannot disagree with the proofs. */
  if (!U.ownerOf) {
    p.innerHTML = head + `<p class="dim">The family index is still loading. The answer will appear here
      without another tap.</p>`;
    openPanel(`connect ${fmt(ka)} to ${fmt(kb)}`); draw(); return;
  }

  const a = connectAnswer(ka, kb, { keys: U.keys, owner: U.ownerOf });
  const famLine = f => {
    const fa = U.families[f];
    return `<li><span class="fam">${esc(fa.name)}</span> <span class="dim">#${fmt(fa.n)} · ${esc(fa.category ?? 'no category recorded')}</span></li>`;
  };
  let body = head;

  if (a.verdict === 'absent') {
    body += `<p class="refuse">${a.absent.map(fmt).join(' and ')} ${a.absent.length > 1 ? 'were' : 'was'}
      never issued in this numbering, so there is nothing at that address to connect.</p>`;

  } else if (a.verdict === 'same-line') {
    body += `<p class="refuse">Those are the same line. A line is not connected to itself, and reporting
      that it is would be the page agreeing with you rather than answering you.</p>` +
      (a.both.length
        ? `<p>Line ${fmt(ka)} is carried by ${fmt(a.both.length)} ${a.both.length === 1 ? 'family' : 'families'}.</p>`
        : `<p>No family carries line ${fmt(ka)}.</p>`);

  } else if (a.verdict === 'no-family') {
    body += `<p class="refuse">${a.without.map(fmt).join(' and ')} ${a.without.length > 1 ? 'are' : 'is'}
      carried by no function family at all, so ${a.without.length > 1 ? 'they have' : 'it has'} nothing to be
      joined through.</p>`;

  } else if (a.verdict === 'joined') {
    body += `<p>Joined by <span class="fam">${fmt(a.both.length)}</span>
      ${a.both.length === 1 ? 'family that carries' : 'families that carry'} both lines${a.both.length > 12 ? ', first twelve' : ''}:</p>
      <ul>${a.both.slice(0, 12).map(famLine).join('')}</ul>
      <p class="dim">This is co-membership: two different lines sitting in one function. It is not the same
      text in two places, and it is not a dependency. Either line may be carried by only that one family and
      still connect perfectly well through it.</p>`;

  } else {
    body += `<p class="refuse">No family carries both lines, so these two are not joined.</p>
      <dl><dt>${fmt(ka)}</dt><dd>${a.A.length ? fmt(a.A.length) + ' ' + (a.A.length === 1 ? 'family' : 'families') : 'no family'}</dd>
          <dt>${fmt(kb)}</dt><dd>${a.B.length ? fmt(a.B.length) + ' ' + (a.B.length === 1 ? 'family' : 'families') : 'no family'}</dd></dl>
      <p class="dim">An unjoined pair is the ordinary case: most lines of the estate sit in unrelated
      functions. This is not about fanout. ${fmt(U.fanout)} of the ${fmt(U.n)} numbered lines appear in more
      than one family, which is duplication; joining two numbers asks the different question of whether one
      family holds them both.</p>`;
  }

  p.innerHTML = body;
  openPanel(`connect ${fmt(ka)} to ${fmt(kb)}`);

  /* Frame both ends. */
  const [ax, ay] = placeOne(ka), [bx, by] = placeOne(kb);
  view.x = (ax + bx) / 2; view.y = (ay + by) / 2;
  const span = Math.max(Math.hypot(bx - ax, by - ay), 4);
  view.zoom = Math.min(view.w, view.h) / (span * 1.8);
  draw();
}

/* ── gestures ────────────────────────────────────────────────────────────── */

function gestures() {
  let down = null, moved = 0, pinch = null;
  const pts = new Map();
  stage.addEventListener('pointerdown', e => {
    stage.setPointerCapture(e.pointerId);
    pts.set(e.pointerId, [e.clientX, e.clientY]);
    if (pts.size === 1) { down = [e.clientX, e.clientY]; moved = 0; }
    if (pts.size === 2) {
      const [p, q] = [...pts.values()];
      pinch = { d: Math.hypot(p[0] - q[0], p[1] - q[1]), z: view.zoom };
    }
  });
  stage.addEventListener('pointermove', e => {
    if (!pts.has(e.pointerId)) return;
    const prev = pts.get(e.pointerId);
    pts.set(e.pointerId, [e.clientX, e.clientY]);
    if (pts.size === 2 && pinch) {
      const [p, q] = [...pts.values()];
      const d = Math.hypot(p[0] - q[0], p[1] - q[1]);
      if (pinch.d > 0) view.zoom = Math.max(0.02, Math.min(4000, pinch.z * (d / pinch.d)));
      draw(); return;
    }
    if (pts.size === 1) {
      const dx = e.clientX - prev[0], dy = e.clientY - prev[1];
      moved += Math.abs(dx) + Math.abs(dy);
      view.x -= dx / view.zoom; view.y += dy / view.zoom;
      draw();
    }
  });
  const up = e => {
    if (pts.size === 1 && down && moved < 7) {
      const key = nearestKeyAt(e.clientX, e.clientY);
      if (key >= 0) { view.focus = key; paintPanel(key); view.link = null; draw(); }
    }
    pts.delete(e.pointerId);
    if (pts.size < 2) pinch = null;
    if (pts.size === 0) down = null;
  };
  stage.addEventListener('pointerup', up);
  stage.addEventListener('pointercancel', e => { pts.delete(e.pointerId); pinch = null; down = null; });
  stage.addEventListener('wheel', e => {
    e.preventDefault();
    const f = Math.exp(-e.deltaY * 0.0016);
    view.zoom = Math.max(0.02, Math.min(4000, view.zoom * f));
    draw();
  }, { passive: false });
  stage.addEventListener('dblclick', () => { view.focus = -1; view.link = null; $('panel').hidden = true; home(); });
}

/* ── URL state: the whole of it, in permanent numbers ────────────────────── */

function readURL() {
  const q = new URLSearchParams(location.search);
  const pa = parseKey(q.get('line') ?? ''), pb = parseKey(q.get('to') ?? '');
  if (!pa.ok) { if (q.get('line')) refuse(`The link carried a line number this page cannot use: ${pa.why}.`); return; }
  $('a').value = String(pa.key);
  const rawTo = q.get('to');
  if (pb.ok) { $('b').value = String(pb.key); view.link = [pa.key, pb.key]; connect(pa.key, pb.key); }
  else if (rawTo !== null && rawTo.trim() !== '') {
    /* focus stays unset: tier 2 repaints the panel for a focused key when it
       lands, which would silently replace this refusal with an ordinary card. */
    refuse(`The link asked to connect to "${rawTo}", which is not a line number: ${pb.why}. `
         + `Line ${pa.key} is where the beam is pointing.`);
    flyTo(pa.key);
  }
  else { view.focus = pa.key; paintPanel(pa.key); flyTo(pa.key); }
}

/* One refusal path, so a bad number is always visible rather than ignored. */
function refuse(sentence) {
  $('panelbody').replaceChildren();
  const h = document.createElement('h2'); h.textContent = 'Refused';
  const p2 = document.createElement('p'); p2.className = 'refuse'; p2.textContent = sentence;
  $('panelbody').append(h, p2);
  openPanel('refused');
}
function writeURL(a, b) {
  const q = new URLSearchParams();
  if (a) q.set('line', String(a));
  if (b) q.set('to', String(b));
  history.replaceState(null, '', q.toString() ? '?' + q : location.pathname);
}

/* ── start ───────────────────────────────────────────────────────────────── */

(async function start() {
  try {
    await tier1();
  } catch (e) {
    $('count').textContent = 'Could not load the numbered database: ' + e.message
      + '. Check the internet connection and reload.';
    return;
  }
  resize();
  try { initGL(); } catch (e) {
    ctx2d = stage.getContext('2d');
    $('hint').textContent = 'GPU not available: drawn without animation';
  }
  home();
  gestures();
  window.addEventListener('resize', () => { resize(); draw(); });

  $('beam').addEventListener('submit', e => {
    e.preventDefault();
    const pa = parseKey($('a').value), pb = parseKey($('b').value);
    if (!pa.ok) { refuse(`That is not a line number: ${pa.why}.`); return; }
    if ($('b').value.trim() && !pb.ok) { refuse(`Second number: ${pb.why}.`); return; }
    if (pb.ok) { view.focus = -1; connect(pa.key, pb.key); writeURL(pa.key, pb.key); }
    else { view.focus = pa.key; view.link = null; paintPanel(pa.key); flyTo(pa.key); writeURL(pa.key, null); }
    document.activeElement?.blur();
  });
  $('close').addEventListener('click', () => { $('panel').hidden = true; $('panel').classList.remove('min', 'max'); view.focus = -1; view.link = null; draw(); });
  dragPanel();

  readURL();
  tier2().catch(e => { $('prov').textContent = 'family index unavailable: ' + e.message; });
})();

Wafer Development Environment — Cable Cross Sections Page

A web page in the testcode folder of GlobalGrid2050 covering cables, substations, 400kV and 132kV, using IEC 60909. Published at https://globalgrid2050.com/testcode/wafer-development-environment/202609190330-cable-cross-sections/. It is built from the close all helper (`closeAll`).

renderglobalgrid2050 / testcode/wafer-development-environment/202609190330-cable-cross-sections/index.html · lines 1–160 of 160 · version 2026-09-19 03:30 · Entry point · pattern closeAll (shared by 15 files)

What it does
It draws cables, substations, 400kV and 132kV. Defines closeAll. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: cables, substations, 400kV, 132kV.
Inputs & outputs
In: form fields (user input). Out: web page. Voltage levels named: 400kV, 132kV.
Downstream impact
Used directly by 5 files: GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); Homepage Versions — Before Refresh Page (globalgrid2050, https://globalgrid2050.com/homepage_versions/20260922-before-refresh/); Homepage V123 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v123.html); Homepage V124 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v124.html); and 1 more. Reached from 83 other entry points, including GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); Homepage V037 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v037.html); Homepage V038 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v038.html). It is itself an entry point, published at https://globalgrid2050.com/testcode/wafer-development-environment/202609190330-cable-cross-sections/.
What it achieves
Defines `closeAll`. Its code works with 132 kV and 400 kV. It responds to click and keydown events.
Why it matters
Loaded by the GlobalGrid2050 Homepage Before Four Nests page at https://globalgrid2050.com/homepage-before-four-nests-20260925.html and 4 other pages.
Application
globalgrid2050 · testcode/wafer-development-environment/202609190330-cable-cross-sections · page
Uses
Wafer Development Environment — Cable Cross Sections Style Sheet (stylesheet), Wafer Development Environment — Cable Cross Sections (script src), Pilot Rules (script src), Pilot (script src)
Used by
linked from GlobalGrid2050 Homepage Before Four Nests (link), linked from Homepage Versions — Before Refresh Page (link), linked from Homepage V123 (link), linked from Homepage V124 (link), linked from Homepage V125 (link)
Produces
closeAll
Defines here
closeAll
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/wafer-development-environment/202609190330-cable-cross-sections/index.html:1-160 · blob 8c3fe0d460ee3c08353759c7dadd2801d6ca994c · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: experimental · users: none · canonical: production_core
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, maximum-scale=5">
<meta name="color-scheme" content="dark">
<title>202609190330-cable-cross-sections</title>
<meta name="wafer-data" content="../shared/">
<meta name="wafer-start" content="draw cable132">
<link rel="stylesheet" href="style.css">
</head>
<body>

<canvas id="stage" aria-label="Every permanently numbered line of code in the estate, placed by its own number."></canvas>

<header id="bar">
  <span id="wordmark">THE LINE WAFER</span>
  <nav id="menubar" aria-label="wafer menu"></nav>
  <span id="count" class="dim">loading the numbered database…</span>
</header>

<form id="beam" autocomplete="off">
  <input id="a" inputmode="numeric" pattern="[0-9]*" placeholder="line number" aria-label="line number to fly to">
  <input id="b" inputmode="numeric" pattern="[0-9]*" placeholder="connect to…" aria-label="second line number to connect to">
  <button id="go" type="submit">FLY</button>
</form>

<section id="panel" hidden>
  <div id="panelbar">
    <span id="paneltitle">line</span>
    <button id="panelmin" type="button" title="minimise" aria-label="minimise">–</button>
    <button id="panelmax" type="button" title="maximise" aria-label="maximise">▢</button>
    <button id="close" type="button" title="close" aria-label="close">✕</button>
  </div>
  <div id="panelbody"></div>
</section>

<script>
/* THE MENU, BORROWED FROM GRIDATLAS (atlas/modules/202609031958-menu-bar.js).
   The pattern copied: one strip of title buttons, each with aria-haspopup="menu",
   aria-expanded and aria-controls pointing at a sibling panel that is `hidden` at
   rest; clicking a title closes every other panel and toggles its own; Escape
   closes; ArrowLeft/ArrowRight walk the titles and ArrowDown enters the open
   panel; a click anywhere else closes everything. GridAtlas calls that state
   closed_at_rest, and it is the whole point here: at rest the belt has the frame.
   Nothing has been removed — every preset button that used to sit in two rows
   across the top is a row in one of these panels, with more beside it. */
(function () {
  var MENUS = [
    ['Systems', [
      ['the grid: 400 kV, 132 kV and every substation', 'draw grid'],
      ['the 400 kV grid', 'draw grid400'],
      ['the 132 kV network', 'draw grid132'],
      ['every substation', 'draw substations'],
      ['Shotwick solar farm and its grid', 'draw shotwick'],
      ['the London Underground', 'draw underground'],
      ['the British Isles', 'draw uk'],
      ['the world', 'draw world'],
      ['a cable trench section', 'draw trench'],
      ['a fault study (pandapower, IEC 60909)', 'draw fault'],
      ['the Kuiper belt: every repository', 'draw kuiper']
    ]],
    ['Belt', [
      ['pulse the belt — a propagation pattern over code bodies, not an electrical result', 'pulse'],
      ['stop the pulse', 'pulse stop'],
      ['orbit gridatlas', 'gravity gridatlas'],
      ['the wordmark from the dust', 'logo'],
      ['a clock: time as a law', 'clock'],
      ['release: every line back to its own place', 'release']
    ]],
    ['Code', [
      ['go to the most-copied line in the estate (39885)', 'block 39885'],
      ['the code behind block 39885, in the card', 'twin 39885'],
      ['state of block 39885: HOME or AWAY', 'state 39885'],
      ['measure block 39885: one recorded draw', 'measure 39885'],
      ['connect two lines with the beam', 'connect 39885 1217'],
      ['how many blocks are found at their recorded line', 'entangle']
    ]],
    ['Apps', [
      ['every app on the wafer', 'apps'],
      ['GridAtlas', 'app gridatlas'],
      ['land on GridAtlas: the live app, inside this page', 'land gridatlas'],
      ['land on Pipeline News', 'land pipelinenews'],
      ['back to space: the wafer', 'space'],
      ['the engine’s published modules', 'engine']
    ]],
    ['Help', [
      ['every command this page answers', 'help'],
      ['clear the beam and the card', 'reset']
    ]]
  ];
  var bar = document.getElementById('menubar'), titles = [], panels = [];
  function closeAll(except) {
    for (var i = 0; i < titles.length; i++) {
      if (titles[i] === except) continue;
      titles[i].setAttribute('aria-expanded', 'false');
      titles[i].parentNode.classList.remove('gm-open');
      panels[i].hidden = true;
    }
  }
  MENUS.forEach(function (m, i) {
    var menu = document.createElement('div'); menu.className = 'gm-menu';
    var title = document.createElement('button');
    title.type = 'button'; title.className = 'gm-title'; title.textContent = m[0];
    title.id = 'gm-title-' + i;
    title.setAttribute('aria-haspopup', 'menu');
    title.setAttribute('aria-expanded', 'false');
    title.setAttribute('aria-controls', 'gm-panel-' + i);
    var panel = document.createElement('div');
    panel.className = 'gm-panel'; panel.id = 'gm-panel-' + i; panel.hidden = true;
    panel.setAttribute('role', 'group'); panel.setAttribute('aria-labelledby', title.id);
    m[1].forEach(function (row) {
      var b = document.createElement('button');
      b.type = 'button'; b.dataset.cmd = row[1];
      b.innerHTML = '<span>' + row[0] + '</span><code>' + row[1] + '</code>';
      panel.appendChild(b);
    });
    title.addEventListener('click', function (e) {
      e.stopPropagation();
      var wasOpen = !panel.hidden;
      closeAll();
      if (wasOpen) return;
      panel.hidden = false; menu.classList.add('gm-open');
      title.setAttribute('aria-expanded', 'true');
    });
    menu.appendChild(title); menu.appendChild(panel);
    bar.appendChild(menu); titles.push(title); panels.push(panel);
  });
  bar.addEventListener('click', function (e) {
    var b = e.target.closest('button[data-cmd]');
    if (!b) return;
    closeAll();                       /* the drawing is the point: the menu shuts the moment it is used */
    if (window.__pilot) window.__pilot(b.dataset.cmd);
  });
  bar.addEventListener('keydown', function (e) {
    var i = titles.indexOf(document.activeElement);
    if (e.key === 'Escape') { closeAll(); if (i < 0 && document.activeElement.closest) { var t = document.activeElement.closest('.gm-menu'); if (t) t.querySelector('.gm-title').focus(); } e.preventDefault(); return; }
    if (i < 0) return;
    if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
      titles[(i + (e.key === 'ArrowRight' ? 1 : -1) + titles.length) % titles.length].focus(); e.preventDefault();
    } else if (e.key === 'ArrowDown') {
      titles[i].click(); var f = panels[i].querySelector('button'); if (f) f.focus(); e.preventDefault();
    }
  });
  document.addEventListener('click', function (e) { if (!e.target.closest || !e.target.closest('#menubar')) closeAll(); });
})();
</script>
<footer id="foot">
  <span id="prov" class="dim">provenance loading</span>
  <span id="hint" class="dim">drag to steer · pinch or scroll to focus the beam · tap a line · provided as is, without warranty of any kind; a chart, not a design</span>
  <a id="proofs" href="proof/">check every claim on this page</a>
</footer>

<noscript><p class="dim" style="padding:1rem">This surface is drawn from the numbered database at run time, so it needs JavaScript. Nothing here is typed into the page.</p></noscript>

<script type="module" src="app.mjs"></script>
<script src="pilot-rules.js"></script>
<script type="module" src="pilot.mjs"></script>
</body>
</html>

Kuiper Weigh

A JavaScript module in the testcode folder of GlobalGrid2050 that reads estate bodies and Kuiper network, using SHA-256. Served with the page at https://globalgrid2050.com/testcode/wafer-development-environment/202609190330-cable-cross-sections/.

storageglobalgrid2050 / testcode/wafer-development-environment/202609190330-cable-cross-sections/kuiper-weigh.mjs · lines 1–73 of 73 · version 2026-09-19 03:30 · Not reached from any entry point (candidate for review)

What it does
It loads estate bodies and Kuiper network. Uses libraries node:fs, node:path, node:crypto, node:url. Side effects: reads or writes files.
Why it exists in the grid workflow
Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow.
Inputs & outputs
In: JSON file estate-bodies.json; JSON file bodies.json; JSON file kuiper-network.json; command-line arguments.
What it achieves
Join the measured copy count onto every station of `kuiper-network.json`.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · testcode/wafer-development-environment/202609190330-cable-cross-sections · JavaScript module
Uses
node:fs, node:path, node:crypto, node:url
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
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/wafer-development-environment/202609190330-cable-cross-sections/kuiper-weigh.mjs:1-73 · blob 7743bbb635d4cdbc54c7f255cd4bd130f4249dbc · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem · domain stage: experimental · users: none · canonical: unreached_review
// kuiper-weigh.mjs — join the measured copy count onto every station of kuiper-network.json.
//
// Law, printed with the run: one body per distinct blob SHA. The station's third element is that
// blob SHA and it is the key; the fourth element is `copies`, the number of tracked paths in the
// estate whose bytes hash to that SHA. `copies` is read from the estate run's own estate-bodies.json
// and joined on the blob SHA, never on position and never on order. A station whose SHA is not in
// the run gets no fourth element at all and stays base dust: no intensity is invented for it.
//
// Usage: node kuiper-weigh.mjs [<path to estate-bodies.json>] [<path to bodies.json>]
// Nothing outside this folder is written.

import fs from 'node:fs';
import path from 'node:path';
import crypto from 'node:crypto';
import { fileURLToPath } from 'node:url';

const HERE = path.dirname(fileURLToPath(import.meta.url));
const RUN = process.argv[2] || 'C:/Users/vikra/Documents/GitHub/Kuiper-belt/data/20260919T001154Z/estate-bodies.json';
const SUM = process.argv[3] || path.join(path.dirname(RUN), 'bodies.json');
const NET = path.join(HERE, 'kuiper-network.json');

const bodies = JSON.parse(fs.readFileSync(RUN, 'utf8')).bodies;
const summary = JSON.parse(fs.readFileSync(SUM, 'utf8'));
const net = JSON.parse(fs.readFileSync(NET, 'utf8'));

const copiesOf = new Map();
for (const b of bodies) if (Number.isInteger(b.copies) && b.copies > 0) copiesOf.set(b.id, b.copies);

let joined = 0, unmeasured = 0, dup = 0, uniq = 0, paths = 0, maxCopies = 0, maxId = null;
const stations = net.stations.map(s => {
  const [x, y, id] = s;
  const c = copiesOf.get(id);
  if (c == null) { unmeasured++; return [x, y, id]; }           // base dust: nothing invented
  joined++; paths += c;
  if (c > 1) dup++; else uniq++;
  if (c > maxCopies) { maxCopies = c; maxId = id; }
  return [x, y, id, c];
});

const homes = new Set(bodies.map(b => b.home));

net.stations = stations;
net.law = net.law.replace(/; the station's fourth element[\s\S]*$/, '') +
  "; the station's fourth element is copies, the measured number of tracked paths whose bytes hash to that blob SHA, joined on the SHA and never on order; a station with no measured copy count carries no fourth element and stays base dust";
net.counts = {
  run: summary.run,
  bodies: stations.length,
  measured: joined,
  unmeasured,
  duplicated: dup,
  unique: uniq,
  tracked_paths: paths,
  repositories: summary.repositories,
  home_repositories: homes.size,
  max_copies: maxCopies,
  max_copies_id: maxId,
  source_file: path.basename(RUN),
  source_run_tracked_paths: summary.tracked_paths
};

const text = JSON.stringify(net);
fs.writeFileSync(NET, text);

const digest = crypto.createHash('sha256').update(text).digest('hex');
console.log('kuiper-network.json rewritten');
console.log('  bytes          ', text.length);
console.log('  sha256         ', digest);
console.log('  stations       ', stations.length);
console.log('  measured copies', joined, ' unmeasured (base dust):', unmeasured);
console.log('  duplicated     ', dup, ' unique:', uniq);
console.log('  tracked paths  ', paths, '(run summary says', summary.tracked_paths + ')');
console.log('  repositories   ', summary.repositories, ' distinct home repositories:', homes.size);
console.log('  max copies     ', maxCopies, 'at', maxId);