In this section
- Assign Licences ingest · cosmic / tools/licence/assign_licences.py lines 1–167
- Wafer storage · cosmic / tools/wafer.py lines 1–164
- Cosmic Regression other · cvaa / tools/seed-regression/cosmic_regression.mjs lines 1–103
- Exact Cosmic Target transform · cvaa / tools/seed-regression/exact_cosmic_target.mjs lines 1–19
Assign Licences
A Python command-line tool in the licence folder of Cosmic that works with readme line (`readme_line`), using SHA-256.
ingestcosmic / tools/licence/assign_licences.py · lines 1–167 of 167 · Entry point
- What it does
- It loads data. Defines git, readme_line, wrap, has_licence, main. Uses libraries argparse, hashlib, os, re, subprocess. Side effects: reads or writes files; starts processes.
- Inputs & outputs
- In: command-line arguments.
- Downstream impact
- It is itself an entry point (Python CLI); no other file was found loading it.
- What it achieves
- It is built from the git step (`git`), the wrap step (`wrap`) and the has licence helper (`has_licence`). Give every Ventusltd repository that has no licence the estate's licence. It accepts `--clones`, `--repos` and `--commit`.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- cosmic · tools/licence · Python CLI
- Uses
- argparse, hashlib, os, re, subprocess, sys
- Used by
- none found
- Produces
- git, readme_line, wrap, has_licence, main
- Defines here
- git, readme_line, wrap, has_licence, main
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- cosmic@51bebf892d63a617408bc5e25b270b9f893e9c03 tools/licence/assign_licences.py:1-167 · blob 2fb0dc341dcbefd8699d5a2fcae17b07c05b55ee · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: ingest · effects: filesystem, process · domain stage: unknown · users: none · canonical: unknown
#!/usr/bin/env python3
"""tools/licence/assign_licences.py - give every Ventusltd repository that has no licence the estate's licence.
The estate's licence is Apache-2.0: it is already the licence of 27 repositories, including GridAtlas,
VENTUS Grid Engine and Pipeline News, chosen there for the reasons Pipeline News's NOTICE records
(patent grant for adopters, attribution travels with the work). This script copies the exact LICENSE
text those repositories carry (byte-identical to gridatlas/LICENSE) and writes a NOTICE in Pipeline
News's form: name, copyright, why this licence, and what it does not cover (third-party data keeps its
own terms).
A repository is left untouched if it already has any LICENSE, LICENCE, COPYING or UNLICENSE file, in any
letter case or extension. Nothing is overwritten. A NOTICE that already exists is left alone.
Usage:
python tools/licence/assign_licences.py --clones DIR [--repos a,b,...] [--commit] [--push]
--clones folder holding one clone per repository (folder name = repository name)
--commit commit LICENSE (and NOTICE) in each changed clone
--push push each commit to origin main (needs push access)
Without --commit the script only reports what it would add.
"""
import argparse
import hashlib
import os
import re
import subprocess
import sys
HERE = os.path.dirname(os.path.abspath(__file__))
LICENSE_TEXT = os.path.join(HERE, 'APACHE-2.0.txt')
LICENSE_SHA256 = 'cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30'
HAS_LICENCE = re.compile(r'^(licen[cs]e|copying|unlicense)(\.[a-z0-9]+)?$', re.I)
NOTICE = """{repo}
Copyright 2026 Ventus Ltd
Author: Vikram (Ventus Ltd)
Project: GlobalGrid2050 | Ventus Core - Open Infrastructure Intelligence
Site: globalgrid2050.com
{about}
Licensed under the Apache License, Version 2.0. You may not use this work
except in compliance with that licence; a copy is in the LICENSE file beside
this one, and at http://www.apache.org/licenses/LICENSE-2.0
WHY THIS LICENCE, recorded so the choice can be argued with rather than
guessed at:
This estate exists to be adopted. Apache-2.0 grants the patent rights an
adopter needs alongside the copyright ones, which a permissive licence
without a patent grant does not, and it requires attribution to travel with
the work rather than relying on goodwill. It is the licence already used by
GridAtlas, VENTUS Grid Engine, Pipeline News and the other Apache-licensed
repositories of this estate.
Built on public knowledge. The Ventus contribution is the architecture.
Licensed to the world. Misrepresentation is not permitted.
WHAT THIS LICENCE DOES NOT COVER:
Third-party data, text, images or code this repository reads, quotes or
redistributes keep their own terms and are not licensed by this file. That
includes, where present, government and regulator datasets, network
operator open data, OpenStreetMap, Ordnance Survey and Environment Agency
data, map tiles, and any work by other authors. A licence granted here over
material that was never the licensor's to grant would be worth nothing to
the adopter who relied on it.
"""
def git(d, *a):
return subprocess.run(['git', '-C', d] + list(a), capture_output=True, text=True)
def readme_line(d):
"""First real sentence of the root README, for the NOTICE's one-line 'about'."""
for name in sorted(os.listdir(d)):
if name.lower().startswith('readme') and os.path.isfile(os.path.join(d, name)):
text = open(os.path.join(d, name), encoding='utf-8', errors='replace').read()
for para in re.split(r'\n\s*\n', re.sub(r'<!--.*?-->', '', text, flags=re.S)):
p = ' '.join(l.strip() for l in para.split('\n') if l.strip() and not l.strip().startswith(('#', '|', '!', '[!', '```', '- ', '* ')))
p = re.sub(r'\[([^\]]*)\]\([^)]*\)', r'\1', p)
p = re.sub(r'[*_`]+', '', p).strip()
if len(p) >= 25 and not re.search(r'\b(ai read|read first|generated|sha-?256|[0-9a-f]{40})\b', p, re.I):
m = re.match(r'(.{25,200}?[.!?])(\s|$)', p)
return m.group(1) if m else p[:200].rsplit(' ', 1)[0] + '...'
return ''
def wrap(text, width=78):
out, line = [], ''
for w in text.split():
if len(line) + len(w) + 1 > width:
out.append(line)
line = w
else:
line = (line + ' ' + w).strip()
if line:
out.append(line)
return '\n'.join(out)
def has_licence(d):
return [n for n in os.listdir(d) if HAS_LICENCE.match(n)]
def main():
ap = argparse.ArgumentParser(description=__doc__.split('\n')[0])
ap.add_argument('--clones', required=True)
ap.add_argument('--repos', default='')
ap.add_argument('--commit', action='store_true')
ap.add_argument('--push', action='store_true')
a = ap.parse_args()
lic = open(LICENSE_TEXT, 'rb').read()
if hashlib.sha256(lic).hexdigest() != LICENSE_SHA256:
sys.exit('APACHE-2.0.txt does not match the estate LICENSE (sha256 %s)' % LICENSE_SHA256)
wanted = [r for r in a.repos.split(',') if r]
changed, skipped, failed = [], [], []
for repo in sorted(os.listdir(a.clones), key=str.lower):
d = os.path.join(a.clones, repo)
if not os.path.isdir(os.path.join(d, '.git')) or (wanted and repo not in wanted):
continue
url = git(d, 'config', '--get', 'remote.origin.url').stdout.strip()
if not url.lower().startswith('https://github.com/ventusltd/'):
continue
existing = has_licence(d)
if existing:
skipped.append((repo, existing[0]))
continue
add = ['LICENSE'] + ([] if os.path.exists(os.path.join(d, 'NOTICE')) else ['NOTICE'])
if not a.commit:
changed.append((repo, '+'.join(add) + ' (dry run)'))
continue
open(os.path.join(d, 'LICENSE'), 'wb').write(lic)
if 'NOTICE' in add:
about = readme_line(d)
open(os.path.join(d, 'NOTICE'), 'w', encoding='utf-8', newline='\n').write(
NOTICE.format(repo=repo, about=('\n' + wrap(about) + '\n') if about else ''))
if a.commit:
git(d, 'add', *add)
r = git(d, '-c', 'user.name=Claude', '-c', 'user.email=noreply@anthropic.com', 'commit', '-q', '-m',
'Add Apache-2.0 LICENSE and NOTICE (estate licence)\n\n'
'Same licence text as GridAtlas, VENTUS Grid Engine and Pipeline News (sha256 %s).\n'
'NOTICE records why, and that third-party data keeps its own terms.\n'
'Written by tools/licence/assign_licences.py in Ventusltd/cosmic at the owner\'s request.\n\n'
'Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>\n'
'Claude-Session: https://claude.ai/code/session_015ELZDE6TmnksKXryh91ALT' % LICENSE_SHA256[:16])
if r.returncode:
failed.append((repo, 'commit: ' + r.stderr.strip()[:200]))
continue
if a.push:
branch = git(d, 'rev-parse', '--abbrev-ref', 'HEAD').stdout.strip() or 'main'
r = git(d, '-c', 'push.negotiate=true', 'push', 'origin', 'HEAD:' + branch)
if r.returncode:
failed.append((repo, 'push: ' + r.stderr.strip().splitlines()[-1][:200] if r.stderr.strip() else 'push failed'))
continue
changed.append((repo, '+'.join(add)))
for repo, what in changed:
print('ADDED %-55s %s' % (repo, what))
for repo, f in skipped:
print('HAS %-55s %s' % (repo, f))
for repo, why in failed:
print('FAILED %-55s %s' % (repo, why))
print('%d added, %d already licensed, %d failed' % (len(changed), len(skipped), len(failed)))
return 1 if failed else 0
if __name__ == '__main__':
sys.exit(main())Wafer
A Python command-line tool in the tools folder of Cosmic that calculates planar distances.
storagecosmic / tools/wafer.py · lines 1–164 of 164 · Entry point
- What it does
- It loads data. Defines main. Uses libraries argparse, json, math, os. Side effects: reads or writes files.
- Inputs & outputs
- In: JSON file wafer.json; command-line arguments. Out: JSON file.
- Downstream impact
- It is itself an entry point (Python CLI); no other file was found loading it.
- What it achieves
- A 300 mm wafer as real geometry, computed from stated inputs. It accepts `--diameter`, `--exclusion` and `--die-w`.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- cosmic · tools · Python CLI
- Uses
- argparse, json, math, os
- Used by
- none found
- Produces
- main
- Defines here
- main
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- cosmic@51bebf892d63a617408bc5e25b270b9f893e9c03 tools/wafer.py:1-164 · blob 6a631ed2bc82465fbcea26b50e38e89c52ae5941 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: filesystem · domain stage: unknown · users: none · canonical: supporting_data
#!/usr/bin/env python3
"""tools/wafer.py - a 300 mm wafer as real geometry, computed from stated inputs.
THE WAFER IS NOT A CLOUD OF DOTS. A scanner steps a rectangular reticle across a round substrate
at a fixed pitch, and the collision between the square step and the circle is the entire geometry
of a wafer map: full fields in the middle, partial fields at the rim that are printed and thrown
away, and an exclusion ring where nothing is printed at all. Drawing that as a spiral of points
would discard the only structure an engineer needs.
So this does not invent a placement law. It computes the actual step positions and writes them as
coordinates, and the engine is told to use them exactly (the `explicit` law). Every number below
is an input you can change or dispute, and the arithmetic is reproducible:
wafer diameter 300 mm SEMI M1
edge exclusion 3 mm the fixed quality area; 2 mm and 1.5 mm are also used
reticle field 26 x 33 mm the scanner slit and scan length, the maximum full field
scribe lane 0.08 mm kerf between adjacent dies
Nothing here is measured from a real lot. It is geometry from the standards, and the cartridge
says so, because a computed number and a measured number must never wear the same clothes.
Writes:
wafer/dies.tsv label value_um2 kind x_mm y_mm w_mm h_mm
wafer.json the cartridge
value is AREA IN SQUARE MICROMETRES, which is additive, checkable, and happens to put a 300 mm
wafer within sight of the estate's 37.93 billion lines.
"""
import argparse
import json
import math
import os
def main():
ap = argparse.ArgumentParser()
ap.add_argument('--diameter', type=float, default=300.0, help='wafer diameter, mm')
ap.add_argument('--exclusion', type=float, default=3.0, help='edge exclusion, mm')
ap.add_argument('--die-w', type=float, default=26.0, help='die width, mm')
ap.add_argument('--die-h', type=float, default=33.0, help='die height, mm')
ap.add_argument('--scribe', type=float, default=0.08, help='scribe lane, mm')
ap.add_argument('--out', default='.')
a = ap.parse_args()
R = a.diameter / 2.0
Ru = R - a.exclusion # the usable radius, inside the exclusion ring
px, py = a.die_w + a.scribe, a.die_h + a.scribe # the stepper pitch
ncx = int(math.ceil(2 * R / px)) + 2
ncy = int(math.ceil(2 * R / py)) + 2
rows, full, partial = [], 0, 0
for iy in range(-ncy, ncy + 1):
for ix in range(-ncx, ncx + 1):
cx, cy = ix * px, iy * py # a centred grid: one step sits on the wafer centre
# the four corners decide it. All inside the usable circle -> a full field. Some in,
# some out -> printed but not usable. None in -> the scanner never goes there.
corners = [(cx - a.die_w/2, cy - a.die_h/2), (cx + a.die_w/2, cy - a.die_h/2),
(cx - a.die_w/2, cy + a.die_h/2), (cx + a.die_w/2, cy + a.die_h/2)]
d = [math.hypot(x, y) for x, y in corners]
if min(d) > Ru:
continue # not printed at all
kind = 'full' if max(d) <= Ru else 'partial'
if kind == 'full':
full += 1
area = a.die_w * a.die_h
else:
partial += 1
# A PARTIAL FIELD IS NOT A WHOLE DIE OF SILICON. The reticle is exposed in full,
# but most of that rectangle hangs off the substrate, so counting it whole makes
# the printed area exceed the wafer, which is impossible. This is the actual
# rectangle-circle intersection, on a deterministic sub grid so it reproduces.
N = 240
inside = 0
for sy in range(N):
yy = cy - a.die_h/2 + (sy + 0.5) * a.die_h / N
for sx in range(N):
xx = cx - a.die_w/2 + (sx + 0.5) * a.die_w / N
if xx*xx + yy*yy <= Ru*Ru:
inside += 1
area = a.die_w * a.die_h * inside / (N * N)
rows.append({'label': 'die %+d%+d' % (ix, iy),
'value': int(round(area * 1e6)),
'kind': kind, 'x': cx, 'y': cy, 'w': a.die_w, 'h': a.die_h,
'r': math.hypot(cx, cy)})
# centre outwards, so that here too distance is the ordering and the newest idea, the centre
# of the wafer where yield is highest, is where you arrive
rows.sort(key=lambda r: (r['r'], r['label']))
os.makedirs(os.path.join(a.out, 'wafer'), exist_ok=True)
with open(os.path.join(a.out, 'wafer', 'dies.tsv'), 'w', encoding='utf-8', newline='\n') as f:
f.write('# label\tvalue_um2\tkind\tx_mm\ty_mm\tw_mm\th_mm\n')
for r in rows:
f.write('%s\t%d\t%s\t%.4f\t%.4f\t%.4f\t%.4f\n'
% (r['label'], r['value'], r['kind'], r['x'], r['y'], r['w'], r['h']))
printed = sum(r['value'] for r in rows)
wafer_area = int(round(math.pi * R * R * 1e6))
usable_area = int(round(math.pi * Ru * Ru * 1e6))
good = sum(r['value'] for r in rows if r['kind'] == 'full')
cart = {
'_': 'A WAFER IS NOT A SKY. Every level here declares its own law and its own view, so '
'arriving at a wafer gives you a wafer: an orthogonal stepper grid clipped to a round '
'substrate, with the partial fields at the rim drawn and counted rather than quietly '
'dropped. The engine is the same one that draws 37.93 billion lines of git.',
'name': '300 mm wafer',
'subtitle': 'computed geometry from the standards, not a measured lot',
'unit': 'square micrometres',
'total': printed,
'provenance': 'computed',
'computed_by': 'tools/wafer.py, from stated inputs; no lot was measured',
'inputs': {
'wafer_diameter_mm': a.diameter, 'edge_exclusion_mm': a.exclusion,
'die_mm': [a.die_w, a.die_h], 'scribe_mm': a.scribe,
'stepper_pitch_mm': [round(px, 4), round(py, 4)]
},
'derived': {
'wafer_area_um2': wafer_area,
'usable_area_um2': usable_area,
'silicon_under_printed_fields_um2': printed,
'checks': {
'_': 'the printed silicon cannot exceed the usable area, and does not',
'printed_le_usable': bool(printed <= usable_area)
},
'full_fields': full,
'partial_fields': partial,
'gross_die_per_wafer': full,
'utilisation_of_wafer': round(good / wafer_area * 100, 2),
'printed_and_discarded_um2': printed - good
},
'extent_mm': R,
'levels': [{
'name': 'die', 'plural': 'dies',
'law': 'explicit', 'view': 'section',
'source': 'wafer/dies.tsv',
'columns': ['label', 'value', 'kind', 'x', 'y', 'w', 'h'],
'child': None,
'_': 'positions are DATA, not a placement law. A stepper put them there.'
}],
'leaf': {'name': 'square micrometre', 'plural': 'square micrometres'},
'laws': {
'explicit': 'x, y, w, h come from the measurement. The engine places nothing.',
'areal': 'r = sqrt((i+0.5)/n), theta = i * golden angle. For things with no preferred axis.'
},
'views': {
'section': 'an engineering section: outlines, a hard grid, the exclusion ring and the '
'notch drawn, partial fields dashed. Lines, not dots.',
'field': 'a population of points, binary, coverage as density. The sky.'
}
}
with open(os.path.join(a.out, 'wafer.json'), 'w', encoding='utf-8', newline='\n') as f:
json.dump(cart, f, indent=1)
print(json.dumps({'full_fields': full, 'partial_fields': partial,
'printed_um2': printed, 'wafer_area_um2': wafer_area,
'utilisation_pct': cart['derived']['utilisation_of_wafer'],
'pitch_mm': [round(px, 4), round(py, 4)]}, indent=1))
return 0
if __name__ == '__main__':
raise SystemExit(main())Cosmic Regression
A JavaScript module in the seed regression folder of CVAA that replays the selected COSMIC functions against compact controlled sector fixtures, using SHA-256.
othercvaa / tools/seed-regression/cosmic_regression.mjs · lines 1–103 of 103 · Not reached from any entry point (candidate for review) · pattern scenario (shared by 5 files)
- What it does
- Defines scenario. Uses libraries node:assert/strict, node:child_process, node:crypto, node:path, node:vm. Side effects: starts processes.
- 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: command-line arguments.
- What it achieves
- Defines `scenario`.
- Why it matters
- No other file in the estate was found to import it.
- Application
- cvaa · tools/seed-regression · JavaScript module
- Uses
- Exact Cosmic Target (script call), node:assert/strict, node:child_process, node:crypto, node:path, node:vm
- Used by
- none found
- Produces
- scenario
- Defines here
- scenario
- 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/seed-regression/cosmic_regression.mjs:1-103 · blob 50e9a35e79e99cde220ad768c98b33f0ce400054 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: unknown · effects: process · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
/** Replay the selected COSMIC functions against compact controlled sector fixtures. */
import assert from 'node:assert/strict';
import { execFileSync } from 'node:child_process';
import { createHash } from 'node:crypto';
import { resolve } from 'node:path';
import { runInNewContext } from 'node:vm';
import { requireExactCosmicTarget } from './exact_cosmic_target.mjs';
const REVISION = 'dbe20b06c1ac107e902b93354f8e8a37b0462ad0';
const BLOB = '41a9007eb8480538552240829c5cf7a137e0445c';
const SOURCE_SHA = 'e55b588267b87df4411481c7677e43419439d1813385a3308c6e226f19fc75bd';
const [, , option, checkout, unexpected] = process.argv;
if (option !== '--cosmic-root' || !checkout || unexpected) {
throw new Error('Usage: node cosmic_regression.mjs --cosmic-root <local COSMIC checkout>');
}
const raw = execFileSync('git', ['-C', resolve(checkout), 'show', REVISION + ':index.html'], {
env: { ...process.env, GIT_NO_LAZY_FETCH: '1' },
});
const header = Buffer.from('blob ' + raw.length + '\0');
assert.equal(createHash('sha1').update(header).update(raw).digest('hex'), BLOB);
assert.equal(createHash('sha256').update(raw).digest('hex'), SOURCE_SHA);
const html = raw.toString('utf8');
const begin = html.indexOf('function loadRows(url, depth)');
const end = html.indexOf('// --------------------------------------------------------------------------------- the camera', begin);
assert(begin >= 0 && end > begin);
const functions = html.slice(begin, end);
const levels = [
{ child: 'sector/{i2}.tsv' },
{ columns: ['label', 'value'], law: 'fixture' },
];
function scenario(body, { online = true } = {}) {
const reads = [];
const sandbox = {
levels,
calls: {},
fetch: async url => {
reads.push(url);
assert.equal(url, 'sector/00.tsv');
return { ok: online, status: 404, text: async () => body };
},
};
runInNewContext(
'const LEVELS = levels, fmt = n => String(n), GOLD32 = 0x9e3779b9, PER_PIXEL = 1 / 30;\n' +
'const performance = { now: () => 0 }, cv = { height: 800 }, scale = 1, pan = [0, 0];\n' +
'const place = (label, value, i, depth) => ({ label, value, i, depth, x: i, y: 0, rho: .1, seed: i });\n' +
'const root = { children: [place("selected", 20, 0, 0), place("unrelated", 45, 1, 0)] };\n' +
'const TOTAL = 65, LAWS = { fixture: rows => rows.forEach(r => Object.assign(r, { x:r.i, y:0, rho:.1 })) };\n' +
'let tween; function restart() {}\n' + functions +
'\ncumulate(root.children); calls.locate = async k => { target = null; await collapseTo(k); return target; };',
sandbox,
{ filename: 'cosmic/index.html@' + REVISION }
);
return { reads, locate: sandbox.calls.locate };
}
const healthy = scenario('leaf-a\t7\nleaf-b\t13\n');
const first = requireExactCosmicTarget(await healthy.locate(7), levels, 7);
assert.deepEqual(Array.from(first.path, item => item.label), ['selected', 'leaf-b']);
assert.equal(first.m, 0);
assert.deepEqual(healthy.reads, ['sector/00.tsv']);
const cached = requireExactCosmicTarget(await healthy.locate(7), levels, 7);
assert.deepEqual([cached.x, cached.y], [first.x, first.y]);
assert.equal(cached.fetches, 0);
assert.deepEqual(healthy.reads, ['sector/00.tsv']);
assert.throws(() => requireExactCosmicTarget(first, levels, 8), /exact leaf contract/);
const mismatch = scenario('leaf-a\t7\nleaf-b\t12\n');
const parent = await mismatch.locate(7);
assert.deepEqual(Array.from(parent.path, item => item.label), ['selected']);
assert.throws(() => requireExactCosmicTarget(parent, levels, 7), /children sum to 19, parent holds 20/);
for (const incomplete of [scenario(''), scenario('', { online: false })]) {
const incompleteTarget = await incomplete.locate(7);
assert.deepEqual(Array.from(incompleteTarget.path, item => item.label), ['selected']);
assert.throws(() => requireExactCosmicTarget(incompleteTarget, levels, 7), /did not resolve to a leaf/);
assert.deepEqual(incomplete.reads, ['sector/00.tsv']);
}
const noIdentity = scenario('\t7\nleaf-b\t13\n');
const blankLeaf = await noIdentity.locate(0);
assert.equal(blankLeaf.node.label, '');
assert.throws(() => requireExactCosmicTarget(blankLeaf, levels, 0), /exact leaf contract/);
const outOfRange = await healthy.locate(65);
assert.throws(() => requireExactCosmicTarget(outOfRange, levels, 65), /did not resolve inside/);
assert.throws(() => requireExactCosmicTarget(first, levels, 7.5), /safe integer ordinal/);
assert.deepEqual(healthy.reads, ['sector/00.tsv']);
console.log(JSON.stringify({
passed: true,
source: { repository: 'Ventusltd/cosmic', revision: REVISION, git_blob: BLOB,
sha256: SOURCE_SHA, tablet: 6187, elements: [134863, 134865, 134905, 134906] },
guards: {
healthy: { path: Array.from(first.path, item => item.label), offset: first.m,
cold_reads: healthy.reads.length, repeat_additional_reads: cached.fetches },
malformed_original_parent: Array.from(parent.path, item => item.label),
count_mismatch_refused: true, empty_refused: true, unavailable_refused: true,
out_of_range_refused: true, non_integer_refused: true, mismatched_ordinal_refused: true, blank_leaf_refused: true,
},
scope: 'Pinned COSMIC functions with synthetic sector reads. No browser or latency claims.',
}, null, 2));
Exact Cosmic Target
A JavaScript module in the seed regression folder of CVAA. It is built from the require exact cosmic target helper (`requireExactCosmicTarget`).
transformcvaa / tools/seed-regression/exact_cosmic_target.mjs · lines 1–19 of 19 · Not reached from any entry point (candidate for review)
- What it does
- It calculates its inputs. Defines requireExactCosmicTarget.
- 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). README: "These compact checks cover deterministic discovery, resource-aware planning, exact retrieval and provenance, recursive comparison, and COSMIC's incomplete-target refusal."
- Downstream impact
- Used directly by 1 file: Cosmic Regression (cvaa).
- What it achieves
- Confirm that COSMIC returned an exact leaf for the requested ordinal.
- Why it matters
- Run by Cosmic Regression.
- Application
- cvaa · tools/seed-regression · JavaScript module
- Uses
- none found
- Used by
- run by Cosmic Regression (script call)
- Produces
- requireExactCosmicTarget
- Defines here
- requireExactCosmicTarget
- 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/seed-regression/exact_cosmic_target.mjs:1-19 · blob 64059171d1fa56f4ff94f4caf4230e241f17b234 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: transform · effects: none found · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
/** Confirm that COSMIC returned an exact leaf for the requested ordinal. */
export function requireExactCosmicTarget(target, levels, ordinal) {
if (!Number.isSafeInteger(ordinal) || ordinal < 0) {
throw new RangeError('An exact request needs a non-negative safe integer ordinal');
}
if (!target) throw new RangeError('Ordinal did not resolve inside the cartridge');
const { node, path, m, k, x, y } = target;
const level = levels[node?.depth];
if (level?.child) {
throw new Error(node.badChildren || 'Selected sector did not resolve to a leaf');
}
if (!level || !Array.isArray(path) || path.at(-1) !== node || k !== ordinal ||
path.some(item => typeof item?.label !== 'string' || !item.label.trim()) ||
!Number.isSafeInteger(node.value) || !Number.isSafeInteger(m) ||
m < 0 || m >= node.value || !Number.isFinite(x) || !Number.isFinite(y)) {
throw new Error('Resolved target does not satisfy the exact leaf contract');
}
return target;
}