GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Automation and CI / cvaa / tools

CVAA Selftest and 1 more file

A JavaScript module in the tools folder that reads legal evidence, serial release cutter, classification and promotion authority, using SHA-256.

519 lines of JavaScript and YAML from cvaa, data-centres-gb, in 2 files. Topic: Automation and CI. Section 1693 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. CVAA Selftest render · cvaa / tools/selftest.mjs lines 1–370
  2. Data Centres Intelligence Candidate Workflow automation · data-centres-gb / .github/workflows/202608271727-data-centres-intelligence-candidate.yml lines 1–149

CVAA Selftest

A JavaScript module in the tools folder that reads legal evidence, serial release cutter, classification and promotion authority, using SHA-256.

rendercvaa / tools/selftest.mjs · lines 1–370 of 370 · Entry point

What it does
It loads legal evidence, serial release cutter, classification and promotion authority. Defines 6 functions or classes, including w, gitify, legalFixture, CLEAN, run. Uses libraries node:fs, node:path, node:url, node:os, node:child_process. Side effects: changes the web page (DOM); reads or writes files; starts processes; uses storage (browser storage, DuckDB or Parquet).
Why it exists in the grid workflow
Domain stage agent_infra (repository name word 'cvaa'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
Inputs & outputs
In: JSON file legal-evidence.json; JSON file serial-release-cutter.json; JSON file source-classification.json; JSON file promotion-authority.json; JSON file observers.json; JSON file site-tile.json; JSON file gpu-reuse.json; JSON file star.json.
Downstream impact
Used directly by 2 files: CVAA Inoculate Workflow (cvaa); CVAA Selftest Workflow (cvaa).
What it achieves
It is built from the gitify step (`gitify`), the legal fixture helper (`legalFixture`) and the run step (`run`). Every antibody must fire on its diseased fixture and stay silent on a clean one. Its code works with 100 kW.
Why it matters
Run by CVAA Inoculate Workflow and CVAA Selftest Workflow.
Application
cvaa · tools · JavaScript module
Uses
node:fs, node:path, node:url, node:os, node:child_process, node:crypto
Used by
run by CVAA Inoculate Workflow (workflow run), run by CVAA Selftest Workflow (workflow run)
Produces
w, gitify, legalFixture, CLEAN, run, seedGpu
Defines here
w, gitify, legalFixture, CLEAN, run, seedGpu
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
cvaa@dc04524c4df79e90642b8b7c00729e67cdf52855 tools/selftest.mjs:1-370 · blob 203187f696b2ec6c6423fd2ba0a4af04d84e8af9 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem, process, storage · domain stage: agent_infra · users: ai_agent · canonical: unknown
// cvaa/tools/selftest.mjs — every antibody must fire on its diseased fixture and stay silent on a clean one.
import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, existsSync, rmSync, readdirSync, copyFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { tmpdir } from 'node:os';
import { execSync } from 'node:child_process';
import { createHash } from 'node:crypto';
const here = dirname(dirname(fileURLToPath(import.meta.url)));
const w = (root, p, s) => { mkdirSync(join(root, p, '..'), { recursive: true }); writeFileSync(join(root, p), s); };
const OID = '0'.repeat(40);
const HASH = '0'.repeat(64);
// Declared here, not beside the baseline block below, because history-level fixtures need it
// while the DISEASED table is being seeded - a const referenced before its line is a TDZ error.
const gitify = (root, generation = '202608301700', extra = []) => {
  execSync('git init -q && git config user.name selftest && git config user.email selftest@example.invalid && git add . && git commit -q -m "' + generation + ': fixture"', { cwd: root, stdio: 'pipe' });
  for (const subject of extra) execSync('git commit -q --allow-empty -m ' + JSON.stringify(subject), { cwd: root, stdio: 'pipe' });
};
const legalFixture = () => JSON.parse(readFileSync(join(here, 'tools/fixtures/legal-evidence.json'), 'utf8'));
const CLEAN = root => {
  w(root, '.cvaa/contracts/legal-evidence.json', JSON.stringify(legalFixture()));
  w(root, 'README.md', '# clean');
  w(root, '.github/workflows/202608301321-scope-loop.yml', 'on:\n  schedule:\n    - cron: "*/30 * * * *"\n  workflow_dispatch:\npermissions:\n  contents: read\njobs:\n  a:\n    timeout-minutes: 10\n    steps:\n      - uses: actions/checkout@0000000000000000000000000000000000000000\n        with:\n          fetch-depth: 0\n      - run: node inoculate.mjs || exit 0\n');
  // A workflow that only MENTIONS cvaa, in a comment, and runs something
  // else. full-history-checkout must scope by invocation, not by mention:
  // gridatlas's cartridge proof began failing the moment someone
  // documented why its actions were pinned.
  w(root, '.github/workflows/cvaa-mention.yml', '# cvaa reported three of them here\non: push\npermissions:\n  contents: read\njobs:\n  a:\n    timeout-minutes: 10\n    steps:\n      - uses: actions/checkout@0000000000000000000000000000000000000000\n      - run: node tools/proofs/run-current.mjs\n');
  w(root, 'scope-of-works/202608301321-a.md', '---\nstatus: done\nscope: 1\nexecutor: script\n---\n');
  w(root, '.cvaa/contracts/serial-release-cutter.json', JSON.stringify({
    schema: 'cvaa.serial-release-cutter.v1', execution: 'serial', no_op: 'reject',
    same_input_replay: 'same-release', divergent_reuse: 'reject',
    expected_parent: OID, input_sha256: HASH,
  }));
  w(root, '.cvaa/contracts/source-classification.json', JSON.stringify({
    schema: 'cvaa.source-classification.v1', expected_ref: OID, checkout_ref: OID,
    current_ref: OID, buffer_sha256: HASH, classified_sha256: HASH,
    receipt_sha256: HASH, source_reads: 1, outcome: 'not-applicable', status: 'pass',
  }));
  w(root, '.cvaa/contracts/promotion-authority.json', JSON.stringify({
    schema: 'cvaa.promotion-authority.v1',
    build: { branch_only: true, permissions: 'read', may_promote: false },
    promotion: { explicit_dispatch: true, authority: 'codex CEO lane', may_push_main: true },
  }));
  w(root, '.cvaa/contracts/observers.json', JSON.stringify({
    schema: 'cvaa.observers.v1',
    observers: [{ name: 'snapshot reader', input: 'snapshot', data_only: true, executes_target_code: false, side_effects: [] }],
  }));
};
const DISEASED = {
  'legal-evidence-screening': root => {
    const document = legalFixture();
    document.claim.actor = 'synthetic developer without recorded authority';
    w(root, '.cvaa/contracts/legal-evidence.json', JSON.stringify(document));
  },
  'site-tile-stream': r => w(r, '.cvaa/contracts/site-tile.json', JSON.stringify({
    schema: 'cvaa.site-tile.v1', tile_m: 256, gap_s: 10, daily_cap: 500, fetch_on: ['arrival', 'movement'],
    bulk: true, raw_store: { kind: 'mirror' }, receipt_fields: ['tile'], survey_year_gate: 'none',
    no_ground: 'zero-fill', in_ci: true,
  })),
  'gpu-reuse-before-new-infrastructure': r => w(r, '.cvaa/gpu-reuse.json', '{}'),
  'dead-ends-explained': r => w(r, 'spider/manifest.json', '{"graphs":["fixture"]}'),
  'star-grammar': r => {
    w(r, 'star.json', '{}');
    w(r, 'index.html', '<main>solar star</main><script>Math.random()</script>');
  },
  'grid-first-critical-path': r => w(r, '.cvaa/contracts/grid-first-critical-path.json', '{}'),
  'runtime-endpoint-contract': r => w(r, '.cvaa/contracts/runtime-endpoints.json', JSON.stringify({
    schema: 'cvaa.runtime-endpoints.v1', build: 'fixture', environment: 'local',
    required: [{ method: 'GET', path: '/receipt', status: 200 }],
    probes: [{ method: 'GET', path: '/receipt', status: 404, bodyValidated: false, build: 'fixture', environment: 'local' }],
  })),
  'one-active-scope': r => { w(r, 'scope-of-works/202608301321-a.md', '---\nstatus: active\nscope: 1\n---\n'); w(r, 'scope-of-works/202608301322-b.md', '---\nstatus: active\nscope: 2\n---\n'); },
  'no-app-copies': r => { mkdirSync(join(r, 'atlas'), { recursive: true }); mkdirSync(join(r, '202608300453-atlas-v9'), { recursive: true }); },
  'no-per-release-workflows': r => w(r, '.github/workflows/202608300453-promote.yml', 'on: push\n'),
  'no-expiry-windows': r => w(r, '.github/workflows/202608300453-x.yml', 'env:\n  MISSION_EXPIRES_AT: 2026\n'),
  'self-terminating-loops': r => w(r, '.github/workflows/202608300453-x.yml', 'on:\n  schedule:\n    - cron: "0 * * * *"\njobs: {}\n'),
  'chaining-token': r => w(r, '.github/workflows/202608300453-x.yml', 'steps:\n  - run: git push\n'),
  'pointer-verifies': r => w(r, 'atlas/current.json', '{"release_id":"202608300453-atlas-v9","cartridges":[]}'),
  'derived-state-not-authored': r => w(r, 'STATE.md', 'hand written'),
  'context-diet': r => w(r, '.github/workflows/202608300453-x.yml', 'steps:\n  - with:\n      prompt: |\n        read a.md b.md c.md d.md e.json\n'),
  'rollback-exists': r => { w(r, 'atlas/current.json', '{"release_id":"x"}'); w(r, '.github/workflows/202608300453-x.yml', 'run: echo > atlas/current.json\n'); },
  'release-name-convention': r => w(r, 'index.html', 'const AREAS = [\n  { name:"Pipeline News — 202608260159", url:"./a/" },\n  { name:"Pipeline News — 202608291447", url:"./b/" },\n  { name:"Pipeline News — Project Intelligence 202608311343", url:"./c/" }\n];\n'),
  'page-data-block-parses': r => w(r, 'index.html', 'const AREAS = [\n  { name:"A", url:"./a/" },\n  { name:"B, url:"./b/" }\n];\n'),
  'pinned-actions': r => w(r, '.github/workflows/202608300453-x.yml', 'steps:\n  - uses: actions/checkout@v4\n'),
  'least-permissions': r => w(r, '.github/workflows/202608300453-x.yml', 'on: push\njobs: {}\n'),
  'agent-quarantine': r => w(r, '.github/workflows/202608300453-x.yml', 'steps:\n  - uses: anthropics/claude-code-action@v1\n    with:\n      prompt: do things\n'),
  'vocabulary': r => w(r, 'scope-of-works/202608301321-a.md', '---\nstatus: closed\nscope: 1\n---\n'),
  'serial-release-cutter': r => w(r, '.cvaa/contracts/serial-release-cutter.json', '{}'),
  'source-receipt-classification': r => w(r, '.cvaa/contracts/source-classification.json', JSON.stringify({
    schema: 'cvaa.source-classification.v1', expected_ref: OID, checkout_ref: '1'.repeat(40),
    current_ref: OID, buffer_sha256: HASH, classified_sha256: '1'.repeat(64),
    receipt_sha256: HASH, source_reads: 2, outcome: 'unknown', status: 'pass',
  })),
  'promotion-authority-separated': r => w(r, '.cvaa/contracts/promotion-authority.json', JSON.stringify({
    schema: 'cvaa.promotion-authority.v1',
    build: { branch_only: true, permissions: 'write', may_promote: true },
    promotion: { explicit_dispatch: false, authority: '', may_push_main: true },
  })),
  'observer-data-only': r => w(r, '.cvaa/contracts/observers.json', JSON.stringify({
    schema: 'cvaa.observers.v1',
    observers: [{ name: 'unsafe observer', input: 'repository', data_only: false, executes_target_code: true, side_effects: ['write'] }],
  })),
  'registry-integrity': null, 'no-dangerous-apis': null,   // registry-level: covered by the runner's fail-closed load
  'monotonic-utc-generations': null,
  // History-level, and fixturable: gitify gives the fixture a real commit graph. The scope ledger
  // declares generation 202608301321; the second commit stamps a later generation that no scope
  // file claims, so it must be reported. Its subject is a real gridatlas subject, and it contains
  // the word "drill" on purpose - under the removed prose exemption this fixture stayed SILENT,
  // which is what makes it a control rather than a restatement of code that already passes.
  'on-ledger-commits': r => {
    w(r, 'scope-of-works/202608301321-a.md', '---\ngeneration: "202608301321"\nstatus: done\nscope: 1\nexecutor: script\n---\n');
    gitify(r, '202608301321', ['202608301822: record A-roads forensic drill request']);
  },
  'rollback-exercised': r => {
    w(r, 'atlas/current.json', '{"release_id":"202608300453-atlas-v9"}');
    w(r, 'atlas/state/rollback-drills.json', '{"drills":[{"at":"202609030100","release_id":"202608300453-atlas-v9","outcome":"failed: pointer would not move"}]}');
  }, 'attestation-freshness': r => {
    w(r, 'atlas/current.json', '{"generation":"202609030234","release_id":"202608300453-atlas-v9"}');
    w(r, 'atlas/state/live-set.json', '{"generation":"202608292311","release_id":"202608292311-atlas-v9"}');
  },  // history-level: need a git repo; covered by tools/replay.mjs evidence in studies/
  'no-time-based-gates': r => w(r, '.github/workflows/202608300453-x.yml', 'env:\n  MISSION_EXPIRES_AT: 2026\n'),
  'executor-declared': r => w(r, 'scope-of-works/202608301322-b.md', '---\nstatus: done\nscope: 2\n---\n'),
  'loop-exists': r => w(r, '.github/workflows/202608301321-scope-loop.yml', 'on:\n  workflow_dispatch:\npermissions:\n  contents: read\njobs:\n  a:\n    timeout-minutes: 5\n    steps:\n      - run: echo || exit 0\n'),
  'full-history-checkout': r => { w(r, '.git/shallow', '0000000000000000000000000000000000000000\n'); w(r, '.github/workflows/202608301720-cvaa.yml', 'steps:\n  - uses: actions/checkout@0000000000000000000000000000000000000000\n  - run: node cvaa/inoculate.mjs .\n'); },
  // A store that is present and incomplete. Session aaaa converted 4871 of 5092 lines -
  // the hole a query can never see - and session bbbb is named by the manifest with no
  // file behind it. Both are structural: nothing here is decided from prose.
  'memory-store-complete': r => {
    w(r, 'logs/parquet/session_aaaa.parquet', 'PAR1');
    w(r, 'logs/reports/memory-manifest.json', JSON.stringify({
      generation: '202609031019',
      sessions: [
        { session_id: 'aaaa', project: 'claude', parquet_file: 'logs/parquet/session_aaaa.parquet', source_lines: 5092, distinct_source_lines: 4871, rows: 4871 },
        { session_id: 'bbbb', project: 'claude', parquet_file: 'logs/parquet/session_bbbb.parquet', source_lines: 300, distinct_source_lines: 300, rows: 300 },
      ],
    }));
  },
  'no-expiry-windows': null,   // superseded by no-time-based-gates
  // A live-mutation contract whose runtime receipt says the live page was never measured, yet asks to claim success.
  'observed-before-asserted': r => w(r, '.cvaa/contracts/observed-before-asserted.json', JSON.stringify({
    schema: 'cvaa.observed-before-asserted.v1', target: 'https://example.invalid/', expected_identity: 'v1',
    runtime_receipt: { measured: false }, claim_allowed: true,
  })),
  // The Kuiper editions (2 November 2026). A folder whose GREEN.md names one manifest while the folder carries another:
  // the a432b43 state, where the live tree had moved past the last green row before the release read it.
  'kuiper-belt-manifest-on-a-green-row': r => {
    w(r, 'editions/202611012135/modules.json', '{"schema":"kuiper.modules.v1","edition":"202611012135","order":["hello","line-card","see-through"],"modules":[]}\n');
    w(r, 'editions/202611012135/GREEN.md', '| G2 (row 3) | hello, line-card | `418ae14ca39bc92be028f852825da196fd634ec12bb48f8f538d0cf739564d05` | `be99c8a126ce691805e3b8deffb849f09ffdba49478c787cb217b03297e75752` |\n');
  },
  // A brief that teaches the lower-case flag. Assembled from parts so this file never carries the line itself.
  'neural-link-post-reads-the-file': r => w(r, 'BRIEF.md', 'Post with `gh api repos/o/r/issues/1/comments ' + '-' + 'f body=@file`.\n'),
  // A not-public list naming one made-up token, and a README that carries the token. The token is a fixture word.
  'kuiper-belt-no-private-names': r => {
    const tok = 'fixture-not-public-name', digest = createHash('sha256').update(tok).digest('hex').slice(0, 24);
    w(r, 'tools/check_proof.py', "NOT_PUBLIC = {'" + digest + "'}\n");
    w(r, 'README.md', '# clean\nthe register of ' + tok + ' is kept here\n');
  },
  // A pointer that named a folder in one commit, and a later commit that edited the folder.
  'kuiper-belt-released-folder-frozen': r => {
    w(r, 'editions/index.html', '<meta http-equiv="refresh" content="0; url=202611012135/">\n');
    w(r, 'editions/202611012135/index.html', "const KY_EDITION = '202611012135';\n");
    gitify(r, '202611012135');
    w(r, 'editions/202611012135/index.html', "const KY_EDITION = '202611012135'; // edited after release\n");
    execSync('git add . && git commit -q -m "edit a released folder"', { cwd: r, stdio: 'pipe' });
  },
  // A page stamped for the new folder whose drift.json still carries the previous edition's stamp.
  'kuiper-belt-data-stamp-is-the-page-stamp': r => {
    w(r, 'editions/202611020326/index.html', "const KY_EDITION = '202611020326';\n");
    w(r, 'editions/202611020326/modules.json', '{"schema":"kuiper.modules.v1","edition":"202611020326","order":[],"modules":[]}\n');
    w(r, 'editions/202611020326/data/drift.json', '{"schema":"kuiper.drift.v1","edition":"202611012135"}\n');
  },
  // A record whose writes entry is a sentence.
  'kuiper-belt-record-paths-not-prose': r => w(r, 'editions/202611020528/modules.json', JSON.stringify({
    schema: 'kuiper.modules.v1', edition: '202611020528', order: ['drift'],
    modules: [{ id: 'drift', reads: ['data/drift.json'], writes: ['#ky-drift', '#hud (one DRIFT line per frame, appended)'] }],
  }) + '\n'),
  // A wafer estate whose coupling is asserted: two keys, one twin, rate 0.5, undated.
  'quantum-star-protocol': r => {
    w(r, 'QUANTUM-STAR-PROTOCOL.md', '# fixture\n');
    w(r, 'keys.json', '{"count":2,"max_key":2,"keys":[1,2]}');
    w(r, 'entangle.json', '{"keys":2,"places":1,"resolved":1,"broken":1,"broken_keys":[2],"rate":0.5}');
    w(r, 'wafer/pilot.mjs', 'const big = rv.unit === "kW" && rv.value > 100; if (big) say("above 100 kW: a chartered electrical engineer must sign");\n');
  },
  // A page that says the dots compute, in a repository where the proof has never run.
  // Multi-agent session records (owner-filed 2026-12-06 01:34 Europe/London, V1 to V10). One planted
  // SESSIONS/<session>/ folder per vaccine; the clean fixture has no SESSIONS/, so each reports a skip there.
  'brief-in-repo-before-spawn': r => w(r, 'SESSIONS/s/ROSTER.md', 'AGENT-01 | player | /tmp/vk/1/ | 15:00Z\n'),
  'handback-has-two-anchors': r => { w(r, 'SESSIONS/s/RELAY-LOG.md', '- 2026-12-05 16:00 UTC | AGENT-01 | FINDING | 0123456789abcdef |\n'); w(r, 'SESSIONS/s/CARRY/OUTBOX-SNAPSHOT/AGENT-02.md', '[AGENT-02 -> ALL]\nTYPE: HANDOFF\n'); },
  'decision-is-a-dated-signed-record': r => w(r, 'SESSIONS/s/DECISIONS.md', '| D1 | licence wording | owner | UNTRACKED cosmic file |\n'),
  'continuity-first-2048': r => w(r, 'SESSIONS/s/CONTINUITY.md', '# continuity\n' + 'x'.repeat(2100) + '\n<!-- CVAA:CONTINUITY:START -->\nmain abc1234\n<!-- CVAA:CONTINUITY:END -->\n'),
  'one-committer-per-tree': r => w(r, 'SESSIONS/s/ROSTER.md', 'AGENT-01 | sole cosmic committer | repo/a | 15:00Z\nAGENT-02 | sole cosmic committer | repo/b | 15:01Z\n'),
  'no-tmp-as-evidence': r => w(r, 'SESSIONS/s/DECISIONS.md', '| D1 | 2026-12-05 21:00 | rule | owner | /tmp/vk/brief.md |\n'),
  'working-tree-is-not-memory': r => w(r, 'SESSIONS/s/CONTINUITY.md', '# continuity\nIn flight: five agents.\n'),
  'grid-first-for-agents': r => w(r, 'SESSIONS/s/PLAN.md', '# plan\n1. New ticker module.\n2. Advisor: the Earth radius is wrong.\n'),
  'live-means-read-back': r => w(r, 'SESSIONS/s/CONTINUITY.md', '- main abc1234, live abc1234\n'),
  'unknown-never-zero-in-records': r => w(r, 'SESSIONS/s/RELAY-LOG.md', '- relay round: 0 messages\n'),
  'cells-compute-or-say-programmable': r => {
    w(r, 'index.html', '<html><body><p>Every one of the dots computes the fault current of the network.</p></body></html>\n');
  },
  // The trillion loop: one planted instance of each of the nine at once, so the vaccine is
  // exercised by a case that fails as well as by the clean fixture, which is the case that
  // passes. That is the vaccine's own D4, and the block further down asserts every dose by name.
  'trillion-loop': r => {
    w(r, 'tools/counter.py', [
      'import os', 'import sys', '',
      'TOTAL_MAX = 1500.0',
      '',
      'def total(rows):',
      '    cases = 0',
      '    for run in rows:',
      '        cases += run.get("cases", 0)',
      '    print("verified: 0 differ on %d rows" % len(rows))',
      '    return cases',
      '',
      'def gate(feed):',
      '    if not os.path.exists(feed):',
      '        return {}',
      '    return {"clause": "PASS"}',
      '',
      'def main():',
      '    ok = gate("STANDARDS.md")',
      '    print("PASS" if ok else "FAIL")',
      '    print("PUBLISHED")',
      '    sys.exit(0)',
      '',
    ].join('\n'));
    w(r, 'RESULTS.md', [
      '# results', '',
      'Verified 0 differ on 200000 cases.', '',
      '31292801587800 cases from 48 runs of the same lattice.', '',
    ].join('\n'));
    // assembled from parts at run time, so this file itself carries no home-directory path
    // and names nobody; the fixture it writes carries the shape D8 looks for.
    w(r, 'NOTES.txt', 'artefacts live at ' + ['C', ':', '\\', 'Users', '\\', 'someone', '\\', 'repo'].join('') + '\n');
  },
};
execSync(`node ${join(here, 'tools', 'grid-first-critical-path.test.mjs')}`, { stdio: 'inherit' });
execSync(`node ${join(here, 'tools', 'generation-correction.test.mjs')}`, { stdio: 'inherit' });
execSync(`node ${join(here, 'tools', 'gpu-reuse.test.mjs')}`, { stdio: 'inherit' });
let failed = 0;
const registryNames = readdirSync(join(here, 'vaccines')).filter(file => file.endsWith('.md')).map(file => file.replace(/^\d{12}-/, '').replace(/\.md$/, ''));
for (const name of registryNames) if (!(name in DISEASED)) { console.error(`selftest fixture missing for ${name}`); failed++; }
for (const name of Object.keys(DISEASED)) if (!registryNames.includes(name)) { console.error(`selftest fixture has no vaccine: ${name}`); failed++; }
const run = root => { try { return execSync(`node ${join(here, 'inoculate.mjs')} ${root} --no-lock --no-write`, { stdio: 'pipe' }).toString(); } catch (e) { return e.stdout.toString(); } };
const clean = mkdtempSync(join(tmpdir(), 'cvaa-clean-')); CLEAN(clean);
const cleanOut = run(clean);
for (const line of cleanOut.split('\n')) if (/^FAIL/.test(line)) { console.error(`clean fixture flagged: ${line}`); failed++; }
// Exercise the real bounded snapshot and sandbox, not only the antibody function.
const gpu = mkdtempSync(join(tmpdir(), 'cvaa-gpu-reuse-')); CLEAN(gpu);
const gpuName = 'gpu-reuse-before-new-infrastructure';
const gpuLinks = ['https://github.com/Ventusltd/cvaa/blob/main/vaccines/202609250037-gpu-reuse-before-new-infrastructure.md', '.cvaa/gpu-reuse.json', 'docs/GPU-INVENTORY.md', 'scripts/existing.py', 'receipts/existing.json'];
const gpuHeader = '# fixture\n<!-- CVAA:GPU-REUSE:START -->\n' + gpuLinks.map((link, i) => `[evidence ${i}](${link})`).join('\n') + '\n<!-- CVAA:GPU-REUSE:END -->\n';
const gpuDocument = {
  schema: 'cvaa.gpu-reuse.v1', inventory_sources: ['docs/GPU-INVENTORY.md'],
  implementations: [{ script: 'scripts/existing.py', receipt: 'receipts/existing.json' }],
  workload_scope: 'Fixture array workload only; no browser acceleration claim.',
  decision: { mode: 'reuse', reason: 'Existing fixture numerical batches fit the requested workload.' },
  runner_status: { checked_at: '2026-09-25T00:37:00Z', source: 'docs/GPU-INVENTORY.md', status: 'Unknown; no accessible runner observation.' },
};
const seedGpu = () => {
  w(gpu, 'README.md', gpuHeader);
  w(gpu, '.cvaa/gpu-reuse.json', JSON.stringify(gpuDocument));
  w(gpu, 'docs/GPU-INVENTORY.md', '# Existing process\nRunner state unknown in fixture.');
  w(gpu, 'scripts/existing.py', '# historical implementation fixture');
  w(gpu, 'receipts/existing.json', '{"fixture":true}');
};
seedGpu();
if (!new RegExp(`^immune\\s+${gpuName}`, 'm').test(run(gpu))) { console.error('healthy GPU evidence trail failed'); failed++; }
for (const [label, mutate] of [
  ['missing inventory', () => rmSync(join(gpu, 'docs/GPU-INVENTORY.md'))],
  ['empty inventory', () => w(gpu, 'docs/GPU-INVENTORY.md', '')],
  ['missing README entry', () => w(gpu, 'README.md', '# fixture')],
  ['entry beyond 2048 bytes', () => w(gpu, 'README.md', 'x'.repeat(2048) + gpuHeader)],
  ['invalid JSON', () => w(gpu, '.cvaa/gpu-reuse.json', '{')],
  ['oversize JSON', () => w(gpu, '.cvaa/gpu-reuse.json', JSON.stringify({ ...gpuDocument, padding: 'x'.repeat(65536) }))],
  ['deleted metadata', () => rmSync(join(gpu, '.cvaa/gpu-reuse.json'))],
]) {
  seedGpu(); mutate();
  if (!new RegExp(`^FAIL\\s+${gpuName}`, 'm').test(run(gpu))) { console.error(`GPU reuse did not reject ${label}`); failed++; }
}
rmSync(gpu, { recursive: true, force: true });
for (const [name, seed] of Object.entries(DISEASED)) {
  if (!seed) { console.log(`skip   ${name} (registry-level, history-level or superseded)`); continue; }
  const root = mkdtempSync(join(tmpdir(), `cvaa-${name}-`)); CLEAN(root); seed(root);
  const out = run(root);
  const fired = new RegExp(`^(FAIL|WARN)\\s+${name}`, 'm').test(out);
  console.log(`${fired ? 'fires ' : 'SILENT'} ${name}`);
  if (!fired) failed++;
  rmSync(root, { recursive: true, force: true });
}
// A vaccine with nine doses is nine rules, and a rule nothing exercises is a decoration - the
// disease D4 names. The clean fixture above is the case that passes; this is the case that fails,
// and every dose must name itself in the output or the registry is lying about its coverage.
const nine = mkdtempSync(join(tmpdir(), 'cvaa-nine-')); CLEAN(nine); DISEASED['trillion-loop'](nine);
const nineOut = run(nine);
for (let d = 1; d <= 9; d++) if (!new RegExp(`- D${d} `).test(nineOut)) { console.error(`trillion-loop dose D${d} did not fire on the planted fixture`); failed++; }
rmSync(nine, { recursive: true, force: true });

// Machine-output contract.
try {
  const jsonOut = execSync(`node ${join(here, 'inoculate.mjs')} ${clean} --no-lock --no-write --json`, { stdio: 'pipe' }).toString();
  const line = jsonOut.split('\n').find(value => value.startsWith('{"schema":"cvaa.run.v1"'));
  const parsed = JSON.parse(line || '{}');
  if (parsed.schema !== 'cvaa.run.v1' || parsed.shallow !== false || !Array.isArray(parsed.results)) throw new Error('invalid JSON run contract');
} catch (error) { console.error(`JSON contract failed: ${error.message}`); failed++; }

// cvaa must never execute code the TARGET owns. A repository under inspection is
// not trusted - that is why every antibody runs sandboxed - yet the context builder
// used to run `node tools/scope/loop.mjs state --stdout` with cwd set to the target,
// outside all of it, and it did so under --no-write. Demonstrated rather than
// asserted: this target's loop.mjs writes a marker, and the marker must not appear.
const hostile = mkdtempSync(join(tmpdir(), 'cvaa-hostile-')); CLEAN(hostile);
w(hostile, 'STATE.md', '# STATE\ngenerated whenever\n');
w(hostile, 'tools/scope/loop.mjs', "import { writeFileSync } from 'node:fs';\nwriteFileSync('EXECUTED-TARGET-CODE', 'x');\n");
let hostileOut = '';
try { hostileOut = execSync(`node ${join(here, 'inoculate.mjs')} ${hostile} --no-lock --no-write`, { stdio: 'pipe' }).toString(); }
catch (error) { hostileOut = (error.stdout || '').toString(); }
if (existsSync(join(hostile, 'EXECUTED-TARGET-CODE'))) { console.error('cvaa executed target-owned code'); failed++; }
// And the rule that needed that output must say it could not evaluate, rather than
// return [] and print `immune` - a skip is not a pass.
if (!/^skip\s+derived-state-not-authored/m.test(hostileOut)) { console.error('derived-state-not-authored reported a verdict it could not reach'); failed++; }
rmSync(hostile, { recursive: true, force: true });

// A memory store with no manifest is the case the rule must refuse to answer. Counting
// parquet files would let it print `immune` over a store missing ten of eleven sessions,
// because the sessions that were never converted leave nothing behind to count.
const unmanifested = mkdtempSync(join(tmpdir(), 'cvaa-nomanifest-')); CLEAN(unmanifested);
w(unmanifested, 'logs/parquet/session_aaaa.parquet', 'PAR1');
if (!/^skip\s+memory-store-complete/m.test(run(unmanifested))) { console.error('memory-store-complete reported a verdict over a store it could not audit'); failed++; }
rmSync(unmanifested, { recursive: true, force: true });

// A HEALTHY store where rows exceed source lines, which is normal and must stay silent.
// One transcript line carrying three images and a caption becomes four rows - that is
// what the converter's block_no column is for. This rule was first written asserting
// rows === source_lines; claude's session_9556e57d is 2360 rows over 2356 complete
// lines, so that invariant would have fired forever on a healthy store, and the only
// way to satisfy it would have been to make the converter discard content blocks.
const blocky = mkdtempSync(join(tmpdir(), 'cvaa-blocks-')); CLEAN(blocky);
w(blocky, 'logs/parquet/session_cccc.parquet', 'PAR1');
w(blocky, 'logs/reports/memory-manifest.json', JSON.stringify({
  generation: '202609031019',
  sessions: [{ session_id: 'cccc', project: 'claude', parquet_file: 'logs/parquet/session_cccc.parquet', source_lines: 2356, distinct_source_lines: 2356, rows: 2360 }],
}));
if (!/^immune\s+memory-store-complete/m.test(run(blocky))) { console.error('memory-store-complete flagged a complete store for expanding blocks into rows'); failed++; }
rmSync(blocky, { recursive: true, force: true });

// Baseline generator preserves policy, refuses fail-closed findings and never widens a ratchet.
const baseline = mkdtempSync(join(tmpdir(), 'cvaa-baseline-')); CLEAN(baseline); DISEASED['chaining-token'](baseline);
w(baseline, '.github/workflows/unpinned.yml', 'jobs:\n  x:\n    steps:\n      - uses: actions/checkout@v4\n');
w(baseline, 'cvaa.json', JSON.stringify({ custom: 'keep', allow: [{ vaccine: 'pinned-actions', max: 9, expires: '2099-01-01' }] }, null, 2) + '\n');
gitify(baseline);
try { execSync(`node ${join(here, 'inoculate.mjs')} ${baseline} --no-lock --no-write --baseline-write`, { stdio: 'pipe' }); } catch (error) { console.error(`baseline writer unexpectedly failed: ${error.stderr || error.message}`); failed++; }
try {
  const config = JSON.parse(readFileSync(join(baseline, 'cvaa.json'), 'utf8'));
  const item = config.allow?.find(value => value.vaccine === 'chaining-token');
  const warning = config.allow?.find(value => value.vaccine === 'pinned-actions');
  if (config.custom !== 'keep' || !item || item.max !== 1 || !/^\d{4}-\d{2}-\d{2}$/.test(item.expires) || warning?.max !== 1 || warning?.expires !== '2099-01-01') throw new Error('baseline preservation or entry missing');
} catch (error) { console.error(`baseline contract failed: ${error.message}`); failed++; }
const beforeGrowth = readFileSync(join(baseline, 'cvaa.json'), 'utf8');
w(baseline, '.github/workflows/202608301702-second-push.yml', 'jobs:\n  x:\n    steps:\n      - run: git push\n');
execSync('git add . && git commit -q -m "202608301702: grow fixture debt"', { cwd: baseline, stdio: 'pipe' });
let growthRejected = false;
try { execSync(`node ${join(here, 'inoculate.mjs')} ${baseline} --no-lock --no-write --baseline-write`, { stdio: 'pipe' }); } catch (error) { growthRejected = /ratchets never widen/.test(String(error.stderr || '')); }
if (!growthRejected || readFileSync(join(baseline, 'cvaa.json'), 'utf8') !== beforeGrowth) { console.error('baseline writer widened or rewrote a ratchet'); failed++; }
const bad = mkdtempSync(join(tmpdir(), 'cvaa-bad-history-')); CLEAN(bad); w(bad, '.github/workflows/202608301720-cvaa.yml', 'steps:\n  - uses: actions/checkout@0000000000000000000000000000000000000000\n  - run: node inoculate.mjs .\n'); gitify(bad, '202608301703');
try { execSync(`node ${join(here, 'inoculate.mjs')} ${bad} --no-lock --no-write --baseline-write`, { stdio: 'pipe' }); } catch {}
if (existsSync(join(bad, 'cvaa.json'))) { console.error('baseline writer grandfathered full-history-checkout'); failed++; }
for (const root of [clean, baseline, bad]) rmSync(root, { recursive: true, force: true });
console.log(failed ? `\n${failed} antibody problem(s)` : '\nall antibodies fire on disease and stay silent on health');
process.exit(failed ? 1 : 0);

Data Centres Intelligence Candidate Workflow

A GitHub Actions workflow in Data Centres GB that builds and publishes the site. Runs by hand.

automationdata-centres-gb / .github/workflows/202608271727-data-centres-intelligence-candidate.yml · lines 1–149 of 149 · version 2026-08-27 17:27 · Entry point

What it does
It builds and publishes its content. Side effects: starts processes; uses storage (browser storage, DuckDB or Parquet).
Inputs & outputs
In: JSON file 202608271727-data-centres-intelligence.json; JSON file 202608271727-repository-context.json; JSON file 202608271727-data-centres-intelligence-source.json; Parquet file part-000.parquet; JSON file 202608271727-pipelinenews-data-centres.json; JSON file 202608271727-data-centres-intelligence-audit.json; DuckDB queries. Out: commits pushed to the repository.
Downstream impact
It is itself an entry point (workflow); no other file was found loading it.
What it achieves
Runs `build/python/202608271727-build-data-centres-intelligence.py` and `build/python/202608271727-verify-data-centres-intelligence.py`.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
data-centres-gb · .github/workflows · workflow
Uses
Test Data Centres Intelligence (workflow run)
Used by
none found
Produces
none declared
Defines here
202608271727 · DATA_CENTRES intelligence candidate
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
data-centres-gb@12c24a653e9d4eb3507857fd6e6d169b2dd1ff63 .github/workflows/202608271727-data-centres-intelligence-candidate.yml:1-149 · blob 20ac4a4473c3499cd46f47af7fdee14b583fcf42 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: ingest · effects: process, storage · domain stage: unknown · users: none · canonical: supporting_data
name: "202608271727 · DATA_CENTRES intelligence candidate"

on:
  workflow_dispatch:

permissions:
  contents: write

concurrency:
  group: data-centres-intelligence-202608271727
  cancel-in-progress: false

env:
  GENERATION: "202608271727"
  DUCKDB_VERSION: "1.3.2"
  CANDIDATE_BRANCH: "candidate/202608271727"
  PARENT_COMMIT: "0939e3c735f4c9cacefb3acad00b35b6e07e62c2"

jobs:
  build-verify-quarantine:
    runs-on: ubuntu-24.04
    timeout-minutes: 20
    steps:
      - name: Check out exact workflow source
        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
        with:
          fetch-depth: 0

      - name: Set up pinned Python
        uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
        with:
          python-version: "3.12"

      - name: Install pinned analytical engine
        run: python -m pip install --disable-pip-version-check "duckdb==${DUCKDB_VERSION}"

      - name: Assert main, exact parent and exact seven-file source boundary
        shell: bash
        run: |
          set -euo pipefail
          test "${GITHUB_REF}" = "refs/heads/main"
          test "$(git rev-parse HEAD)" = "${GITHUB_SHA}"
          read -r -a ancestry <<< "$(git rev-list --parents -n 1 "${GITHUB_SHA}")"
          test "${#ancestry[@]}" -eq 2
          test "${ancestry[1]}" = "${PARENT_COMMIT}"
          expected=(
            ".github/workflows/202608271727-data-centres-intelligence-candidate.yml"
            "build/python/202608271727-build-data-centres-intelligence.py"
            "build/python/202608271727-verify-data-centres-intelligence.py"
            "contracts/202608271727-data-centres-intelligence.json"
            "data/source-fixtures/202608271727-repository-context.json"
            "manifests/202608271727-data-centres-intelligence-source.json"
            "tests/test_202608271727_data_centres_intelligence.py"
          )
          mapfile -t expected_sorted < <(printf '%s\n' "${expected[@]}" | sort)
          mapfile -t actual < <(git diff --name-only --diff-filter=ACDMRTUXB "${PARENT_COMMIT}" "${GITHUB_SHA}" | sort)
          diff -u <(printf '%s\n' "${expected_sorted[@]}") <(printf '%s\n' "${actual[@]}")
          test -z "$(git status --porcelain=v1)"
          python build/python/202608271727-build-data-centres-intelligence.py doctor --root .

      - name: Run syntax and hostile semantic tests
        shell: bash
        env:
          PYTHONPYCACHEPREFIX: ${{ runner.temp }}/pycache
        run: |
          set -euo pipefail
          python -m py_compile \
            build/python/202608271727-build-data-centres-intelligence.py \
            build/python/202608271727-verify-data-centres-intelligence.py \
            tests/test_202608271727_data_centres_intelligence.py
          python -m unittest -v tests/test_202608271727_data_centres_intelligence.py

      - name: Compile twice in isolation
        shell: bash
        run: |
          set -euo pipefail
          python build/python/202608271727-build-data-centres-intelligence.py build \
            --root . \
            --output-root "${RUNNER_TEMP}/candidate-a" \
            --source-commit "${GITHUB_SHA}"
          python build/python/202608271727-build-data-centres-intelligence.py build \
            --root . \
            --output-root "${RUNNER_TEMP}/candidate-b" \
            --source-commit "${GITHUB_SHA}"

      - name: Independently verify both closures and byte parity
        shell: bash
        run: |
          set -euo pipefail
          python build/python/202608271727-verify-data-centres-intelligence.py verify \
            --root "${RUNNER_TEMP}/candidate-a" \
            --source-root . \
            --expected-source-commit "${GITHUB_SHA}"
          python build/python/202608271727-verify-data-centres-intelligence.py verify \
            --root "${RUNNER_TEMP}/candidate-b" \
            --source-root . \
            --expected-source-commit "${GITHUB_SHA}"
          python build/python/202608271727-verify-data-centres-intelligence.py compare \
            --left "${RUNNER_TEMP}/candidate-a" \
            --right "${RUNNER_TEMP}/candidate-b"

      - name: Replace only the complete touched partition and land closure
        shell: bash
        run: |
          set -euo pipefail
          python build/python/202608271727-build-data-centres-intelligence.py land \
            --candidate-root "${RUNNER_TEMP}/candidate-a" \
            --destination-root . \
            --source-commit "${GITHUB_SHA}"
          python build/python/202608271727-verify-data-centres-intelligence.py verify \
            --root . \
            --source-root . \
            --expected-source-commit "${GITHUB_SHA}"

      - name: Assert immutable output-only boundary
        shell: bash
        run: |
          set -euo pipefail
          mapfile -t actual < <(git status --porcelain=v1 --untracked-files=all | cut -c4- | sort)
          expected=(
            "data/intelligence/generation=202608271727/section=DATA_CENTRES/part-000.parquet"
            "exports/202608271727-pipelinenews-data-centres.json"
            "reports/202608271727-data-centres-intelligence-audit.json"
          )
          mapfile -t expected_sorted < <(printf '%s\n' "${expected[@]}" | sort)
          diff -u <(printf '%s\n' "${expected_sorted[@]}") <(printf '%s\n' "${actual[@]}")

      - name: Commit quarantined immutable candidate branch
        shell: bash
        run: |
          set -euo pipefail
          git add -- \
            data/intelligence/generation=202608271727/section=DATA_CENTRES/part-000.parquet \
            exports/202608271727-pipelinenews-data-centres.json \
            reports/202608271727-data-centres-intelligence-audit.json
          mapfile -t staged < <(git diff --cached --name-only | sort)
          expected=(
            "data/intelligence/generation=202608271727/section=DATA_CENTRES/part-000.parquet"
            "exports/202608271727-pipelinenews-data-centres.json"
            "reports/202608271727-data-centres-intelligence-audit.json"
          )
          mapfile -t expected_sorted < <(printf '%s\n' "${expected[@]}" | sort)
          diff -u <(printf '%s\n' "${expected_sorted[@]}") <(printf '%s\n' "${staged[@]}")
          git config user.name "github-actions[bot]"
          git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
          export GIT_AUTHOR_DATE="2026-08-27T16:27:00Z"
          export GIT_COMMITTER_DATE="2026-08-27T16:27:00Z"
          git commit -m "202608271727: publish quarantined DATA_CENTRES intelligence candidate"
          git push origin "HEAD:refs/heads/${CANDIDATE_BRANCH}"