GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Automation and CI / globalgrid2050 / testcode/202609142225/proof

Repair Check and 8 more files

A JavaScript module in the proof folder of GlobalGrid2050 that repairs round self-test: one check per finding of the review (blockers, majors, and the minors that were fixed).

681 lines of JavaScript and Python and Shell from globalgrid2050, in 9 files. Topic: Automation and CI. Section 1794 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. Coder Walk3 render · globalgrid2050 / testcode/202609142225/proof/coder-walk3.mjs lines 1–179
  2. Extract2 ingest · globalgrid2050 / testcode/202609142225/proof/extract2.py lines 1–22
  3. Extract3 ingest · globalgrid2050 / testcode/202609142225/proof/extract3.py lines 1–37
  4. Extract4 storage · globalgrid2050 / testcode/202609142225/proof/extract4.py lines 1–15
  5. Extract Evidence ingest · globalgrid2050 / testcode/202609142225/proof/extract_evidence.py lines 1–20
  6. Final Check render · globalgrid2050 / testcode/202609142225/proof/final-check.mjs lines 1–132
  7. Grep Tests test · globalgrid2050 / testcode/202609142225/proof/grep-tests.sh lines 1–21
  8. Lens Grammar Proof render · globalgrid2050 / testcode/202609142225/proof/lens-grammar-proof.mjs lines 1–74
  9. Repair Check render · globalgrid2050 / testcode/202609142225/proof/repair-check.mjs lines 1–181

Coder Walk3

A JavaScript module in the proof folder of GlobalGrid2050. It is built from the sleep step (`sleep`), the begin step (`begin`) and the note step (`note`).

renderglobalgrid2050 / testcode/202609142225/proof/coder-walk3.mjs · lines 1–179 of 179 · version 2026-09-14 22:25 · Not reached from any entry point (candidate for review) · pattern tapEl (shared by 5 files)

What it does
It loads data. Defines 7 functions or classes, including sleep, begin, note, shot, probe. Uses libraries node:module, node:fs, C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core. 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 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: command-line arguments. Out: JSON file coder-walk3.json.
What it achieves
Mobile-coder critic, round 1, pass 3: the full journey by touch, now knowing that a closed panel still sits at y 436-796 (see `coder-diag-overlay.json`). It writes `coder-walk3.json`.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · testcode/202609142225/proof · JavaScript module
Uses
node:module, node:fs, C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core
Used by
none found
Produces
sleep, begin, note, shot, probe, tapEl, drag
Defines here
sleep, begin, note, shot, probe, tapEl, drag
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/202609142225/proof/coder-walk3.mjs:1-179 · blob 0b310932d707e068f133600e872d9189c38a9f80 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, storage · domain stage: experimental · users: none · canonical: unreached_review
// Mobile-coder critic, round 1, pass 3: the full journey by touch, now knowing that a closed panel still sits at
// y 436-796 (see coder-diag-overlay.json). Swipes over the tiles start above that band, as a person would learn to do.
//   node C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/202609142225/proof/coder-walk3.mjs [port]
import { createRequire } from 'node:module';
import fs from 'node:fs';
const require = createRequire(import.meta.url);
const puppeteer = require('C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core');
const PORT = process.argv[2] || '8890', BASE = `http://127.0.0.1:${PORT}/testcode/202609142225/`;
const OUT = 'C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/202609142225/proof/';
const sleep = ms => new Promise(r => setTimeout(r, ms));
const browser = await puppeteer.launch({ executablePath: 'C:/Program Files/Google/Chrome/Application/chrome.exe', headless: 'new', args: ['--enable-gpu', '--use-gl=angle', '--use-angle=d3d11', '--ignore-gpu-blocklist', '--no-first-run'], protocolTimeout: 90000 });
const report = { run_utc: new Date().toISOString(), base: BASE, viewport: '430x900 dpr2 isMobile hasTouch', steps: [], console: [] };
const targets = []; browser.on('targetcreated', t => targets.push({ url: t.url(), type: t.type() }));
const page = await browser.newPage();
await page.setViewport({ width: 430, height: 900, deviceScaleFactor: 2, isMobile: true, hasTouch: true });
page.on('console', m => { if (m.type() === 'error' || m.type() === 'warning') report.console.push(m.type() + ': ' + m.text()); });
page.on('pageerror', e => report.console.push('pageerror: ' + e.message));
page.on('requestfailed', r => report.console.push('requestfailed: ' + r.url()));
let taps = 0, drags = 0, step = null;
function begin(name) { step = { name, taps: 0, drags: 0, notes: [] }; report.steps.push(step); console.log('\n== ' + name); }
function note(s) { step.notes.push(s); console.log('  ' + s); }
async function shot(name) { await page.screenshot({ path: OUT + `coder-${name}.png` }); step.shots = (step.shots || []).concat(`coder-${name}.png`); }
async function probe(sel, text) {
  return page.evaluate((s, t) => { const es = [...document.querySelectorAll(s)]; const e = t ? es.find(x => x.textContent.trim() === t || x.textContent.trim().startsWith(t)) : es[0]; if (!e) return null; const b = e.getBoundingClientRect(); const cx = b.left + b.width / 2, cy = b.top + b.height / 2; const hit = document.elementFromPoint(cx, cy); const reach = !!hit && (hit === e || e.contains(hit)  … [line shortened here: 882 characters; full line on GitHub]
}
async function tapEl(sel, text, why) {
  const p = await probe(sel, text); if (!p) { note(`NO ELEMENT ${sel} ${text || ''} (${why})`); return null; }
  if (!p.inViewport || !p.reach) note(`target "${p.text}" at y ${p.top}-${p.bottom}: ${p.inViewport ? '' : 'OFF SCREEN; '}${p.reach ? '' : 'covered by ' + p.hitDesc}`);
  await page.touchscreen.tap(p.x, p.y); step.taps++; taps++;
  note(`tap ${step.taps}: ${why} → "${p.text.slice(0, 40)}" ${p.w}x${p.h} at (${Math.round(p.x)},${Math.round(p.y)})${p.w < 44 || p.h < 44 ? ' [under 44 px]' : ''}${p.reach && p.inViewport ? '' : ' [NOT REACHABLE]'}`);
  return p;
}
async function drag(x0, y0, x1, y1, steps = 8, dt = 20) { await page.touchscreen.touchStart(x0, y0); for (let s = 1; s <= steps; s++) { await page.touchscreen.touchMove(x0 + (x1 - x0) * s / steps, y0 + (y1 - y0) * s / steps); await sleep(dt); } await page.touchscreen.touchEnd(); step.drags++; drags++; }
const facts = () => page.evaluate(() => { const r = id => { const e = document.getElementById(id); if (!e || e.hidden) return null; const b = e.getBoundingClientRect(); return { top: Math.round(b.top), bottom: Math.round(b.bottom), h: Math.round(b.height) }; }; const P = document.getElementById('panel'); const pb = P.getBoundingClientRect(); return { innerH: innerHeight, scrollY: Math.round(scroll  … [line shortened here: 1,014 characters; full line on GitHub]
const vdInfo = () => page.evaluate(() => { const t = [...document.querySelectorAll('.tile')].find(x => x.querySelector('b').textContent === 'Vd'); if (!t) return null; const r = t.getBoundingClientRect(); const st = document.getElementById('stage').getBoundingClientRect(); const cx = r.left + r.width / 2, cy = r.top + r.height / 2; const h = document.elementFromPoint(cx, cy); return { x: cx, y: cy  … [line shortened here: 757 characters; full line on GitHub]

// ---------------- 00 load + the ghost-panel probe
begin('00-load');
await page.goto(BASE + '?lens=ring', { waitUntil: 'networkidle0', timeout: 90000 });
await page.evaluate(() => { try { localStorage.removeItem('star-generator.recipe'); } catch (e) {} });
await page.goto(BASE + '?lens=ring', { waitUntil: 'networkidle0', timeout: 90000 });
await page.waitForFunction(() => /blocks on the table/.test(document.getElementById('count').textContent) && document.getElementById('count').title.length > 0, { timeout: 60000 }); await sleep(1200);
let f = await facts();
note(`panel at load: hidden attr=${f.panelHiddenAttr}, computed display=${f.panelDisplay}, box y ${f.panelBox.join('-')}; stage ${JSON.stringify(f.stage)}`);
const ghost = await page.evaluate(() => [300, 450, 500, 600, 700, 780].map(y => { const e = document.elementFromPoint(215, y); return `${y}:${e ? (e.id ? '#' + e.id : e.tagName + '.' + e.className) : 'none'}`; }));
note(`what a finger meets at x=215, y=…: ${ghost.join('  ')}`);
await shot('00-load');

// ---------------- 01 search
begin('01-search');
await tapEl('.u-search', null, 'tap the search box'); await page.keyboard.type('distance', { delay: 30 }); note('typed "distance"'); await sleep(600);
const hits = await page.evaluate(() => [...document.querySelectorAll('.u-hits button')].map(b => ({ t: b.textContent.trim(), h: Math.round(b.getBoundingClientRect().height), bottom: Math.round(b.getBoundingClientRect().bottom) })));
note(`${hits.length} hit chips, ${hits[0].h} px tall, last one ends at y ${hits[hits.length - 1].bottom}: ${hits.map(h => h.t).join(' | ')}`);
const ghost2 = await page.evaluate(() => [...document.querySelectorAll('.u-hits button')].map(b => { const r = b.getBoundingClientRect(); const e = document.elementFromPoint(r.left + r.width / 2, r.top + r.height / 2); return (e === b || b.contains(e)) ? null : `${b.textContent.trim()}@${Math.round(r.top)}→${e ? (e.id ? '#' + e.id : e.tagName + '.' + e.className) : 'none'}`; }).filter(Boolean));
note(`hit chips a finger cannot reach: ${ghost2.length ? ghost2.join(', ') : 'none'}`);
await shot('01-search');

// ---------------- 02 open family
begin('02-open-family');
await tapEl('.u-hits button', '#511 distanceKm', 'tap the first hit');
await page.waitForFunction(() => !document.getElementById('panel').hidden && !/Loading family/.test(document.getElementById('panel').textContent), { timeout: 30000 }); await sleep(600);
f = await facts(); note(`panel head "${f.head}", panel ${JSON.stringify(f.panel)} tall=${f.panelTall}; page scrolled to ${f.scrollY}; stage ${JSON.stringify(f.stage)}; url ${f.url}`);
const lb = await page.evaluate(() => { const B = document.getElementById('panel-body'); const pb = B.getBoundingClientRect(); const ls = [...B.querySelectorAll('.u-line')]; return { n: ls.length, vis: ls.filter(l => { const r = l.getBoundingClientRect(); return r.top >= pb.top && r.bottom <= pb.bottom; }).length, keys: ls.map(l => l.querySelector('.u-key').textContent), first3: ls.slice(0, 3).map(  … [line shortened here: 566 characters; full line on GitHub]
note(`${lb.n} numbered lines (keys ${lb.keys.join(', ')}); ${lb.vis} visible at peek height (body ${lb.bodyH} of ${lb.bodyScrollH} px; lines start ${lb.linesTop} px down); shown as: ${lb.first3.join(' || ')}`);
await shot('02-open-family');

// ---------------- 03 read three lines
begin('03-read-lines');
await tapEl('#panel-foot .u-chip', 'Measure', 'tap Measure to fetch the text');
await page.waitForFunction(() => { const c = document.querySelector('#panel .u-code'); return c && !/Fetching/.test(c.textContent); }, { timeout: 40000 }); await sleep(400);
let ln = await page.evaluate(() => { const B = document.getElementById('panel-body'); const pb = B.getBoundingClientRect(); const ls = [...B.querySelectorAll('.u-line')]; const c = B.querySelector('.u-code'); return { vis: ls.filter(l => { const r = l.getBoundingClientRect(); return r.top >= pb.top && r.bottom <= pb.bottom; }).length, codeTop: Math.round(c.getBoundingClientRect().top), bodyBottom:  … [line shortened here: 628 characters; full line on GitHub]
note(`after Measure: panel tall=${ln.tall}; code box top y ${ln.codeTop} vs panel body bottom ${ln.bodyBottom} → ${ln.vis} lines visible; code box needs sideways scroll: ${ln.codeScrollW} > ${ln.codeClientW}`);
for (let k = 0; k < 4 && ln.vis < 3; k++) { const pb = await page.evaluate(() => { const b = document.getElementById('panel-body').getBoundingClientRect(); return { x: b.left + b.width / 2, top: b.top, bottom: b.bottom }; }); await drag(pb.x, pb.bottom - 30, pb.x, pb.top + 30, 10, 16); await sleep(400); ln = await page.evaluate(() => { const B = document.getElementById('panel-body'); const pb = B.  … [line shortened here: 791 characters; full line on GitHub]
note(`read: ${ln.first3.join(' || ')}`);
await shot('03-read-lines');

// ---------------- 04 add family
begin('04-add-family');
await tapEl('#panel-foot .u-chip', 'Add to recipe', 'tap Add to recipe'); await sleep(500);
f = await facts(); note(`tray "${f.tray}" · url recipe=${decodeURIComponent((f.url.match(/recipe=([^&]*)/) || [])[1] || '')}`);
await shot('04-add-family');

// ---------------- 05 table lens
begin('05-table-lens');
await tapEl('#lensbar a', 'table', 'tap the table tab'); await sleep(1200);
f = await facts(); note(`lens ${f.lens}; tray "${f.tray}"; panel still open tall=${f.panelTall} ${JSON.stringify(f.panel)} over stage ${JSON.stringify(f.stage)}; hint "${f.hint}"`);
const uncovered = await page.evaluate(() => { const st = document.getElementById('stage').getBoundingClientRect(); const P = document.getElementById('panel').getBoundingClientRect(); return [...document.querySelectorAll('.tile')].filter(t => { const r = t.getBoundingClientRect(); return r.top >= st.top && r.bottom <= Math.min(st.bottom, P.top); }).length; });
note(`tiles visible and not under the panel: ${uncovered}`);
await shot('05-table-lens');

// ---------------- 06 shrink the panel (handle), then scroll to Vd in the live band, then add Vd
begin('06-shrink-panel');
let h = await probe('#panel-handle'); await drag(h.x, h.y, h.x, h.y + 120, 8, 20); await sleep(500); f = await facts(); note(`drag ${step.drags}: handle down 120 px → panel tall=${f.panelTall} ${JSON.stringify(f.panel)}`);
h = await probe('#panel-handle'); await drag(h.x, h.y, h.x, h.y + 120, 8, 20); await sleep(500); f = await facts(); note(`drag ${step.drags}: handle down again → panel ${f.panel ? 'open' : 'closed (hidden attr)'}; computed display ${f.panelDisplay}; its box still at y ${f.panelBox.join('-')}; trail "${f.trail}"`);
const dead = await page.evaluate(() => { const st = document.getElementById('stage').getBoundingClientRect(); const P = document.getElementById('panel').getBoundingClientRect(); const ys = []; for (let y = Math.ceil(st.top) + 5; y < st.bottom - 5; y += 10) { const e = document.elementFromPoint(215, y); ys.push(e && e.closest('#panel') ? 'P' : e && e.closest('#overlay') ? 'o' : '?'); } return { sta  … [line shortened here: 553 characters; full line on GitHub]
note(`finger map down the stage (o = tiles, P = closed panel's box), y ${dead.stage[0]}→${dead.stage[1]} every 10 px: ${dead.map}`);
step.liveBand = [dead.liveTop, dead.liveBottom];
await shot('06a-panel-closed');

begin('06-scroll-to-Vd');
let vd = await vdInfo(); note(`Vd tile at y ${vd.top}-${vd.bottom} (overlay scrollTop ${vd.scrollTop}); live band for swipes y ${dead.liveTop}-${dead.liveBottom}`);
const head0 = (await facts()).head;
for (let k = 0; k < 12 && !(vd.inStage && vd.reach); k++) {
  await drag(215, dead.liveBottom - 16, 215, dead.liveTop + 16, 6, 20); await sleep(450);
  vd = await vdInfo(); const ff = await facts();
  note(`swipe ${step.drags} (y ${dead.liveBottom - 16}→${dead.liveTop + 16}): overlay scrollTop ${vd.scrollTop}; Vd y ${vd.top}-${vd.bottom} inStage=${vd.inStage} reachable=${vd.reach} (${vd.hit})${ff.head !== head0 ? ' · STRAY: panel changed to "' + ff.head + '"' : ''}${ff.panel ? ' · panel reopened' : ''}`);
}
if (vd.inStage && !vd.reach) { // Vd is in the stage but under the closed panel's box: nudge it up
  for (let k = 0; k < 4 && !vd.reach; k++) { await drag(215, dead.liveBottom - 16, 215, dead.liveBottom - 16 - 120, 6, 20); await sleep(450); vd = await vdInfo(); note(`nudge ${step.drags}: overlay scrollTop ${vd.scrollTop}; Vd y ${vd.top}-${vd.bottom} reachable=${vd.reach} (${vd.hit})`); }
}
await shot('06b-Vd-in-view');

begin('06-swipe-Vd');
const x0 = vd.left + 18; await drag(x0, vd.y, x0 + 90, vd.y, 6, 20); await sleep(700);
f = await facts(); const swiped = /Vd/.test(f.tray);
note(`swipe-right 90 px across Vd: tray "${f.tray}" → ${swiped ? 'ADDED by swipe' : 'NOT added by swipe'}; panel ${f.panel ? 'opened "' + f.head + '"' : 'closed'}; overlay scrollTop ${f.overlayTop}`);
await shot('06c-after-swipe');

begin('06-tap-Vd');
if (!swiped) {
  vd = await vdInfo(); await page.touchscreen.tap(vd.x, vd.y); step.taps++; taps++; note(`tap ${step.taps}: Vd tile ${vd.w}x${vd.h} at (${Math.round(vd.x)},${Math.round(vd.y)}) reachable=${vd.reach}`); await sleep(900);
  f = await facts(); note(`panel "${f.head}" ${JSON.stringify(f.panel)} tall=${f.panelTall}; url ${f.url}; page scrollY ${f.scrollY}`);
  const vd2 = await vdInfo(); note(`Vd tile now at y ${vd2.top}-${vd2.bottom}, ${vd2.reach ? 'still visible' : 'under the panel'}`);
  await shot('06d-Vd-panel');
  await tapEl('#panel-foot .u-chip', 'Add to recipe', 'tap Add to recipe for Vd'); await sleep(500); f = await facts();
}
const marks = await page.evaluate(() => ({ recipeTiles: [...document.querySelectorAll('.tile.recipe')].map(t => t.querySelector('b').textContent), chips: [...document.querySelectorAll('#tray .rc')].map(c => ({ t: c.textContent.replace('×', '').trim(), w: Math.round(c.getBoundingClientRect().width), right: Math.round(c.getBoundingClientRect().right), border: c.style.borderColor })), cnt: (document.  … [line shortened here: 663 characters; full line on GitHub]
note(`tray "${f.tray}" · recipe=${decodeURIComponent((f.url.match(/recipe=([^&]*)/) || [])[1] || '')} · tiles outlined as recipe: ${marks.recipeTiles.join(', ') || 'none'} · chips ${JSON.stringify(marks.chips)} · count "${marks.cnt}" at x ${marks.cntLeft}, Hand off at x ${marks.goLeft}`);
await shot('06-Vd-added');

// ---------------- 07 river
begin('07-river');
await tapEl('#lensbar a', 'river', 'tap the river tab'); await sleep(1500);
f = await facts(); const chips = await page.evaluate(() => [...document.querySelectorAll('#tray .rc')].map(c => c.textContent.replace('×', '').trim()));
note(`lens ${f.lens}; tray chips ${JSON.stringify(chips)} → both still there: ${chips.includes('#511') && chips.includes('Vd')}; url ${f.url}; panel ${f.panel ? 'open "' + f.head + '" tall=' + f.panelTall : 'closed'}; hint "${f.hint}"`);
const labels = await page.evaluate(() => [...document.querySelectorAll('#labels span')].filter(s => !s.hidden).map(s => s.textContent));
note(`river labels on screen: ${labels.join(', ')} → Vd labelled: ${labels.includes('Vd')}, #511 labelled: ${labels.includes('#511')}`);
await shot('07-river');
if (f.panel) { h = await probe('#panel-handle'); await drag(h.x, h.y, h.x, h.y + 120, 8, 20); await sleep(400); f = await facts(); if (f.panel) { h = await probe('#panel-handle'); await drag(h.x, h.y, h.x, h.y + 120, 8, 20); await sleep(400); f = await facts(); } note(`closed the panel with ${step.drags} handle drags to see the river`); await shot('07b-river-no-panel'); }

// ---------------- 08 recipe sheet
begin('08-sheet');
await tapEl('#tray .cnt', null, 'tap the count in the tray'); await sleep(600);
let sh = await page.evaluate(() => { const S = document.getElementById('sheet'); const b = S.getBoundingClientRect(); return { top: Math.round(b.top), bottom: Math.round(b.bottom), scrollH: S.scrollHeight, clientH: S.clientHeight, head: (S.querySelector('.u-h') || {}).textContent, rows: [...S.querySelectorAll('.ch')].map(r => ({ text: r.textContent.trim(), parts: [...r.children].map(c => `${c.text  … [line shortened here: 871 characters; full line on GitHub]
note(`sheet y ${sh.top}-${sh.bottom}, content ${sh.scrollH} in ${sh.clientH}; head "${sh.head}"`);
for (const r of sh.rows) note(`row "${r.text}": ${r.parts.join(' ')}`);
note(`buttons ${sh.buttons.join(', ')} (viewport 900)`); note(`needs: ${(sh.needs || '').slice(0, 160)}`); note(`pinned files (${sh.pinned.length}): ${sh.pinned.slice(0, 3).join(' ; ')}${sh.pinned.length > 3 ? ' …' : ''}`); note(`hand-off url: ${sh.handoff}`);
await shot('08a-sheet');
for (let k = 0; k < 4; k++) { const b = await probe('#sheet .row .u-chip', 'Hand off'); if (b && b.inViewport && b.reach) break; const s = await page.evaluate(() => { const r = document.getElementById('sheet').getBoundingClientRect(); return { x: r.left + r.width / 2, top: r.top, bottom: r.bottom }; }); await drag(s.x, s.bottom - 40, s.x, s.top + 40, 8, 16); await sleep(400); note(`drag ${step.dra  … [line shortened here: 505 characters; full line on GitHub]
await shot('08b-sheet-scrolled');

// ---------------- 09 hand off
begin('09-handoff');
const nT = targets.length;
await tapEl('#sheet .row .u-chip', 'Hand off', 'tap Hand off in the sheet'); await sleep(2500);
let opened = targets.slice(nT); note(`new tab: ${opened.map(t => t.url).join(' ; ') || 'none'}`);
step.handoffURL = opened.length ? opened[0].url : null;
const hp = (await browser.pages()).find(p => p !== page && /code-generator/.test(p.url()));
if (hp) { await hp.setViewport({ width: 430, height: 900, deviceScaleFactor: 2, isMobile: true, hasTouch: true }).catch(() => {}); await hp.waitForNetworkIdle({ timeout: 30000 }).catch(() => {}); await sleep(1500); const pk = await hp.evaluate(() => { const T = document.body.innerText; const m = s => (T.match(new RegExp('.{0,60}' + s + '.{0,60}')) || [''])[0].replace(/\s+/g, ' '); return { title:   … [line shortened here: 1,014 characters; full line on GitHub]
await shot('09-handoff');

// ---------------- 10 side tests: slow finger-scroll over a tile; the ✕
begin('10-slow-scroll-on-tiles');
await page.evaluate(() => document.getElementById('sheet').hidden = true);
await tapEl('#lensbar a', 'table', 'tap the table tab'); await sleep(1200);
f = await facts(); if (f.panel) { h = await probe('#panel-handle'); await drag(h.x, h.y, h.x, h.y + 120, 8, 20); await sleep(400); f = await facts(); if (f.panel) { h = await probe('#panel-handle'); await drag(h.x, h.y, h.x, h.y + 120, 8, 20); await sleep(400); f = await facts(); } }
note(`panel ${f.panel ? 'open' : 'closed'}; page scrollY ${f.scrollY}; stage ${JSON.stringify(f.stage)}`);
const t0 = await page.evaluate(() => { const st = document.getElementById('stage').getBoundingClientRect(); const P = document.getElementById('panel').getBoundingClientRect(); const x = [...document.querySelectorAll('.tile')].find(e => { const r = e.getBoundingClientRect(); return r.top > st.top + 10 && r.bottom < Math.min(st.bottom, P.top) - 10; }); if (!x) return null; const r = x.getBoundingCli  … [line shortened here: 514 characters; full line on GitHub]
if (t0) { const before = await facts(); await drag(t0.x, t0.y, t0.x, t0.y - 100, 12, 60); await sleep(900); const after = await facts(); note(`slow finger-scroll (~750 ms, 100 px) starting on tile ${t0.sym}: overlay ${before.overlayTop}→${after.overlayTop}; panel ${before.panel ? 'open' : 'closed'}→${after.panel ? 'OPENED "' + after.head + '"' : 'closed'}; url ${after.url}`); await shot('10-slow-s  … [line shortened here: 410 characters; full line on GitHub]
begin('11-panel-x');
f = await facts(); if (!f.panel) { const t = await page.evaluate(() => { const st = document.getElementById('stage').getBoundingClientRect(); const P = document.getElementById('panel').getBoundingClientRect(); const x = [...document.querySelectorAll('.tile')].find(e => { const r = e.getBoundingClientRect(); return r.top > st.top + 10 && r.bottom < Math.min(st.bottom, P.top) - 10 && !e.closest('det  … [line shortened here: 706 characters; full line on GitHub]
f = await facts(); note(`before ✕: trail "${f.trail}"; url ${f.url}`);
await tapEl('#panel-foot button.x', null, 'tap the ✕ in the panel foot'); await sleep(700);
f = await facts(); note(`after ✕: panel ${f.panel ? 'open' : 'closed'}; trail "${f.trail}"; url ${f.url}; tray "${f.tray}" → the ✕ ${/trail=/.test(f.url) ? 'kept' : 'THREW AWAY'} the journey trail`);
await shot('11-after-x');
report.totalTaps = taps; report.totalDrags = drags;
await browser.close();
fs.writeFileSync(OUT + 'coder-walk3.json', JSON.stringify(report, null, 1));
console.log('\nwritten coder-walk3.json · taps', taps, '· drags', drags, '· console', report.console.length ? report.console : 'clean');

Extract2

A Python module in the proof folder of GlobalGrid2050.

ingestglobalgrid2050 / testcode/202609142225/proof/extract2.py · lines 1–22 of 22 · version 2026-09-14 22:25 · Not reached from any entry point (candidate for review)

What it does
It loads data. Uses libraries json, struct, collections, re. 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 data.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
globalgrid2050 · testcode/202609142225/proof · Python module
Uses
json, struct, collections, re
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/202609142225/proof/extract2.py:1-22 · blob dc3364f7f898ca3a2c8ef1522e65eaf21af6319e · GitHub at these lines
State
achieves: name · context: readme_derived · stage: ingest · effects: filesystem · domain stage: experimental · users: none · canonical: unreached_review
import json, struct, collections, re
B='C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/'
d=json.load(open(B+'202609141531/data.json',encoding='utf-8'))
recs=d['records']
by=collections.defaultdict(dict)
for r in recs: by[r['url']][r['width']]=r
pat=re.compile(r'graph|stars|testcode|dashboard|engine|generator|code-|lens|star',re.I)
for u in sorted(by):
    if not pat.search(u): continue
    row=[u]
    for w in (1440,430):
        r=by[u].get(w)
        if not r: row.append(f'{w}:MISSING'); continue
        m=r.get('metrics') or {}
        row.append(f"{w}: status={r.get('status')} err={r.get('error')} sw={m.get('scroll_width')} iw={m.get('inner_width')} ovf={m.get('overflow')} load={r.get('load_wall_ms')} dom={(m.get('navigation') or [{}])[0].get('dom_ms')} fcp={[p['start_ms'] for p in (m.get('paint') or []) if p['name']=='first-contentful-paint']} cerr={len(r.get('console_errors') or [])} failed={len(r.get('failed_requests  … [line shortened here: 541 characters; full line on GitHub]
    print('\n  '.join(row))
print()
print('origins',collections.Counter(u.split('/')[2] for u in by))
print('inventory_origin',collections.Counter(r['inventory_origin'] for r in recs))
print('errors present',sum(1 for r in recs if r.get('error')))
ovf430=[(u,by[u][430]['metrics']['scroll_width']) for u in by if 430 in by[u] and by[u][430].get('metrics') and by[u][430]['metrics'].get('overflow')]
print('430 overflow count',len(ovf430))

Extract3

A Python module in the proof folder of GlobalGrid2050 that reads families, blocks and provenance.

ingestglobalgrid2050 / testcode/202609142225/proof/extract3.py · lines 1–37 of 37 · version 2026-09-14 22:25 · Not reached from any entry point (candidate for review)

What it does
It loads families, blocks and provenance. Uses libraries json, struct, collections. 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 data.json; JSON file families.json; JSON file blocks.json; JSON file provenance.json; JSON file index.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
globalgrid2050 · testcode/202609142225/proof · Python module
Uses
json, struct, collections
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/202609142225/proof/extract3.py:1-37 · blob 409c1eb9fae63dcb5a66648a15204d49492ae19a · GitHub at these lines
State
achieves: name · context: readme_derived · stage: ingest · effects: filesystem · domain stage: experimental · users: none · canonical: unreached_review
import json, struct, collections
B='C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/'
d=json.load(open(B+'202609141531/data.json',encoding='utf-8'))
recs=d['records']
for r in recs:
    if r['url'] in ('https://globalgrid2050.com/','https://globalgrid2050.com/index.html') or '1522' in r['url'] or 'graph=' in r['url']:
        m=r.get('metrics') or {}
        print(r['url'],r['width'],'status',r['status'],'sw',m.get('scroll_width'),'load',r.get('load_wall_ms'),'cerr',r.get('console_errors'),'bad',[(b['url'][-50:],b['status']) for b in r.get('bad_status') or []],'title',m.get('title'))
print('any 1522 url:',any('1522' in r['url'] for r in recs))
print('any graph= url:',any('graph=' in r['url'] for r in recs))
# data pack
D=B+'202609142202/data/'
fam=json.load(open(D+'families.json',encoding='utf-8'))
blk=json.load(open(D+'blocks.json',encoding='utf-8'))
prov=json.load(open(D+'provenance.json',encoding='utf-8'))
raw=open(D+'lines.bin','rb').read()
n=len(raw)//4
arr=struct.unpack('<%dI'%n,raw)
print('families.json type',type(fam).__name__,'len',len(fam) if isinstance(fam,list) else list(fam.keys()))
print('blocks.json keys',list(blk.keys()) if isinstance(blk,dict) else type(blk))
if isinstance(blk,dict):
    for k,v in blk.items():
        print('  ',k,type(v).__name__,len(v) if hasattr(v,'__len__') else v)
    if 'blocks' in blk: print('  block sample',blk['blocks'][0])
print('lines.bin bytes',len(raw),'entries',n,'unique',len(set(arr)),'min',min(arr),'max',max(arr))
if isinstance(fam,list):
    print('sum lineCount',sum(f.get('lineCount',0) for f in fam),'blocks in fam',len(set(f['block'] for f in fam)),'cats in fam',len(set(f['category'] for f in fam)))
    print('fam keys',sorted(set(k for f in fam for k in f)))
print('prov keys',list(prov.keys()))
for k,v in prov.items():
    if k!='sources': print(' ',k,':',json.dumps(v)[:600])
print('sources',len(prov['sources']))
for s in prov['sources']:
    if 'index.json' in s['url'] or 'names' in s['url'] or 'blocks' in s['url']: print('  ',s['url'],s['bytes'],s.get('http_status'))
for f in ('electron','random','entangled'):
    x=json.load(open(D+f+'.json',encoding='utf-8'))
    print(f, type(x).__name__, list(x.keys())[:10] if isinstance(x,dict) else len(x))

Extract4

A Python module in the proof folder of GlobalGrid2050 that reads journeys and lens mobile evidence.

storageglobalgrid2050 / testcode/202609142225/proof/extract4.py · lines 1–15 of 15 · version 2026-09-14 22:25 · Not reached from any entry point (candidate for review)

What it does
It loads journeys and lens mobile evidence. Uses libraries json, re. 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 data.json; JSON file journeys.json. Out: JSON file lens_mobile_evidence.json.
What it achieves
It writes `../lens_mobile_evidence.json`.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · testcode/202609142225/proof · Python module
Uses
json, re
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/202609142225/proof/extract4.py:1-15 · blob 84dd9600de36be3efe73edd33ac4fc446dae9c0b · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem · domain stage: experimental · users: none · canonical: unreached_review
import json, re
B='C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/'
d=json.load(open(B+'202609141531/data.json',encoding='utf-8'))
j=json.load(open(B+'202609141531/journeys.json',encoding='utf-8'))
keep=re.compile(r'stars|testcode/2026091413|testcode/2026091414|ventus-grid-engine|globalgrid2050.com/(index.html)?$|grid_engine/index.html$')
out={'source':'testcode/202609141531/data.json + journeys.json','observed_utc':d['observed_utc'],'browser':d['browser'],'renderer':d['renderer'],'records_total':len(d['records']),'unique_urls':len({r['url'] for r in d['records']}),'loads':[],'journeys':[]}
for r in d['records']:
    if keep.search(r['url']):
        m=r.get('metrics') or {}
        out['loads'].append({'url':r['url'],'width':r['width'],'status':r['status'],'error':r.get('error'),'scroll_width':m.get('scroll_width'),'inner_width':m.get('inner_width'),'load_wall_ms':r.get('load_wall_ms'),'fcp_ms':next((p['start_ms'] for p in m.get('paint') or [] if p['name']=='first-contentful-paint'),None),'console_errors':r.get('console_errors'),'bad_status':r.get('bad_status'),'touc  … [line shortened here: 499 characters; full line on GitHub]
for x in j:
    out['journeys'].append({'url':x['url'],'width':x['width'],'input':x['input'],'errors':x['errors'],'scroll_width':x['metrics'].get('scroll_width'),'inner_width':x['metrics'].get('inner_width'),'fcp_ms':next((p['start_ms'] for p in x['metrics'].get('paint') or [] if p['name']=='first-contentful-paint'),None),'numbered_lines_visible':x['metrics'].get('numbered_lines_visible'),'status':x['status']  … [line shortened here: 402 characters; full line on GitHub]
out['not_surveyed']=['dashboard ?graph=* (13 graph ids in root index.html: overview, structure, modular, federation, chemistry, periodic-table, engine-graph, vedic, sense, random, proof-of-work, gridatlas-lineage, generated-apps) - no ?graph= URL in data.json','testcode/202609141522/* - no record','individual 202609141350/vNN pages at startup - only journeys.json covers them']
json.dump(out,open('../lens_mobile_evidence.json','w',encoding='utf-8'),indent=1)
print(len(out['loads']),len(out['journeys']))

Extract Evidence

A Python module in the proof folder of GlobalGrid2050 that reads journeys.

ingestglobalgrid2050 / testcode/202609142225/proof/extract_evidence.py · lines 1–20 of 20 · version 2026-09-14 22:25 · Not reached from any entry point (candidate for review)

What it does
It loads journeys. Uses libraries json, struct, collections, re. 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 data.json; JSON file journeys.json.
What it achieves
Its name says it extracts evidence.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · testcode/202609142225/proof · Python module
Uses
json, struct, collections, re
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/202609142225/proof/extract_evidence.py:1-20 · blob 1a44f74eb05b3535c594c72ca7a7d35aed58e197 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: ingest · effects: filesystem · domain stage: experimental · users: none · canonical: unreached_review
import json, struct, collections, re
B='C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/'
d=json.load(open(B+'202609141531/data.json',encoding='utf-8'))
j=json.load(open(B+'202609141531/journeys.json',encoding='utf-8'))
recs=d['records']
print('records',len(recs),'discovered',d['discovered_pages'])
print('top keys',list(d.keys()))
print('record keys',sorted(set(k for r in recs for k in r)))
print('metric keys',sorted(set(k for r in recs for k in (r.get('metrics') or {}))))
print('widths',collections.Counter(r['width'] for r in recs))
urls=sorted(set(r['url'] for r in recs))
print('unique urls',len(urls))
pat=re.compile(r'graph=|stars/table|stars/code|testcode/202609141350|testcode/202609141522',re.I)
lens=[u for u in urls if pat.search(u)]
print('lens urls',len(lens))
for u in lens: print(' ',u)
print()
print('JOURNEYS',len(j))
for x in j:
    print(x['url'],x['width'],x['input'],'| errors',x['errors'],'| sw',x['metrics'].get('scroll_width'),x['metrics'].get('inner_width'),'| status:',x['status'])

Final Check

A JavaScript module in the proof folder of GlobalGrid2050. It is built from the sleep step (`sleep`), the check step (`check`) and the open step (`open`).

renderglobalgrid2050 / testcode/202609142225/proof/final-check.mjs · lines 1–132 of 132 · version 2026-09-14 22:25 · Not reached from any entry point (candidate for review)

What it does
It loads data. Defines sleep, check, open, DIMMED, pick. Uses libraries node:module, node:fs, C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core. 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 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. README: "`proof/final-check.mjs` is the self-test of the four fixes of that round plus the post-repair Table B measurements (`proof/final-check.json`, `proof/final-.png`): the category chip's dim bit read back out of `G.meta`, the chord lens's geometry count with the `depends on` chip on and off, the fold summary heights at 430 px, and the newest recipe chip's `×` hit-tested with `document.elementFromPoint`."
Inputs & outputs
In: command-line arguments. Out: JSON file final-check.json.
What it achieves
Review round 2 (post-repair) self-test: one check per finding, plus the measurements `DECISION.md` Table B needs after the repair. It writes `final-check.json`.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · testcode/202609142225/proof · JavaScript module
Uses
node:module, node:fs, C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core
Used by
none found
Produces
sleep, check, open, DIMMED, pick
Defines here
sleep, check, open, DIMMED, pick
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/202609142225/proof/final-check.mjs:1-132 · blob a66bd7f1eec1ff6f8364f2669377009839c294a7 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, storage · domain stage: experimental · users: none · canonical: unreached_review
// Review round 2 (post-repair) self-test: one check per finding, plus the measurements DECISION.md Table B needs after the repair.
//   node C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/202609142225/proof/final-check.mjs [port]
// Writes proof/final-check.json and proof/final-*.png. Every number below is read from the live page; nothing is typed in.
//   F1 category chip -> computeLit -> the dim bit (32) reaches the GPU and is cleared on un-click
//   F2 legend kind chip -> relayout -> lens geometry follows the chip (chord's idle chords)
//   F3 .tb-cat summary folds are >= 44 px at 430 (the repositories fold included)
//   F4 the newest recipe chip's remove button is hit-testable at 430
import { createRequire } from 'node:module';
import fs from 'node:fs';
const require = createRequire(import.meta.url);
const puppeteer = require('C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core');
const PORT = process.argv[2] || '8911', BASE = `http://127.0.0.1:${PORT}/testcode/202609142225/`;
const OUT = 'C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/202609142225/proof/';
const LENSES = ['ring', 'particle', 'chord', 'river', 'table', 'column'];
const sleep = ms => new Promise(r => setTimeout(r, ms));
const browser = await puppeteer.launch({ executablePath: 'C:/Program Files/Google/Chrome/Application/chrome.exe', headless: 'new', args: ['--enable-gpu', '--use-gl=angle', '--use-angle=d3d11', '--ignore-gpu-blocklist', '--no-first-run'], protocolTimeout: 120000 });
const report = { run_utc: new Date().toISOString(), base: BASE, checks: [], measurements: {} };
let pass = 0, fail = 0;
const errs = [];
function check(id, ok, detail) { report.checks.push({ id, ok: !!ok, detail }); if (ok) pass++; else fail++; console.log(`${ok ? 'PASS' : 'FAIL'} ${id}: ${typeof detail === 'string' ? detail : JSON.stringify(detail)}`); }
async function open(url, width) {
  const page = await browser.newPage(); const mobile = width <= 600;
  await page.setViewport({ width, height: 900, deviceScaleFactor: mobile ? 2 : 1, isMobile: mobile, hasTouch: mobile });
  page.on('console', m => { if (m.type() === 'error') errs.push(m.text()); }); page.on('pageerror', e => errs.push('pageerror: ' + e.message));
  await page.goto(url, { waitUntil: 'networkidle0', timeout: 90000 });
  await page.evaluate(() => { try { localStorage.removeItem('star-generator.recipe'); } catch (e) {} });
  await page.goto(url, { waitUntil: 'networkidle0', timeout: 90000 });
  await page.waitForFunction(() => /blocks on the table/.test(document.getElementById('count').textContent) && document.getElementById('count').title.length > 0, { timeout: 60000 });
  await sleep(900); return page;
}
const DIMMED = () => { const G = window.__star.G; let n = 0; for (let i = 0; i < G.N; i++) if (G.meta[4 * i + 2] & 32) n++; return n; };

// ---- F1: the category chip's dim bit reaches the GPU, and leaves it again
{
  const page = await open(BASE + '?lens=ring&key=block:Gc', 1440);
  const before = await page.evaluate(DIMMED);
  const chip = await page.evaluate(() => { const c = document.querySelector('#legend .lg.cat'); c.click(); return c.textContent; });
  await sleep(700);
  const on = await page.evaluate(() => ({ dim: (() => { const G = window.__star.G; let n = 0; for (let i = 0; i < G.N; i++) if (G.meta[4 * i + 2] & 32) n++; return n; })(), cat: window.__star.state.cat, url: location.search }));
  await page.screenshot({ path: OUT + 'final-f1-cat-on-1440.png' });
  await page.evaluate(() => document.querySelector('#legend .lg.cat').click()); await sleep(700);
  const off = await page.evaluate(() => ({ dim: (() => { const G = window.__star.G; let n = 0; for (let i = 0; i < G.N; i++) if (G.meta[4 * i + 2] & 32) n++; return n; })(), cat: window.__star.state.cat, url: location.search }));
  check('F1 category chip sets the dim bit on the GPU and clears it again', before === 0 && on.dim > 0 && on.cat >= 0 && off.dim === 0 && off.cat === -1, { chip, before, on, off });
  report.measurements.f1 = { chip, dimmed_before: before, dimmed_on: on.dim, dimmed_off: off.dim };
  await page.close();
}
// ---- F2: the legend kind chip refreshes the lens geometry, not only the edges
{
  const page = await open(BASE + '?lens=chord&key=block:Gc', 1440);
  const before = await page.evaluate(() => ({ geom: window.__star.G.geomCount, edges: window.__star.G.edgeCount, kindsOn: window.__star.state.kindsOn, viewKinds: window.__star.view.kindsOn }));
  const word = await page.evaluate(() => { const c = [...document.querySelectorAll('#legend .lg')].find(b => b.textContent.trim() === 'depends on'); c.click(); return c.textContent.trim(); });
  await sleep(800);
  const after = await page.evaluate(() => ({ geom: window.__star.G.geomCount, edges: window.__star.G.edgeCount, kindsOn: window.__star.state.kindsOn, viewKinds: window.__star.view.kindsOn }));
  await page.screenshot({ path: OUT + 'final-f2-chord-off-1440.png' });
  const back = await page.evaluate(() => { const c = [...document.querySelectorAll('#legend .lg')].find(b => b.textContent.trim() === 'depends on'); c.click(); return true; });
  await sleep(800);
  const again = await page.evaluate(() => ({ geom: window.__star.G.geomCount, viewKinds: window.__star.view.kindsOn }));
  check('F2 depends on chip off: chord geometry drops below 400 and the view follows', word === 'depends on' && after.geom < 400 && after.geom < before.geom && ((after.viewKinds >> 1) & 1) === 0 && again.geom === before.geom, { before, after, again, back });
  report.measurements.f2 = { geom_on: before.geom, geom_off: after.geom, geom_on_again: again.geom, arcs_only: after.geom, idle_chords: before.geom - after.geom };
  await page.close();
}
// ---- F3: every category fold summary is at least 44 px tall at 430 (the repositories fold is itself a .tb-cat)
{
  const page = await open(BASE + '?lens=table', 430);
  const s = await page.evaluate(() => {
    const sums = [...document.querySelectorAll('.tb-cat summary')].map(e => ({ text: e.textContent.slice(0, 30), h: Math.round(e.getBoundingClientRect().height) }));
    const h3 = [...document.querySelectorAll('.tb-cat h3')].map(e => Math.round(e.getBoundingClientRect().height));
    const tiles = [...document.querySelectorAll('.tile')].slice(0, 3).map(e => { const r = e.getBoundingClientRect(); return Math.round(Math.min(r.width, r.height)); });
    const tabs = [...document.querySelectorAll('#lensbar a')].map(e => Math.round(e.getBoundingClientRect().height));
    const crumb = Math.round((document.querySelector('#trail a') || { getBoundingClientRect: () => ({ height: 0 }) }).getBoundingClientRect().height);
    const search = Math.round(document.querySelector('.u-search').getBoundingClientRect().height);
    return { sums, h3, tiles, tabs, crumb, search, scrollWidth: document.documentElement.scrollWidth, repoFold: sums.find(x => /repositories/.test(x.text)) || null };
  });
  await page.screenshot({ path: OUT + 'final-f3-table-430.png' });
  check('F3 .tb-cat summary folds are >= 44 px at 430 (repositories fold included)', s.sums.length > 0 && s.sums.every(x => x.h >= 44) && !!s.repoFold && s.repoFold.h >= 44 && s.scrollWidth === 430, { count: s.sums.length, min: Math.min(...s.sums.map(x => x.h)), repoFold: s.repoFold, scrollWidth: s.scrollWidth });
  report.measurements.f3 = s;
  await page.close();
}
// ---- F4: the newest recipe chip's remove button is reachable at 430
{
  const page = await open(BASE + '?lens=table&recipe=block:Si', 430);
  const one = await page.evaluate(() => ({ chips: document.querySelectorAll('#tray .rc').length, cnt: document.querySelector('#tray .cnt').textContent, title: document.querySelector('#tray .cnt').title }));
  const t = await page.evaluate(() => { const st = document.getElementById('stage').getBoundingClientRect(); const x = [...document.querySelectorAll('.tile')].find(e => { const r = e.getBoundingClientRect(); return r.top > st.top + 10 && r.bottom < st.bottom - 10 && !e.closest('details'); }); const r = x.getBoundingClientRect(); return { x: r.left + r.width / 2, y: r.top + r.height / 2, sym: x.que  … [line shortened here: 434 characters; full line on GitHub]
  await page.touchscreen.tap(t.x, t.y); await sleep(900);
  await page.evaluate(() => [...document.querySelectorAll('#panel-foot .u-chip, #panel-foot button')].find(b => b.textContent === 'Add to recipe').click()); await sleep(700);
  await page.evaluate(() => { const x = document.querySelector('#panel-foot button.x'); if (x) x.click(); }); await sleep(500);
  const r = await page.evaluate(() => {
    const chips = [...document.querySelectorAll('#tray .rc')];
    const last = chips[chips.length - 1], b = last.querySelector('button'), br = b.getBoundingClientRect();
    const cx = br.left + br.width / 2, cy = br.top + br.height / 2;
    const hit = document.elementFromPoint(cx, cy);
    const box = document.querySelector('#tray .chips').getBoundingClientRect();
    return { chips: chips.length, keys: window.__star.state.recipe.slice(), lastText: last.textContent, x: Math.round(br.width), y: Math.round(br.height), cx: Math.round(cx), cy: Math.round(cy), reach: hit === b || b.contains(hit), hitTag: hit ? hit.tagName + '.' + hit.className : null, visible: br.left >= box.left - 0.5 && br.right <= box.right + 0.5, scrollLeft: Math.round(document.querySelector  … [line shortened here: 591 characters; full line on GitHub]
  });
  await page.screenshot({ path: OUT + 'final-f4-tray-430.png' });
  await page.evaluate(() => { const chips = [...document.querySelectorAll('#tray .rc')]; chips[chips.length - 1].querySelector('button').click(); }); await sleep(600);
  const gone = await page.evaluate(() => ({ chips: document.querySelectorAll('#tray .rc').length, keys: window.__star.state.recipe.slice() }));
  check('F4 the newest recipe chip is on screen and its remove button is hit-testable at 430', one.chips === 1 && r.chips === 2 && r.reach && r.visible && r.x >= 44 && r.y >= 44 && gone.chips === 1 && r.scrollWidth === 430, { added: t.sym, one, two: r, afterRemove: gone });
  check('F4 the tray count is in numerals with the full words on the title', /^\d+ block/.test(r.cnt) && !/will travel/.test(r.cnt) && /will travel/.test(r.cntTitle), { cnt: r.cnt, title: r.cntTitle });
  report.measurements.f4 = { one, two: r, afterRemove: gone };
  await page.close();
}
// ---- Table B after the repair: smallest tap targets at 430, and the six lens segments on screen
{
  const heights = {};
  for (const id of LENSES) {
    const page = await open(BASE + `?lens=${id}&key=block:Gc`, 430);
    const m = await page.evaluate(() => {
      const pick = sel => [...document.querySelectorAll(sel)].map(e => { const r = e.getBoundingClientRect(); return r.width > 0 && r.height > 0 ? Math.round(Math.min(r.width, r.height)) : null; }).filter(v => v !== null);
      const all = { search: pick('.u-search'), crumb: pick('#trail a'), legend: pick('#legend .lg'), tab: pick('#lensbar a'), panelBtn: pick('#panel-foot button, #panel-foot .u-chip'), panelChip: pick('#panel-body .u-chip'), tile: pick('.tile'), card: pick('.card'), summary: pick('.tb-cat summary'), h3: pick('.tb-cat h3'), seg: pick('.col .seg button'), trayGo: pick('#tray .go') };
      let min = Infinity, who = null;
      for (const [k, v] of Object.entries(all)) for (const h of v) if (h < min) { min = h; who = k; }
      return { min, who, all: Object.fromEntries(Object.entries(all).map(([k, v]) => [k, v.length ? Math.min(...v) : null])), scrollWidth: document.documentElement.scrollWidth, geom: window.__star.G.geomCount, edges: window.__star.G.edgeCount, hint: document.getElementById('hint').textContent, key: window.__star.state.focus >= 0 ? window.__star.core.keyStr[window.__star.state.focus] : null };
    });
    heights[id] = m;
    await page.screenshot({ path: OUT + `final-tapsize-${id}-430.png` });
    await page.close();
  }
  report.measurements.tap_430 = heights;
  const worst = Object.entries(heights).map(([k, v]) => [k, v.min, v.who]);
  check('Table B post-repair: every measured tap target at 430 is >= 32 px and no lens scrolls sideways', worst.every(w => w[1] >= 32) && Object.values(heights).every(v => v.scrollWidth === 430), worst);
  check('Table B post-repair: the smallest tap target is no longer the 21/22 px fold or heading', worst.every(w => w[1] > 22), worst);
  const segs = Object.entries(heights).map(([k, v]) => ({ lens: k, key: v.key, geometry_segments: v.geom, edge_segments: v.edges }));
  report.measurements.lens_segments_430 = segs;
  check('Table B post-repair: all six lenses draw on screen at 430 with the same key', segs.length === 6 && segs.every(s => s.key === 'block:Gc'), segs);
}
report.console_errors = errs; report.pass = pass; report.fail = fail;
check('console: no errors across the checks', errs.length === 0, errs);
await browser.close();
fs.writeFileSync(OUT + 'final-check.json', JSON.stringify(report, null, 1));
console.log(`\n${pass} pass · ${fail} fail · written final-check.json`);
process.exitCode = fail ? 1 : 0;

Grep Tests

A shell script in the proof folder of GlobalGrid2050.

testglobalgrid2050 / testcode/202609142225/proof/grep-tests.sh · lines 1–21 of 21 · version 2026-09-14 22:25 · Entry point

What it does
It tests its inputs. Side effects: makes network requests; starts processes.
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. README: "`proof/grep-tests.sh` runs the §10.5 grep tests."
Downstream impact
It is itself an entry point (shell script); no other file was found loading it.
What it achieves
The README says: `proof/grep-tests.sh` runs the §10.5 grep tests.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
globalgrid2050 · testcode/202609142225/proof · shell script
Uses
none found
Used by
none found
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 testcode/202609142225/proof/grep-tests.sh:1-21 · blob bb8af9ae4d4282e44eb7903d8d1a88600c2e9bb4 · GitHub at these lines
State
achieves: readme · context: readme_derived · stage: ingest · effects: network, process · domain stage: experimental · users: none · canonical: production_core
#!/bin/sh
# GRAMMAR §10.5 grep tests over the lens modules and the whole page. Run from the page folder.
cd "$(dirname "$0")/.." || exit 1
fail=0
echo "== lens modules: no fetch(, no hex colour literal, no history., no state. write, no 'dependents', no 'REPO' chip"
for f in lenses/*.js; do
  for pat in 'fetch(' '#[0-9a-fA-F]\{6\}' 'history\.' 'state\.[a-zA-Z]* *=[^=]' 'dependents' 'depended on by' 'REPO' 'DEPENDS-ON' 'FOUND-IN' 'CONTAINS'; do
    if grep -n "$pat" "$f" >/dev/null; then echo "FAIL $f: $pat"; grep -n "$pat" "$f"; fail=1; fi
  done
done
echo "== whole page: every legend word with its hex only in core.js REL"
grep -n "'contains': '#8b93a7'\|'depends on': '#ffd54a'\|'uses': '#00e5ff'\|'used by': '#ff7ab6'\|'shared line': '#39d353'\|'random link': '#8b93a7'\|'entangled': '#b8ccff'" core.js | wc -l
echo "== hex literals outside core.js, gl.js, style.css (should be none)"
grep -n '#[0-9a-fA-F]\{6\}' ui.js index.html lenses/*.js && fail=1
echo "== retired words anywhere in shipped code (should be none)"
grep -n 'dependents\|depended on by\|BLOCK [0-9]\|DEPENDS-ON\|FOUND-IN' core.js ui.js gl.js lenses/*.js index.html style.css && fail=1
echo "== verdict colours: red/green/amber words in CSS/JS (only .u-fail red allowed)"
grep -n 'ff5c5c\|ffb3b3' style.css
grep -inw 'verdict\|amber\|rag' core.js ui.js gl.js lenses/*.js style.css | grep -v 'never\|not shown\|no red\|forbidden'
echo "grep tests exit $fail"
exit $fail

Lens Grammar Proof

A JavaScript module in the testcode folder of GlobalGrid2050 using data from the stars, ventus-grid-engine and code-generator repositories.

renderglobalgrid2050 / testcode/202609142225/proof/lens-grammar-proof.mjs · lines 1–74 of 74 · version 2026-09-14 22:25 · Not reached from any entry point (candidate for review)

What it does
Uses libraries node:module, node:fs, node:path, C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core. Side effects: changes the web page (DOM); 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: data source: stars data; data source: ventus-grid-engine data; data source: code-generator data; JSON file lens-grammar-proof.json; command-line arguments. Out: JSON file lens-grammar-proof.json.
What it achieves
Lens-grammar proof: measures each existing lens at phone width (430x900, touch) and desktop (1280x900).
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · testcode/202609142225/proof · JavaScript module
Uses
Table (estate URL), Code (estate URL), Code Generator — Index Page (estate URL), node:module, node:fs, node:path, C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core
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/202609142225/proof/lens-grammar-proof.mjs:1-74 · blob eefd8678ddbfe45e273d62ecc33226dd62993007 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: experimental · users: none · canonical: unreached_review
// Lens-grammar proof: measures each existing lens at phone width (430x900, touch) and desktop (1280x900).
// Reads only public pages. Writes JSON + PNG into this folder. Run: node lens-grammar-proof.mjs <port>
import { createRequire } from 'node:module';
import fs from 'node:fs';
import path from 'node:path';
const require = createRequire(import.meta.url);
const puppeteer = require('C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core');
const port = process.argv[2] || '8861';
const here = path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1'));
const LOCAL = `http://127.0.0.1:${port}/testcode/202609141522/`;
const pages = [
  { id: 'v08-ring-journey', url: LOCAL + 'v08-ring-journey/index.html', tap: 'svg#ring circle.b' },
  { id: 'v03-particle-universe', url: LOCAL + 'v03-particle-universe/index.html', tap: null },
  { id: 'v05-chord-dependencies', url: LOCAL + 'v05-chord-dependencies/index.html', tap: 'svg#ch path.arc' },
  { id: 'v07-flow-repos', url: LOCAL + 'v07-flow-repos/index.html', tap: 'svg#flow g.node' },
  { id: 'v10-ide-search', url: LOCAL + 'v10-ide-search/index.html', tap: null },
  { id: 'stars-table', url: 'https://ventusltd.github.io/stars/table.html', tap: '.tile' },
  { id: 'stars-code-511', url: 'https://ventusltd.github.io/stars/code.html?family=511', tap: null },
  { id: 'grid-engine-periodic', url: 'https://ventusltd.github.io/ventus-grid-engine/?graph=periodic-table', tap: null },
  { id: 'code-generator', url: 'https://ventusltd.github.io/code-generator/?blocks=Si,Vn', tap: null },
];
const browser = await puppeteer.launch({
  executablePath: 'C:/Program Files/Google/Chrome/Application/chrome.exe', headless: 'new',
  args: ['--enable-gpu', '--use-gl=angle', '--use-angle=d3d11', '--ignore-gpu-blocklist', '--no-first-run'],
});
const out = { run_utc: new Date().toISOString(), port, results: [] };
for (const p of pages) for (const vp of [{ name: 'mobile', width: 430, height: 900, hasTouch: true, isMobile: true, deviceScaleFactor: 2 }, { name: 'desktop', width: 1280, height: 900, hasTouch: false, isMobile: false, deviceScaleFactor: 1 }]) {
  const page = await browser.newPage();
  await page.setViewport(vp);
  const failed = []; const consoleErrors = [];
  page.on('requestfailed', r => failed.push(r.url()));
  page.on('response', r => { if (r.status() >= 400) failed.push(`${r.status()} ${r.url()}`); });
  page.on('console', m => { if (m.type() === 'error') consoleErrors.push(m.text().slice(0, 160)); });
  const rec = { id: p.id, viewport: vp.name, url: p.url };
  try {
    await page.goto(p.url, { waitUntil: 'networkidle2', timeout: 60000 });
    await new Promise(r => setTimeout(r, 2500));
    rec.measure = await page.evaluate(() => ({
      innerWidth: innerWidth, scrollWidth: document.documentElement.scrollWidth, bodyScrollWidth: document.body.scrollWidth,
      title: document.title, h1: (document.querySelector('h1') || {}).textContent || null,
      count: (document.querySelector('#count,#status,.count') || {}).textContent || null,
      legend: [...document.querySelectorAll('.u-legend span, .legend span')].map(s => s.textContent.trim()),
      legendColours: [...document.querySelectorAll('.u-legend i')].map(i => i.style.background),
      svgText: document.querySelectorAll('svg text').length, svgPaths: document.querySelectorAll('svg path').length, svgCircles: document.querySelectorAll('svg circle').length,
      tiles: document.querySelectorAll('.tile').length, cards: document.querySelectorAll('.card').length,
      footer: (document.querySelector('footer.u-foot') || {}).textContent || null,
      fail: (document.querySelector('.u-fail') || {}).textContent || null,
      hash: location.hash, search: location.search,
    }));
    if (p.tap) {
      const t = await page.$(p.tap);
      if (t) {
        if (vp.hasTouch) await t.tap(); else await t.click();
        await new Promise(r => setTimeout(r, 3000));
        rec.afterTap = await page.evaluate(() => ({
          hash: location.hash, search: location.search,
          trail: (document.querySelector('#trail, .crumbs') || {}).textContent || null,
          panelShown: !!document.querySelector('#panel:not([hidden]), #block:not([hidden]), .panel:not([hidden])'),
          panelHead: (document.querySelector('#panel .u-h, #block .u-h, .panel h3') || {}).textContent || null,
          svgPaths: document.querySelectorAll('svg path').length, scrollWidth: document.documentElement.scrollWidth,
        }));
      } else rec.afterTap = 'tap target not found: ' + p.tap;
    }
    const shot = path.join(here, `${p.id}-${vp.name}.png`);
    await page.screenshot({ path: shot, fullPage: false });
    rec.screenshot = path.basename(shot);
  } catch (e) { rec.error = String(e.message || e).slice(0, 300); }
  rec.failedRequests = failed.slice(0, 10); rec.consoleErrors = consoleErrors.slice(0, 5);
  out.results.push(rec); console.log(JSON.stringify(rec));
  await page.close();
}
await browser.close();
fs.writeFileSync(path.join(here, 'lens-grammar-proof.json'), JSON.stringify(out, null, 2));
console.log('written', path.join(here, 'lens-grammar-proof.json'));

Repair Check

A JavaScript module in the proof folder of GlobalGrid2050 that repairs round self-test: one check per finding of the review (blockers, majors, and the minors that were fixed).

renderglobalgrid2050 / testcode/202609142225/proof/repair-check.mjs · lines 1–181 of 181 · version 2026-09-14 22:25 · Not reached from any entry point (candidate for review)

What it does
It loads data. Defines sleep, check, open. Uses libraries node:module, node:fs, C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core. 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 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. README: "`proof/repair-check.mjs` is the repair round's self-test (one check per review finding"
Inputs & outputs
In: command-line arguments. Out: JSON file repair-check.json.
What it achieves
It is built from the sleep step (`sleep`), the check step (`check`) and the open step (`open`). The README says: `proof/repair-check.mjs` is the repair round's self-test (one check per review finding. It writes `repair-check.json`.
Why it matters
No other file in the estate was found to import it.
Application
globalgrid2050 · testcode/202609142225/proof · JavaScript module
Uses
node:module, node:fs, C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core
Used by
none found
Produces
sleep, check, open
Defines here
sleep, check, open
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/202609142225/proof/repair-check.mjs:1-181 · blob e7cf9e6ac852ecd5a396093754b9b2b05e9d3781 · GitHub at these lines
State
achieves: readme · context: readme_derived · stage: output · effects: dom, filesystem, storage · domain stage: experimental · users: none · canonical: unreached_review
// Repair round self-test: one check per finding of the review (blockers, majors, and the minors that were fixed).
//   node C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/202609142225/proof/repair-check.mjs [port]
// Writes proof/repair-check.json and proof/repair-*.png. Every number below is read from the live page.
import { createRequire } from 'node:module';
import fs from 'node:fs';
const require = createRequire(import.meta.url);
const puppeteer = require('C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core');
const PORT = process.argv[2] || '8877', BASE = `http://127.0.0.1:${PORT}/testcode/202609142225/`;
const OUT = 'C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/202609142225/proof/';
const sleep = ms => new Promise(r => setTimeout(r, ms));
const browser = await puppeteer.launch({ executablePath: 'C:/Program Files/Google/Chrome/Application/chrome.exe', headless: 'new', args: ['--enable-gpu', '--use-gl=angle', '--use-angle=d3d11', '--ignore-gpu-blocklist', '--no-first-run'], protocolTimeout: 120000 });
const report = { run_utc: new Date().toISOString(), base: BASE, checks: [] };
let pass = 0, fail = 0;
function check(id, ok, detail) { report.checks.push({ id, ok: !!ok, detail }); if (ok) pass++; else fail++; console.log(`${ok ? 'PASS' : 'FAIL'} ${id}: ${typeof detail === 'string' ? detail : JSON.stringify(detail)}`); }
async function open(url, width, errs) {
  const page = await browser.newPage(); const mobile = width <= 600;
  await page.setViewport({ width, height: 900, deviceScaleFactor: mobile ? 2 : 1, isMobile: mobile, hasTouch: mobile });
  page.on('console', m => { if (m.type() === 'error') errs.push(m.text()); }); page.on('pageerror', e => errs.push('pageerror: ' + e.message));
  await page.goto(url, { waitUntil: 'networkidle0', timeout: 90000 });
  await page.evaluate(() => { try { localStorage.removeItem('star-generator.recipe'); } catch (e) {} });
  await page.goto(url, { waitUntil: 'networkidle0', timeout: 90000 });
  await page.waitForFunction(() => /blocks on the table/.test(document.getElementById('count').textContent) && document.getElementById('count').title.length > 0, { timeout: 60000 });
  await sleep(800); return page;
}
const errs = [];

// ---- major 1: a line carried by many families never picks fs[0] for compose / hand-off
{
  const page = await open(BASE + '?lens=table&recipe=block:Si,line:17', 1440, errs);
  const r = await page.evaluate(async () => { const S = window.__star; const j = await S.recipeJSON(); const rl = S.core.resolveLine(17); return { carried: rl.fams ? rl.fams.length : null, composeEntity: S.core.composeEntity('line:17'), handOff: S.handOffURL(), line: j.lines[0], tray: document.getElementById('tray').textContent, trayTitle: (document.querySelector('#tray .cnt') || {}).title || '',   … [line shortened here: 480 characters; full line on GitHub]
  check('M1 line:17 not attributed to a family', r.composeEntity === -1 && r.line.family === null && r.line.families_carrying === r.carried && /blocks=Si&/.test(r.handOff) && !/Cg/.test(r.handOff), r);
  check('M1 tray says pick one', /carried by [\d,]+ families · pick one/.test(r.trayTitle) && /\d+ to pick/.test(r.trayCount) && /pick one/.test(r.tray), { tray: r.tray, count: r.trayCount, title: r.trayTitle });   // review round 2: the count in the tray is numerals, the full words are on its title
  await page.click('#tray .cnt'); await sleep(300);
  const sheet = await page.evaluate(() => ({ text: document.getElementById('sheet').textContent, pick: !!document.querySelector('#sheet .ch .u-chip[title]') }));
  check('M1 sheet row says pick one with a chooser', /line 17 · carried by [\d,]+ families · pick one/.test(sheet.text) && sheet.pick, sheet.text.slice(0, 200));
  await page.click('#sheet .ch .u-chip[title]'); await sleep(300);
  const chooser = await page.evaluate(() => ({ head: document.querySelector('#sheet .u-h').textContent, rows: document.querySelectorAll('#sheet .ch').length, more: (document.querySelector('#sheet .u-more') || {}).textContent }));
  check('M1 chooser lists the families paged 40', /carried by/.test(chooser.head) && chooser.rows === 40 && /more|families/.test(chooser.more || ''), chooser);
  await page.screenshot({ path: OUT + 'repair-line-chooser.png' });
  await page.click('#sheet .ch button'); await sleep(400);
  const after = await page.evaluate(async () => { const S = window.__star; const j = await S.recipeJSON(); return { handOff: S.handOffURL(), line: j.lines[0], tray: document.getElementById('tray').textContent, trayTitle: (document.querySelector('#tray .cnt') || {}).title || '', trayCount: (document.querySelector('#tray .cnt') || {}).textContent || '' }; });
  check('M1 after a pick the chosen family and its block travel', after.line.family !== null && after.line.chosen === true && after.line.families_carrying > 1 && /pinned as a note/.test(after.trayTitle), after);   // review round 2: the full words moved to the title of the count and of the chips
  await page.close();
}
// ---- major 2: column show / spider are not navigations
{
  const page = await open(BASE + '?lens=column', 1440, errs);
  const before = await page.evaluate(() => ({ focus: window.__star.state.focus, trail: window.__star.state.trail.length, url: location.search, hist: history.length, panel: document.getElementById('panel').hidden }));
  await page.click('.col .seg button:nth-child(2)'); await sleep(500);
  const mid = await page.evaluate(() => ({ focus: window.__star.state.focus, trail: window.__star.state.trail.length, url: location.search, hist: history.length, panel: document.getElementById('panel').hidden, on: document.querySelector('.col .seg button.on').textContent }));
  await page.click('.col .seg button:nth-child(4)'); await sleep(700);
  const after = await page.evaluate(() => ({ focus: window.__star.state.focus, trail: window.__star.state.trail.length, url: location.search, hist: history.length, panel: document.getElementById('panel').hidden, spider: document.querySelector('.col .seg button:nth-child(4)').textContent }));
  check('M2 column segment/spider keep focus, trail, URL, history', before.focus === -1 && mid.focus === -1 && after.focus === -1 && mid.trail === 0 && after.trail === 0 && before.url === mid.url && mid.url === after.url && before.hist === after.hist && mid.panel && after.panel && mid.on === 'show: depends on' && after.spider === 'column', { before, mid, after });
  await page.close();
}
// ---- major 3: table show 40 more is paging, not a hop
{
  const page = await open(BASE + '?lens=table&key=block:Cg', 1440, errs);
  const before = await page.evaluate(() => ({ focus: window.__star.state.focus, trail: window.__star.state.trail.length, url: location.search, hist: history.length, groups: document.querySelectorAll('.tb-cat:last-of-type .tile').length, head: document.querySelector('#panel .u-h').textContent }));
  await page.evaluate(() => document.querySelector('.tb-cat .u-more').scrollIntoView());
  await page.click('.tb-cat .u-more'); await sleep(600);
  const after = await page.evaluate(() => ({ focus: window.__star.state.focus, trail: window.__star.state.trail.length, url: location.search, hist: history.length, groups: document.querySelectorAll('.tb-cat:last-of-type .tile').length, head: document.querySelector('#panel .u-h').textContent }));
  check('M3 show 40 more: +40 tiles, same focus/trail/URL/history', after.groups === before.groups + 40 && after.focus === before.focus && after.trail === before.trail && after.url === before.url && after.hist === before.hist && after.head === before.head, { before, after });
  await page.close();
  const p2 = await open(BASE + '?lens=table', 1440, errs);
  const b2 = await p2.evaluate(() => ({ focus: window.__star.state.focus, hist: history.length, panel: document.getElementById('panel').hidden }));
  await p2.evaluate(() => document.querySelector('.tb-cat .u-more').scrollIntoView()); await p2.click('.tb-cat .u-more'); await sleep(600);
  const a2 = await p2.evaluate(() => ({ focus: window.__star.state.focus, hist: history.length, panel: document.getElementById('panel').hidden, groups: document.querySelectorAll('.tb-cat:last-of-type .tile').length }));
  check('M3 show 40 more with no focus: no navigation, panel stays closed', b2.focus === -1 && a2.focus === -1 && a2.hist === b2.hist && a2.panel && a2.groups === 80, { b2, a2 });
  await p2.close();
}
// ---- major 4: a family focus scrolls the table to its block tile (430)
{
  const page = await open(BASE + '?lens=table&key=family:80299', 430, errs);
  const r = await page.evaluate(() => { const ov = document.getElementById('overlay'); const t = document.querySelector('.tile.focus'); const st = document.getElementById('stage').getBoundingClientRect(); const P = document.getElementById('panel').getBoundingClientRect(); const tr = t ? t.getBoundingClientRect() : null; return { scrollTop: ov.scrollTop, scrollH: ov.scrollHeight, tile: t ? t.queryS  … [line shortened here: 689 characters; full line on GitHub]
  check('M4 family focus scrolls the overlay to its block tile, inside the visible band', r.scrollTop > 0 && r.inBand, r);
  await page.screenshot({ path: OUT + 'repair-table-family-430.png' });
  await page.close();
}
// ---- major 5: legend dim state follows the lens after every tab switch
{
  const page = await open(BASE + '?lens=ring&key=block:Cg', 1440, errs);
  const LENSES = ['ring', 'particle', 'chord', 'river', 'table', 'column']; const wrong = {};
  for (const id of LENSES.slice(1)) { await page.click(`#lensbar a:nth-child(${LENSES.indexOf(id) + 1})`); await sleep(400); wrong[id] = await page.evaluate(() => { const L = window.__star.lens; const U = window.__star.core.U; return [...document.querySelectorAll('#legend .lg:not(.cat)')].map((b, k) => { const w = b.textContent.trim(); const loaded = k < 5 || !!U.pack; const shouldDim = !loaded ||  … [line shortened here: 509 characters; full line on GitHub]
  check('M5 legend dim state matches lens.draws after each switch', Object.values(wrong).every(w => w.length === 0), wrong);
  await page.close();
}
// ---- blocker 6: a closed panel is gone (430)
{
  const page = await open(BASE + '?lens=table', 430, errs);
  const r = await page.evaluate(() => { const P = document.getElementById('panel'); const st = document.getElementById('stage').getBoundingClientRect(); const map = []; for (let y = Math.ceil(st.top) + 5; y < st.bottom - 5; y += 10) { const e = document.elementFromPoint(215, y); map.push(e && e.closest('#panel') ? 'P' : e && e.closest('#overlay') ? 'o' : '?'); } const tiles = [...document.querySel  … [line shortened here: 810 characters; full line on GitHub]
  check('B6 closed panel has display none and swallows no touch', r.hidden && r.display === 'none' && !r.map.includes('P') && r.tilesVisible > 0, r);
  await page.screenshot({ path: OUT + 'repair-table-fresh-430.png' });
  await page.close();
}
// ---- blocker 7: swipe-right on a tile composes by touch (430)
{
  const page = await open(BASE + '?lens=table', 430, errs);
  const t = await page.evaluate(() => { const st = document.getElementById('stage').getBoundingClientRect(); const x = [...document.querySelectorAll('.tile')].find(e => { const r = e.getBoundingClientRect(); return r.top > st.top + 10 && r.bottom < st.bottom - 10 && !e.closest('details'); }); const r = x.getBoundingClientRect(); return { x: r.left + 18, y: r.top + r.height / 2, sym: x.querySelecto  … [line shortened here: 425 characters; full line on GitHub]
  await page.touchscreen.touchStart(t.x, t.y); for (let s = 1; s <= 6; s++) { await page.touchscreen.touchMove(t.x + 90 * s / 6, t.y); await sleep(20); } await page.touchscreen.touchEnd(); await sleep(600);
  const r = await page.evaluate(() => ({ tray: document.getElementById('tray').textContent, recipe: window.__star.state.recipe.slice(), focus: window.__star.state.focus, panel: document.getElementById('panel').hidden }));
  check('B7 swipe-right 90 px on a tile adds it to the recipe by touch', r.recipe.includes('block:' + t.sym) && r.focus === -1, { tile: t.sym, ...r });
  // and a vertical finger scroll over the tiles still scrolls, never composes or navigates
  const before = await page.evaluate(() => document.getElementById('overlay').scrollTop);
  await page.touchscreen.touchStart(215, t.y + 40); for (let s = 1; s <= 8; s++) { await page.touchscreen.touchMove(215, t.y + 40 - 120 * s / 8); await sleep(20); } await page.touchscreen.touchEnd(); await sleep(500);
  const v = await page.evaluate(() => ({ scrollTop: document.getElementById('overlay').scrollTop, recipe: window.__star.state.recipe.length, focus: window.__star.state.focus }));
  check('B7 vertical finger scroll over tiles scrolls the grid only', v.scrollTop > before && v.recipe === 1 && v.focus === -1, { before, ...v });
  await page.close();
}
// ---- major 8 + minor: Measure makes the panel tall; a lens tab drops/closes it; measured text survives a keyboard switch
{
  const page = await open(BASE + '?lens=ring&key=family:511', 430, errs);
  await page.waitForFunction(() => document.querySelector('#panel-foot .u-chip'), { timeout: 30000 });
  await page.evaluate(() => [...document.querySelectorAll('#panel-foot .u-chip')].find(b => b.textContent === 'Measure').click());
  await page.waitForFunction(() => { const c = document.querySelector('#panel .u-code'); return c && !/Fetching/.test(c.textContent) && !/text on Measure/.test(c.textContent); }, { timeout: 40000 }); await sleep(300);
  const m = await page.evaluate(() => { const B = document.getElementById('panel-body'); const pb = B.getBoundingClientRect(); const ls = [...B.querySelectorAll('.u-line')]; const c = B.querySelector('.u-code'); return { tall: document.getElementById('panel').classList.contains('tall'), vis: ls.filter(l => { const r = l.getBoundingClientRect(); return r.top >= pb.top && r.bottom <= pb.bottom; }).l  … [line shortened here: 756 characters; full line on GitHub]
  check('M11 after Measure the code box is in view and lines are readable', m.tall && m.vis >= 3 && m.codeTop >= m.bodyTop && m.codeTop < m.bodyBottom && !m.sideways, m);
  check('m shared-line key coloured with a title', m.sharedKeys.length > 0, m.sharedKeys);
  check('m numbered lines before uses/used by on a phone', m.order.findIndex(s => /Numbered lines/.test(s)) < Math.max(m.order.findIndex(s => /uses/.test(s)), m.order.findIndex(s => /used by/.test(s))) || !m.order.some(s => /used by|uses/.test(s)), m.order);
  await page.screenshot({ path: OUT + 'repair-measure-430.png' });
  await page.keyboard.press(']'); await sleep(600);   // keyboard switch keeps the panel (at peek), measured text kept
  const k = await page.evaluate(() => ({ tall: document.getElementById('panel').classList.contains('tall'), hidden: document.getElementById('panel').hidden, lens: document.querySelector('#lensbar a.on').textContent, text: (document.querySelector('#panel .u-code') || {}).textContent || '' }));
  check('M8 keyboard lens switch drops the panel to peek and (minor) keeps the measured text', !k.tall && !k.hidden && k.lens === 'particle' && !/text on Measure/.test(k.text) && k.text.length > 50, { tall: k.tall, hidden: k.hidden, lens: k.lens, textHead: k.text.slice(0, 60) });
  await page.evaluate(() => [...document.querySelectorAll('#lensbar a')].find(a => a.textContent === 'table').click()); await sleep(900);
  const t = await page.evaluate(() => { const st = document.getElementById('stage').getBoundingClientRect(); return { hidden: document.getElementById('panel').hidden, lens: document.querySelector('#lensbar a.on').textContent, tiles: [...document.querySelectorAll('.tile')].filter(t => { const r = t.getBoundingClientRect(); return r.top >= st.top && r.bottom <= st.bottom; }).length, url: location.se  … [line shortened here: 411 characters; full line on GitHub]
  check('M8 lens tab tap on a phone closes the panel and shows the tiles', t.hidden && t.lens === 'table' && t.tiles > 0 && /key=family:511/.test(t.url), t);
  await page.screenshot({ path: OUT + 'repair-table-after-tab-430.png' });
  await page.close();
}
// ---- majors 9, 10, 12 and minor needs: the sheet and the count words (430)
{
  const page = await open(BASE + '?lens=table&recipe=family:511,block:Vd', 430, errs);
  const w = await page.evaluate(() => ({ tray: document.getElementById('tray').textContent, cnt: document.querySelector('#tray .cnt').textContent, cntTitle: document.querySelector('#tray .cnt').title, chipTitle: (document.querySelector('#tray .rc') || {}).title || '', chips: [...document.querySelectorAll('#tray .rc')].map(c => c.textContent.replace('×', '').trim()), outlined: [...document.querySel  … [line shortened here: 565 characters; full line on GitHub]
  check('M12 count words say which blocks travel and what is a note', /2 blocks will travel \(Ss, Vd\)/.test(w.cntTitle) && /#511 pinned as a note/.test(w.cntTitle) && w.chipTitle === w.cntTitle && /^2 blocks · 1 note$/.test(w.cnt), { cnt: w.cnt, title: w.cntTitle });   // review round 2: numerals in the tray, the full words on the title of the count and of every chip
  check('M12 family chip shows its derived block; Ss and Vd outlined on the table', w.chips.includes('#511 → Ss') && w.outlined.includes('Ss(derived)') && w.outlined.includes('Vd'), { chips: w.chips, outlined: w.outlined });
  await page.evaluate(() => document.querySelector('#tray .cnt').click()); await sleep(400);
  const sh = await page.evaluate(() => { const S = document.getElementById('sheet'); const b = S.getBoundingClientRect(); return { top: Math.round(b.top), bottom: Math.round(b.bottom), rows: [...S.querySelectorAll('.ch')].map(r => ({ h: Math.round(r.getBoundingClientRect().height), parts: [...r.children].map(c => `${c.textContent.trim().slice(0, 16)}(${Math.round(c.getBoundingClientRect().width)}x  … [line shortened here: 796 characters; full line on GitHub]
  check('M9 sheet rows: name button wide, ▲▼× chips 44 px, one line each', sh.rows.every(r => r.h <= 48) && sh.rows.every(r => { const ws = r.parts.map(p => +p.match(/\((\d+)x/)[1]); return ws[0] > 150 && ws.slice(1).every(x => x >= 44 && x <= 60); }), sh.rows);
  check('M10 Hand off / Copy recipe / Copy command visible at the top of the sheet', sh.buttons.length === 3 && sh.buttons.every(b => b.y >= sh.top && b.y + b.h <= 900 && b.h >= 44), sh.buttons);
  check('m needs shown as a count first, one-letter names behind show all', /^needs: \d+ from outside/.test(sh.needs) && !/, [a-z],/.test(sh.needs) && sh.showAll, sh.needs);
  await page.screenshot({ path: OUT + 'repair-sheet-430.png' });
  await page.close();
}
// ---- major 13: ✕ closes the panel and keeps the journey
{
  const page = await open(BASE + '?lens=ring&key=block:Cg&trail=block:At,block:Cg', 1440, errs);
  await page.waitForFunction(() => document.querySelector('#panel-foot button.x'), { timeout: 30000 });
  const before = await page.evaluate(() => ({ trail: document.getElementById('trail').textContent, url: location.search }));
  await page.click('#panel-foot button.x'); await sleep(300);
  const after = await page.evaluate(() => ({ trail: document.getElementById('trail').textContent, url: location.search, hidden: document.getElementById('panel').hidden, focus: window.__star.state.focus, rootTitle: document.querySelector('#trail a.root').title }));
  check('M13 ✕ closes the panel; trail, key and URL stay; home is the root crumb', after.hidden && after.trail === before.trail && after.url === before.url && after.focus >= 0 && after.rootTitle === 'home', { before, after });
  await page.close();
}
// ---- minors: tray after pack for a line key; h3 and search chip heights; river labels the recipe; BUILT stamp; orphans
{
  const page = await open(BASE + '?lens=river&recipe=line:17,family:511,block:Vd&key=block:Vd', 430, errs);
  const r = await page.evaluate(() => ({ chips: [...document.querySelectorAll('#tray .rc')].map(c => c.textContent.replace('×', '').trim()), labels: [...document.querySelectorAll('#labels span')].filter(s => !s.hidden).map(s => s.textContent), footer: document.getElementById('footer').textContent, orphans: window.__star.core.packStats.orphans }));
  check('m tray shows the line in words after the pack (no raw key)', r.chips.some(c => /^line 17 · [\d,]+ families · pick one$/.test(c)) && !r.chips.includes('line:17'), r.chips);
  check('m river labels every recipe member', r.labels.includes('#511') && r.labels.includes('Vd'), r.labels);
  check('m footer build stamp comes from publish.mjs (ISO minute), pack orphans 0', /built \d{4}-\d\d-\d\d \d\d:\d\d UTC/.test(r.footer) && r.orphans === 0, { built: (r.footer.match(/built [^·]*/) || [])[0], orphans: r.orphans });
  await page.close();
  const p2 = await open(BASE + '?lens=table', 430, errs);
  await p2.type('.u-search', 'distance'); await sleep(500);
  const s = await p2.evaluate(() => ({ h3: [...document.querySelectorAll('.tb-cat h3')].map(h => Math.round(h.getBoundingClientRect().height)), hits: [...document.querySelectorAll('.u-hits .u-chip')].map(b => Math.round(b.getBoundingClientRect().height)), scrollWidth: document.documentElement.scrollWidth }));
  check('m category headings and search hit chips are ≥ 44 px tall; page 430 wide', s.h3.every(h => h >= 44) && s.hits.length > 0 && s.hits.every(h => h >= 44) && s.scrollWidth === 430, { h3: s.h3.slice(0, 3), hits: s.hits.slice(0, 3), scrollWidth: s.scrollWidth });
  await p2.close();
}
// ---- the tapped tile stays in view (minor)
{
  const page = await open(BASE + '?lens=table', 430, errs);
  const t = await page.evaluate(() => { const st = document.getElementById('stage').getBoundingClientRect(); const x = [...document.querySelectorAll('.tile')].find(e => { const r = e.getBoundingClientRect(); return r.top > st.top + 10 && r.bottom < st.bottom - 10 && !e.closest('details'); }); const r = x.getBoundingClientRect(); return { x: r.left + r.width / 2, y: r.top + r.height / 2, sym: x.que  … [line shortened here: 452 characters; full line on GitHub]
  await page.touchscreen.tap(t.x, t.y); await sleep(900);
  const a = await page.evaluate((sym) => { const x = [...document.querySelectorAll('.tile')].find(e => e.querySelector('b').textContent === sym); const r = x.getBoundingClientRect(); const P = document.getElementById('panel').getBoundingClientRect(); const h = document.elementFromPoint(r.left + r.width / 2, r.top + r.height / 2); return { top: Math.round(r.top), bottom: Math.round(r.bottom), panel  … [line shortened here: 553 characters; full line on GitHub]
  check('m a tapped tile stays visible above the sheet', a.reach && a.bottom <= a.panelTop, { tile: t.sym, before: t, after: a });
  await page.close();
}
report.console_errors = errs; report.pass = pass; report.fail = fail;
check('console: no errors across the checks', errs.length === 0, errs);
await browser.close();
fs.writeFileSync(OUT + 'repair-check.json', JSON.stringify(report, null, 1));
console.log(`\n${pass} pass · ${fail} fail · written repair-check.json`);