In this section
- Gen2 render · globalgrid2050 / testcode/202609142202/proof/gen2.mjs lines 1–183
- Prng Check2 transform · globalgrid2050 / testcode/202609142202/proof/prng_check2.mjs lines 1–7
- Proof render · globalgrid2050 / testcode/202609142202/proof/proof.mjs lines 1–81
- Proof2 render · globalgrid2050 / testcode/202609142202/proof/proof2.mjs lines 1–150
- Publish Gen2 storage · globalgrid2050 / testcode/202609142202/proof/publish-gen2.mjs lines 1–22
- Review1 Check render · globalgrid2050 / testcode/202609142202/proof/review1_check.mjs lines 1–140
Gen2
A JavaScript module in the proof folder of GlobalGrid2050 that draws provenance and cables. It opens page (`openPage`), measures fps (`measureFps`) and labels report (`labelReport`).
renderglobalgrid2050 / testcode/202609142202/proof/gen2.mjs · lines 1–183 of 183 · version 2026-09-14 22:02 · Not reached from any entry point (candidate for review) · pattern measureFps (shared by 2 files)
- What it does
- It draws provenance and cables. Defines 13 functions or classes, including log, sleep, firstOutside, firstInside, openPage. 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.
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: cables.
- Inputs & outputs
- In: JSON file provenance.json. Out: JSON file gen2.json; WebGL/WebGPU drawing.
- What it achieves
- Generation 2 self-test. Serves the repo on 127.0.0.1:8875, drives headless Chrome (GPU flags), runs the round-2 checks, writes `proof/gen2.json`, `proof/gen2.stdout`.txt (via the caller's redirect), `proof/gen2-server.log` and three screenshots, then stops the server. It reads `/data/provenance.json` and writes `/proof/gen2.json`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609142202/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
- log, sleep, firstOutside, firstInside, openPage, hudLines, hudFind, consoleSummary, measureFps, search, labelReport, topAt
- Defines here
- log, sleep, firstOutside, firstInside, openPage, hudLines, hudFind, consoleSummary, measureFps, search, labelReport, topAt, handler
- 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/202609142202/proof/gen2.mjs:1-183 · blob a12fbad73766df72d05aa52454624ce05cd392f7 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, process · domain stage: experimental · users: none · canonical: unreached_review
// gen2.mjs — generation 2 self-test. Serves the repo on 127.0.0.1:8875, drives headless Chrome (GPU flags), runs the round-2 checks,
// writes proof/gen2.json, proof/gen2.stdout.txt (via the caller's redirect), proof/gen2-server.log and three screenshots, then stops the server.
// run: node C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/202609142202/proof/gen2.mjs
import { createRequire } from 'node:module';
import fs from 'node:fs';
import { spawn, execSync, execFileSync } 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 ROOT = 'C:/Users/vikra/Documents/GitHub/globalgrid2050';
const DIR = ROOT + '/testcode/202609142202';
const PORT = 8875;
const URL = `http://127.0.0.1:${PORT}/testcode/202609142202/index.html`;
const CHROME = 'C:/Program Files/Google/Chrome/Application/chrome.exe';
const R = { started_utc: new Date().toISOString(), port: PORT, url: URL };
const log = (...a) => console.log(...a);
const sleep = ms => new Promise(r => setTimeout(r, ms));
// ---- ground truth from disk ----
R.node_check = (() => { try { execFileSync('node', ['--check', DIR + '/quantum.js'], { stdio: 'pipe' }); return 'ok'; } catch (e) { return 'FAILED: ' + e.message; } })();
const prov = JSON.parse(fs.readFileSync(DIR + '/data/provenance.json', 'utf8'));
const linesBuf = fs.readFileSync(DIR + '/data/lines.bin'); const uniqBuf = fs.readFileSync(DIR + '/data/all-lines.bin'); const famBuf = fs.readFileSync(DIR + '/data/all-lines.family.bin');
const uniq = new Uint32Array(uniqBuf.buffer, uniqBuf.byteOffset, uniqBuf.length / 4);
let inFam = 0; for (const v of famBuf) inFam += v;
R.disk = { lines_bin_entries: linesBuf.length / 4, all_lines: uniq.length, in_a_family: inFam, outside: uniq.length - inFam, lines_md_generated_utc: prov.checks.lines_md_generated_utc };
const firstOutside = (() => { for (let i = 0; i < uniq.length; i++) if (!famBuf[i]) return uniq[i]; })();
const firstInside = (() => { for (let i = 0; i < uniq.length; i++) if (famBuf[i]) return uniq[i]; })();
const stamp = prov.checks.lines_md_generated_utc; const stampText = `${stamp.slice(0, 10)} ${stamp.slice(11, 16)} UTC`;
R.expected_count_line = `on GPU: ${uniq.length.toLocaleString('en-GB')} unique numbered lines (LINES.md ${stampText}) + ${(linesBuf.length / 4).toLocaleString('en-GB')} family-line entries · ${inFam.toLocaleString('en-GB')} unique lines sit inside a function family, ${(uniq.length - inFam).toLocaleString('en-GB')} do not`;
log('node --check:', R.node_check, '| disk:', JSON.stringify(R.disk));
// ---- static server ----
const serverLog = fs.openSync(DIR + '/proof/gen2-server.log', 'w');
const server = spawn('python', ['-m', 'http.server', String(PORT), '--bind', '127.0.0.1'], { cwd: ROOT, stdio: ['ignore', serverLog, serverLog] });
await sleep(1500);
let browser;
try {
browser = await puppeteer.launch({ executablePath: CHROME, headless: 'new', args: ['--enable-gpu', '--use-gl=angle', '--use-angle=d3d11', '--ignore-gpu-blocklist', '--no-first-run', '--no-default-browser-check'] });
R.chrome_version = await browser.version();
async function openPage(w, h, dpr, mobile) {
const page = await browser.newPage(); await page.setViewport({ width: w, height: h, deviceScaleFactor: dpr, isMobile: !!mobile, hasTouch: !!mobile });
const con = [], errs = [], external = [], failed = [];
page.on('console', m => con.push({ type: m.type(), text: m.text().slice(0, 300) }));
page.on('pageerror', e => errs.push(String(e && e.message || e).slice(0, 300)));
page.on('requestfailed', r => failed.push(r.url() + ' ' + (r.failure() && r.failure().errorText)));
page.on('request', r => { const u = r.url(); if (!u.startsWith(`http://127.0.0.1:${PORT}/`)) external.push(u); });
const t0 = Date.now(); await page.goto(URL, { waitUntil: 'load' });
await page.waitForFunction(() => window.__qts && window.__qts.S && window.__qts.S.seaDrawn > 0 && window.__qts.S.uniqDrawn > 0, { timeout: 60000 });
return { page, con, errs, external, failed, readyMs: Date.now() - t0 };
}
const hudLines = p => p.evaluate(() => Array.from(document.querySelectorAll('#hud div')).map(d => d.textContent));
const hudFind = async (p, re) => (await hudLines(p)).find(l => re.test(l)) || null;
const consoleSummary = P => ({ all: P.con.length, errors: P.con.filter(c => c.type === 'error'), warnings: P.con.filter(c => c.type === 'warning' || c.type === 'warn'), pageerrors: P.errs.slice(), requestfailed: P.failed.slice(), external_requests: P.external.slice() });
const measureFps = p => p.evaluate(() => new Promise(res => { let n = 0; const t0 = performance.now(); const f = t => { n++; if (t - t0 < 3000) requestAnimationFrame(f); else res({ frames: n, ms: +(t - t0).toFixed(1), fps: +((n - 1) * 1000 / (t - t0)).toFixed(1) }); }; requestAnimationFrame(f); }));
const state = p => p.evaluate(() => { const S = window.__qts.S; return { atom: S.atom ? { n: S.atom.n, name: S.atom.name, valence: S.atom.valence, tunnelling: S.atom.tunnelling } : null, famIdx: S.famIdx, key: S.key, lastQuery: S.lastQuery, measurements: S.measurements.length, outcome: S.outcome, msg: S.msg, hold: S.hold, seaDrawn: S.seaDrawn, uniqDrawn: S.uniqDrawn, seaBytes: S.seaBytes, uniqBy … [line shortened here: 512 characters; full line on GitHub]
const search = async (p, q) => { await p.evaluate(() => { const s = document.querySelector('#search'); s.value = ''; s.focus(); }); await p.type('#search', q); await p.keyboard.press('Enter'); await sleep(200); };
const labelReport = p => p.evaluate(() => {
const cv = document.querySelector('#gl').getBoundingClientRect();
const boxes = Array.from(document.querySelectorAll('#labels .lb')).map(l => { const b = l.getBoundingClientRect(); return { text: l.textContent.slice(0, 40), l: b.left, t: b.top, r: b.right, b: b.bottom }; });
const overlaps = []; for (let i = 0; i < boxes.length; i++) for (let j = i + 1; j < boxes.length; j++) { const a = boxes[i], c = boxes[j]; if (a.l < c.r - 1 && c.l < a.r - 1 && a.t < c.b - 1 && c.t < a.b - 1) overlaps.push([a.text, c.text]); }
const outside = boxes.filter(b => b.l < cv.left - 2 || b.r > cv.right + 2 || b.t < cv.top - 2 || b.b > cv.bottom + 2).map(b => b.text);
return { labels: boxes.length, overlaps, outside, canvas: { w: Math.round(cv.width), h: Math.round(cv.height) } };
});
// =================== DESKTOP 1440x1000 ===================
{
const P = await openPage(1440, 1000, 1, false); const page = P.page; const d = R.desktop = { readyMs: P.readyMs };
d.renderer_page_S = await page.evaluate(() => window.__qts.S.renderer);
d.renderer_fresh_context = await page.evaluate(() => { const c = document.createElement('canvas'); const gl = c.getContext('webgl2'); if (!gl) return 'no webgl2'; const x = gl.getExtension('WEBGL_debug_renderer_info'); return x ? gl.getParameter(x.UNMASKED_RENDERER_WEBGL) : 'ext missing: ' + gl.getParameter(gl.RENDERER); });
await sleep(3000);
const hl = await hudLines(page);
d.hud_count_lines = hl.slice(1, 4); d.hud_count_line_matches_disk = hl[1] === R.expected_count_line;
d.state_line = hl.find(l => l.startsWith('state:')); d.born_line = hl.find(l => l.startsWith('last measurement (Born audit):')); d.caveats_line = hl.find(l => l.startsWith('data caveats:'));
d.count_div = await page.evaluate(() => document.querySelector('#count').textContent);
d.fps_3s = await measureFps(page); d.scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth);
d.state0 = await state(page); d.labels = await labelReport(page);
log('desktop: renderer', d.renderer_page_S); log('HUD count line:', hl[1]); log('HUD line 2:', hl[2]); log('matches disk:', d.hud_count_line_matches_disk); log('fps 3 s:', JSON.stringify(d.fps_3s), 'scrollWidth', d.scrollWidth, 'draw calls', d.state0.lastDrawCalls, 'VBO', d.state0.seaBytes, '+', d.state0.uniqBytes); log('desktop labels:', JSON.stringify(d.labels));
// wording checks: no bare TUNNEL outside the valence-gated sentence; P(away) on the state line; the pole prints no φ number after a collapse (checked later)
d.wording = { state_has_P_away: /P\(away\)/.test(d.state_line), hud_lines_with_TUNNEL: hl.filter(l => /TUNNEL/.test(l)).map(l => l.slice(0, 160)), caveats_has_tunnelling_counts: /atoms with a tunnelling bond \(valence ≥ 1\): 106\/500 · valence 0: 394\/500/.test(d.caveats_line), caveats_has_theta_source: /θ from the shell counts recorded for this atom in electron\/atoms\.json \(star-maker @c5bf … [line shortened here: 812 characters; full line on GitHub]
// ---- Enter after a no-match must not measure (adversarial review finding) ----
const m0 = (await state(page)).measurements;
await search(page, '#999999999'); const s1 = await state(page); await page.keyboard.press('Enter'); await sleep(300); const s2 = await state(page);
d.enter_after_no_match = { msg_after_search: s1.msg, lastQuery_after_no_match: s1.lastQuery, measurements_before: m0, after_second_enter: s2.measurements, measured: s2.measurements !== m0, pass: s2.measurements === m0 && s1.lastQuery === '' };
log('Enter after no-match:', JSON.stringify(d.enter_after_no_match));
// ---- unique-line search: outside-family and inside-family lines ----
await search(page, `line ${firstOutside}`); const so = await state(page); const lp = await page.evaluate(() => { const b = document.querySelector('#lines'); return b.hidden ? null : b.textContent.slice(0, 300); });
await search(page, `#${firstInside}`); const sk = await state(page); // a bare number that is also a family key steers to the family and points at "line N"
await search(page, `line ${firstInside}`); const si = await state(page);
d.unique_line_key_clash = { n: firstInside, msg: sk.msg, family_won: sk.famIdx >= 0 && sk.key === 0, hint_present: /type "line \d+" for the line/.test(sk.msg || '') };
d.unique_line_search = { outside: { n: firstOutside, key: so.key, famIdx: so.famIdx, msg: so.msg, lines_panel: lp, pass: so.key === firstOutside && so.famIdx === -1 && /outside every function family/.test(so.msg) }, inside: { n: firstInside, key: si.key, famIdx: si.famIdx, msg: si.msg, pass: si.key === firstInside && si.famIdx >= 0 && /inside a function family/.test(si.msg) } };
log('unique-line search:', JSON.stringify(d.unique_line_search));
// ---- click on a point steers only ----
{ const geo = await page.evaluate(() => { const { G, DPR } = window.__qts; const r = document.querySelector('#gl').getBoundingClientRect(); return { cx: r.x + G.c0[0] / DPR, cy: r.y + G.c0[1] / DPR, R: G.R / DPR, canvas: { x: r.x, y: r.y, w: r.width, h: r.height } }; });
const topAt = (x, y) => page.evaluate((x, y) => { const e = document.elementFromPoint(x, y); return e ? e.id || e.className || e.tagName : null; }, x, y);
const bornBefore = await hudFind(page, /^last measurement/); let hit = null, tries = 0;
for (let k = 0; k < 120 && !hit; k++) { const ang = (k * 2.399963) % (2 * Math.PI); const rad = geo.R * (0.72 + 0.26 * ((k * 0.618034) % 1)); const x = Math.round(geo.cx + Math.cos(ang) * rad), y = Math.round(geo.cy + Math.sin(ang) * rad); if ((await topAt(x, y)) !== 'gl') continue; tries++; await page.mouse.click(x, y); await sleep(120); const st = await state(page); if (/^(twin star: )?#\d … [line shortened here: 512 characters; full line on GitHub]
const bornAfter = await hudFind(page, /^last measurement/);
d.click_steers_only = { tries, hit, born_before: bornBefore, born_after: bornAfter, click_alone_measured: bornBefore !== bornAfter, pass: !!hit && bornBefore === bornAfter }; log('click steers only:', JSON.stringify({ tries, hit: !!hit, measured: d.click_steers_only.click_alone_measured })); }
// ---- measurable family by name, Enter again measures; Born prefix; φ at the pole ----
await search(page, 'renderTable'); const sr = await state(page); await page.keyboard.press('Enter'); await sleep(400); const sr2 = await state(page); const hl2 = await hudLines(page);
d.search_then_measure = { atom: sr.atom, famIdx: sr.famIdx, measurements_before: sr.measurements, after: sr2.measurements, outcome: sr2.outcome, born: hl2.find(l => l.startsWith('last measurement (Born audit):')), state: hl2.find(l => l.startsWith('state:')), pole_phi_hidden: /φ — \(global phase at the pole, not a state parameter\)/.test(hl2.find(l => l.startsWith('state:')) || ''), phi_wordin … [line shortened here: 597 characters; full line on GitHub]
log('search renderTable + Enter:', JSON.stringify({ atom: sr.atom, measured: d.search_then_measure.pass, pole_phi_hidden: d.search_then_measure.pole_phi_hidden, phi: d.search_then_measure.phi_wording })); log('Born:', d.search_then_measure.born);
// repeat on the collapsed state: certain derived from P
await page.click('#measure'); await sleep(200); d.repeat_line = await hudFind(page, /^last measurement/);
// ---- bare Enter guard: with #hold focused Enter must not measure; with body focused it must ----
await page.click('#reprepare'); await sleep(100); const mA = (await state(page)).measurements;
await page.focus('#hold'); await page.keyboard.press('Enter'); await sleep(200); const sB = await state(page);
await page.focus('#hold'); await page.keyboard.press('Enter'); await sleep(100); // toggle hold back
await page.evaluate(() => { document.activeElement && document.activeElement.blur(); }); await page.keyboard.press('Enter'); await sleep(300); const sC = await state(page);
d.bare_enter = { with_hold_focused: { measurements_before: mA, after: sB.measurements, hold_toggled: sB.hold, measured: sB.measurements !== mA }, with_body_focused: { after: sC.measurements, measured: sC.measurements === sB.measurements + 1 }, pass: sB.measurements === mA && sC.measurements === sB.measurements + 1 };
log('bare Enter:', JSON.stringify(d.bare_enter));
// ---- SOUL tier wording (#766 via search) ----
await page.click('#reprepare'); await sleep(100); await search(page, '#766'); d.soul_tier_line = await hudFind(page, /^twin tier:/);
// ---- forged bucket (answered locally with ACAO): the record must not be used ----
{ await search(page, 'renderTable'); await sleep(100); d.external_requests_before_forged_test = P.external.length;
const intercepted = []; await page.setRequestInterception(true);
const handler = req => { const u = req.url(); if (u.startsWith('http://127.0.0.1')) return req.continue();
if (/\/code\/f\/\d+\.json/.test(u)) { intercepted.push({ url: u, answered: 'locally with a forged bucket' }); const fam = window_fam; return req.respond({ status: 200, headers: { 'Access-Control-Allow-Origin': '*' }, contentType: 'application/json', body: JSON.stringify({ [String(fam)]: { n: fam, names: ['renderTable'], lines: [1, 2, 3], repos: ['forged-a', 'forged-b', 'forged-c'], places: … [line shortened here: 543 characters; full line on GitHub]
if (/raw\.githubusercontent\.com/.test(u)) { intercepted.push({ url: u, answered: 'locally with dummy text' }); return req.respond({ status: 200, headers: { 'Access-Control-Allow-Origin': '*' }, contentType: 'text/plain', body: 'DUMMY 1\nDUMMY 2\nDUMMY 3' }); }
intercepted.push({ url: u, answered: 'ABORTED' }); return req.abort(); };
const window_fam = await page.evaluate(() => window.__qts.D.families[window.__qts.S.famIdx].n);
page.on('request', handler);
await page.click('#cable'); await sleep(100); await page.click('#measure'); await sleep(2500);
const cableLine = await hudFind(page, /^cable/); const liveRec = await page.evaluate(() => window.__qts.S.liveRec);
let lineText = null; const btn = await page.$('#lines button.u-chip'); if (btn) { await btn.click(); await sleep(2000); lineText = await page.evaluate(() => ({ note: (document.querySelector('#lines .u-code .u-muted') || {}).textContent || null, linesShown: document.querySelectorAll('#lines .u-line').length, anyDummy: Array.from(document.querySelectorAll('#lines .u-line')).some(l => /DUMMY/.t … [line shortened here: 426 characters; full line on GitHub]
d.forged_bucket = { family: window_fam, cable_line: cableLine, liveRec_null: liveRec === null, line_text: lineText, intercepted, raw_fetch_attempted: intercepted.some(i => /raw\.githubusercontent/.test(i.url)), pass: /record not used, nothing fetched further/.test(cableLine || '') && liveRec === null && !(lineText && lineText.anyDummy) && !intercepted.some(i => /raw\.githubusercontent/.test( … [line shortened here: 410 characters; full line on GitHub]
await page.click('#cable'); await sleep(100); page.off('request', handler); await page.setRequestInterception(false);
log('forged bucket:', JSON.stringify({ pass: d.forged_bucket.pass, cable: (cableLine || '').slice(0, 200), liveRec_null: d.forged_bucket.liveRec_null, lineText })); }
// ---- context loss and restore ----
{ const e0 = P.errs.length + P.con.filter(c => c.type === 'error').length;
const lost = await page.evaluate(async () => { const gl = window.__qts.gl; const ext = gl.getExtension('WEBGL_lose_context'); window.__loseExt = ext; ext.loseContext(); await new Promise(r => setTimeout(r, 1500)); const t = Array.from(document.querySelectorAll('#hud div')).map(d => d.textContent); const S = window.__qts.S; return { isContextLost: gl.isContextLost(), S_contextLost: S.contextL … [line shortened here: 672 characters; full line on GitHub]
const restored = await page.evaluate(async () => { window.__loseExt.restoreContext(); await new Promise(r => setTimeout(r, 2500)); const gl = window.__qts.gl; const { S, G, B } = window.__qts; gl.bindBuffer(gl.ARRAY_BUFFER, B.sea); const sz = gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE); gl.bindBuffer(gl.ARRAY_BUFFER, B.uniq); const usz = gl.getBufferParameter(gl.ARRAY_BUFFER, gl.B … [line shortened here: 1,113 characters; full line on GitHub]
restored.context_line = await hudFind(page, /^context:/);
d.context_loss = { lost, restored, errors_during: P.errs.length + P.con.filter(c => c.type === 'error').length - e0, pass: lost.isContextLost && lost.S_contextLost && lost.seaDrawn === 0 && !!lost.hud_lost_line && !lost.hud_on_gpu_line_present && !restored.isContextLost && restored.seaDrawn === R.disk.lines_bin_entries && restored.uniqDrawn === R.disk.all_lines && restored.litPixelsAroundSph … [line shortened here: 469 characters; full line on GitHub]
log('context loss:', JSON.stringify({ pass: d.context_loss.pass, lost_line: lost.hud_lost_line, restored_lit: restored.litPixelsAroundSphere64x64, restored_line_ok: restored.hud_on_gpu_line === R.expected_count_line, context_line: restored.context_line, journeyN: restored.journeyN, errors: d.context_loss.errors_during })); }
// ---- prove it: in-memory hashes of both binaries vs provenance ----
await page.click('#prove'); await sleep(1500); d.prove_line = await hudFind(page, /^prove it:/); d.prove_both_match = /lines\.bin in memory\) \w+ vs provenance \w+ \(match\)[^]*all-lines\.bin in memory\) \w+ vs provenance \w+ \(match\)/.test(d.prove_line || '');
// final console tally, screenshot
d.console = consoleSummary(P); d.console_error_count = d.console.errors.length + d.console.pageerrors.length;
await page.click('#reprepare'); await sleep(200); await page.evaluate(() => window.scrollTo(0, 0)); await page.screenshot({ path: DIR + '/proof/gen2-1440.png' });
log('desktop console:', JSON.stringify({ all: d.console.all, errors: d.console.errors.length, warnings: d.console.warnings.length, pageerrors: d.console.pageerrors.length, external: d.console.external_requests.length }));
await page.close();
}
// =================== PHONE 430x900 (DPR 1, touch) then rotation to 900x430 ===================
{
const P = await openPage(430, 900, 1, true); const page = P.page; const d = R.phone = { readyMs: P.readyMs };
await sleep(3000); const hl = await hudLines(page);
d.hud_count_lines = hl.slice(1, 4); d.hud_count_line_matches_disk = hl[1] === R.expected_count_line;
d.fps_3s = await measureFps(page); d.scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); d.bodyScrollWidth = await page.evaluate(() => document.body.scrollWidth);
d.state0 = await state(page); d.hud_position = await page.evaluate(() => getComputedStyle(document.querySelector('#hud')).position);
d.labels = await labelReport(page); d.geometry = await page.evaluate(() => { const { G, DPR } = window.__qts; return { c0css: G.c0.map(v => Math.round(v / DPR)), c1css: G.c1.map(v => Math.round(v / DPR)), Rcss: Math.round(G.R / DPR), sphereRcss: Math.round(G.sphereR / DPR), phone: G.phone }; });
d.phone_hud_atom_line = hl.find(l => l.startsWith('atom:')) || null; d.phone_hud_bands_line = hl.find(l => l.startsWith('bands:')) || null;
d.controls_in_width = await page.evaluate(() => Array.from(document.querySelectorAll('#bar button, #bar input, #legend button, #legend select')).every(b => { const r = b.getBoundingClientRect(); return r.left >= 0 && r.right <= 430.5; }));
log('phone 430: count line ok', d.hud_count_line_matches_disk, 'fps', JSON.stringify(d.fps_3s), 'scrollWidth', d.scrollWidth, 'labels', JSON.stringify(d.labels), 'geometry', JSON.stringify(d.geometry));
await page.evaluate(() => { const r = document.querySelector('#stage').getBoundingClientRect(); window.scrollTo(0, r.top + window.scrollY - 4); }); await sleep(300);
await page.screenshot({ path: DIR + '/proof/gen2-430.png' });
d.console = consoleSummary(P); d.console_error_count = d.console.errors.length + d.console.pageerrors.length;
// rotate
await page.setViewport({ width: 900, height: 430, deviceScaleFactor: 1, isMobile: true, hasTouch: true }); await sleep(1500);
const hr = await hudLines(page); const dl = R.landscape = {};
dl.hud_count_lines = hr.slice(1, 4); dl.hud_count_line_matches_disk = hr[1] === R.expected_count_line;
dl.state = await state(page); dl.hud_position = await page.evaluate(() => getComputedStyle(document.querySelector('#hud')).position);
dl.geometry = await page.evaluate(() => { const { G, DPR } = window.__qts; const cv = document.querySelector('#gl').getBoundingClientRect(); return { canvasCss: { w: Math.round(cv.width), h: Math.round(cv.height) }, c0css: G.c0.map(v => Math.round(v / DPR)), c1css: G.c1.map(v => Math.round(v / DPR)), Rcss: Math.round(G.R / DPR), sphereRcss: Math.round(G.sphereR / DPR), phone: G.phone, phoneMed … [line shortened here: 453 characters; full line on GitHub]
dl.labels = await labelReport(page); dl.scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth); dl.fps_3s = await measureFps(page);
dl.sphere_handle_inside_canvas = await page.evaluate(() => { const h = document.querySelector('#sphereHandle').getBoundingClientRect(), c = document.querySelector('#gl').getBoundingClientRect(); return h.top >= c.top - 1 && h.bottom <= c.bottom + 1 && h.left >= c.left - 1 && h.right <= c.right + 1; });
dl.rotation_live = dl.geometry.phone === false && dl.state.phone === false && dl.hud_position === 'absolute' && dl.labels.outside.length === 0 && dl.sphere_handle_inside_canvas;
log('rotated 900x430: live', dl.rotation_live, 'geometry', JSON.stringify(dl.geometry), 'labels', JSON.stringify(dl.labels), 'scrollWidth', dl.scrollWidth, 'fps', JSON.stringify(dl.fps_3s));
await page.evaluate(() => { const r = document.querySelector('#stage').getBoundingClientRect(); window.scrollTo(0, r.top + window.scrollY - 4); }); await sleep(300);
await page.screenshot({ path: DIR + '/proof/gen2-900x430.png' });
dl.console = consoleSummary(P); dl.console_error_count = dl.console.errors.length + dl.console.pageerrors.length;
await page.close();
}
} catch (e) { R.error = e.stack || String(e); log('ERROR', R.error); }
if (browser) await browser.close();
try { execSync(`taskkill /PID ${server.pid} /T /F`, { stdio: 'ignore' }); } catch (e) { R.server_kill_error = e.message; }
await sleep(800);
try { const ns = execSync('netstat -ano', { encoding: 'utf8' }); R.port_still_listening = ns.split('\n').some(l => l.includes(`127.0.0.1:${PORT}`) && l.includes('LISTENING')); } catch (e) { R.port_check_error = e.message; }
R.finished_utc = new Date().toISOString();
const passes = { node_check: R.node_check === 'ok', desktop_count_line: R.desktop && R.desktop.hud_count_line_matches_disk, desktop_no_console_errors: R.desktop && R.desktop.console_error_count === 0, enter_after_no_match: R.desktop && R.desktop.enter_after_no_match.pass, unique_line_search: R.desktop && R.desktop.unique_line_search.outside.pass && R.desktop.unique_line_search.inside.pass, click_s … [line shortened here: 1,362 characters; full line on GitHub]
R.passes = passes; R.pass = Object.values(passes).every(Boolean);
fs.writeFileSync(DIR + '/proof/gen2.json', JSON.stringify(R, null, 1));
log('PASSES', JSON.stringify(passes)); log('PASS', R.pass, 'port still listening:', R.port_still_listening);
process.exitCode = R.pass ? 0 : 1; // the exit status follows the JSON pass flag so a CI caller cannot mistake a written report for a passed onePrng Check2
A JavaScript module in the proof folder of GlobalGrid2050. It is built from the hash32 step (`hash32`) and the mulberry32 step (`mulberry32`).
transformglobalgrid2050 / testcode/202609142202/proof/prng_check2.mjs · lines 1–7 of 7 · version 2026-09-14 22:02 · Not reached from any entry point (candidate for review) · pattern mulberry (shared by 65 files)
- What it does
- It calculates its inputs. Defines hash32, mulberry32.
- 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.
- What it achieves
- PRNG check for the page's Born draw: r = first output of mulberry32(FNV-1a(`seedString`|soul|count)), exactly as `quantum.js` does it.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609142202/proof · JavaScript module
- Uses
- none found
- Used by
- none found
- Produces
- hash32, mulberry32
- Defines here
- hash32, mulberry32
- 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/202609142202/proof/prng_check2.mjs:1-7 · blob 711d8112622adac3a478d53d78963eb984b5cc03 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: transform · effects: none found · domain stage: experimental · users: none · canonical: unreached_review
// PRNG check for the page's Born draw: r = first output of mulberry32(FNV-1a(seedString|soul|count)), exactly as quantum.js does it.
// Measures P(r < 1/3) over 20,000 consecutive counts for three souls (expected 0.3333) and prints it; nothing else.
function hash32(str) { let h = 0x811c9dc5 >>> 0; for (let i = 0; i < str.length; i++) { h ^= str.charCodeAt(i); h = Math.imul(h, 0x01000193) >>> 0; } return h >>> 0; }
function mulberry32(a) { return function () { a |= 0; a = a + 0x6D2B79F5 | 0; let t = Math.imul(a ^ a >>> 15, 1 | a); t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t; return ((t ^ t >>> 14) >>> 0) / 4294967296; }; }
const out = {};
for (const soul of [2039, 766, 6554]) { let lt = 0; const N = 20000; for (let c = 0; c < N; c++) if (mulberry32(hash32('2026-09-14|' + soul + '|' + c))() < 1 / 3) lt++; out[soul] = { counts: N, p_r_lt_one_third: +(lt / N).toFixed(4) }; }
console.log(JSON.stringify(out));Proof
A JavaScript module in the testcode folder of GlobalGrid2050. It is built from the run step (`run`).
renderglobalgrid2050 / testcode/202609142202/proof/proof.mjs · lines 1–81 of 81 · version 2026-09-14 22:02 · Not reached from any entry point (candidate for review)
- What it does
- It lists and searches its content. Defines run. 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
- Out: JSON file report.json.
- What it achieves
- Headless-Chrome proof for testcode/ (puppeteer-core by absolute path, GPU flags as instructed). It writes `report.json`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609142202/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
- run
- Defines here
- run
- 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/202609142202/proof/proof.mjs:1-81 · blob 9729bb4cf6e173b925edef569ded495dac4ede5f · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: experimental · users: none · canonical: unreached_review
// Headless-Chrome proof for testcode/202609142202 (puppeteer-core by absolute path, GPU flags as instructed).
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.env.PORT || '8862';
const URL = `http://127.0.0.1:${PORT}/testcode/202609142202/index.html`;
const OUT = 'C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/202609142202/proof/';
const browser = await puppeteer.launch({
headless: 'new', executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
args: ['--enable-gpu', '--use-gl=angle', '--use-angle=d3d11', '--ignore-gpu-blocklist', '--enable-unsafe-webgpu', '--no-sandbox', '--window-size=1440,1000']
});
const report = { url: URL, runs: [] };
async function run(width, height, name, interact) {
const page = await browser.newPage();
const errors = [], logs = [];
page.on('console', m => { const t = m.type(); if (t === 'error' || t === 'warning') errors.push(t + ': ' + 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() + ' ' + (r.failure() || {}).errorText));
await page.setViewport({ width, height, deviceScaleFactor: 1, isMobile: width < 768, hasTouch: width < 768 });
const t0 = Date.now();
await page.goto(URL, { waitUntil: 'networkidle0', timeout: 120000 });
await new Promise(r => setTimeout(r, 5000));
const r = {};
r.name = name; r.width = width; r.height = height; r.loadMs = Date.now() - t0;
r.scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth);
r.bodyScrollWidth = await page.evaluate(() => document.body.scrollWidth);
r.hud = await page.evaluate(() => Array.from(document.querySelectorAll('#hud div')).map(d => d.textContent));
r.count = await page.evaluate(() => document.querySelector('#count').textContent);
r.fail = await page.evaluate(() => Array.from(document.querySelectorAll('.u-fail')).map(d => d.textContent));
r.labels = await page.evaluate(() => document.querySelectorAll('#labels .lb').length);
if (interact) {
// prove it
await page.click('#prove'); await new Promise(r => setTimeout(r, 1500));
r.prove = await page.evaluate(() => Array.from(document.querySelectorAll('#hud div')).map(d => d.textContent).find(t => t.startsWith('prove it')));
// search steers, then measures
await page.type('#search', '#80299'); await page.keyboard.press('Enter'); await new Promise(r => setTimeout(r, 600));
r.searchSteer = await page.evaluate(() => Array.from(document.querySelectorAll('#hud div')).map(d => d.textContent).filter(t => /^family|^line|^join|^state/.test(t)));
// steer to the conductor "Number" by name (family #6076 joined to soul #2039), then Enter again measures
await page.evaluate(() => { document.querySelector('#search').value = ''; }); await page.click('#search'); await page.type('#search', 'Number'); await page.keyboard.press('Enter'); await new Promise(r => setTimeout(r, 300));
r.steerName = await page.evaluate(() => Array.from(document.querySelectorAll('#hud div')).map(d => d.textContent).filter(t => /^\d+ famil|^join|^state/.test(t)));
await page.keyboard.press('Enter'); await new Promise(r => setTimeout(r, 2500));
r.afterMeasure = await page.evaluate(() => Array.from(document.querySelectorAll('#hud div')).map(d => d.textContent).filter(t => /^Born|^twin|^state|^re-prepare|^cable|^join|^earlier/.test(t)));
r.record = await page.evaluate(() => document.querySelector('#record').textContent);
r.stateDotAfterCollapse = await page.evaluate(() => { const S = window.__qts.S; return { outcome: S.outcome, collapseT: S.collapseT, theta: S.theta, litRepo: S.litRepo, twinChosen: S.twin.chosen && S.twin.chosen.label }; });
// 25 measurements for the histogram
for (let i = 0; i < 25; i++) { await page.click('#measure'); await new Promise(r => setTimeout(r, 40)); }
await new Promise(r => setTimeout(r, 1200));
r.histogram = await page.evaluate(() => Array.from(document.querySelectorAll('#hud div')).map(d => d.textContent).find(t => t.startsWith('histogram')));
r.journeyVertices = await page.evaluate(() => window.__qts.S.measurements.length);
// pick: click the sea at the focused family's own position (computed from the page's layout, not guessed)
const pt = await page.evaluate(() => { const { S, G, familyPos, DPR } = window.__qts; const p = familyPos(S.famIdx); const c = document.querySelector('#gl').getBoundingClientRect(); return { x: c.left + (G.c0[0] + p[0] * G.R) / DPR, y: c.top + (G.c0[1] + p[1] * G.R) / DPR }; });
await page.evaluate(() => { document.querySelector('#hud').style.pointerEvents = 'none'; }); // the HUD overlay must not swallow the proof's tap
await page.mouse.click(pt.x, pt.y); await new Promise(r => setTimeout(r, 500));
r.pickPoint = pt;
r.pick =await page.evaluate(() => Array.from(document.querySelectorAll('#hud div')).map(d => d.textContent).find(t => /^#\d+ · family|tap hit no entry|pick framebuffer/.test(t)));
// drag on the sphere: theta/phi by hand, normalisation stays 1
const sh = await page.evaluate(() => { const r = document.querySelector('#sphereHandle').getBoundingClientRect(); return { x: r.left + r.width / 2, y: r.top + r.height / 2 }; });
await page.mouse.move(sh.x, sh.y); await page.mouse.down(); await page.mouse.move(sh.x + 30, sh.y - 25, { steps: 8 }); await new Promise(r => setTimeout(r, 300));
r.handState = await page.evaluate(() => Array.from(document.querySelectorAll('#hud div')).map(d => d.textContent).find(t => t.startsWith('state')));
await page.mouse.up(); await new Promise(r => setTimeout(r, 2300));
r.relaxedState = await page.evaluate(() => Array.from(document.querySelectorAll('#hud div')).map(d => d.textContent).find(t => t.startsWith('state')));
// arrow key walks the conduction band
await page.keyboard.press('ArrowRight'); await new Promise(r => setTimeout(r, 300));
r.band = await page.evaluate(() => Array.from(document.querySelectorAll('#hud div')).map(d => d.textContent).find(t => t.startsWith('conduction band')));
r.gpuBuffer = await page.evaluate(() => ({ seaBytes: window.__qts.S.seaBytes, seaDrawn: window.__qts.S.seaDrawn, stride: window.__qts.S.seaStride }));
r.fpsAfter = await page.evaluate(() => Array.from(document.querySelectorAll('#hud div')).map(d => d.textContent).find(t => t.startsWith('fps')));
// line text fetch (classical)
const btn = await page.$('#lines button.u-chip'); if (btn) { await btn.click(); await new Promise(r => setTimeout(r, 6000)); r.lineText = await page.evaluate(() => { const n = document.querySelector('#lines .u-code .u-muted'); const l = document.querySelectorAll('#lines .u-line'); return { note: n ? n.textContent : null, lines: l.length, first: l[0] ? l[0].textContent.slice(0, 120) : null }; } … [line shortened here: 404 characters; full line on GitHub]
}
await page.screenshot({ path: OUT + name + '.png', fullPage: false });
r.errors = errors; r.logs = logs.slice(0, 20);
report.runs.push(r); await page.close();
}
try {
await run(1440, 1000, 'build-1440', true);
await run(430, 900, 'build-430', false);
} catch (e) { report.error = e.stack; }
await browser.close();
fs.writeFileSync(OUT + 'report.json', JSON.stringify(report, null, 1));
console.log(JSON.stringify(report, null, 1));Proof2
A JavaScript module in the testcode folder of GlobalGrid2050 that draws report2 and cables, using haversine and SHA-256.
renderglobalgrid2050 / testcode/202609142202/proof/proof2.mjs · lines 1–150 of 150 · version 2026-09-14 22:02 · Not reached from any entry point (candidate for review) · pattern elecProbe (shared by 2 files)
- What it does
- It draws report2 and cables. Defines 9 functions or classes, including sleep, newPage, hud, hudFind, st. 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.
- Why it exists in the grid workflow
- Domain stage experimental (path word 'testcode'): work its own path marks as experimental (sandbox, prototype, archive or similar words); by this evidence it is not part of a production workflow. Domain terms in the code: cables.
- Inputs & outputs
- Out: JSON file report2.json; WebGL/WebGPU drawing.
- What it achieves
- It is built from the sleep step (`sleep`), the new page helper (`newPage`) and the hud step (`hud`). Repair-round proof for testcode/ (puppeteer-core by absolute path, GPU flags as instructed). It writes `report2.json`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609142202/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, newPage, hud, hudFind, st, elecProbe, annuli, clickMeasure, reprepareAndMeasure
- Defines here
- sleep, newPage, hud, hudFind, st, elecProbe, annuli, clickMeasure, reprepareAndMeasure
- 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/202609142202/proof/proof2.mjs:1-150 · blob 2e703aa73368674ed898da2b501805b689324adb · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, process · domain stage: experimental · users: none · canonical: unreached_review
// Repair-round proof for testcode/202609142202 (puppeteer-core by absolute path, GPU flags as instructed).
// Starts its own python http.server on PORT from the repository root, stops it with taskkill /T /F, checks the port is free.
// Every non-127.0.0.1 request is LOGGED (not blocked) so the count of external requests is measured, not claimed.
import { createRequire } from 'node:module';
import fs from 'node:fs';
import { spawn, execSync } 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.env.PORT || '8863';
const ROOT = 'C:/Users/vikra/Documents/GitHub/globalgrid2050';
const URL = `http://127.0.0.1:${PORT}/testcode/202609142202/index.html`;
const OUT = 'C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/202609142202/proof/';
const sleep = ms => new Promise(r => setTimeout(r, ms));
const R = { url: URL, started_utc: new Date().toISOString() };
const server = spawn('python', ['-m', 'http.server', PORT, '--bind', '127.0.0.1'], { cwd: ROOT, stdio: ['ignore', fs.openSync(OUT + 'server2.log', 'w'), fs.openSync(OUT + 'server2.log', 'a')] });
await sleep(1500);
const browser = await puppeteer.launch({
headless: 'new', executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
args: ['--enable-gpu', '--use-gl=angle', '--use-angle=d3d11', '--ignore-gpu-blocklist', '--enable-unsafe-webgpu', '--no-sandbox', '--window-size=1440,1000']
});
async function newPage(w, h, dpr, mobile) {
const page = await browser.newPage(); const ext = [], errors = [];
page.on('request', req => { const u = req.url(); if (!u.startsWith('http://127.0.0.1')) ext.push({ url: u, t: Date.now() }); });
page.on('pageerror', e => errors.push('pageerror: ' + e.message));
page.on('console', m => { const t = m.type(); if (t === 'error' || t === 'warning') errors.push(t + ': ' + m.text()); });
page.on('requestfailed', r => errors.push('requestfailed: ' + r.url() + ' ' + (r.failure() || {}).errorText));
await page.setViewport({ width: w, height: h, deviceScaleFactor: dpr, isMobile: mobile, hasTouch: mobile });
return { page, ext, errors };
}
const hud = page => page.evaluate(() => Array.from(document.querySelectorAll('#hud div')).map(d => d.textContent));
const hudFind = async (page, re) => (await hud(page)).find(t => re.test(t)) || null;
const st = page => page.evaluate(() => { const S = window.__qts.S; return { theta: S.theta, dataTheta: S.dataTheta, outcome: S.outcome, measuredTheta: S.measuredTheta, litRepo: S.litRepo, chosen: S.twin && S.twin.chosen && S.twin.chosen.label, hand: S.hand, cableOn: !!S.cableOn }; });
// electron draw: hook drawArraysInstanced and record the first 512-vertex call's arguments and uniforms
const elecProbe = () => new Promise(res => {
const gl = document.querySelector('#gl').getContext('webgl2'); const orig = gl.drawArraysInstanced; let done = false;
gl.drawArraysInstanced = function (mode, first, count, inst) {
if (!done && count === 512) { done = true; const prog = gl.getParameter(gl.CURRENT_PROGRAM); const counts = gl.getUniform(prog, gl.getUniformLocation(prog, 'u_counts')); const stride = gl.getUniform(prog, gl.getUniformLocation(prog, 'u_stride')); gl.drawArraysInstanced = orig; res({ draw: { mode, first, count, instanceCount: inst }, u_counts_KLM: Array.from(counts), u_stride: stride }); }
return orig.call(gl, mode, first, count, inst);
};
setTimeout(() => { if (!done) { gl.drawArraysInstanced = orig; res({ error: 'no 512-vertex instanced draw seen in 2 s' }); } }, 2000);
});
// bright pixels in the K/L/M annuli around the sphere centre (drawing buffer preserved)
const annuli = () => {
const { G } = window.__qts; const gl = document.querySelector('#gl').getContext('webgl2'); const r = G.sphereR; const cx = G.c0[0], cy = G.c0[1];
const half = Math.ceil(r * 1.4); const x0 = Math.round(cx - half), y0 = Math.round(G.H - cy - half); const w = 2 * half, h = 2 * half;
const px = new Uint8Array(w * h * 4); gl.readPixels(x0, y0, w, h, gl.RGBA, gl.UNSIGNED_BYTE, px);
const bands = { K_0p50_0p60: [0.50, 0.60], L_0p80_0p90: [0.80, 0.90], M_1p20_1p30: [1.20, 1.30] }; const out = {};
for (const [k, [a, b]] of Object.entries(bands)) { let n = 0; for (let j = 0; j < h; j++) for (let i = 0; i < w; i++) { const dx = (x0 + i) - cx, dy = (G.H - (y0 + j)) - cy; const d = Math.hypot(dx, dy) / r; if (d >= a && d < b) { const o = (j * w + i) * 4; if (Math.max(px[o], px[o + 1], px[o + 2]) > 70) n++; } } out[k] = n; }
return { sphereR_px: r, bright: out };
};
const clickMeasure = async (page, n = 1, gap = 60) => { for (let i = 0; i < n; i++) { await page.click('#measure'); await sleep(gap); } };
const reprepareAndMeasure = async (page, n) => { const outs = []; for (let i = 0; i < n; i++) { await page.click('#reprepare'); await sleep(30); await page.click('#measure'); await sleep(30); outs.push(await page.evaluate(() => window.__qts.S.outcome)); } return outs; };
try {
// ---------------- desktop 1440×1000 ----------------
const { page, ext, errors } = await newPage(1440, 1000, 1, false);
const t0 = Date.now(); await page.goto(URL, { waitUntil: 'networkidle0', timeout: 120000 }); await sleep(5000);
const d = R.desktop = { loadMs: Date.now() - t0 };
d.hud = await hud(page); d.renderer = d.hud.find(t => t.startsWith('renderer')); d.count = await page.evaluate(() => document.querySelector('#count').textContent);
d.fps5s = d.hud.find(t => t.startsWith('fps')); d.onGPU = d.hud.find(t => t.startsWith('on GPU'));
d.scrollWidth = await page.evaluate(() => document.documentElement.scrollWidth);
d.externalRequestsDuringLoad = ext.map(e => e.url);
d.gpu = await page.evaluate(() => ({ seaBytes: window.__qts.S.seaBytes, seaDrawn: window.__qts.S.seaDrawn, stride: window.__qts.S.seaStride, drawCalls: window.__qts.S.lastDrawCalls }));
d.defaultFocus = await page.evaluate(() => window.__qts.S.msg);
d.footer = await page.evaluate(() => document.querySelector('#foot').textContent);
// electron shells: #2039 (K0 L40 M20) then band → #6554 (K0 L0 M60)
d.elec_2039 = { atom: await page.evaluate(() => { const a = window.__qts.S.atom; return { n: a.n, name: a.name, shells: a.shells }; }), draw: await page.evaluate(elecProbe), annuli: await page.evaluate(annuli) };
await page.click('body'); await page.keyboard.press('ArrowRight'); await sleep(600);
d.elec_6554 = { atom: await page.evaluate(() => { const a = window.__qts.S.atom; return { n: a.n, name: a.name, shells: a.shells }; }), draw: await page.evaluate(elecProbe), annuli: await page.evaluate(annuli) };
await page.keyboard.press('ArrowLeft'); await sleep(300);
// no-atom baseline for the annuli: steer to family #80299 (haversine, no electron record)
await page.click('#search'); await page.type('#search', '#80299'); await page.keyboard.press('Enter'); await sleep(500);
d.search80299 = { msg: await page.evaluate(() => window.__qts.S.msg), state: await hudFind(page, /^state/) };
d.annuli_noAtom = await page.evaluate(annuli);
await page.keyboard.press('Enter'); await sleep(300); d.search80299.secondEnter = await page.evaluate(() => window.__qts.S.msg);
// back to Number and measure with the cable OFF: external requests must stay at 0
await page.evaluate(() => { document.querySelector('#search').value = ''; }); await page.click('#search'); await page.type('#search', 'Number'); await page.keyboard.press('Enter'); await sleep(300);
const extBefore = ext.length; await page.keyboard.press('Enter'); await sleep(1500);
d.measure1 = { born: await hudFind(page, /^Born/), state: await hudFind(page, /^state/), twin: await hudFind(page, /^twin/), cable: await hudFind(page, /^cable/), S: await st(page), externalRequests: ext.length - extBefore };
// 12 repeat clicks inside the window: outcomes must all equal the first, histogram must not count them
const first = d.measure1.S.outcome; const reps = []; for (let i = 0; i < 12; i++) { await page.click('#measure'); await sleep(40); reps.push(await page.evaluate(() => window.__qts.S.outcome)); }
d.repeats = { first, outcomes: reps, allSame: reps.every(o => o === first), born: await hudFind(page, /^Born/), state: await hudFind(page, /^state/), hist: await page.evaluate(() => Object.fromEntries(window.__qts.S.hist)), externalRequests: ext.length - extBefore };
// 25 × (re-prepare + measure): histogram on prepared states only
const outs = await reprepareAndMeasure(page, 25); await sleep(600);
d.histogram = { outcomes: outs, line: await hudFind(page, /^histogram/), hist: await page.evaluate(() => Object.fromEntries(window.__qts.S.hist)), externalRequests: ext.length - extBefore, recordChips: await page.evaluate(() => document.querySelectorAll('#record button').length) };
// lit repo after a TUNNEL: Born line names it, and one repo dot in the atomDots buffer carries the lit colour (1, .45, .2)
let tries = 0; while ((await page.evaluate(() => window.__qts.S.outcome)) !== 1 && tries++ < 40) { await page.click('#reprepare'); await sleep(20); await page.click('#measure'); await sleep(20); }
d.litRepo = { S: await st(page), born: await hudFind(page, /^Born/), litDotsInBuffer: await page.evaluate(() => { const gl = document.querySelector('#gl').getContext('webgl2'); const { B } = window.__qts; gl.bindBuffer(gl.ARRAY_BUFFER, B.atomDots); const out = new Float32Array(64 * 8); gl.getBufferSubData(gl.ARRAY_BUFFER, 0, out); let n = 0; for (let i = 0; i < B.atomDotsN; i++) if (Math.abs(out … [line shortened here: 526 characters; full line on GitHub]
// hand-prepared measurement: state line must agree with the Born line
await page.click('#reprepare'); await sleep(100); await page.evaluate(() => { window.__qts.S.hand = { theta: 2.6, phi: 1.0 }; }); await page.click('#measure'); await sleep(300);
d.handMeasure = { state: await hudFind(page, /^state/), born: await hudFind(page, /^Born/), S: await st(page) };
// resize while collapsed keeps the chosen twin
d.resizeAfterCollapse = { before: await st(page) }; await page.setViewport({ width: 1300, height: 900, deviceScaleFactor: 1 }); await sleep(500); d.resizeAfterCollapse.after = await st(page); await page.setViewport({ width: 1440, height: 1000, deviceScaleFactor: 1 }); await sleep(500);
// cable ON: exactly one external request for the first measurement of this bucket, none for the second; sha256 line printed
await page.click('#reprepare'); await sleep(100); await page.click('#cable'); await sleep(100); const extC = ext.length;
await page.click('#measure'); await sleep(4000);
d.cableOn = { firstMeasurement: { cable: await hudFind(page, /^cable/), externalRequests: ext.slice(extC).map(e => e.url) } };
await page.click('#reprepare'); await sleep(100); const extC2 = ext.length; await page.click('#measure'); await sleep(1500);
d.cableOn.secondMeasurement = { cable: await hudFind(page, /^cable/), externalRequests: ext.slice(extC2).map(e => e.url) };
await page.click('#cable'); await sleep(100); // off again
// line text on demand (raw.githubusercontent at the pinned commit)
const extL = ext.length; const btn = await page.$('#lines button.u-chip'); if (btn) { await btn.click(); await sleep(6000); d.lineText = { note: await page.evaluate(() => { const n = document.querySelector('#lines .u-code .u-muted'); return n ? n.textContent : null; }), lines: await page.evaluate(() => document.querySelectorAll('#lines .u-line').length), first: await page.evaluate(() => { const … [line shortened here: 551 characters; full line on GitHub]
// SOUL tier: #766 geometry (band index 3); 8 × re-prepare + measure, chosen twin per outcome
await page.click('body'); await page.evaluate(() => { const { D, S } = window.__qts; S.bandPos = D.band.indexOf(766) - 1; }); await page.keyboard.press('ArrowRight'); await sleep(400);
d.soul = { atom: await page.evaluate(() => { const a = window.__qts.S.atom; return { n: a.n, name: a.name, shells: a.shells }; }), tier: await hudFind(page, /^twin/), runs: [] };
for (let i = 0; i < 8; i++) { await page.click('#reprepare'); await sleep(30); await page.evaluate(() => { window.__qts.S.hand = { theta: Math.PI / 2, phi: 0 }; }); await page.click('#measure'); await sleep(80); d.soul.runs.push({ outcome: await page.evaluate(() => window.__qts.S.outcome), chosen: await page.evaluate(() => window.__qts.S.twin.chosen && window.__qts.S.twin.chosen.label), note: aw … [line shortened here: 454 characters; full line on GitHub]
// pick on the twin star at the mirrored focused-family position
await page.click('#reprepare'); await sleep(200);
await page.evaluate(() => { document.querySelector('#hud').style.pointerEvents = 'none'; }); // the HUD overlay must not swallow the proof's taps
const pt = await page.evaluate(() => { const { S, G, familyPos, DPR } = window.__qts; const p = familyPos(S.famIdx); const c = document.querySelector('#gl').getBoundingClientRect(); return { x: c.left + (G.c1[0] - p[0] * G.R) / DPR, y: c.top + (G.c1[1] - p[1] * G.R) / DPR, famIdx: S.famIdx }; });
await page.mouse.click(pt.x, pt.y); await sleep(400); d.twinPick = { point: pt, msg: await page.evaluate(() => window.__qts.S.msg) };
const pp = await page.evaluate(() => { const { S, G, familyPos, DPR } = window.__qts; const p = familyPos(S.famIdx); const c = document.querySelector('#gl').getBoundingClientRect(); return { x: c.left + (G.c0[0] + p[0] * G.R) / DPR, y: c.top + (G.c0[1] + p[1] * G.R) / DPR }; });
await page.mouse.click(pp.x, pp.y); await sleep(400); d.principalPick = { point: pp, msg: await page.evaluate(() => window.__qts.S.msg) };
await page.evaluate(() => { document.querySelector('#hud').style.pointerEvents = ''; });
// labels vs HUD overlap on desktop
d.labelOverlap = await page.evaluate(() => { const h = document.querySelector('#hud').getBoundingClientRect(); return Array.from(document.querySelectorAll('#labels .lb')).map(l => { const b = l.getBoundingClientRect(); const ov = !(b.right < h.left || b.left > h.right || b.bottom < h.top || b.top > h.bottom); return { text: l.textContent.slice(0, 32), overlapsHUD: ov }; }).filter(x => x.overlaps … [line shortened here: 409 characters; full line on GitHub]
// prove it
await page.click('#prove'); await sleep(1500); d.prove = await hudFind(page, /^prove it/);
d.fpsEnd = await hudFind(page, /^fps/); d.externalHosts = [...new Set(ext.map(e => new globalThis.URL(e.url).host))]; d.externalRequestsTotal = ext.length;
// back to the default focus for the screenshot
await page.evaluate(() => { document.querySelector('#search').value = ''; }); await page.click('#search'); await page.type('#search', 'Number'); await page.keyboard.press('Enter'); await sleep(800);
await page.screenshot({ path: OUT + 'build-1440.png' });
d.errors = errors; await page.close();
// ---------------- phone 430×900 DPR 1 (screenshot) and DPR 2 touch ----------------
for (const [dpr, name] of [[1, 'build-430'], [2, 'build-430-dpr2']]) {
const P = await newPage(430, 900, dpr, true); const pg = P.page;
await pg.goto(URL, { waitUntil: 'networkidle0', timeout: 120000 }); await sleep(5000);
const m = R[name] = {};
m.scrollWidth = await pg.evaluate(() => document.documentElement.scrollWidth); m.bodyScrollWidth = await pg.evaluate(() => document.body.scrollWidth);
m.hud = await hud(pg); m.fps = m.hud.find(t => t.startsWith('fps')); m.onGPU = m.hud.find(t => t.startsWith('on GPU'));
m.gpu = await pg.evaluate(() => ({ seaBytes: window.__qts.S.seaBytes, seaDrawn: window.__qts.S.seaDrawn, stride: window.__qts.S.seaStride, drawCalls: window.__qts.S.lastDrawCalls, DPR: window.__qts.DPR, canvas: [document.querySelector('#gl').width, document.querySelector('#gl').height], phoneMode: window.__qts.S.phoneMode }));
m.layout = await pg.evaluate(() => { const r = s => { const b = document.querySelector(s).getBoundingClientRect(); return { l: Math.round(b.left), t: Math.round(b.top), w: Math.round(b.width), h: Math.round(b.height) }; }; return { stage: r('#stage'), canvas: r('#gl'), hud: r('#hud'), hudPosition: getComputedStyle(document.querySelector('#hud')).position, sphereHandle: r('#sphereHandle') }; }) … [line shortened here: 401 characters; full line on GitHub]
m.labelOverlap = await pg.evaluate(() => { const h = document.querySelector('#hud').getBoundingClientRect(); return Array.from(document.querySelectorAll('#labels .lb')).map(l => { const b = l.getBoundingClientRect(); return { text: l.textContent.slice(0, 32), overlapsHUD: !(b.right < h.left || b.left > h.right || b.bottom < h.top || b.top > h.bottom) }; }).filter(x => x.overlapsHUD); });
m.controlsInViewportWidth = await pg.evaluate(() => Array.from(document.querySelectorAll('#bar button, #bar input')).every(b => { const r = b.getBoundingClientRect(); return r.left >= 0 && r.right <= 430; }));
try { const sh = m.layout.sphereHandle; await pg.touchscreen.tap(sh.l + sh.w / 2, sh.t + sh.h / 2); await sleep(400); m.touchTapSphere = { born: await hudFind(pg, /^Born/) }; } catch (e) { m.touchTapSphere = { error: e.message }; }
await sleep(1500); m.fpsAfter = await hudFind(pg, /^fps/);
await pg.screenshot({ path: OUT + name + '.png' });
m.externalRequests = P.ext.map(e => e.url); m.errors = P.errors; await pg.close();
}
} catch (e) { R.error = e.stack; }
await browser.close();
// stop the server and check the port
try { execSync(`taskkill /PID ${server.pid} /T /F`, { stdio: 'ignore' }); } catch (e) { R.serverKillError = e.message; }
await sleep(800);
try { const ns = execSync('netstat -ano', { encoding: 'utf8' }); R.portStillListening = ns.split('\n').some(l => l.includes(`127.0.0.1:${PORT}`) && l.includes('LISTENING')); } catch (e) { R.portCheckError = e.message; }
R.finished_utc = new Date().toISOString();
fs.writeFileSync(OUT + 'report2.json', JSON.stringify(R, null, 1));
console.log(JSON.stringify(R, null, 1));Publish Gen2
A JavaScript module in the proof folder of GlobalGrid2050 that reads publication and provenance, using SHA-256.
storageglobalgrid2050 / testcode/202609142202/proof/publish-gen2.mjs · lines 1–22 of 22 · version 2026-09-14 22:02 · Not reached from any entry point (candidate for review)
- What it does
- It loads publication and provenance. Uses libraries node:crypto, node:fs, node:path. 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 publication.json; JSON file provenance.json; JSON file gen2.json. Out: JSON file publication.json.
- What it achieves
- Writes `publication.json`: bytes and sha256 of every shipped file in the folder (recursively), .log files excluded, `publication.json` itself excluded (it cannot carry its own hash). It reads `/publication.json` and writes `/publication.json`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609142202/proof · JavaScript module
- Uses
- node:crypto, node:fs, node:path
- 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/202609142202/proof/publish-gen2.mjs:1-22 · blob 30ad0010c4ade38cf0d36d84c7fc2e2ab0e664e1 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: filesystem · domain stage: experimental · users: none · canonical: unreached_review
// publish-gen2.mjs — writes publication.json: bytes and sha256 of every shipped file in the folder (recursively), .log files excluded,
// publication.json itself excluded (it cannot carry its own hash). Run after the self-test so the proof files are final.
import { createHash } from 'node:crypto';
import fs from 'node:fs';
import path from 'node:path';
const DIR = 'C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/202609142202';
const files = {};
const walk = d => { for (const e of fs.readdirSync(d, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) { const p = path.join(d, e.name); if (e.isDirectory()) walk(p); else { const rel = path.relative(DIR, p).split(path.sep).join('/'); if (rel === 'publication.json' || rel.endsWith('.log')) continue; const b = fs.readFileSync(p); files[rel] = { bytes: b.length, sha256: createH … [line shortened here: 447 characters; full line on GitHub]
walk(DIR);
const prev = JSON.parse(fs.readFileSync(DIR + '/publication.json', 'utf8'));
const pub = {
stamp: prev.stamp, name: prev.name,
generation: 'generation 2: round-2 findings fixed; all 250,174 unique lines added',
previous_generation: { generation: prev.generation, published_utc: prev.published_utc },
published_utc: new Date().toISOString().replace(/\.\d{3}Z$/, '+00:00'),
data_provenance: 'data/provenance.json',
self_test: 'proof/gen2.mjs → proof/gen2.json',
files,
note: 'Every shipped file with bytes and sha256; logs are not shipped. Numbers on the page come from data/ only: 250,174 unique numbered lines (LINES.md 2026-09-14 19:56 UTC; 128,369 inside a function family, 121,805 not) and 664,940 family-line entries (128,369 distinct numbered lines) in the published buckets; index.json states 250,174.'
};
fs.writeFileSync(DIR + '/publication.json', JSON.stringify(pub, null, 1));
console.log(Object.keys(files).length, 'files listed;', Object.values(files).reduce((s, f) => s + f.bytes, 0).toLocaleString('en-GB'), 'bytes; generation:', pub.generation);Review1 Check
A JavaScript module in the proof folder of GlobalGrid2050 that draws review1 report and cables.
renderglobalgrid2050 / testcode/202609142202/proof/review1_check.mjs · lines 1–140 of 140 · version 2026-09-14 22:02 · Not reached from any entry point (candidate for review) · pattern elecProbe (shared by 2 files)
- What it does
- It draws review1 report and cables. Defines 8 functions or classes, including sleep, newPage, hud, hudFind, hudAll. Uses libraries node:module, node:fs, C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core, C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core/package.json. 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. Domain terms in the code: cables.
- Inputs & outputs
- Out: JSON file review1_report.json; WebGL/WebGPU drawing.
- What it achieves
- It is built from the sleep step (`sleep`), the new page helper (`newPage`) and the hud step (`hud`). Adversarial review round 1 — independent headless-Chrome measurements for testcode/. It writes `review1_report.json`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609142202/proof · JavaScript module
- Uses
- node:module, node:fs, C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core, C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core/package.json
- Used by
- none found
- Produces
- sleep, newPage, hud, hudFind, hudAll, elecProbe, annuli, gc
- Defines here
- sleep, newPage, hud, hudFind, hudAll, elecProbe, annuli, gc
- 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/202609142202/proof/review1_check.mjs:1-140 · blob 8e68f6bf36273d78116a1f29e33323940144f063 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: experimental · users: none · canonical: unreached_review
// Adversarial review round 1 — independent headless-Chrome measurements for testcode/202609142202.
// Runs against a local server on PORT (default 8877). All non-127.0.0.1 requests are intercepted,
// logged and ABORTED so the list of external hosts the page tries to reach is measured, not claimed.
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.env.PORT || '8877';
const URL = `http://127.0.0.1:${PORT}/testcode/202609142202/index.html`;
const OUT = 'C:/Users/vikra/Documents/GitHub/globalgrid2050/testcode/202609142202/proof/';
const sleep = ms => new Promise(r => setTimeout(r, ms));
const browser = await puppeteer.launch({
headless: 'new', executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
args: ['--enable-gpu', '--use-gl=angle', '--use-angle=d3d11', '--ignore-gpu-blocklist', '--enable-unsafe-webgpu', '--no-sandbox', '--window-size=1440,1000']
});
const R = { url: URL, puppeteer: require('C:/Users/vikra/Desktop/Claude-Sandbox-MSI/bench/node_modules/puppeteer-core/package.json').version };
async function newPage(w, h, dpr, mobile) {
const page = await browser.newPage(); const ext = [], errors = [];
await page.setRequestInterception(true);
page.on('request', req => { const u = req.url(); if (u.startsWith('http://127.0.0.1')) req.continue(); else { ext.push({ url: u, t: Date.now() }); req.abort(); } });
page.on('pageerror', e => errors.push('pageerror: ' + e.message));
page.on('console', m => { const t = m.type(); if (t === 'error' || t === 'warning') errors.push(t + ': ' + m.text()); });
await page.setViewport({ width: w, height: h, deviceScaleFactor: dpr, isMobile: mobile, hasTouch: mobile });
return { page, ext, errors };
}
const hud = page => page.evaluate(() => Array.from(document.querySelectorAll('#hud div')).map(d => d.textContent));
const hudFind = async (page, re) => (await hud(page)).find(t => re.test(t)) || null;
const hudAll = async (page, re) => (await hud(page)).filter(t => re.test(t));
// electron-shell VBO: read the a_shell attribute buffer the moment the 512-vertex draw happens
const elecProbe = () => new Promise(res => {
const gl = document.querySelector('#gl').getContext('webgl2'); const orig = gl.drawArrays; let done = false;
gl.drawArrays = function (mode, first, count) {
if (!done && count === 512) {
done = true; const prog = gl.getParameter(gl.CURRENT_PROGRAM);
const ls = gl.getAttribLocation(prog, 'a_shell'), li = gl.getAttribLocation(prog, 'a_i');
const buf = gl.getVertexAttrib(ls, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING); const prev = gl.getParameter(gl.ARRAY_BUFFER_BINDING);
gl.bindBuffer(gl.ARRAY_BUFFER, buf); const out = new Float32Array(512 * 2); gl.getBufferSubData(gl.ARRAY_BUFFER, 0, out); gl.bindBuffer(gl.ARRAY_BUFFER, prev);
const shells = {}; for (let i = 0; i < 512; i++) { const s = out[i * 2 + 1]; shells[s] = (shells[s] || 0) + 1; }
const counts = gl.getUniform(prog, gl.getUniformLocation(prog, 'u_counts')); const stride = gl.getUniform(prog, gl.getUniformLocation(prog, 'u_stride'));
gl.drawArrays = orig;
res({ a_i_loc: li, a_shell_loc: ls, a_shell_value_histogram: shells, u_counts_KLM: Array.from(counts), u_stride: stride, draw: { mode, first, count } });
}
return orig.call(gl, mode, first, count);
};
setTimeout(() => { if (!done) { gl.drawArrays = orig; res({ error: 'no 512-vertex draw seen in 2 s' }); } }, 2000);
});
// pixels in annuli around the sphere centre (drawing buffer is preserved): counts of "bright" pixels
const annuli = () => {
const { G } = window.__qts; const gl = document.querySelector('#gl').getContext('webgl2'); const r = G.sphereR; const cx = G.c0[0], cy = G.c0[1];
const half = Math.ceil(r * 1.4); const x0 = Math.round(cx - half), y0 = Math.round(G.H - cy - half); const w = 2 * half, h = 2 * half;
const px = new Uint8Array(w * h * 4); gl.readPixels(x0, y0, w, h, gl.RGBA, gl.UNSIGNED_BYTE, px);
const bands = { K_0p50_0p60: [0.50, 0.60], L_0p80_0p90: [0.80, 0.90], M_1p20_1p30: [1.20, 1.30] }; const out = {};
for (const [k, [a, b]] of Object.entries(bands)) { let n = 0, tot = 0; for (let j = 0; j < h; j++) for (let i = 0; i < w; i++) { const dx = (x0 + i) - cx, dy = (G.H - (y0 + j)) - cy; const d = Math.hypot(dx, dy) / r; if (d >= a && d < b) { tot++; const o = (j * w + i) * 4; if (Math.max(px[o], px[o + 1], px[o + 2]) > 70) n++; } } out[k] = { bright: n, pixels: tot }; }
return { sphereR_px: r, ...out };
};
try {
// ---------------- desktop ----------------
const { page, ext, errors } = await newPage(1440, 1000, 1, false);
const cdp = await page.createCDPSession(); await cdp.send('HeapProfiler.enable');
const gc = () => cdp.send('HeapProfiler.collectGarbage');
await page.goto(URL, { waitUntil: 'networkidle0', timeout: 120000 }); await sleep(5000);
const d = R.desktop = {};
d.hud0 = await hud(page); d.count = await page.evaluate(() => document.querySelector('#count').textContent);
d.externalRequestsDuringLoad = ext.slice();
d.gpu = await page.evaluate(() => ({ seaBytes: window.__qts.S.seaBytes, seaDrawn: window.__qts.S.seaDrawn, stride: window.__qts.S.seaStride, drawCalls: window.__qts.S.lastDrawCalls, DPR: window.__qts.DPR }));
// electron shells: buffer contents + pixels, for the default atom (#2039 K0 L40 M20)
d.elec_2039 = { atom: await page.evaluate(() => { const a = window.__qts.S.atom; return { n: a.n, name: a.name, shells: a.shells }; }), buffer: await page.evaluate(elecProbe), annuli: await page.evaluate(annuli) };
// walk to an atom with K>0 and repeat
await page.click('body'); await page.keyboard.press('ArrowRight'); await sleep(600);
d.elec_next = { atom: await page.evaluate(() => { const a = window.__qts.S.atom; return { n: a.n, name: a.name, shells: a.shells }; }), buffer: await page.evaluate(elecProbe), annuli: await page.evaluate(annuli) };
await page.keyboard.press('ArrowLeft'); await sleep(300);
// per-frame CPU (idle, 15 s): TaskDuration/ScriptDuration deltas and rAF gaps
await gc(); const m0 = await page.metrics(); const t0 = Date.now();
const raf = await page.evaluate(() => new Promise(res => { const g = []; let last = performance.now(); let n = 0; const f = t => { g.push(t - last); last = t; if (++n < 600) requestAnimationFrame(f); else res(g); }; requestAnimationFrame(f); }));
await sleep(4000); await gc(); const m1 = await page.metrics(); const secs = (Date.now() - t0) / 1000;
const sorted = raf.slice().sort((a, b) => a - b);
d.idle = { seconds: +secs.toFixed(1), frames_sampled: raf.length, raf_gap_ms: { mean: +(raf.reduce((a, b) => a + b, 0) / raf.length).toFixed(2), p95: +sorted[Math.floor(sorted.length * 0.95)].toFixed(2), max: +sorted[sorted.length - 1].toFixed(2) },
taskDuration_s: +(m1.TaskDuration - m0.TaskDuration).toFixed(3), scriptDuration_s: +(m1.ScriptDuration - m0.ScriptDuration).toFixed(3), cpu_ms_per_frame_est: +((m1.TaskDuration - m0.TaskDuration) * 1000 / (secs * 60)).toFixed(2),
heap_before: m0.JSHeapUsedSize, heap_after: m1.JSHeapUsedSize, nodes_before: m0.Nodes, nodes_after: m1.Nodes, listeners_before: m0.JSEventListeners, listeners_after: m1.JSEventListeners };
// measure 'Number' → external requests fired automatically
const extBefore = ext.length;
await page.click('#search'); await page.type('#search', 'Number'); await page.keyboard.press('Enter'); await sleep(300); await page.keyboard.press('Enter'); await sleep(1500);
d.afterMeasure = { born: await hudFind(page, /^Born/), twin: await hudFind(page, /^twin/), cable: await hudFind(page, /^cable/), state: await hudFind(page, /^state/) };
d.externalRequestsAfterOneMeasurement = ext.slice(extBefore).map(e => e.url);
// 25 more via the button
const extBefore2 = ext.length; for (let i = 0; i < 25; i++) { await page.click('#measure'); await sleep(40); } await sleep(1500);
d.externalRequestsAfter25More = ext.slice(extBefore2).length; d.externalHosts = [...new Set(ext.map(e => new globalThis.URL(e.url).host))];
d.histogram = await hudFind(page, /^histogram/);
// heap growth under 300 rapid measurements (external aborted so this is loop + DOM cost only)
await gc(); const h0 = await page.metrics();
for (let i = 0; i < 300; i++) { await page.click('#measure'); }
await sleep(2000); await gc(); const h1 = await page.metrics();
d.measure300 = { heap_before: h0.JSHeapUsedSize, heap_after: h1.JSHeapUsedSize, nodes_before: h0.Nodes, nodes_after: h1.Nodes, listeners_before: h0.JSEventListeners, listeners_after: h1.JSEventListeners,
measurements: await page.evaluate(() => window.__qts.S.measurements.length), recordChips: await page.evaluate(() => document.querySelectorAll('#record button').length), extRequestsTotal: ext.length };
// hand-prepared measurement: state line vs Born line
await page.evaluate(() => { window.__qts.S.hand = { theta: 2.6, phi: 1.0 }; }); await page.click('#measure'); await sleep(300);
d.handMeasure = { state: await hudFind(page, /^state/), born: await hudFind(page, /^Born/), S: await page.evaluate(() => ({ theta: window.__qts.S.theta, dataTheta: window.__qts.S.dataTheta, hand: window.__qts.S.hand, outcome: window.__qts.S.outcome })) };
// resize while collapsed: does the chosen twin survive?
d.resizeAfterCollapse = { before: await page.evaluate(() => ({ outcome: window.__qts.S.outcome, chosen: window.__qts.S.twin.chosen && window.__qts.S.twin.chosen.label, tetherDissolved: window.__qts.S.tetherDissolved })) };
await page.setViewport({ width: 1300, height: 900, deviceScaleFactor: 1 }); await sleep(500);
d.resizeAfterCollapse.after = await page.evaluate(() => ({ outcome: window.__qts.S.outcome, chosen: window.__qts.S.twin.chosen && window.__qts.S.twin.chosen.label, collapseT: window.__qts.S.collapseT, twinNote: window.__qts.S.twinNote }));
await page.setViewport({ width: 1440, height: 1000, deviceScaleFactor: 1 }); await sleep(9000); // let re-prepare pass
// SOUL tier (#766 geometry via the band: index 3) — record twin note per outcome
await page.click('body'); for (let i = 0; i < 3; i++) { await page.keyboard.press('ArrowRight'); await sleep(150); }
d.soul = { atom: await page.evaluate(() => { const a = window.__qts.S.atom; return { n: a.n, name: a.name, shells: a.shells, valence_repos: a.valence_repos }; }), tierBefore: await hudFind(page, /^twin/), runs: [] };
for (let i = 0; i < 6; i++) { await page.click('#measure'); await sleep(120); d.soul.runs.push({ born: (await hudFind(page, /^Born/) || '').slice(0, 60), twin: await hudFind(page, /^twin/), litRepo: await page.evaluate(() => window.__qts.S.litRepo), chosen: await page.evaluate(() => window.__qts.S.twin.chosen) }); }
// pick on the twin star (instance 1) at the mirrored focused-family position
const pt = await page.evaluate(() => { const { S, G, familyPos, DPR } = window.__qts; const p = familyPos(S.famIdx); const c = document.querySelector('#gl').getBoundingClientRect(); return { x: c.left + (G.c1[0] - p[0] * G.R) / DPR, y: c.top + (G.c1[1] - p[1] * G.R) / DPR, famIdx: S.famIdx }; });
await page.evaluate(() => { document.querySelector('#hud').style.pointerEvents = 'none'; }); await page.mouse.click(pt.x, pt.y); await sleep(400);
d.twinPick = { point: pt, msg: await page.evaluate(() => window.__qts.S.msg) };
await page.screenshot({ path: OUT + 'review1-desktop.png' });
d.errors = errors; await page.close();
// ---------------- phone: 430×900, DPR 2, touch ----------------
const P = await newPage(430, 900, 2, true); const pg = P.page;
await pg.goto(URL, { waitUntil: 'networkidle0', timeout: 120000 }); await sleep(5000);
const m = R.mobile = {};
m.hud = await hud(pg); m.count = await pg.evaluate(() => document.querySelector('#count').textContent);
m.scrollWidth = await pg.evaluate(() => document.documentElement.scrollWidth);
m.gpu = await pg.evaluate(() => ({ seaBytes: window.__qts.S.seaBytes, seaDrawn: window.__qts.S.seaDrawn, stride: window.__qts.S.seaStride, drawCalls: window.__qts.S.lastDrawCalls, DPR: window.__qts.DPR, canvas: [document.querySelector('#gl').width, document.querySelector('#gl').height], phoneMode: window.__qts.S.phoneMode }));
m.layout = await pg.evaluate(() => { const r = s => { const b = document.querySelector(s).getBoundingClientRect(); return { l: Math.round(b.left), t: Math.round(b.top), w: Math.round(b.width), h: Math.round(b.height) }; }; const { G, DPR } = window.__qts; return { stage: r('#stage'), hud: r('#hud'), hudCollapsed: document.querySelector('#hud').classList.contains('collapsed'), sphereHandle: r('#s … [line shortened here: 783 characters; full line on GitHub]
const fps0 = await hudFind(pg, /^fps/); await sleep(2000); m.fpsLine = await hudFind(pg, /^fps/); m.fpsLine0 = fps0;
// touch: tap the sphere handle → measure; horizontal swipe on the canvas → walk band
m.touch = {};
try {
const sh = m.layout.sphereHandle; await pg.touchscreen.tap(sh.l + sh.w / 2, sh.t + sh.h / 2); await sleep(400);
m.touch.tapSphere = { born: await hudFind(pg, /^Born/) };
const st = m.layout.stage; const y = st.t + st.h * 0.62, x0 = st.l + 300, x1 = st.l + 120; // in the lower (twin) half, away from the handle
await pg.touchscreen.touchStart(x0, y); for (let i = 1; i <= 6; i++) await pg.touchscreen.touchMove(x0 + (x1 - x0) * i / 6, y); await pg.touchscreen.touchEnd(); await sleep(400);
m.touch.swipe = { msg: await pg.evaluate(() => window.__qts.S.msg), bandPos: await pg.evaluate(() => window.__qts.S.bandPos) };
} catch (e) { m.touch.error = e.message; }
m.hudAfter = await hud(pg);
await pg.screenshot({ path: OUT + 'review1-mobile-dpr2.png' });
m.externalHosts = [...new Set(P.ext.map(e => new globalThis.URL(e.url).host))]; m.errors = P.errors; await pg.close();
} catch (e) { R.error = e.stack; }
await browser.close();
fs.writeFileSync(OUT + 'review1_report.json', JSON.stringify(R, null, 1));
console.log(JSON.stringify(R, null, 1));