In this section
- Bench render · globalgrid2050 / testcode/202609142225/proof/bench.mjs lines 1–210
- Build Proof render · globalgrid2050 / testcode/202609142225/proof/build-proof.mjs lines 1–89
- Coder Diag Overlay interaction · globalgrid2050 / testcode/202609142225/proof/coder-diag-overlay.mjs lines 1–49
- Coder Side render · globalgrid2050 / testcode/202609142225/proof/coder-side.mjs lines 1–60
- Coder Side2 render · globalgrid2050 / testcode/202609142225/proof/coder-side2.mjs lines 1–41
- Coder Walk2 render · globalgrid2050 / testcode/202609142225/proof/coder-walk2.mjs lines 1–152
Bench
A JavaScript module in the proof folder of GlobalGrid2050 that starts gpu (`startGpu`) and renders with WebGL, using haversine.
renderglobalgrid2050 / testcode/202609142225/proof/bench.mjs · lines 1–210 of 210 · version 2026-09-14 22:25 · Not reached from any entry point (candidate for review) · pattern INSTRUMENT (shared by 3 files)
- What it does
- It draws its content. Defines 17 functions or classes, including sleep, mean, r1, log, startGpu. Uses libraries node:module, node:fs, node:child_process, C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core. Side effects: changes the web page (DOM); reads or writes files; starts processes; uses storage (browser storage, DuckDB or Parquet).
- Why it exists in the grid workflow
- Domain stage 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/bench.mjs` is the benchmark (`proof/bench.json`, `proof/bench-table.md`, `proof/bench-.png`), whose figures are Table A and Table B of DECISION.md."
- Inputs & outputs
- In: JSON file bench.json; command-line arguments. Out: JSON file bench.json; WebGL/WebGPU drawing.
- What it achieves
- It starts gpu (`startGpu`) and is built from the sleep step (`sleep`) and the mean step (`mean`). Star Generator GPU bench (owner decides offline from these measurements). Its code works with 1 Hz. It writes `bench.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, node:child_process, C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core
- Used by
- none found
- Produces
- sleep, mean, r1, log, startGpu, gpuWindow, INSTRUMENT, wrap, FACTS, interact, tap, benchLens
- Defines here
- sleep, mean, r1, log, startGpu, gpuWindow, INSTRUMENT, wrap, FACTS, interact, tap, benchLens, VISIBLE, coordination, compose, add, save
- 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/bench.mjs:1-210 · blob 88853fd3f315d5c8841c7d458627e648eabc4974 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, process, storage · domain stage: experimental · users: none · canonical: unreached_review
// Star Generator GPU bench (owner decides offline from these measurements).
// node C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/202609142225/proof/bench.mjs [port]
// Serve the repository root first: python -m http.server <port> --bind 127.0.0.1 (from globalgrid2050/).
// For each lens at 1440x900 (mouse) and 430x900 (touch emulation, devicePixelRatio 2 — the page caps dpr at 2, as a phone would hit):
// WebGL renderer string, instances drawn per frame, time to first GL draw, fps mean + frame-time p95 over 4 s idle and 4 s
// while panning/tapping, document scrollWidth, smallest tap target among the key hit areas, JS heap, console errors,
// nvidia-smi utilisation + memory sampled every second (idle baseline before Chrome, then per phase).
// Then the coordination test (search #80299 in ring, switch lenses, screenshot proof/coord-<lens>-<width>.png) and the
// compose test at 430 by touch (add #80299 and block Vd, read the hand-off URL and the recipe JSON from the tray/sheet).
// Results: proof/bench.json, proof/bench-table.md, proof/bench-*.png, proof/coord-*.png, proof/compose-*.png.
import { createRequire } from 'node:module';
import fs from 'node:fs';
import { spawn } from 'node:child_process';
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] || '8884', 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'], WIDTHS = [1440, 430];
const KEYQ = '&key=family:80299&trail=block:Gc,family:80299'; // one state for every lens: a family focus with its block open and a journey
const CHROME = 'C:/Program Files/Google/Chrome/Application/chrome.exe';
const ARGS = ['--enable-gpu', '--use-gl=angle', '--use-angle=d3d11', '--ignore-gpu-blocklist', '--no-first-run', '--enable-precise-memory-info'];
const sleep = ms => new Promise(r => setTimeout(r, ms));
const mean = a => a.length ? a.reduce((s, x) => s + x, 0) / a.length : null;
const r1 = x => x == null ? null : Math.round(x * 10) / 10;
const log = (...a) => { const s = a.map(x => typeof x === 'string' ? x : JSON.stringify(x)).join(' '); console.log(s); fs.appendFileSync(OUT + 'bench.log', s + '\n'); };
fs.writeFileSync(OUT + 'bench.log', '');
/* ---------- nvidia-smi sampler (1 Hz) ---------- */
const gpu = { samples: [], proc: null };
function startGpu() {
const p = spawn('nvidia-smi', ['--query-gpu=timestamp,utilization.gpu,utilization.memory,memory.used,memory.total', '--format=csv,noheader,nounits', '-l', '1']);
let buf = ''; p.stdout.on('data', d => { buf += d; const lines = buf.split(/\r?\n/); buf = lines.pop(); for (const l of lines) { const m = l.split(',').map(s => s.trim()); if (m.length >= 5 && /^\d/.test(m[1])) gpu.samples.push({ t: Date.now(), ts: m[0], util: +m[1], memUtil: +m[2], mem: +m[3], total: +m[4] }); } });
p.stderr.on('data', d => log('nvidia-smi stderr:', String(d).trim())); gpu.proc = p;
}
function gpuWindow(t0, t1) {
const s = gpu.samples.filter(x => x.t >= t0 && x.t <= t1); if (!s.length) return { n: 0 };
const u = s.map(x => x.util), m = s.map(x => x.mem);
return { n: s.length, utilMean: r1(mean(u)), utilMax: Math.max(...u), memMeanMiB: Math.round(mean(m)), memMaxMiB: Math.max(...m), totalMiB: s[0].total };
}
/* ---------- in-page instrumentation, installed before any script of the page runs ---------- */
const INSTRUMENT = () => {
const B = window.__bench = { firstDraw: null, draws: 0, inst: 0, countAt: null, packAt: null, namesAt: null, frameMs: [] };
const wrap = (proto, name, n) => { const orig = proto[name]; proto[name] = function (...a) { if (B.firstDraw == null) B.firstDraw = performance.now(); B.draws++; B.inst += n(a); return orig.apply(this, a); }; };
wrap(WebGL2RenderingContext.prototype, 'drawArraysInstanced', a => a[3]);
wrap(WebGL2RenderingContext.prototype, 'drawArrays', a => a[2]);
const poll = setInterval(() => {
const c = document.getElementById('count'); if (B.countAt == null && c && /blocks on the table/.test(c.textContent)) B.countAt = performance.now();
const S = window.__star; if (S) { if (B.packAt == null && S.core.packLoaded && S.core.packLoaded()) B.packAt = performance.now(); if (B.namesAt == null && S.core.U.names) B.namesAt = performance.now(); }
if (B.countAt != null && B.packAt != null && B.namesAt != null) clearInterval(poll);
}, 4);
window.__measure = ms => new Promise(res => {
const dts = []; let last = null, t0 = null; const d0 = B.draws, i0 = B.inst, g0 = window.__star ? window.__star.G.frames : 0, f0 = B.frameMs.length;
function f(t) { if (t0 == null) t0 = t; if (last != null) dts.push(t - last); last = t; if (t - t0 < ms) requestAnimationFrame(f); else { const el = t - t0, sorted = dts.slice().sort((a, b) => a - b), g1 = window.__star ? window.__star.G.frames : 0; const fm = B.frameMs.slice(f0).sort((a, b) => a - b); res({ frames: dts.length, elapsedMs: Math.round(el), fpsMean: Math.round(dts.length / (el / … [line shortened here: 1,116 characters; full line on GitHub]
requestAnimationFrame(f);
});
};
const FACTS = () => {
const S = window.__star, G = S.G, B = window.__bench, r1 = x => x == null ? null : Math.round(x * 10) / 10;
if (!G.__timed) { const orig = G.frame; G.frame = function () { const t = performance.now(); const r = orig.apply(this, arguments); B.frameMs.push(performance.now() - t); return r; }; G.__timed = true; } // CPU-side time of the page's own G.frame(): JS + GL command submission, not vsync-capped
const gl = document.getElementById('gl').getContext('webgl2'); const ext = gl && gl.getExtension('WEBGL_debug_renderer_info');
const renderer = gl ? (ext ? gl.getParameter(ext.UNMASKED_RENDERER_WEBGL) : gl.getParameter(gl.RENDERER)) : 'no webgl2';
const vendor = gl ? (ext ? gl.getParameter(ext.UNMASKED_VENDOR_WEBGL) : gl.getParameter(gl.VENDOR)) : null;
const sels = { search: '.u-search', crumb: '#trail a', legendChip: '#legend .lg', lensTab: '#lensbar a', panelButton: '#panel-foot button, #panel-foot .u-chip', trayGo: '#tray .go', trayRemove: '#tray .rc button', panelChip: '#panel-body .u-chip', tile: '.tile', card: '.card', columnSeg: '.col .seg button', repoChip: '.tb-repos .u-chip', catHeading: '.tb-cat h3', foldSummary: 'details summary', … [line shortened here: 418 characters; full line on GitHub]
const targets = {}; let smallest = null;
for (const [name, sel] of Object.entries(sels)) { let mn = null; for (const e of document.querySelectorAll(sel)) { const r = e.getBoundingClientRect(); if (r.width < 1 || r.height < 1) continue; const m = Math.round(Math.min(r.width, r.height)); if (mn == null || m < mn.px) mn = { px: m, w: Math.round(r.width), h: Math.round(r.height), text: (e.textContent || e.placeholder || '').trim().slice(0, … [line shortened here: 515 characters; full line on GitHub]
const pm = performance.memory ? { usedJSHeapMB: Math.round(performance.memory.usedJSHeapSize / 1048576 * 10) / 10, totalJSHeapMB: Math.round(performance.memory.totalJSHeapSize / 1048576 * 10) / 10 } : null;
return { renderer, vendor, glVersion: gl ? gl.getParameter(gl.VERSION) : null, firstDrawMs: r1(B.firstDraw), countSentenceMs: r1(B.countAt), packLoadedMs: r1(B.packAt), namesLoadedMs: r1(B.namesAt), url: location.search, count: document.getElementById('count').textContent, countTitle: document.getElementById('count').title,
N: G.N, edgeInstances: G.edgeCount, geometryInstances: G.geomCount, journeyInstances: G.journeyCount, lineInstances: G.linesCount, lineBytes: G.linesBytes, canvasPx: [document.getElementById('gl').width, document.getElementById('gl').height], dpr: devicePixelRatio, framesSoFar: G.frames, litOnly: G.litOnly,
scrollWidth: document.documentElement.scrollWidth, innerWidth, targets, smallestTap: smallest, memory: pm, panelHead: (document.querySelector('#panel .u-h') || {}).textContent || null, packStats: S.core.packStats, footer: document.getElementById('footer').textContent };
};
/* ---------- interaction while measuring: drags (pan / rotate / scroll the overlay) and taps on the stage ---------- */
async function interact(page, mobile, rect, ms) {
const cx = rect.x + rect.w / 2, cy = rect.y + rect.h / 2, end = Date.now() + ms; let k = 0; const acts = [];
const drag = async (x0, y0, x1, y1) => { if (mobile) { await page.touchscreen.touchStart(x0, y0); for (let s = 1; s <= 10; s++) { await page.touchscreen.touchMove(x0 + (x1 - x0) * s / 10, y0 + (y1 - y0) * s / 10); await sleep(16); } await page.touchscreen.touchEnd(); } else { await page.mouse.move(x0, y0); await page.mouse.down(); for (let s = 1; s <= 10; s++) { await page.mouse.move(x0 + (x1 - … [line shortened here: 505 characters; full line on GitHub]
const tap = async (x, y) => { if (mobile) await page.touchscreen.tap(x, y); else await page.mouse.click(x, y); acts.push('tap'); };
while (Date.now() < end) {
const d = k % 2 ? -1 : 1;
await drag(cx - 90 * d, cy - 20 * d, cx + 90 * d, cy + 60 * d); await sleep(120);
if (!mobile) { await page.mouse.move(cx, cy); await page.mouse.wheel({ deltaY: 240 * d }); acts.push('wheel'); await sleep(120); }
await tap(cx + 50 * d, cy - 40 * d); await sleep(420); // > 300 ms apart so two taps never read as a double-tap (home)
k++;
}
return acts;
}
/* ---------- one lens at one width ---------- */
async function benchLens(browser, lens, width) {
const mobile = width <= 600; const name = `${lens}-${width}`; const rec = { lens, width, mobile, errors: [], warnings: [], pageErrors: [], failedRequests: [] };
const page = await browser.newPage();
await page.setViewport({ width, height: 900, deviceScaleFactor: mobile ? 2 : 1, isMobile: mobile, hasTouch: mobile });
await page.evaluateOnNewDocument(INSTRUMENT);
page.on('console', m => { if (m.type() === 'error') rec.errors.push(m.text()); else if (m.type() === 'warning') rec.warnings.push(m.text()); });
page.on('pageerror', e => rec.pageErrors.push(String(e.message))); page.on('requestfailed', r => rec.failedRequests.push(r.url()));
const tLoad0 = Date.now();
await page.goto(BASE + `?lens=${lens}${KEYQ}`, { waitUntil: 'load', timeout: 90000 });
await page.waitForFunction(() => window.__star && window.__star.core.packLoaded(), { timeout: 90000 }).catch(() => rec.errors.push('pack never loaded'));
await page.waitForFunction(() => window.__star.core.U.names, { timeout: 60000 }).catch(() => rec.warnings.push('names never loaded'));
await page.waitForFunction(() => !document.getElementById('panel').hidden && document.querySelector('#panel-foot button'), { timeout: 60000 }).catch(() => rec.warnings.push('panel foot never rendered'));
await sleep(1500); // tween (600 ms) and the panel's family bucket
const tLoad1 = Date.now();
Object.assign(rec, await page.evaluate(FACTS));
rec.metricsAfterLoad = await page.metrics().then(m => ({ JSHeapUsedMB: r1(m.JSHeapUsedSize / 1048576), JSHeapTotalMB: r1(m.JSHeapTotalSize / 1048576), Nodes: m.Nodes })).catch(() => null);
await page.screenshot({ path: OUT + `bench-${name}.png` });
const tIdle0 = Date.now(); rec.idle = await page.evaluate(() => window.__measure(4000)); const tIdle1 = Date.now();
const rect = await page.evaluate(() => { const r = document.getElementById('gl').getBoundingClientRect(); return { x: r.left, y: r.top, w: r.width, h: r.height }; });
const tAct0 = Date.now(); const pm = page.evaluate(() => window.__measure(4000)); await sleep(60); rec.actions = await interact(page, mobile, rect, 3800); rec.active = await pm; const tAct1 = Date.now();
rec.afterInteraction = await page.evaluate(() => { const S = window.__star, G = S.G; return { url: location.search, focus: S.state.focus >= 0 ? S.core.keyStr[S.state.focus] : null, litOnly: G.litOnly, view: { pan: G.view.pan.map(Math.round), zoom: Math.round(G.view.zoom * 100) / 100, rotate: Math.round(G.view.rotate * 100) / 100 }, scrollWidth: document.documentElement.scrollWidth, memory: perfo … [line shortened here: 495 characters; full line on GitHub]
await page.screenshot({ path: OUT + `bench-${name}-after.png` });
await page.close(); await sleep(1200);
rec.gpu = { load: gpuWindow(tLoad0, tLoad1), idle: gpuWindow(tIdle0, tIdle1), active: gpuWindow(tAct0, tAct1) };
log(name, { renderer: rec.renderer, firstDraw: rec.firstDrawMs, pack: rec.packLoadedMs, inst: rec.idle.instancesPerFrame, idle: [rec.idle.fpsMean, rec.idle.ftP95Ms], active: [rec.active.fpsMean, rec.active.ftP95Ms], scrollWidth: rec.scrollWidth, tap: rec.smallestTap, mem: rec.memory, errors: rec.errors.length, gpu: rec.gpu });
return rec;
}
/* ---------- coordination test: #80299 in ring, then every other lens keeps the key selected and visible ---------- */
const VISIBLE = () => {
const S = window.__star, G = S.G, i = S.state.focus, st = document.getElementById('stage').getBoundingClientRect();
const p = i >= 0 ? G.curPos(i) : null; let onCanvas = null; if (p) { const [x, y] = G.toScreen(p[0], p[1]); onCanvas = { x: Math.round(x), y: Math.round(y), inside: x >= 0 && x <= G.w && y >= 0 && y <= G.h }; }
const ov = document.querySelector('#overlay .tile.focus, #overlay .card.focus'); let overlay = null; if (ov) { const r = ov.getBoundingClientRect(); overlay = { text: ov.textContent.trim().slice(0, 40), inside: r.bottom > st.top && r.top < st.bottom && r.right > st.left && r.left < st.right }; }
const lab = [...document.querySelectorAll('#labels span')].find(s => !s.hidden && s.textContent === '#80299');
const ovEl = document.getElementById('overlay');
return { lens: S.state.lens, focusKey: i >= 0 ? S.core.keyStr[i] : null, url: location.search, panelHead: (document.querySelector('#panel .u-h') || {}).textContent || null, onCanvas, overlayFocus: overlay, labelShown: !!lab, edges: G.edgeCount, scrollWidth: document.documentElement.scrollWidth, pageScrollY: Math.round(scrollY), stageTop: Math.round(st.top), stageH: Math.round(st.height), overlay … [line shortened here: 645 characters; full line on GitHub]
};
async function coordination(browser, width) {
const mobile = width <= 600; const out = { width, steps: [], errors: [] };
const page = await browser.newPage(); await page.setViewport({ width, height: 900, deviceScaleFactor: mobile ? 2 : 1, isMobile: mobile, hasTouch: mobile });
page.on('console', m => { if (m.type() === 'error') out.errors.push(m.text()); }); page.on('pageerror', e => out.errors.push('pageerror: ' + e.message));
await page.goto(BASE + '?lens=ring', { waitUntil: 'load', timeout: 90000 });
await page.waitForFunction(() => window.__star && window.__star.core.packLoaded() && window.__star.core.U.names, { timeout: 90000 });
const tapEl = async sel => { const r = await page.evaluate(s => { const e = document.querySelector(s); if (!e) return null; e.scrollIntoView({ block: 'nearest' }); const b = e.getBoundingClientRect(); return { x: b.left + b.width / 2, y: b.top + b.height / 2 }; }, sel); if (!r) throw new Error('no element ' + sel); if (mobile) await page.touchscreen.tap(r.x, r.y); else await page.mouse.click(r.x … [line shortened here: 410 characters; full line on GitHub]
await tapEl('.u-search'); await page.keyboard.type('#80299'); await sleep(300);
out.hits = await page.evaluate(() => [...document.querySelectorAll('.u-hits .u-chip, .u-hits .u-muted')].map(e => e.textContent));
await tapEl('.u-hits .u-chip'); // the first hit: family:80299
await page.waitForFunction(() => document.querySelector('#panel-foot button'), { timeout: 60000 }).catch(() => out.errors.push('panel foot never rendered in ring'));
await sleep(1400);
const ring = await page.evaluate(VISIBLE); ring.haversineSelected = /haversine/.test(ring.panelHead || '') && ring.focusKey === 'family:80299'; out.steps.push(ring);
await page.screenshot({ path: OUT + `coord-ring-${width}.png` });
for (const lens of LENSES.slice(1)) {
await tapEl(`#lensbar a:nth-child(${LENSES.indexOf(lens) + 1})`); await sleep(1600); // 600 ms tween + smooth scrollTo in the overlay lenses
const s = await page.evaluate(VISIBLE); s.sameKey = s.focusKey === 'family:80299' && /key=family%3A80299|key=family:80299/.test(s.url); s.visible = !!((s.onCanvas && s.onCanvas.inside) || (s.overlayFocus && s.overlayFocus.inside)); out.steps.push(s);
await page.screenshot({ path: OUT + `coord-${lens}-${width}.png` });
}
await page.close();
log(`coordination ${width}`, out.steps.map(s => `${s.lens}: key=${s.focusKey} canvas=${s.onCanvas ? s.onCanvas.inside : '-'} overlay=${s.overlayFocus ? s.overlayFocus.inside : '-'} label=${s.labelShown}`));
return out;
}
/* ---------- compose test at 430 by touch ---------- */
async function compose(browser) {
const ctx = await browser.createBrowserContext(); // fresh localStorage: no recipe carried over
const page = await ctx.newPage(); await page.setViewport({ width: 430, height: 900, deviceScaleFactor: 2, isMobile: true, hasTouch: true });
const out = { errors: [], steps: [] }; page.on('console', m => { if (m.type() === 'error') out.errors.push(m.text()); }); page.on('pageerror', e => out.errors.push('pageerror: ' + e.message));
await page.goto(BASE + '?lens=ring', { waitUntil: 'load', timeout: 90000 });
await page.waitForFunction(() => window.__star && window.__star.core.packLoaded() && window.__star.core.U.names, { timeout: 90000 });
await page.evaluate(() => { window.__clip = null; Object.defineProperty(navigator.clipboard, 'writeText', { value: t => { window.__clip = t; return Promise.resolve(); }, configurable: true }); });
// a person scrolls the target into view before tapping: after a key opens, the page scrolls the stage to the top and the search box sits above the fold (measured: scrollBeforeTap)
const tapEl = async (sel, text) => { const r = await page.evaluate((s, t) => { const es = [...document.querySelectorAll(s)]; const e = t ? es.find(x => x.textContent.trim() === t) : es[0]; if (!e) return null; const before = e.getBoundingClientRect().top; e.scrollIntoView({ block: 'nearest' }); const b = e.getBoundingClientRect(); return { x: b.left + b.width / 2, y: b.top + b.height / 2, w: b.w … [line shortened here: 598 characters; full line on GitHub]
const add = async q => {
const sr = await tapEl('.u-search'); out.steps.push({ note: `search box top before scrolling for "${q}"`, topBeforeScroll: sr.topBeforeScroll }); await page.keyboard.type(q); await sleep(300);
const hit = await page.evaluate(() => (document.querySelector('.u-hits .u-chip') || {}).textContent || null); await tapEl('.u-hits .u-chip');
await page.waitForFunction(() => [...document.querySelectorAll('#panel-foot button')].some(b => b.textContent === 'Add to recipe'), { timeout: 60000 });
await sleep(300); const btn = await tapEl('#panel-foot button', 'Add to recipe'); await sleep(400);
const st = await page.evaluate(() => ({ recipe: window.__star.state.recipe.slice(), tray: document.getElementById('tray').textContent, url: location.search, panelHead: (document.querySelector('#panel .u-h') || {}).textContent }));
out.steps.push({ query: q, hit, addButtonPx: [Math.round(btn.w), Math.round(btn.h)], ...st }); log('compose add', q, st);
};
await add('#80299'); await add('Vd');
await page.screenshot({ path: OUT + 'compose-430.png' });
await tapEl('#tray .cnt'); await sleep(500);
out.sheetText = await page.evaluate(() => document.getElementById('sheet').innerText);
out.handOffFromSheet = (out.sheetText.match(/https:\/\/ventusltd\.github\.io\/code-generator\/\S+/) || [null])[0];
out.handOffFromApi = await page.evaluate(() => window.__star.handOffURL());
await tapEl('#sheet button', 'Copy recipe'); await sleep(2500);
out.clip = await page.evaluate(() => window.__clip);
out.copyButtonText = await page.evaluate(() => [...document.querySelectorAll('#sheet button')].map(b => b.textContent).filter(t => /cop/i.test(t)));
await page.screenshot({ path: OUT + 'compose-sheet-430.png' });
try { out.recipe = JSON.parse(out.clip); } catch (e) { out.recipe = null; out.errors.push('recipe JSON from the sheet did not parse: ' + e.message); }
const j = out.recipe;
out.checks = j ? { keysHave80299: j.keys.includes('family:80299'), keysHaveVd: j.keys.includes('block:Vd'), blocks: j.blocks.map(b => `${b.symbol}@${(b.files[0] || {}).commit ? b.files[0].commit.slice(0, 7) : 'no pinned place'}`), families: j.families.map(f => `${f.n} ${f.name || ''} → ${f.place ? `${f.place.repo}@${f.place.commit.slice(0, 7)} ${f.place.path}#L${f.place.first}-L${f.place.last}` … [line shortened here: 805 characters; full line on GitHub]
await page.close(); await ctx.close();
log('compose', { handOff: out.handOffFromSheet, checks: out.checks, errors: out.errors });
return out;
}
/* ---------- main ---------- */
const report = { run_utc: new Date().toISOString(), base: BASE, chromeArgs: ARGS, note: 'mobile = 430x900, hasTouch, isMobile, deviceScaleFactor 2 (the page caps dpr at 2); desktop = 1440x900 dpr 1, mouse' };
startGpu(); log('sampling idle GPU for 10 s before Chrome…'); const tIdle0 = Date.now(); await sleep(10500); report.gpuIdleBeforeChrome = gpuWindow(tIdle0, Date.now());
const browser = await puppeteer.launch({ executablePath: CHROME, headless: 'new', args: ARGS });
report.chrome = await browser.version();
{ const tb0 = Date.now(); await sleep(5500); report.gpuChromeBlank = gpuWindow(tb0, Date.now()); }
log('idle GPU before Chrome', report.gpuIdleBeforeChrome, 'Chrome open, blank', report.gpuChromeBlank, report.chrome);
const save = () => { report.gpuSamples = gpu.samples.length; fs.writeFileSync(OUT + 'bench.json', JSON.stringify(report, null, 1)); };
try {
report.lenses = [];
for (const width of WIDTHS) for (const lens of LENSES) { report.lenses.push(await benchLens(browser, lens, width)); save(); }
report.coordination = []; for (const width of WIDTHS) { report.coordination.push(await coordination(browser, width)); save(); }
try { report.compose = await compose(browser); } catch (e) { report.compose = { failed: String(e.message) }; log('compose failed', e.message); }
save();
} finally { await browser.close(); gpu.proc && gpu.proc.kill(); }
save();
/* ---------- the table ---------- */
const rows = [['lens', 'width', 'renderer', 'first GL draw ms', 'pack loaded ms', 'instances / frame', 'draw calls / frame', 'idle fps', 'idle p95 ms', 'active fps', 'active p95 ms', 'frames >24 ms idle / active', 'G.frame() CPU ms mean / p95 idle', 'G.frame() CPU ms mean / p95 active', 'scrollWidth / innerWidth', 'smallest tap target px (area)', 'JS heap MB', 'console errors', 'GPU util % mean/ma … [line shortened here: 465 characters; full line on GitHub]
for (const r of report.lenses) rows.push([r.lens, r.width, r.renderer, r.firstDrawMs, r.packLoadedMs, r.idle.instancesPerFrame, r.idle.drawCallsPerFrame, r.idle.fpsMean, r.idle.ftP95Ms, r.active.fpsMean, r.active.ftP95Ms, `${r.idle.over24ms} / ${r.active.over24ms}`, `${r.idle.glSubmitMeanMs} / ${r.idle.glSubmitP95Ms}`, `${r.active.glSubmitMeanMs} / ${r.active.glSubmitP95Ms}`, `${r.scrollWidth} / $ … [line shortened here: 900 characters; full line on GitHub]
const md = rows.map((r, i) => '| ' + r.join(' | ') + ' |' + (i === 0 ? '\n|' + r.map(() => '---').join('|') + '|' : '')).join('\n');
fs.writeFileSync(OUT + 'bench-table.md', md + '\n');
log('\n' + md);
log('written', OUT + 'bench.json');Build Proof
A JavaScript module in the testcode folder of GlobalGrid2050 that renders with WebGL. It is built from the load step (`load`).
renderglobalgrid2050 / testcode/202609142225/proof/build-proof.mjs · lines 1–89 of 89 · version 2026-09-14 22:25 · Not reached from any entry point (candidate for review)
- What it does
- It draws its content. Defines load. 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.
- 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 build-proof.json; command-line arguments. Out: JSON file build-proof.json; WebGL/WebGPU drawing.
- What it achieves
- Star Generator build proof: loads each lens headless at 1440 and 430, records console errors, `scrollWidth`, counts from the live page, and screenshots to proof/build- - .png. It writes `build-proof.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
- load
- Defines here
- load
- 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/build-proof.mjs:1-89 · blob 5771ca749625e65568ca0aaa9b4af14cb4ef0b99 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: experimental · users: none · canonical: unreached_review
// Star Generator build proof: loads each lens headless at 1440 and 430, records console errors, scrollWidth,
// counts from the live page, and screenshots to proof/build-<lens>-<width>.png. Run from anywhere:
// node C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/202609142225/proof/build-proof.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] || '8873', 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 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 report = { run_utc: new Date().toISOString(), base: BASE, loads: [] };
async function load(url, width, name, opts = {}) {
const page = await browser.newPage();
const mobile = width <= 600;
await page.setViewport({ width, height: mobile ? 900 : 900, deviceScaleFactor: 1, isMobile: mobile, hasTouch: mobile });
const errors = [], logs = [];
page.on('console', m => { if (m.type() === 'error' || m.type() === 'warning') errors.push(m.text()); else logs.push(m.text()); });
page.on('pageerror', e => errors.push('pageerror: ' + e.message));
page.on('requestfailed', r => errors.push('requestfailed: ' + r.url()));
const t0 = Date.now();
await page.goto(url, { waitUntil: 'networkidle0', timeout: 90000 });
await page.waitForFunction(() => document.getElementById('count') && /blocks on the table/.test(document.getElementById('count').textContent), { timeout: 60000 }).catch(() => errors.push('count sentence never appeared'));
await new Promise(r => setTimeout(r, opts.wait || 2500));
const facts = await page.evaluate(() => ({
title: document.title, url: location.search, count: document.getElementById('count').textContent, countTitle: document.getElementById('count').title,
scrollWidth: document.documentElement.scrollWidth, innerWidth: innerWidth, hint: document.getElementById('hint').textContent, trail: document.getElementById('trail').textContent,
legend: [...document.querySelectorAll('#legend .lg:not(.cat)')].map(b => ({ word: b.textContent.trim(), colour: b.querySelector('i').style.backgroundColor, off: b.classList.contains('off'), title: b.title })),
lensbar: [...document.querySelectorAll('#lensbar a')].map(a => a.textContent + (a.classList.contains('on') ? '*' : '')),
footer: document.getElementById('footer').textContent, tray: document.getElementById('tray').textContent, labels: [...document.querySelectorAll('#labels span')].filter(s => !s.hidden).length,
panelOpen: !document.getElementById('panel').hidden, panelHead: (document.querySelector('#panel .u-h') || {}).textContent || null,
webgl2: !!document.createElement('canvas').getContext('webgl2'), touch: navigator.maxTouchPoints,
tapTargets: [...document.querySelectorAll('#lensbar a, #panel-foot button, #tray .go, .u-search')].map(e => { const r = e.getBoundingClientRect(); return [Math.round(r.width), Math.round(r.height)]; }),
}));
await page.screenshot({ path: OUT + name + '.png', fullPage: false });
const rec = { name, url, width, ms: Date.now() - t0, errors, ...facts };
report.loads.push(rec); console.log(name, rec.scrollWidth, rec.errors.length ? rec.errors : 'no console errors', rec.panelHead || '');
return page;
}
for (const width of [1440, 430]) {
// home ring, then a journey through the six lenses with the same key, trail and recipe in the URL
let page = await load(BASE + '?lens=ring', width, `build-ring-${width}-home`);
// tap the first block by clicking its position through the page's own grid: use the search box instead (deterministic)
await page.type('.u-search', 'At'); await page.keyboard.press('Enter'); await new Promise(r => setTimeout(r, 1200));
const afterTap = await page.evaluate(() => ({ url: location.search, trail: document.getElementById('trail').textContent }));
report.loads.push({ name: `tap-first-block-${width}`, ...afterTap }); console.log('after search At:', afterTap);
await page.goBack(); await new Promise(r => setTimeout(r, 800));
const afterBack = await page.evaluate(() => ({ url: location.search, trail: document.getElementById('trail').textContent, panelOpen: !document.getElementById('panel').hidden }));
report.loads.push({ name: `back-${width}`, ...afterBack }); console.log('after Back:', afterBack);
await page.close();
const q = '&key=family:8285&trail=block:Ce,block:Pn,family:8285&recipe=block:Si,block:Vn,block:Ug,block:Ps,block:Dt,family:8285&data=202609141956';
for (const lens of LENSES) { const p = await load(BASE + `?lens=${lens}${q}`, width, `build-${lens}-${width}`, { wait: 3500 }); await p.close(); }
// lens switch keeps key, trail, recipe (click each tab in one page)
page = await load(BASE + `?lens=ring${q}`, width, `build-switch-${width}`, { wait: 2000 });
const switches = [];
for (const lens of LENSES.slice(1)) { await page.click(`#lensbar a:nth-child(${LENSES.indexOf(lens) + 1})`); await new Promise(r => setTimeout(r, 900)); switches.push(await page.evaluate(() => ({ url: location.search, scrollWidth: document.documentElement.scrollWidth, hint: document.getElementById('hint').textContent, edges: undefined }))); }
report.loads.push({ name: `switch-${width}`, switches }); console.log('switches', switches.map(s => s.url));
await page.screenshot({ path: OUT + `build-switch-${width}.png` });
await page.close();
}
// inbound grammars
for (const [name, q] of [['inbound-table', '?block=Cg'], ['inbound-code', '?family=2'], ['inbound-dashboard', '?graph=periodic-table&focus=Cg%20%C2%B7%20Cable%20trench%20geometry'], ['inbound-picker', '?blocks=Si,Vn'], ['inbound-hash', '#family=2'], ['inbound-unknown', '?lens=ring&key=block:Zz']]) { const p = await load(BASE + q, 1440, `build-${name}`, { wait: 1500 }); await p.close(); }
// compose: the tray, the recipe sheet, the hand-off URL, the recipe JSON (acceptance d, §10.4)
{
const page = await load(BASE + '?lens=table&recipe=block:Si,block:Vn,block:Ug,block:Ps,block:Dt,family:8285,line:17', 1440, 'build-compose-1440', { wait: 3500 });
const c = await page.evaluate(async () => { const S = window.__star; const j = await S.recipeJSON(); return { tray: document.getElementById('tray').textContent, handOff: S.handOffURL(), needs: S.needsOutside().length, keys: j.keys, blocks: j.blocks.map(b => `${b.symbol}@${(b.files[0] || {}).commit ? b.files[0].commit.slice(0, 7) : 'no pinned place'}`), families: j.families.map(f => `${f.n}:${f.p … [line shortened here: 581 characters; full line on GitHub]
await page.click('#tray .cnt'); await new Promise(r => setTimeout(r, 400));
c.sheet = await page.evaluate(() => document.getElementById('sheet').textContent.slice(0, 600));
await page.screenshot({ path: OUT + 'build-compose-sheet-1440.png' });
report.loads.push({ name: 'compose-1440', ...c }); console.log('compose', c);
// a category is not composable
await page.evaluate(() => window.__star.state.recipe.length);
await page.close();
// the picker renders the hand-off (public page, measured)
const pk = await browser.newPage(); await pk.setViewport({ width: 1440, height: 900 });
await pk.goto(c.handOff, { waitUntil: 'networkidle0', timeout: 60000 }); await new Promise(r => setTimeout(r, 2500));
const picker = await pk.evaluate(() => ({ url: location.href, title: document.title, text: document.body.innerText.slice(0, 400).replace(/\s+/g, ' '), symbols: ['Si', 'Vn', 'Ug', 'Ps', 'Dt'].map(s => document.body.innerText.includes(s)) }));
await pk.screenshot({ path: OUT + 'build-picker-handoff.png' }); await pk.close();
report.loads.push({ name: 'picker-handoff', ...picker }); console.log('picker', picker);
}
// GPU facts: all line instances resident once
{
const page = await load(BASE + '?lens=ring&key=block:Cg', 1440, 'build-gpu-facts', { wait: 4000 });
const g = await page.evaluate(() => { const S = window.__star; return { linesCount: S.G.linesCount, linesBytes: S.G.linesBytes, N: S.G.N, edgeCount: S.G.edgeCount, geomCount: S.G.geomCount, layoutMs: S.lens._layoutMs, packStats: S.core.packStats, randomStats: S.core.randomStats, entangledStats: S.core.entangledStats, dependsOn: S.core.dependsOnCount, countTitle: document.getElementById('count'). … [line shortened here: 454 characters; full line on GitHub]
report.loads.push({ name: 'gpu-facts', ...g }); console.log('gpu', g); await page.close();
}
await browser.close();
fs.writeFileSync(OUT + 'build-proof.json', JSON.stringify(report, null, 1));
console.log('written', OUT + 'build-proof.json');Coder Diag Overlay
A JavaScript module in the proof folder of GlobalGrid2050. It is built from the sleep step (`sleep`), the log step (`log`) and the drag step (`drag`).
interactionglobalgrid2050 / testcode/202609142225/proof/coder-diag-overlay.mjs · lines 1–49 of 49 · version 2026-09-14 22:25 · Not reached from any entry point (candidate for review)
- What it does
- Defines sleep, log, drag, st. 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.
- 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-diag-overlay.json.
- What it achieves
- Diagnosis: why does a finger drag over the table lens's tile overlay not scroll it at 430 px? It writes `coder-diag-overlay.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, log, drag, st
- Defines here
- sleep, log, drag, st
- 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-diag-overlay.mjs:1-49 · blob 609db695d0d27abfd5ca3029ac5f51437b60044d · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: experimental · users: none · canonical: unreached_review
// Diagnosis: why does a finger drag over the table lens's tile overlay not scroll it at 430 px?
// node C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/202609142225/proof/coder-diag-overlay.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: 60000 });
const page = await browser.newPage();
await page.setViewport({ width: 430, height: 900, deviceScaleFactor: 2, isMobile: true, hasTouch: true });
const out = { run_utc: new Date().toISOString(), tests: [] };
const log = (k, v) => { out.tests.push({ [k]: v }); console.log(k, JSON.stringify(v)); };
await page.goto(BASE + '?lens=table&recipe=family:511', { 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(1500);
await page.screenshot({ path: OUT + 'coder-diag-table-fresh.png' });
const env = await page.evaluate(() => { const st = document.getElementById('stage').getBoundingClientRect(); const e = document.elementFromPoint(215, st.top + st.height / 2); const ov = document.getElementById('overlay'); const cs = getComputedStyle(ov); return { innerW: innerWidth, innerH: innerHeight, scrollY, stage: [Math.round(st.top), Math.round(st.bottom)], hitMid: e ? e.tagName + '.' + e.cl … [line shortened here: 948 characters; full line on GitHub]
log('env', env);
// event counters
await page.evaluate(() => { window.__ev = {}; const c = n => e => { window.__ev[n] = (window.__ev[n] || 0) + 1; window.__ev[n + '_target'] = (e.target.className || e.target.id || e.target.tagName); }; const ov = document.getElementById('overlay'); for (const n of ['touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointercancel', 'scroll']) ov.addEven … [line shortened here: 633 characters; full line on GitHub]
const mid = env.stage[0] + (env.stage[1] - env.stage[0]) / 2;
async function drag(x0, y0, x1, y1, steps, dt) { 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(); }
const st = () => page.evaluate(() => ({ scrollTop: document.getElementById('overlay').scrollTop, ev: window.__ev, head: (document.querySelector('#panel .u-h') || {}).textContent || null, panelOpen: !document.getElementById('panel').hidden, url: location.search }));
// A: fast drag, 6 steps x 20 ms (as in the walk)
await page.evaluate(() => window.__ev = {});
await drag(215, env.stage[1] - 30, 215, env.stage[0] + 30, 6, 20); await sleep(500); log('A_fast_drag_6x20', await st());
// B: slow drag, 20 steps x 30 ms
await page.evaluate(() => window.__ev = {});
await drag(215, env.stage[1] - 30, 215, env.stage[0] + 30, 20, 30); await sleep(500); log('B_slow_drag_20x30', await st());
// C: drag starting in the gap between tiles / on a heading (x=20)
await page.evaluate(() => window.__ev = {});
const gap = await page.evaluate(() => { const st = document.getElementById('stage').getBoundingClientRect(); for (let y = st.top + 20; y < st.bottom - 20; y += 4) { const e = document.elementFromPoint(20, y); if (e && !e.closest('.tile') && e.closest('#overlay')) return { y, el: e.tagName + '.' + e.className }; } return null; });
log('C_gap_point', gap);
if (gap) { await drag(20, Math.min(gap.y + 300, env.stage[1] - 20), 20, gap.y, 12, 25); await sleep(500); log('C_drag_off_tile', await st()); }
// D: native CDP scroll gesture (what a real finger fling produces)
await page.evaluate(() => window.__ev = {});
const cdp = await page.createCDPSession();
await cdp.send('Input.synthesizeScrollGesture', { x: 215, y: Math.round(mid), yDistance: -400, gestureSourceType: 'touch', speed: 800 }); await sleep(800); log('D_cdp_synthesizeScrollGesture_touch', await st());
// E: tap a visible tile (do taps reach tiles at all?)
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; }); if (!x) return null; const r = x.getBoundingClientRect(); return { x: r.left + r.width / 2, y: r.top + r.height / 2, sym: x.querySele … [line shortened here: 428 characters; full line on GitHub]
if (t) { await page.evaluate(() => window.__ev = {}); await page.touchscreen.tap(t.x, t.y); await sleep(900); log('E_tap_tile_' + t.sym, await st()); }
// F: swipe right 90 px on that tile (documented compose gesture), fast
if (t) { await page.evaluate(() => window.__ev = {}); const pre = await st(); await drag(t.x - 30, t.y, t.x + 70, t.y, 6, 20); await sleep(700); const post = await st(); log('F_swipe_right_tile_' + t.sym, { before_url: pre.url, after_url: post.url, ev: post.ev, tray: await page.evaluate(() => document.getElementById('tray').textContent.trim()) }); }
// G: wheel (a mouse, for contrast — not touch)
await page.mouse.move(215, mid); await page.mouse.wheel({ deltaY: 400 }); await sleep(500); log('G_mouse_wheel', await st());
await page.screenshot({ path: OUT + 'coder-diag-table-after.png' });
await browser.close();
fs.writeFileSync(OUT + 'coder-diag-overlay.json', JSON.stringify(out, null, 1));Coder Side
A JavaScript module in the proof folder of GlobalGrid2050 that closes panel handle (`closePanelByHandle`).
renderglobalgrid2050 / testcode/202609142225/proof/coder-side.mjs · lines 1–60 of 60 · version 2026-09-14 22:25 · Not reached from any entry point (candidate for review)
- What it does
- Defines sleep, drag, closePanelByHandle. 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.
- 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-side.json.
- What it achieves
- It closes panel handle (`closePanelByHandle`) and is built from the sleep step (`sleep`) and the drag step (`drag`). Side tests for the mobile-coder critic: (A) a slow finger-scroll that starts on a tile — does the 450 ms press fire Measure / does a short one fire Navigate? It writes `coder-side.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, drag, closePanelByHandle
- Defines here
- sleep, drag, closePanelByHandle
- 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-side.mjs:1-60 · blob 5b1d55e99cc7ad035430b678b5d130b2bddb135e · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: experimental · users: none · canonical: unreached_review
// Side tests for the mobile-coder critic: (A) a slow finger-scroll that starts on a tile — does the 450 ms press
// fire Measure / does a short one fire Navigate? (B) what the panel's ✕ does to the journey trail. (C) the
// "Open in ▾" menu by touch. Touch only. node …/coder-side.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 page = await browser.newPage();
await page.setViewport({ width: 430, height: 900, deviceScaleFactor: 2, isMobile: true, hasTouch: true });
const out = { run_utc: new Date().toISOString(), tests: [] }; const log = (k, v) => { out.tests.push({ [k]: v }); console.log(k, JSON.stringify(v)); };
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(); }
const facts = () => page.evaluate(() => { const P = document.getElementById('panel'); return { panelOpen: !P.hidden, head: (P.querySelector('.u-h') || {}).textContent || null, url: location.search, trail: document.getElementById('trail').textContent, overlayTop: document.getElementById('overlay').scrollTop, scrollY: Math.round(scrollY), tray: document.getElementById('tray').textContent.trim(), sta … [line shortened here: 654 characters; full line on GitHub]
const tileInBand = () => 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('details'); }); if (!x) return … [line shortened here: 571 characters; full line on GitHub]
async function closePanelByHandle() { for (let k = 0; k < 2; k++) { const f = await facts(); if (!f.panelOpen) break; const h = await page.evaluate(() => { const b = document.getElementById('panel-handle').getBoundingClientRect(); return { x: b.left + b.width / 2, y: b.top + b.height / 2 }; }); await drag(h.x, h.y, h.x, h.y + 120, 8, 20); await sleep(400); } }
await page.goto(BASE + '?lens=table&key=family:511&trail=family:511&recipe=family:511,block:Vd', { 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(1500);
await closePanelByHandle();
let f = await facts(); log('start', f);
// bring tiles into the live band (swipe within y stage.top..436)
let t = await tileInBand();
for (let k = 0; k < 3 && !t; k++) { await drag(215, Math.min(f.panelBox[0], f.stage[1]) - 16, 215, f.stage[0] + 16, 6, 20); await sleep(450); t = await tileInBand(); }
log('tile_in_band', t);
// A1: slow scroll starting on the tile (12 steps x 60 ms ≈ 750 ms, 100 px up)
let before = await facts(); await drag(t.x, t.y, t.x, t.y - 100, 12, 60); await sleep(900); let after = await facts();
log('A1_slow_scroll_on_tile_' + t.sym, { overlay: [before.overlayTop, after.overlayTop], panel: [before.panelOpen, after.panelOpen], head: after.head, url: after.url, measureInUrl: /&m=/.test(after.url) });
await page.screenshot({ path: OUT + 'coder-10-slow-scroll.png' });
// A2: quick short scroll starting on a tile (6 x 20 ms, 40 px) — is it read as a tap?
await closePanelByHandle(); t = await tileInBand(); if (!t) { await drag(215, 420, 215, 100, 6, 20); await sleep(450); t = await tileInBand(); }
before = await facts(); await drag(t.x, t.y, t.x, t.y - 40, 6, 20); await sleep(900); after = await facts();
log('A2_quick_short_scroll_on_tile_' + t.sym, { overlay: [before.overlayTop, after.overlayTop], panel: [before.panelOpen, after.panelOpen], head: after.head, url: after.url });
// A3: long press (hold 700 ms, no move) on a tile — the documented Measure gesture
await closePanelByHandle(); t = await tileInBand(); if (!t) { await drag(215, 420, 215, 100, 6, 20); await sleep(450); t = await tileInBand(); }
before = await facts(); await page.touchscreen.touchStart(t.x, t.y); await sleep(700); await page.touchscreen.touchEnd(); await sleep(900); after = await facts();
log('A3_long_press_tile_' + t.sym, { panel: [before.panelOpen, after.panelOpen], head: after.head, url: after.url, measureInUrl: /&m=/.test(after.url) });
await page.screenshot({ path: OUT + 'coder-10b-long-press.png' });
// B: the ✕ in the panel foot
if (!(await facts()).panelOpen) { t = await tileInBand(); await page.touchscreen.tap(t.x, t.y); await sleep(800); }
before = await facts();
const xb = await page.evaluate(() => { const b = document.querySelector('#panel-foot button.x').getBoundingClientRect(); return { x: b.left + b.width / 2, y: b.top + b.height / 2, w: Math.round(b.width), h: Math.round(b.height), title: document.querySelector('#panel-foot button.x').title }; });
await page.touchscreen.tap(xb.x, xb.y); await sleep(700); after = await facts();
log('B_panel_x', { button: xb, trailBefore: before.trail, trailAfter: after.trail, urlBefore: before.url, urlAfter: after.url, panelAfter: after.panelOpen, trayAfter: after.tray });
await page.screenshot({ path: OUT + 'coder-11-after-x.png' });
// C: "Open in ▾" by touch: tap a tile, tap Open in, read the menu, tap "river"
t = await tileInBand(); if (!t) { await drag(215, 420, 215, 100, 6, 20); await sleep(450); t = await tileInBand(); }
await page.touchscreen.tap(t.x, t.y); await sleep(800);
const oi = await page.evaluate(() => { const b = [...document.querySelectorAll('#panel-foot .u-chip')].find(x => /Open in/.test(x.textContent)).getBoundingClientRect(); return { x: b.left + b.width / 2, y: b.top + b.height / 2, w: Math.round(b.width), h: Math.round(b.height) }; });
await page.touchscreen.tap(oi.x, oi.y); await sleep(400);
const menu = await page.evaluate(() => { const m = document.querySelector('#panel-foot .open-in .menu'); const r = m.getBoundingClientRect(); return { hidden: m.hidden, top: Math.round(r.top), bottom: Math.round(r.bottom), left: Math.round(r.left), right: Math.round(r.right), items: [...m.querySelectorAll('a')].map(a => { const b = a.getBoundingClientRect(); const e = document.elementFromPoint(b.l … [line shortened here: 582 characters; full line on GitHub]
log('C_open_in_menu', { button: oi, menu });
const riverItem = await page.evaluate(() => { const a = [...document.querySelectorAll('#panel-foot .open-in .menu a')].find(x => x.textContent === 'river'); const b = a.getBoundingClientRect(); return { x: b.left + b.width / 2, y: b.top + b.height / 2 }; });
await page.screenshot({ path: OUT + 'coder-12-open-in-menu.png' });
await page.touchscreen.tap(riverItem.x, riverItem.y); await sleep(1200); after = await facts();
log('C_open_in_river', { url: after.url, head: after.head, panelOpen: after.panelOpen, lens: await page.evaluate(() => (document.querySelector('#lensbar a.on') || {}).textContent) });
// D: swipe between lenses with two fingers? (GRAMMAR says pinch-scale ~1 and dx>60 switches lens) — not attempted: two-finger gestures are not part of this task.
await browser.close();
fs.writeFileSync(OUT + 'coder-side.json', JSON.stringify(out, null, 1));Coder Side2
A JavaScript module in the proof folder of GlobalGrid2050. It is built from the sleep step (`sleep`), the drag step (`drag`) and the facts step (`facts`).
renderglobalgrid2050 / testcode/202609142225/proof/coder-side2.mjs · lines 1–41 of 41 · version 2026-09-14 22:25 · Not reached from any entry point (candidate for review) · pattern facts (shared by 5 files)
- What it does
- Defines sleep, drag, facts. 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.
- 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-side2.json.
- What it achieves
- Long-press on a table tile by touch, with the overlay's fling settled first (the earlier attempt landed on a repo chip). It writes `coder-side2.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, drag, facts
- Defines here
- sleep, drag, facts
- 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-side2.mjs:1-41 · blob 03d82b04d463dd8543a10b5ac7beef4e0399bf53 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: experimental · users: none · canonical: unreached_review
// Long-press on a table tile by touch, with the overlay's fling settled first (the earlier attempt landed on a repo chip).
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 page = await browser.newPage(); await page.setViewport({ width: 430, height: 900, deviceScaleFactor: 2, isMobile: true, hasTouch: true });
const out = { run_utc: new Date().toISOString(), tests: [] }; const log = (k, v) => { out.tests.push({ [k]: v }); console.log(k, JSON.stringify(v)); };
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(); }
const facts = () => page.evaluate(() => { const P = document.getElementById('panel'); return { panelOpen: !P.hidden, tall: P.classList.contains('tall'), head: (P.querySelector('.u-h') || {}).textContent || null, url: location.search, overlayTop: document.getElementById('overlay').scrollTop, code: (P.querySelector('.u-code') || {}).textContent || null }; });
await page.goto(BASE + '?lens=table&recipe=family:511,block:Vd', { 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(1500);
let st = await page.evaluate(() => { const b = document.getElementById('stage').getBoundingClientRect(); const P = document.getElementById('panel').getBoundingClientRect(); return { top: Math.round(b.top), bottom: Math.round(b.bottom), panelBox: [Math.round(P.top), Math.round(P.bottom)], live: Math.round(Math.min(P.top, b.bottom, innerHeight)), scrollY: Math.round(scrollY) }; });
log('fresh_table_bands', { ...st, stageCoveredEntirely: st.top >= st.panelBox[0] });
// Q1: does a swipe up that starts on the closed panel's box scroll the page?
await drag(215, 700, 215, 300, 10, 30); await sleep(1200);
let q = await page.evaluate(() => ({ scrollY: Math.round(scrollY), overlayTop: document.getElementById('overlay').scrollTop, stageTop: Math.round(document.getElementById('stage').getBoundingClientRect().top) }));
log('Q1_swipe_on_dead_box_700to300', q);
// Q2: a swipe up that starts on the legend (above the box)
await drag(215, 400, 215, 100, 10, 30); await sleep(1200);
q = await page.evaluate(() => ({ scrollY: Math.round(scrollY), overlayTop: document.getElementById('overlay').scrollTop, stageTop: Math.round(document.getElementById('stage').getBoundingClientRect().top) }));
log('Q2_swipe_on_legend_400to100', q);
st = await page.evaluate(() => { const b = document.getElementById('stage').getBoundingClientRect(); const P = document.getElementById('panel').getBoundingClientRect(); return { top: Math.round(b.top), bottom: Math.round(b.bottom), panelBox: [Math.round(P.top), Math.round(P.bottom)], live: Math.round(Math.min(P.top, b.bottom, innerHeight)), scrollY: Math.round(scrollY) }; });
log('bands_after_page_swipes', st);
if (st.live - st.top > 60) { await drag(215, st.live - 16, 215, st.top + 16, 10, 30); await sleep(1500); } // let any fling settle
const t = await page.evaluate(() => { const s = document.getElementById('stage').getBoundingClientRect(); const P = document.getElementById('panel').getBoundingClientRect(); const x = [...document.querySelectorAll('.tile')].find(e => { const r = e.getBoundingClientRect(); return r.top > s.top + 10 && r.bottom < Math.min(s.bottom, P.top) - 10 && !e.closest('details'); }); if (!x) return null; const … [line shortened here: 698 characters; full line on GitHub]
log('tile', t);
const before = await facts();
await page.touchscreen.touchStart(t.x, t.y); await sleep(700); await page.touchscreen.touchEnd(); await sleep(1500);
let after = await facts();
log('A3_long_press_' + t.sym, { before: { panel: before.panelOpen, overlay: before.overlayTop }, after: { panel: after.panelOpen, tall: after.tall, head: after.head, url: after.url, measureInUrl: /&m=/.test(after.url), codeFetched: after.code ? after.code.slice(0, 80) : null } });
await page.screenshot({ path: OUT + 'coder-10b-long-press.png' });
// and a plain tap on the same tile for contrast (after closing the panel via handle)
for (let k = 0; k < 2; k++) { const f = await facts(); if (!f.panelOpen) break; const h = await page.evaluate(() => { const b = document.getElementById('panel-handle').getBoundingClientRect(); return { x: b.left + b.width / 2, y: b.top + b.height / 2 }; }); await drag(h.x, h.y, h.x, h.y + 120, 8, 20); await sleep(400); }
const t2 = await page.evaluate(() => { const s = document.getElementById('stage').getBoundingClientRect(); const P = document.getElementById('panel').getBoundingClientRect(); const x = [...document.querySelectorAll('.tile')].find(e => { const r = e.getBoundingClientRect(); return r.top > s.top + 10 && r.bottom < Math.min(s.bottom, P.top) - 10 && !e.closest('details'); }); if (!x) return null; cons … [line shortened here: 536 characters; full line on GitHub]
await page.touchscreen.tap(t2.x, t2.y); await sleep(1000); after = await facts();
log('tap_' + t2.sym, { panel: after.panelOpen, tall: after.tall, head: after.head, url: after.url, measureInUrl: /&m=/.test(after.url) });
await browser.close(); fs.writeFileSync(OUT + 'coder-side2.json', JSON.stringify(out, null, 1));Coder Walk2
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-walk2.mjs · lines 1–152 of 152 · 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-walk2.json.
- What it achieves
- Mobile-coder critic, round 1, pass 2: the same journey by touch, recovering the way a person would when the first pass got stuck (drag the panel handle down to see the table. It writes `coder-walk2.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-walk2.mjs:1-152 · blob 4956f2f19331280eefff5da39b1f4910b656f27f · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, storage · domain stage: experimental · users: none · canonical: duplicate_candidate
// Mobile-coder critic, round 1, pass 2: the same journey by touch, recovering the way a person would when the first
// pass got stuck (drag the panel handle down to see the table; scroll tiles and the recipe sheet with a finger).
// Also: a slow finger-scroll over tiles (does a press fire Measure?), and what the panel's ✕ does to the trail.
// node C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/202609142225/proof/coder-walk2.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 ARGS = ['--enable-gpu', '--use-gl=angle', '--use-angle=d3d11', '--ignore-gpu-blocklist', '--no-first-run'];
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: ARGS });
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, 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` }); }
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.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++; }
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) }; }; return { innerH: innerHeight, scrollY: Math.round(scrollY), stage: r('stage'), panel: r('panel'), panelTall: document.getElementById('pane … [line shortened here: 787 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 pnl = document.getElementById('panel'); const pr = pnl.hidden ? null : pnl.getBoundingClientRect(); const cx = r.left + … [line shortened here: 856 characters; full line on GitHub]
// -------- steps 1–5 (as pass 1; brief)
begin('01-05-replay');
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(1000);
await tapEl('.u-search', null, 'search box'); await page.keyboard.type('distance', { delay: 30 }); await sleep(600);
await tapEl('.u-hits button', '#511 distanceKm', 'first hit');
await page.waitForFunction(() => !document.getElementById('panel').hidden && !/Loading family/.test(document.getElementById('panel').textContent), { timeout: 30000 }); await sleep(500);
await tapEl('#panel-foot .u-chip', 'Measure', 'Measure');
await page.waitForFunction(() => { const c = document.querySelector('#panel .u-code'); return c && !/Fetching/.test(c.textContent); }, { timeout: 40000 }); await sleep(400);
{ 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); }
const codeBox = await page.evaluate(() => { const c = document.querySelector('#panel .u-code'); const ls = [...c.querySelectorAll('.u-line')]; return { scrollW: c.scrollWidth, clientW: c.clientWidth, longest: ls.map(l => ({ k: l.querySelector('.u-key').textContent, w: Math.round(l.getBoundingClientRect().width), sw: l.scrollWidth })).sort((a, b) => b.sw - a.sw)[0], keys: ls.map(l => l.querySelecto … [line shortened here: 431 characters; full line on GitHub]
note(`code box: scrollWidth ${codeBox.scrollW} vs clientWidth ${codeBox.clientW}; keys in order: ${codeBox.keys.join(', ')}; widest line key ${codeBox.longest.k} (${codeBox.longest.sw} px)`);
await tapEl('#panel-foot .u-chip', 'Add to recipe', 'Add to recipe (family)'); await sleep(400);
await tapEl('#lensbar a', 'table', 'table tab'); await sleep(1200);
let f = await facts(); note(`after table tab: panel tall=${f.panelTall} ${JSON.stringify(f.panel)} over stage ${JSON.stringify(f.stage)}; tray "${f.tray}"`);
note(`taps so far: ${taps}`);
// -------- step 6: see the table (the panel hides it), find Vd, add it
begin('06-shrink-panel');
const handle = await probe('#panel-handle');
note(`panel handle: ${handle.w}x${handle.h} at y ${handle.top}-${handle.bottom}, reach=${handle.reach} (${handle.hitDesc})`);
await drag(handle.x, handle.y, handle.x, handle.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)}; panel hidden=${f.panel === null}`);
await shot('06a-after-handle-drag-1');
if (f.panel) { const h2 = await probe('#panel-handle'); await drag(h2.x, h2.y, h2.x, h2.y + 120, 8, 20); await sleep(500); f = await facts(); note(`drag ${step.drags} handle down again: panel ${f.panel ? 'still open ' + JSON.stringify(f.panel) : 'closed'}; trail "${f.trail}"; url ${f.url}`); }
await shot('06b-after-handle-drag-2');
const vis = await page.evaluate(() => { const st = document.getElementById('stage').getBoundingClientRect(); const pnl = document.getElementById('panel'); const pr = pnl.hidden ? null : pnl.getBoundingClientRect(); const tiles = [...document.querySelectorAll('.tile')]; const v = tiles.filter(t => { const r = t.getBoundingClientRect(); return r.top >= st.top && r.bottom <= st.bottom && (!pr || r.bo … [line shortened here: 615 characters; full line on GitHub]
note(`tiles now visible and uncovered: ${vis.visible} (${vis.first.join(', ')}); stage y ${vis.stageTop}-${vis.stageBottom}, page scrollY ${vis.scrollY}`);
begin('06-scroll-to-Vd');
let vd = await vdInfo(); note(`Vd tile before scrolling: y ${vd.top}-${vd.bottom}, overlay scrollTop ${vd.scrollTop}`);
const headBefore = (await facts()).head;
for (let k = 0; k < 12 && !(vd.inStage && !vd.underPanel && vd.reach); k++) {
const st = await page.evaluate(() => { const b = document.getElementById('stage').getBoundingClientRect(); const pnl = document.getElementById('panel'); const pr = pnl.hidden ? null : pnl.getBoundingClientRect(); return { x: b.left + b.width / 2, top: Math.max(0, b.top), bottom: Math.min(pr ? pr.top : 1e9, b.bottom, innerHeight) }; });
await drag(st.x, st.bottom - 24, st.x, st.top + 24, 6, 20); await sleep(450);
vd = await vdInfo(); const ff = await facts();
note(`drag ${step.drags} (${Math.round(st.bottom - 24)}→${Math.round(st.top + 24)}): overlay scrollTop ${vd.scrollTop}; Vd y ${vd.top}-${vd.bottom} inStage=${vd.inStage} reach=${vd.reach}${ff.head !== headBefore ? ' · STRAY panel change → ' + ff.head : ''}`);
}
await shot('06c-Vd-in-view');
note(`Vd centre (${Math.round(vd.x)},${Math.round(vd.y)}) hit-test: ${vd.hit}`);
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 the Vd tile: tray "${f.tray}" → ${swiped ? 'ADDED by swipe' : 'not added by swipe'}; panel head "${f.head}"; overlay scrollTop ${f.overlayTop}`);
await shot('06d-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 at (${Math.round(vd.x)},${Math.round(vd.y)}) reach=${vd.reach}`);
await sleep(900); f = await facts(); note(`panel head "${f.head}" tall=${f.panelTall} ${JSON.stringify(f.panel)}; url ${f.url}; scrollY ${f.scrollY}`);
await shot('06e-Vd-panel');
const vdVisible = await vdInfo(); note(`Vd tile with its panel open: y ${vdVisible.top}-${vdVisible.bottom}, underPanel=${vdVisible.underPanel}`);
await tapEl('#panel-foot .u-chip', 'Add to recipe', 'Add to recipe (Vd)'); await sleep(500);
f = await facts();
}
note(`tray "${f.tray}" · recipe=${decodeURIComponent((f.url.match(/recipe=([^&]*)/) || [])[1] || '')}`);
const marks = await page.evaluate(() => ({ recipeTiles: [...document.querySelectorAll('.tile.recipe')].map(t => t.querySelector('b').textContent), trayChips: [...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: (docum … [line shortened here: 562 characters; full line on GitHub]
note(`tiles outlined as recipe: ${marks.recipeTiles.join(', ') || 'none'} · tray chips ${JSON.stringify(marks.trayChips)} · count "${marks.cnt}" at x ${marks.cntLeft}`);
await shot('06-Vd-added');
// -------- step 7: river
begin('07-river');
await tapEl('#lensbar a', 'river', 'river tab'); await sleep(1500);
f = await facts(); note(`lens ${f.lens}; tray "${f.tray}"; url ${f.url}; panel head "${f.head}" tall=${f.panelTall} ${JSON.stringify(f.panel)}`);
const rv = await page.evaluate(() => ({ labels: [...document.querySelectorAll('#labels span')].filter(s => !s.hidden).map(s => s.textContent), trayChips: [...document.querySelectorAll('#tray .rc')].map(c => c.textContent.replace('×', '').trim()), hint: document.getElementById('hint').textContent }));
note(`both in recipe: ${rv.trayChips.includes('#511') && rv.trayChips.includes('Vd')} (${rv.trayChips.join(' | ')}); labels on river: ${rv.labels.join(', ')}`);
await shot('07-river');
// -------- step 8: recipe sheet, scroll to the hand-off row
begin('08-sheet');
await tapEl('#tray .cnt', null, 'recipe count in the tray'); await sleep(600);
let sh = await page.evaluate(() => { const S = document.getElementById('sheet'); const b = S.getBoundingClientRect(); const row = [...S.querySelectorAll('.ch')].map(r => ({ text: r.textContent.trim(), parts: [...r.children].map(c => ({ t: c.textContent.trim().slice(0, 20), w: Math.round(c.getBoundingClientRect().width), h: Math.round(c.getBoundingClientRect().height) })) })); const ho = [...S.quer … [line shortened here: 897 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}" parts ${r.parts.map(p => `${p.t}(${p.w}x${p.h})`).join(' ')}`);
note(`hand-off buttons at y ${sh.buttons.map(b => `${b.t}@${b.top}`).join(', ')} (viewport 900) · needs "${(sh.needs || '').slice(0, 80)}" · pinned files ${sh.pinned}`);
note(`hand-off url shown: ${sh.handoff}`);
await shot('08a-sheet-top');
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); const st = await page … [line shortened here: 526 characters; full line on GitHub]
await shot('08b-sheet-scrolled');
// -------- step 9: hand off from the sheet
begin('09-handoff');
const nT = targets.length;
await tapEl('#sheet .row .u-chip', 'Hand off', 'Hand off in the sheet'); await sleep(2500);
let opened = targets.slice(nT); note(`new tabs: ${opened.map(t => t.url).join(' ; ') || 'none'}`);
if (!opened.length) { await tapEl('#tray .go', null, 'Hand off in the tray'); await sleep(2500); opened = targets.slice(nT); note(`new tabs: ${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; return { title: document.title, scrollWidth: document.documentElement.scrollWidth, hasVd: /\bVd\b/.test(T), hasSs … [line shortened here: 1,062 characters; full line on GitHub]
await shot('09-handoff');
// -------- side tests
begin('10-slow-scroll-on-tiles');
await page.evaluate(() => document.getElementById('sheet').hidden = true);
await tapEl('#lensbar a', 'table', 'table tab'); await sleep(1200);
f = await facts(); note(`panel on return to table: ${f.panel ? 'open tall=' + f.panelTall : 'closed'}; head "${f.head}"`);
if (f.panel) { const 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) { const h2 = await probe('#panel-handle'); await drag(h2.x, h2.y, h2.x, h2.y + 120, 8, 20); await sleep(400); f = await facts(); } note(`after handle drags: panel ${f.panel ? 'open' : 'closed'}`); }
const tile0 = await page.evaluate(() => { const st = document.getElementById('stage').getBoundingClientRect(); const t = [...document.querySelectorAll('.tile')].find(x => { const r = x.getBoundingClientRect(); return r.top > st.top + 10 && r.bottom < st.bottom - 10; }); if (!t) return null; const r = t.getBoundingClientRect(); return { x: r.left + r.width / 2, y: r.top + r.height / 2, sym: t.query … [line shortened here: 432 characters; full line on GitHub]
if (tile0) { const before = await facts(); await drag(tile0.x, tile0.y, tile0.x, tile0.y - 120, 12, 60); await sleep(900); const after = await facts(); note(`slow finger-scroll (~750 ms) starting on tile ${tile0.sym}: overlay scrollTop ${before.overlayTop}→${after.overlayTop}; panel ${before.panel ? 'open' : 'closed'}→${after.panel ? 'open head "' + after.head + '"' : 'closed'}; measure in url: ${ … [line shortened here: 472 characters; full line on GitHub]
begin('11-panel-x');
if (!(await facts()).panel) { 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.to … [line shortened here: 620 characters; full line on GitHub]
f = await facts(); note(`before ✕: trail "${f.trail}", url ${f.url}`);
await tapEl('#panel-foot button.x', null, '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}"`);
await shot('11-after-x');
report.totalTaps = taps;
await browser.close();
fs.writeFileSync(OUT + 'coder-walk2.json', JSON.stringify(report, null, 1));
console.log('\nwritten coder-walk2.json · total taps', taps, '· console', report.console.length ? report.console : 'clean');