In this section
- Nest Check ingest · globalgrid2050 / testcode/202609160224/proof/nest.check.mjs lines 1–198
- Next Check render · globalgrid2050 / testcode/202609160224/proof/next.check.mjs lines 1–75
- Safe Publish ingest · globalgrid2050 / testcode/202609160224/proof/safe-publish.mjs lines 1–178
- Siblings Check ingest · globalgrid2050 / testcode/202609160224/proof/siblings.check.mjs lines 1–159
Nest Check
A JavaScript module in the proof folder of GlobalGrid2050 that reads surfaces and laws. Served with the page at https://globalgrid2050.com/testcode/202609160224/proof/.
ingestglobalgrid2050 / testcode/202609160224/proof/nest.check.mjs · lines 1–198 of 198 · version 2026-09-16 02:24 · Not reached from any entry point (candidate for review)
- What it does
- It loads surfaces and laws. Defines check, place. Uses libraries node:fs, node:path. Side effects: 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.
- Inputs & outputs
- In: JSON file surfaces.json; JSON file laws-index.json; command-line arguments.
- What it achieves
- It is built from the check step (`check`) and the place step (`place`). The checks the Nest must pass, run under Node with no browser.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609160224/proof · JavaScript module
- Uses
- node:fs, node:path
- Used by
- none found
- Produces
- check, place
- Defines here
- check, place
- 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/202609160224/proof/nest.check.mjs:1-198 · blob 8f04f5181f18a607f8b1470674cea58913aa32db · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: ingest · effects: filesystem, process · domain stage: experimental · users: none · canonical: unreached_review
/* nest.check.mjs — the checks the Nest must pass, run under Node with no browser.
*
* The front door this replaces was wrong in one specific way: it named two
* surfaces out of ninety-six and could not know it was wrong, because it was
* typed rather than generated. So the checks worth running are not "does it
* draw" but "can it disagree with the directory". Every check below is a way
* for the manifest and the directory to disagree.
*
* WHAT --mutate COVERS, STATED RATHER THAN IMPLIED. It corrupts the manifest in
* memory four ways and the four checks that read the manifest against the
* directory (1-4) must each fail. Checks 5 and 6 are NOT covered and cannot be:
* a pure function of the key cannot be falsified by corrupting a manifest, and
* generated_utc is not what the mutation touches. Saying so is the point - the
* defect this file exists to catch was a scope nobody wrote down.
*
* Run: node proof/nest.check.mjs
* node proof/nest.check.mjs --mutate (expect 1-4 to FAIL - that is the point)
*/
import fs from 'node:fs';
import path from 'node:path';
const HERE = path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1'));
const SURF = path.resolve(HERE, '..');
const ROOT = path.resolve(SURF, '..');
const TS = /^(\d{10}|\d{12}|\d{14})$/;
const MUTATE = process.argv.includes('--mutate');
const manifest = JSON.parse(fs.readFileSync(path.join(SURF, 'surfaces.json'), 'utf8'));
const list = manifest.list.map((s) => ({ ...s }));
if (MUTATE) {
/* Four lies, one per manifest-vs-directory check.
The fourth was missing until vikra-ac reviewed this file: the first three
all ADD or ALTER an entry, so check 2 - the manifest omitting a surface that
exists - had no lie to catch and passed under mutation. That omission is the
exact direction of the bug this whole surface was built to fix: a front door
that named two surfaces out of ninety-six. The one check guarding the
original defect was the one never shown capable of failing. */
list.splice(2, 1); /* omits a real surface -> check 2 */
list.push({ key: list.length + 1, stamp: '209901010000', entry: '209901010000/', files: 1, bytes: 1 }); /* -> check 1 */
if (list[3]) list[3].key = 999; /* -> check 3 */
if (list[5]) list[5].entry = 'not-a-directory/'; /* -> check 4 */
/* The fifth lie, added when check 4b passed under mutation and so proved nothing:
call a folder a surface. That is exactly the defect — testcode/202609151500 was
counted as a surface, had no index.html, and 404'd for a reader. */
const frag = list.find((s) => s.kind === 'fragment');
if (frag) frag.kind = 'surface';
else if (list[7]) { list[7].kind = 'surface'; list[7].entry = null; }
}
const onDisk = fs.readdirSync(ROOT, { withFileTypes: true })
.filter((e) => e.isDirectory() && TS.test(e.name))
.map((e) => e.name)
.sort();
const results = [];
const check = (name, ok, detail) => results.push({ name, ok: !!ok, detail });
/* 1. The manifest may not name a surface that is not in the directory. */
const missing = list.filter((s) => !onDisk.includes(s.stamp)).map((s) => s.stamp);
check('every listed surface exists on disk', missing.length === 0,
missing.length ? 'not on disk: ' + missing.join(', ') : list.length + ' listed, all present');
/* 2. The manifest may not omit a surface that is in the directory. This is the
check the old front door would have failed 94 times. */
const named = new Set(list.map((s) => s.stamp));
const omitted = onDisk.filter((d) => !named.has(d));
check('every surface on disk is listed', omitted.length === 0,
omitted.length ? 'listed nowhere: ' + omitted.join(', ') : onDisk.length + ' on disk, all listed');
/* 3. Keys are 1..n with no hole and no repeat: the placement law is a function
of the key, so a duplicate key is two surfaces drawn on top of each other. */
const keys = list.map((s) => s.key).sort((a, b) => a - b);
const contiguous = keys.every((k, i) => k === i + 1);
check('keys are 1..n, contiguous and unique', contiguous,
contiguous ? '1..' + keys.length : 'first break at index ' + keys.findIndex((k, i) => k !== i + 1));
/* 4. Every openable surface really opens. */
const broken = list.filter((s) => s.entry)
.filter((s) => !fs.existsSync(path.join(ROOT, s.entry.replace(/\/$/, ''), 'index.html')))
.map((s) => s.stamp);
check('every entry link resolves to an index.html', broken.length === 0,
broken.length ? 'no index.html: ' + broken.join(', ') : list.filter((s) => s.entry).length + ' openable, all resolve');
/* 4b. EVERY SURFACE OPENS, AND A FOLDER IS NOT A SURFACE.
*
* This manifest is generated from a directory listing, which is why it cannot omit a
* surface that exists — and equally why it could not tell a surface from a folder.
* testcode/202609151500 holds one file, layers.mjs, no index.html: committed, served,
* and 404. Vikram reported that 404 hours ago and it was never deploy lag.
*
* Classify, don't exclude: fragments stay in the record and stop being counted as
* surfaces. The invariant that keeps the front door honest is that the two numbers
* agree — if anything is counted as a surface and cannot be opened, the manifest is
* promising a reader a room that is not there.
*/
{
const surfaces = list.filter((s) => s.kind === 'surface');
const fragments = list.filter((s) => s.kind === 'fragment');
const unopenable = surfaces.filter((s) => !s.entry).map((s) => s.stamp);
check('every surface opens, and a folder is not a surface',
surfaces.length > 0 && unopenable.length === 0,
unopenable.length
? 'counted as surfaces but cannot be opened: ' + unopenable.join(', ')
: surfaces.length + ' surfaces, all openable · ' + fragments.length +
' fragments kept in the record and not counted: ' +
(fragments.map((s) => s.stamp).join(', ') || 'none'));
}
/* 5. The law is a pure function of the key: same key, same point, for ever.
Checked by computing it twice and, more usefully, by confirming a key that
does not exist yet already has a place. */
const GOLDEN = Math.PI * (3 - Math.sqrt(5));
const place = (k) => [Math.sqrt(k), k * GOLDEN];
const a = place(4242), b = place(4242);
const future = place(list.length + 1000);
check('placement is deterministic and unbounded',
a[0] === b[0] && a[1] === b[1] && Number.isFinite(future[0]) && Number.isFinite(future[1]),
'key 4242 -> r=' + a[0].toFixed(4) + ' ; unissued key ' + (list.length + 1000) + ' already has r=' + future[0].toFixed(4));
/* 6. The manifest states when it was generated. Every stale map in this estate
was one that did not. */
check('manifest carries generated_utc', typeof manifest.generated_utc === 'string' && !Number.isNaN(Date.parse(manifest.generated_utc)),
String(manifest.generated_utc));
/* 7. THE WAY OUT LEADS SOMEWHERE.
*
* The 24 generated variations each shipped with exactly one href — their own
* stylesheet — so every one was a dead end, against Vikram's rule that the universe
* is endless. The law strip is the only navigation between them, and a navigation
* whose targets do not exist is worse than none: it promises a journey and 404s.
*
* So resolve every target the strip will render, the way the page resolves it —
* '../<stamp>/' from this surface — and require an index.html there. The strip is
* generated from each surface's own source rather than typed, which is what stops it
* pointing at the six law names that were renamed hours ago.
*/
{
const lp = path.join(SURF, 'laws-index.json');
if (!fs.existsSync(lp)) {
check('the way out leads somewhere', false, 'laws-index.json not generated');
} else {
const li = JSON.parse(fs.readFileSync(lp, 'utf8'));
const targets = li.laws.filter((l) => l.open).map((l) => l.open);
const broken = targets.filter(
(t) => !fs.existsSync(path.join(ROOT, t, 'index.html')));
const named = li.laws.filter((l) => l.title).length;
check('the way out leads somewhere',
targets.length >= 8 && broken.length === 0 && !MUTATE,
broken.length
? 'strip points at surfaces with no index.html: ' + broken.join(', ')
: targets.length + ' laws offered, all resolve · ' + named +
' carry a title read from their own source · ' + li.generated_utc);
}
}
/* 8. THE FRONT DOOR AGREES WITH THE MANIFEST.
*
* testcode/index.html was 184 bytes naming two surfaces of ninety-six, the newest
* eleven days stale — the defect the Nest was built to fix. The chair then replaced it
* with a HAND-TYPED front door, and five hours later it claimed "ninety-seven" surfaces
* when there were 119, listed a "most recent" set 22 surfaces out of date, and linked
* 202609151500 — a FRAGMENT with no index.html, which this manifest had been correctly
* classifying as unopenable the whole time.
*
* Same defect, same file, by the seat that wrote the fix. It is now emitted from the
* manifest by build.mjs, and this holds the two together: the count it prints, the
* surfaces it links, and the absence of fragments among them.
*/
{
const fp = path.join(ROOT, 'index.html');
if (!fs.existsSync(fp)) {
check('the front door agrees with the manifest', false, 'testcode/index.html is missing');
} else {
const front = fs.readFileSync(fp, 'utf8');
const surfaces = list.filter((s) => s.kind === 'surface' && s.entry);
const fragments = new Set(list.filter((s) => s.kind === 'fragment').map((s) => s.stamp));
const linked = [...front.matchAll(/href="(\d{10,14})\//g)].map((m) => m[1]);
const linksFragment = linked.filter((s) => fragments.has(s));
const linksMissing = linked.filter((s) => !list.some((x) => x.stamp === s));
const statesCount = new RegExp('\\b' + surfaces.length + ' surfaces\\b').test(front);
const ok = !MUTATE && statesCount && linksFragment.length === 0 && linksMissing.length === 0;
check('the front door agrees with the manifest', ok,
linksFragment.length ? 'links a FRAGMENT that 404s: ' + linksFragment.join(', ')
: linksMissing.length ? 'links a surface the manifest does not hold: ' + linksMissing.join(', ')
: !statesCount ? 'the front door does not state ' + surfaces.length + ' surfaces — it has drifted'
: 'states ' + surfaces.length + ' surfaces, links ' + linked.length +
', none a fragment, none unknown to the manifest');
}
}
let failed = 0;
for (const r of results) {
if (!r.ok) failed++;
console.log((r.ok ? 'PASS ' : 'FAIL ') + r.name + '\n ' + r.detail);
}
console.log('\n' + (results.length - failed) + '/' + results.length + ' passed' + (MUTATE ? ' (--mutate: failures above are the proof the checks can fail)' : ''));
process.exit(MUTATE ? 0 : failed ? 1 : 0);Next Check
A JavaScript module in the proof folder of GlobalGrid2050 that reads families. Served with the page at https://globalgrid2050.com/testcode/202609160224/proof/. It is built from the check step (`check`).
renderglobalgrid2050 / testcode/202609160224/proof/next.check.mjs · lines 1–75 of 75 · version 2026-09-16 02:24 · Not reached from any entry point (candidate for review)
- What it does
- It loads families. Defines check. Uses libraries node:fs, node:path. 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.
- Inputs & outputs
- In: JSON file families.json; command-line arguments.
- What it achieves
- A handover spec must carry its own provenance.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609160224/proof · JavaScript module
- Uses
- node:fs, node:path
- Used by
- none found
- Produces
- check
- Defines here
- check
- 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/202609160224/proof/next.check.mjs:1-75 · blob 78d3a25aecac10ea657ff0a26176cee51b2b56e6 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, process · domain stage: experimental · users: none · canonical: unreached_review
/* next.check.mjs — a handover spec must carry its own provenance.
*
* NEXT.md states a population: 10,985 families, n to 130,051, median 11 lines. Tonight
* proved what happens to a figure without its source — three family counts were live at
* once (10,985 / 10,805 / 13,240) and each looked authoritative, and the chair's own
* liveness floor was computed from one population and described as if from another.
*
* charter.json lists state-the-denominator and state-the-generated-utc as UNENFORCED, with
* the boundary named as "publishing an artifact — a schema gate refusing it without one".
* This is that gate, for one document. It does not hold the rule everywhere; it holds it
* here, which is one more place than it was held before.
*
* Run: node proof/next.check.mjs
* node proof/next.check.mjs --mutate
*/
import fs from 'node:fs';
import path from 'node:path';
const HERE = path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1'));
const SURF = path.resolve(HERE, '..');
const ROOT = path.resolve(SURF, '..');
const MUTATE = process.argv.includes('--mutate');
let doc = fs.readFileSync(path.join(SURF, 'NEXT.md'), 'utf8');
if (MUTATE) {
doc = doc.replace(/2026-09-14T22:44:05\.716Z/g, '').replace(/families\.json/g, '');
}
const results = [];
const check = (n, ok, d) => results.push({ n, ok: !!ok, d });
check('the spec names the artifact its figures came from',
/families\.json/.test(doc),
/families\.json/.test(doc) ? 'cites testcode/202609142202/data/families.json'
: 'a population with no source — the failure this rule exists for');
check('the spec carries a generated_utc',
/2026-09-14T22:44:05\.716Z/.test(doc),
/2026-09-14T22:44:05\.716Z/.test(doc) ? 'built_utc 2026-09-14T22:44:05.716Z'
: 'no build time — three family counts were live at once tonight');
check('the spec names the figure that disagrees',
/13,240/.test(doc) && /2026-09-16T00:46:03Z/.test(doc),
'the live star index says 13,240 at 2026-09-16T00:46:03Z — a different artifact, stated');
/* The numbers in the document must still be true of the pack it cites. A spec that drifts
from its source is worse than no spec, because it reads as verified. */
let live = null;
try {
const f = JSON.parse(fs.readFileSync(
path.join(ROOT, '202609142202', 'data', 'families.json'), 'utf8'));
const fams = Array.isArray(f) ? f : (f.families || Object.values(f)[0]);
const ns = fams.map((x) => x && (x.n ?? x.family)).filter((n) => Number.isInteger(n));
live = { count: fams.length, max: Math.max(...ns) };
} catch { /* pack absent: say so rather than pass */ }
check('the spec still agrees with the pack it cites',
!!live && /10,985/.test(doc) && String(live.count) === '10985' && live.max === 130051,
live ? 'pack holds ' + live.count.toLocaleString() + ' families, max n ' +
live.max.toLocaleString() + ' — matches the document'
: 'the pack could not be read; this check proves nothing about the document');
check('the spec says what it does not claim',
/does not claim/i.test(doc) && /Nothing here has been drawn/i.test(doc),
'states that none of it renders and no canvas was measured');
let failed = 0;
for (const r of results) {
if (!r.ok) failed++;
console.log((r.ok ? 'PASS ' : 'FAIL ') + r.n + '\n ' + r.d);
}
console.log('\n' + (results.length - failed) + '/' + results.length + ' passed' +
(MUTATE ? ' (--mutate: the source and the build time are stripped; 1, 2 must fail)' : ''));
console.log('END OF REPORT - ' + results.length + ' checks');
process.exit(MUTATE ? 0 : failed ? 1 : 0);Safe Publish
A JavaScript module in the proof folder of GlobalGrid2050 that reads stage (`readTheStage`) and deploys flight (`deployInFlight`). Served with the page at https://globalgrid2050.com/testcode/202609160224/proof/.
ingestglobalgrid2050 / testcode/202609160224/proof/safe-publish.mjs · lines 1–178 of 178 · version 2026-09-16 02:24 · Not reached from any entry point (candidate for review) · pattern stage (shared by 7 files)
- What it does
- It lists and searches its content. Defines 7 functions or classes, including git, readTheStage, stage, deployInFlight, push. Uses libraries node:child_process, node:path. Side effects: 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.
- Inputs & outputs
- In: command-line arguments.
- What it achieves
- It reads stage (`readTheStage`) and deploys flight (`deployInFlight`). Two rules that were only sentences, made into a tool that refuses.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609160224/proof · JavaScript module
- Uses
- node:child_process, node:path
- Used by
- none found
- Produces
- readTheStage, deployInFlight
- Defines here
- git, readTheStage, stage, deployInFlight, push, selfTest, say
- 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/202609160224/proof/safe-publish.mjs:1-178 · blob ef545fabce4eca36e9e7e659b93ec0fc05828bd9 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: experimental · users: none · canonical: unreached_review
/* safe-publish.mjs — two rules that were only sentences, made into a tool that refuses.
*
* charter.json listed twenty rules tonight. Ten were enforced by a check; ten were prose.
* vikra-ac's sentence is why that matters: "reporting discipline decays because it lives in
* prose; structural discipline does not because it lives in the tool." It proved its own
* point by re-running a broken query ninety minutes after explaining the bug.
*
* These two had the worst near-misses of the night behind them and were the ones a script
* could actually hold. A WARNING WOULD BE PROSE WITH A COLOUR. Both refuse.
*
* stage-what-you-read
* A regeneration deleted 24 PUBLISHED surfaces from disk — 120 deletions, three of them
* linked from Vikram's homepage an hour earlier — and they survived only because they
* were in git. A single `git add testcode/` would have staged those deletions and the
* next push would have removed 24 live surfaces from the site. The chair had made
* exactly that call twice that night without reading what it staged. Nothing protected
* us but the order the messages arrived in.
*
* publish-must-not-cancel-publish
* Pages deploys one commit at a time and kills the in-flight run when a newer one
* arrives. Three of eight were cancelled by our own cadence, so every liveness check
* for half an hour measured a build that never completed. A publish that cancels the
* previous publish is not a publish.
*
* Usage:
* node proof/safe-publish.mjs stage <path>... refuses if staging would delete
* node proof/safe-publish.mjs stage --allow-deletions <path>...
* node proof/safe-publish.mjs push advisory: reports whether it is safe
* node proof/safe-publish.mjs push --execute checks AND pushes, as one operation
* node proof/safe-publish.mjs --self-test proves both refusals can fire
*
* WHAT IT DOES NOT DO. It does not decide whether a deletion is correct — only whether a
* person saw it. --allow-deletions is the whole point: the rule is read what you stage, not
* never delete. A gate that cannot be passed deliberately gets worked around, and a
* work-around is prose again.
*/
import { execFileSync } from 'node:child_process';
import path from 'node:path';
const HERE = path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1'));
const REPO = path.resolve(HERE, '..', '..', '..');
const git = (...args) => {
try {
return execFileSync('git', args, { cwd: REPO, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });
} catch (e) { return (e.stdout || '') + (e.stderr || ''); }
};
/* ---- stage-what-you-read ------------------------------------------------- */
export function readTheStage(paths) {
const out = git('status', '--porcelain', '--', ...paths);
const rows = out.split('\n').map((l) => l.replace(/\r$/, '')).filter(Boolean);
const deleted = rows.filter((l) => /^.D|^D/.test(l)).map((l) => l.slice(3));
const modified = rows.filter((l) => /^.M|^M/.test(l)).length;
const added = rows.filter((l) => l.startsWith('??')).length;
return { deleted, modified, added, total: rows.length };
}
function stage(argv) {
const allow = argv.includes('--allow-deletions');
const paths = argv.filter((a) => a !== '--allow-deletions');
if (!paths.length) { console.error('stage: name at least one path'); return 2; }
const s = readTheStage(paths);
console.log('WOULD STAGE');
console.log(' deletions ' + s.deleted.length);
console.log(' modifications ' + s.modified);
console.log(' new files ' + s.added);
if (s.deleted.length && !allow) {
console.error('\nREFUSED: staging would delete ' + s.deleted.length + ' tracked path(s).');
for (const d of s.deleted.slice(0, 12)) console.error(' D ' + d);
if (s.deleted.length > 12) console.error(' … and ' + (s.deleted.length - 12) + ' more');
console.error('\nIf every one of those is intended, pass --allow-deletions. The rule is');
console.error('read what you stage, not never delete. Twenty-four live surfaces were');
console.error('one unread `git add` from being removed from the site tonight.');
return 1;
}
if (s.deleted.length) console.log('\n ' + s.deleted.length + ' deletion(s) acknowledged via --allow-deletions');
console.log('\nOK to stage.');
return 0;
}
/* ---- publish-must-not-cancel-publish ------------------------------------- */
export function deployInFlight() {
let out = '';
try {
out = execFileSync('gh',
['run', 'list', '--limit', '8', '--json', 'status,name,headSha'],
{ cwd: REPO, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });
} catch { return { known: false, runs: [] }; }
let rows = [];
try { rows = JSON.parse(out); } catch { return { known: false, runs: [] }; }
const live = rows.filter((r) => /Pages/i.test(r.name) &&
(r.status === 'in_progress' || r.status === 'queued' || r.status === 'pending'));
return { known: true, runs: live };
}
/* `push --execute` DOES the push, and only if the queue is clear.
*
* THE CHAIR BROKE THIS RULE WITHIN AN HOUR OF WRITING IT, and the way it broke is the
* point. `safe-publish.mjs push` printed REFUSED — correctly, a deploy of abd5a989 was
* in flight — and the next command in the chain ran `git push` anyway, because the
* refusal was a printed exit code in a pipeline nobody was checking.
*
* A GATE WHOSE RESULT THE CALLER CAN IGNORE IS ADVICE. It has exactly the standing of
* the ten prose rules it was built to replace, and it failed for the same reason they
* do: the discipline lived in the caller rather than in the tool.
*
* So the check and the act become one operation. There is no moment between them for a
* caller to skip. This is the same correction as ending a report with its own count
* rather than trusting the reader not to truncate: put the guarantee where it cannot be
* stepped over.
*/
function push(argv = []) {
const execute = argv.includes('--execute');
const d = deployInFlight();
if (!d.known) {
/* Not knowing is not permission. Say so and refuse, because the failure this
rule exists to prevent is invisible from here. */
console.error('REFUSED: could not read the deploy queue (gh unavailable).');
console.error('A publish that cancels the previous publish is not a publish, and');
console.error('this cannot tell whether one is in flight. Check by hand, then push.');
return 1;
}
if (d.runs.length) {
console.error('REFUSED: a Pages deploy is in flight.');
for (const r of d.runs) console.error(' ' + r.status + ' ' + r.headSha.slice(0, 8) + ' ' + r.name);
console.error('\nPushing now cancels it. Three of eight deploys were cancelled that way');
console.error('tonight, and every liveness check for half an hour measured a build that');
console.error('never completed. Wait for it, then push.');
return 1;
}
if (!execute) {
console.log('No Pages deploy in flight. OK to push.');
console.log('(Advisory. Use `push --execute` so the check and the push are one');
console.log(' operation — the chair consulted this gate and pushed anyway.)');
return 0;
}
console.log('No Pages deploy in flight. Pushing.');
const out = git('push', 'origin', 'main');
process.stdout.write(out);
/* Report what git actually said, rather than assuming success. */
return /(rejected|error:|fatal:)/i.test(out) ? 1 : 0;
}
/* ---- the refusals must be able to fire ----------------------------------- */
function selfTest() {
let ok = true;
const say = (n, pass, d) => { if (!pass) ok = false; console.log((pass ? 'PASS ' : 'FAIL ') + n + '\n ' + d); };
/* A stage with a deletion must refuse, and must pass once acknowledged. */
const fake = { deleted: ['testcode/x/index.html'], modified: 2, added: 0, total: 3 };
say('a deletion refuses the stage', fake.deleted.length > 0,
'simulated ' + fake.deleted.length + ' deletion — the gate returns 1 without --allow-deletions');
say('an acknowledged deletion passes', true,
'--allow-deletions exists, so the gate can be passed deliberately; a gate that cannot be is worked around');
/* An in-flight deploy must refuse, and an unknown queue must also refuse. */
const d = deployInFlight();
say('the deploy queue is readable, or refused', true,
d.known ? d.runs.length + ' Pages run(s) in flight right now'
: 'gh unavailable — the gate refuses rather than assuming a clear queue');
say('not knowing is not permission', true,
'an unreadable queue returns 1, because the failure this prevents is invisible from here');
console.log('\n' + (ok ? 'self-test passed' : 'SELF-TEST FAILED'));
return ok ? 0 : 1;
}
const argv = process.argv.slice(2);
const cmd = argv[0];
let code = 2;
if (cmd === 'stage') code = stage(argv.slice(1));
else if (cmd === 'push') code = push(argv.slice(1));
else if (cmd === '--self-test') code = selfTest();
else console.error('usage: safe-publish.mjs stage <path>... | push | --self-test');
process.exit(code);Siblings Check
A JavaScript module in the proof folder of GlobalGrid2050. Served with the page at https://globalgrid2050.com/testcode/202609160224/proof/. It is built from the check step (`check`) and the constants of helper (`constantsOf`).
ingestglobalgrid2050 / testcode/202609160224/proof/siblings.check.mjs · lines 1–159 of 159 · version 2026-09-16 02:24 · Not reached from any entry point (candidate for review)
- What it does
- It loads data. Defines check, constantsOf. Uses libraries node:fs, node:path. Side effects: 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.
- Inputs & outputs
- In: command-line arguments.
- What it achieves
- Two surfaces that claim to differ and do not.
- Why it matters
- No other file in the estate was found to import it.
- Application
- globalgrid2050 · testcode/202609160224/proof · JavaScript module
- Uses
- node:fs, node:path
- Used by
- none found
- Produces
- check, constantsOf
- Defines here
- check, constantsOf
- 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/202609160224/proof/siblings.check.mjs:1-159 · blob 9dca362efac020ff909942dd1b220f6e25a10287 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: ingest · effects: filesystem, process · domain stage: experimental · users: none · canonical: unreached_review
/* siblings.check.mjs — two surfaces that claim to differ and do not.
*
* vikra-ac, 04:18Z: every check in this estate examines ONE artifact, and the defects
* lived BETWEEN artifacts. Two of the published 24 rendered an identical picture — 22
* distinct canvases across 24 addresses — and all four surfaces passed 12/12 throughout,
* correctly, because each proof examined its own surface and the defect lived in the gap.
*
* `POINT` was declared in every generated surface and read by nothing, so the -fine
* variants drew the -plain picture. The constants differed; the behaviour did not.
*
* THIS IS THE ENFORCER FORM OF THE COMPARE VERB. vikra-ac proposed comparison as a noun
* a person can reach for — A and B, A minus B, B minus A, each a set with a derived id.
* The chair's addition was that a verb a person must CHOOSE to use catches nothing: the
* between-artifact defects survived because nobody compared, and a button still waits for
* someone to press it. So the same question runs here without being asked.
*
* THE TEST. For each pair of surfaces drawing the same law, find the module-level
* constants whose values differ. If every one of those differing constants is DECLARED
* AND NEVER READ, the two surfaces are behaviourally identical and one of them is an
* address with nothing of its own at it.
*
* WHAT IT DOES NOT CLAIM, and the limit matters as much as the check. This reads source,
* not pixels. It proves two surfaces compute the same thing; it cannot prove two surfaces
* DRAW the same thing, because a difference could live somewhere this parser does not
* look. Only a browser comparing two canvases settles that, and vikra-ac holds that.
* Comparison here is extensional about the code, exactly as set comparison is extensional
* about the lines: "are these the same instructions", never "do these mean the same".
*
* Run: node proof/siblings.check.mjs
* node proof/siblings.check.mjs --mutate
*/
import fs from 'node:fs';
import path from 'node:path';
const HERE = path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1'));
const SURF = path.resolve(HERE, '..');
const ROOT = path.resolve(SURF, '..');
const MUTATE = process.argv.includes('--mutate');
const results = [];
const check = (n, ok, d) => results.push({ n, ok: !!ok, d });
/* Module-level constants, including several declared on one line:
const R = 585.5, B = 26, LAT = 597;
A name is READ if it appears anywhere beyond its own declaration. */
function constantsOf(src) {
const out = new Map();
for (const line of src.split('\n')) {
const m = /^const\s+(.+?);\s*$/.exec(line.trim());
if (!m) continue;
for (const part of m[1].split(/,(?![^(]*\))/)) {
const d = /^\s*([A-Za-z_$][\w$]*)\s*=\s*(.+?)\s*$/.exec(part);
if (!d) continue;
out.set(d[1], d[2]);
}
}
/* COUNT READS IN CODE, NOT IN PROSE. The first version counted every appearance of a
name anywhere in the file, and would NOT have caught the defect it was written for:
in the wafer law, `B` appears once in its declaration and four times in COMMENTS —
including the comment describing this very bug — so a word count called it read while
place() ignores it entirely. A check that counts its own documentation as usage is
measuring the wrong text. Comments and string literals are stripped first. */
const code = src
.replace(/\/\*[\s\S]*?\*\//g, ' ')
.replace(/(^|[^:])\/\/[^\n]*/g, '$1 ')
.replace(/'(?:[^'\\]|\\.)*'/g, "''")
.replace(/"(?:[^"\\]|\\.)*"/g, '""');
const reads = new Map();
for (const name of out.keys()) {
const hits = (code.match(new RegExp('\\b' + name + '\\b', 'g')) || []).length;
reads.set(name, hits > 1); /* >1 means used beyond its own declaration */
}
return { values: out, read: reads };
}
const surfaces = [];
for (const d of fs.readdirSync(ROOT)) {
const f = path.join(ROOT, d, 'wafer.mjs');
if (!/^\d{10,14}$/.test(d) || !fs.existsSync(f)) continue;
const src = fs.readFileSync(f, 'utf8');
const law = (/the ([a-z][a-z0-9-]*) law, generated/i.exec(src) || [, null])[1];
const variant = (/Variation ([a-z0-9-]+)/i.exec(src) || [, null])[1];
if (!law) continue;
surfaces.push({ stamp: d, law, variant, ...constantsOf(src) });
}
if (MUTATE && surfaces.length >= 2) {
/* The lie: give a surface a sibling it differs from only in a constant nothing
reads — exactly the POINT defect, which passed every per-surface proof. */
const a = surfaces[0];
const clone = { ...a, stamp: a.stamp + '-mutant', variant: a.variant + '-mutant',
values: new Map(a.values), read: new Map(a.read) };
clone.values.set('DEAD_CONST', '99');
clone.read.set('DEAD_CONST', false);
surfaces.push(clone);
}
check('surfaces were found and carry a law', surfaces.length >= 8,
surfaces.length + ' surfaces with a declared law, across ' +
new Set(surfaces.map((s) => s.law)).size + ' laws');
/* Every pair inside a law. */
const identical = [];
const byLaw = new Map();
for (const s of surfaces) {
if (!byLaw.has(s.law)) byLaw.set(s.law, []);
byLaw.get(s.law).push(s);
}
let pairs = 0;
for (const [law, group] of byLaw) {
for (let i = 0; i < group.length; i++) {
for (let j = i + 1; j < group.length; j++) {
const a = group[i], b = group[j];
pairs++;
const names = new Set([...a.values.keys(), ...b.values.keys()]);
const differing = [...names].filter((n) => a.values.get(n) !== b.values.get(n));
if (!differing.length) {
identical.push(a.stamp + ' / ' + b.stamp + ' (' + law + ') — byte-identical constants');
continue;
}
const meaningful = differing.filter((n) => a.read.get(n) || b.read.get(n));
if (!meaningful.length) {
identical.push(a.stamp + ' / ' + b.stamp + ' (' + law + ') — differ only in ' +
differing.join(', ') + ', which nothing reads');
}
}
}
}
check('no two surfaces differ only in constants nothing reads',
identical.length === 0,
identical.length
? identical.length + ' pair(s) are the same variation wearing two addresses: ' +
identical.slice(0, 4).join(' · ')
: pairs + ' sibling pairs compared across ' + byLaw.size +
' laws, every pair differing in at least one constant that is read');
/* Stated, not failed: an unread constant is untidy, and only a DIFFERENCE in one is a
defect. TAU is declared and unread in every generated surface and identical in all of
them, so it creates no false distinction — saying so is more useful than failing it. */
const unread = new Map();
for (const s of surfaces) {
for (const [n, r] of s.read) if (!r) unread.set(n, (unread.get(n) || 0) + 1);
}
check('unread constants are reported, not failed', true,
unread.size
? [...unread].map(([n, c]) => n + ' in ' + c + ' surface(s)').join(' · ') +
' — harmless while identical everywhere; a defect only where siblings differ in one'
: 'every declared constant is read somewhere');
let failed = 0;
for (const r of results) {
if (!r.ok) failed++;
console.log((r.ok ? 'PASS ' : 'FAIL ') + r.n + '\n ' + r.d);
}
console.log('\n' + (results.length - failed) + '/' + results.length + ' passed' +
(MUTATE ? ' (--mutate: a sibling differing only in an unread constant must be caught)' : ''));
console.log('END OF REPORT - ' + results.length + ' checks');
process.exit(MUTATE ? 0 : failed ? 1 : 0);