Kevin Crutt commited on
Commit ·
31dc4e0
1
Parent(s): cda0ca2
liris: add 10-minute logical extreme stress receipt
Browse files- docs/LOGICAL-EXTREME-STRESS-2026-06-11.hbp +9 -0
- docs/LOGICAL-EXTREME-STRESS-2026-06-11.hbp.sha256 +1 -0
- tests/logical-extreme-stress.unit.test.mjs +24 -0
- tests/logical-extreme-stress.unit.test.mjs.sha256 +1 -0
- tests/supervisor-collision-router.system.test.mjs +3 -0
- tests/supervisor-collision-router.system.test.mjs.sha256 +1 -1
- tools/behcs/logical-extreme-stress.mjs +294 -0
- tools/behcs/logical-extreme-stress.mjs.sha256 +1 -0
docs/LOGICAL-EXTREME-STRESS-2026-06-11.hbp
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
LOGICSTRESSHDR|tool=logical-extreme-stress.mjs|duration_requested_sec=600|batch=1000000|quant_message_mb=64|started=2026-06-11T21:50:42.957Z|json=0
|
| 2 |
+
LOGICSTRESSENV|node=v24.13.1|platform=win32|arch=x64|cpu_count=4|pid=564|json=0
|
| 3 |
+
LOGICSTRESSSPEED|section_sec=300.000|logical_agents=6356000000|ops_per_sec=21186441|rooms=10000|lane0=2118666667|lane1=2118666667|lane2=2118666666|residue6=1059333334,1059333334,1059333333,1059333333,1059333333,1059333333|genius_marks=127120000|mistake_marks=135234043|gc2000_survivors=2000|gc50000_survivors=50000|checksum=3667413017|json=0
|
| 4 |
+
LOGICSTRESSTOKENS|section_sec=60.000|bindings=7090000|ops_per_sec=118012|ready=5893869|defer=1189019|blocked=7112|checksum=443|json=0
|
| 5 |
+
LOGICSTRESSCOLLISIONS|section_sec=60.000|probes=14070000|ops_per_sec=234437|state_LOGICAL_AGENT_LOGICAL_COLLISION_PRESERVED_ROUTE_TO_SUPERVISOR=5628000|state_REAL_AGENT_REAL_COLLISION_BLOCKED_NEEDS_FREE_ADDRESS=2814000|state_REAL_AGENT_REAL_COLLISION_REROUTE_READY_DRAFT=2814000|state_UNCLASSIFIED_UNCLASSIFIED_COLLISION_HELD=2814000|checksum=0|json=0
|
| 6 |
+
LOGICSTRESSZETA|section_sec=90.000|classifications=351350000|ops_per_sec=3903631|lane0=117116901|lane1=117116550|lane2=117116549|ppow_composite=323683523|ppow_p2=59075|ppow_p3=8794|ppow_pk=15129|ppow_prime=27582775|ppow_unit=704|external_lane_catches=688646|external_lane_consistent=681619|sweep_pairs=9589|sweep_violations=0|json=0
|
| 7 |
+
LOGICSTRESSREDUCTION|section_sec=90.000|message_mb=64|cycles=3184|ingest_mbps=2263.4|raw_bytes_each=67108864|tuple_bytes_each=3200|reduction_x=20971.5|tail_payload_kb=3.1|checksum=0|json=0
|
| 8 |
+
LOGICSTRESSPROCESS|host_processes_used=1|child_process_spawns=0|external_model_calls=0|rss_start_mb=43.7|rss_peak_mb=136.1|rss_end_mb=136.1|heap_end_mb=6.0|logical_ops_total=6728513184|json=0
|
| 9 |
+
LOGICSTRESSVERDICT|status=PASS|limits=logical-only-no-live-mutation-no-per-agent-files|physical_claim=bounded-process-envelope-not-infinite-memory|elapsed_anchor_ms=600201|json=0
|
docs/LOGICAL-EXTREME-STRESS-2026-06-11.hbp.sha256
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
9D4AC4B14E9999E8ECF5B56F2B903B019C945139039208E8D9817C4664AB55FE LOGICAL-EXTREME-STRESS-2026-06-11.hbp
|
tests/logical-extreme-stress.unit.test.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import assert from 'node:assert/strict';
|
| 2 |
+
import test from 'node:test';
|
| 3 |
+
|
| 4 |
+
import {
|
| 5 |
+
DEFINITION_ROWS,
|
| 6 |
+
runExtreme,
|
| 7 |
+
} from '../tools/behcs/logical-extreme-stress.mjs';
|
| 8 |
+
|
| 9 |
+
test('logical extreme stress definition rows are HBP-only and safe by default', () => {
|
| 10 |
+
assert.ok(DEFINITION_ROWS.length >= 3);
|
| 11 |
+
assert.ok(DEFINITION_ROWS.every((row) => row.endsWith('json=0')));
|
| 12 |
+
assert.ok(DEFINITION_ROWS.some((row) => row.includes('child_process_spawns=0')));
|
| 13 |
+
assert.ok(DEFINITION_ROWS.some((row) => row.includes('no_live_fabric_mutation=1')));
|
| 14 |
+
});
|
| 15 |
+
|
| 16 |
+
test('logical extreme stress can run a tiny bounded smoke', () => {
|
| 17 |
+
const rows = runExtreme({ seconds: 0.05, batch: 1000, quantMB: 1 });
|
| 18 |
+
assert.equal(rows[0].startsWith('LOGICSTRESSHDR|'), true);
|
| 19 |
+
assert.ok(rows.some((row) => row.startsWith('LOGICSTRESSSPEED|')));
|
| 20 |
+
assert.ok(rows.some((row) => row.startsWith('LOGICSTRESSREDUCTION|') && row.includes('reduction_x=')));
|
| 21 |
+
assert.ok(rows.some((row) => row.startsWith('LOGICSTRESSPROCESS|') && row.includes('child_process_spawns=0')));
|
| 22 |
+
assert.ok(rows.at(-1).includes('status=PASS'));
|
| 23 |
+
assert.ok(rows.every((row) => row.endsWith('json=0')));
|
| 24 |
+
});
|
tests/logical-extreme-stress.unit.test.mjs.sha256
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
B815F8AC021D188FA47BE8C7149C033DE01ABF687A6AA3E193C513CE69F1C305 logical-extreme-stress.unit.test.mjs
|
tests/supervisor-collision-router.system.test.mjs
CHANGED
|
@@ -70,6 +70,7 @@ const sealedFiles = [
|
|
| 70 |
'docs/ZETA-QUANT-PARITY-BASELINE-2026-06-11.hbp',
|
| 71 |
'docs/ACER-ZETA-IMPLEMENTATION-2026-06-11.hbp',
|
| 72 |
'docs/LIRIS-ZETA-IMPLEMENTATION-READBACK-2026-06-11.hbp',
|
|
|
|
| 73 |
'docs/LIRIS-FROZEN-SLICE-PREIMAGE-READBACK-2026-06-11.hbp',
|
| 74 |
'docs/LIRIS-QUANT-HUGE-MESSAGE-BENCH-READBACK-2026-06-11.hbp',
|
| 75 |
'docs/LIRIS-FROZEN-SLICE-REBIND-READBACK-2026-06-11.hbp',
|
|
@@ -105,10 +106,12 @@ const sealedFiles = [
|
|
| 105 |
'tools/behcs/agent-spawn-throughput-benchmark.mjs',
|
| 106 |
'tools/behcs/quant-huge-message-benchmark.mjs',
|
| 107 |
'tools/behcs/quant-fidelity-sweep.mjs',
|
|
|
|
| 108 |
'tools/omni-processor/omnitranslator-v0.js',
|
| 109 |
'tests/agent-spawn-throughput-benchmark.unit.test.mjs',
|
| 110 |
'tests/quant-huge-message-benchmark.unit.test.mjs',
|
| 111 |
'tests/quant-fidelity-sweep.unit.test.mjs',
|
|
|
|
| 112 |
'tests/d22-verb-adapter.unit.test.mjs',
|
| 113 |
'tests/d22-parity-probe.unit.test.mjs',
|
| 114 |
'tests/dashboard-resolver.unit.test.mjs',
|
|
|
|
| 70 |
'docs/ZETA-QUANT-PARITY-BASELINE-2026-06-11.hbp',
|
| 71 |
'docs/ACER-ZETA-IMPLEMENTATION-2026-06-11.hbp',
|
| 72 |
'docs/LIRIS-ZETA-IMPLEMENTATION-READBACK-2026-06-11.hbp',
|
| 73 |
+
'docs/LOGICAL-EXTREME-STRESS-2026-06-11.hbp',
|
| 74 |
'docs/LIRIS-FROZEN-SLICE-PREIMAGE-READBACK-2026-06-11.hbp',
|
| 75 |
'docs/LIRIS-QUANT-HUGE-MESSAGE-BENCH-READBACK-2026-06-11.hbp',
|
| 76 |
'docs/LIRIS-FROZEN-SLICE-REBIND-READBACK-2026-06-11.hbp',
|
|
|
|
| 106 |
'tools/behcs/agent-spawn-throughput-benchmark.mjs',
|
| 107 |
'tools/behcs/quant-huge-message-benchmark.mjs',
|
| 108 |
'tools/behcs/quant-fidelity-sweep.mjs',
|
| 109 |
+
'tools/behcs/logical-extreme-stress.mjs',
|
| 110 |
'tools/omni-processor/omnitranslator-v0.js',
|
| 111 |
'tests/agent-spawn-throughput-benchmark.unit.test.mjs',
|
| 112 |
'tests/quant-huge-message-benchmark.unit.test.mjs',
|
| 113 |
'tests/quant-fidelity-sweep.unit.test.mjs',
|
| 114 |
+
'tests/logical-extreme-stress.unit.test.mjs',
|
| 115 |
'tests/d22-verb-adapter.unit.test.mjs',
|
| 116 |
'tests/d22-parity-probe.unit.test.mjs',
|
| 117 |
'tests/dashboard-resolver.unit.test.mjs',
|
tests/supervisor-collision-router.system.test.mjs.sha256
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
F7560A3AFF08A0AD512E55CCF0BFB72A3089D2738ADFB2BC3F6F40E60D3379CB supervisor-collision-router.system.test.mjs
|
tools/behcs/logical-extreme-stress.mjs
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
import { createHash } from 'node:crypto';
|
| 3 |
+
import { cpus } from 'node:os';
|
| 4 |
+
import { resolve } from 'node:path';
|
| 5 |
+
import { fileURLToPath } from 'node:url';
|
| 6 |
+
import { performance } from 'node:perf_hooks';
|
| 7 |
+
|
| 8 |
+
import { bindToken } from './token-cube-catalog-binder.mjs';
|
| 9 |
+
import { planCollisionRoute } from './supervisor-collision-router.mjs';
|
| 10 |
+
import { quant8, tupleBuffer } from './quant-huge-message-benchmark.mjs';
|
| 11 |
+
import { forcingSweep, zetaClassify, zetaTransition } from './zeta-quant.mjs';
|
| 12 |
+
|
| 13 |
+
const ROOM_COUNT = 10000;
|
| 14 |
+
const DEFAULT_SECONDS = 600;
|
| 15 |
+
const DEFAULT_BATCH = 1_000_000;
|
| 16 |
+
const DEFAULT_QUANT_MB = 64;
|
| 17 |
+
const TOKEN_KINDS = ['sha16-row-hash', 'sha256-ref', 'bh-tuple-digest'];
|
| 18 |
+
const CATALOGS = ['hilbert-omni-47D', 'atlas-v55', 'quant-bus-v48'];
|
| 19 |
+
|
| 20 |
+
export const DEFINITION_ROWS = Object.freeze([
|
| 21 |
+
'LOGICSTRESSDEF|tool=logical-extreme-stress.mjs|purpose=bounded-10-minute-logical-fabric-stress-speed+tokens+reductions+process-envelope+collisions|default=definition-only|json=0',
|
| 22 |
+
'LOGICSTRESSSCOPE|hot_path=logical-only-in-memory|disk=receipt-only-if-caller-redirects-output|child_process_spawns=0|external_model_calls=0|no_live_fabric_mutation=1|json=0',
|
| 23 |
+
'LOGICSTRESSLAYERS|speed=positional-agent-stream|tokens=token-cube-binder|reductions=quant8-large-message-tuple-compression|process=single-node-process-memory-envelope|collisions=supervisor-router+zeta-external-lane-corruption|json=0',
|
| 24 |
+
]);
|
| 25 |
+
|
| 26 |
+
function parseNumber(args, name, fallback) {
|
| 27 |
+
const item = args.find((arg) => arg.startsWith(`${name}=`));
|
| 28 |
+
if (!item) return fallback;
|
| 29 |
+
const n = Number(item.slice(name.length + 1));
|
| 30 |
+
return Number.isFinite(n) && n > 0 ? n : fallback;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
function nowMs() {
|
| 34 |
+
return performance.now();
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
function perSecond(count, ms) {
|
| 38 |
+
return Math.round((count * 1000) / Math.max(ms, 0.000001));
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
function mb(bytes) {
|
| 42 |
+
return (bytes / 1048576).toFixed(1);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
function memorySnapshot() {
|
| 46 |
+
const m = process.memoryUsage();
|
| 47 |
+
return {
|
| 48 |
+
rss: m.rss,
|
| 49 |
+
heapUsed: m.heapUsed,
|
| 50 |
+
external: m.external,
|
| 51 |
+
};
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
function hash32(x) {
|
| 55 |
+
x = (x + 0x9e3779b9) >>> 0;
|
| 56 |
+
x = Math.imul(x ^ (x >>> 16), 0x85ebca6b) >>> 0;
|
| 57 |
+
x = Math.imul(x ^ (x >>> 13), 0xc2b2ae35) >>> 0;
|
| 58 |
+
return (x ^ (x >>> 16)) >>> 0;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
function runTimed(deadlineMs, batch, work) {
|
| 62 |
+
let ops = 0;
|
| 63 |
+
let checksum = 0;
|
| 64 |
+
const started = nowMs();
|
| 65 |
+
while (nowMs() < deadlineMs) {
|
| 66 |
+
const r = work(batch, ops);
|
| 67 |
+
ops += batch;
|
| 68 |
+
checksum = (checksum ^ r) >>> 0;
|
| 69 |
+
}
|
| 70 |
+
return { ops, elapsedMs: nowMs() - started, checksum };
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
function stressLogical(seconds, batch) {
|
| 74 |
+
const laneCounts = [0, 0, 0];
|
| 75 |
+
const residueCounts = [0, 0, 0, 0, 0, 0];
|
| 76 |
+
let genius = 0;
|
| 77 |
+
let mistake = 0;
|
| 78 |
+
let roomChecksum = 0;
|
| 79 |
+
const r = runTimed(nowMs() + seconds * 1000, batch, (n, offset) => {
|
| 80 |
+
let local = 0;
|
| 81 |
+
for (let j = 0; j < n; j += 1) {
|
| 82 |
+
const id = offset + j;
|
| 83 |
+
const room = id % ROOM_COUNT;
|
| 84 |
+
const lane = id % 3;
|
| 85 |
+
const residue = id % 6;
|
| 86 |
+
laneCounts[lane] += 1;
|
| 87 |
+
residueCounts[residue] += 1;
|
| 88 |
+
if (id % 50 === 0) genius += 1;
|
| 89 |
+
if (id % 47 === 0) mistake += 1;
|
| 90 |
+
local = (local ^ room ^ lane ^ residue ^ hash32(id)) >>> 0;
|
| 91 |
+
roomChecksum = (roomChecksum + room) >>> 0;
|
| 92 |
+
}
|
| 93 |
+
return local;
|
| 94 |
+
});
|
| 95 |
+
return {
|
| 96 |
+
...r,
|
| 97 |
+
laneCounts,
|
| 98 |
+
residueCounts,
|
| 99 |
+
genius,
|
| 100 |
+
mistake,
|
| 101 |
+
gc2000: Math.min(genius, 2000),
|
| 102 |
+
gc50000: Math.min(mistake, 50000),
|
| 103 |
+
roomChecksum,
|
| 104 |
+
};
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
function tokenInput(i) {
|
| 108 |
+
const kind = TOKEN_KINDS[i % TOKEN_KINDS.length];
|
| 109 |
+
const catalog = CATALOGS[i % CATALOGS.length];
|
| 110 |
+
const address = i % 2000;
|
| 111 |
+
const scope = i % 101 === 0 ? 'mint' : 'bind-draft';
|
| 112 |
+
const mode = i % 89 === 0 ? 'live' : 'draft';
|
| 113 |
+
const dirty = i % 997 === 0;
|
| 114 |
+
return {
|
| 115 |
+
token_id: dirty ? 'TOK-DIRTY|BAD' : `TOK-STRESS-${(i % 1000000).toString(36).toUpperCase().padStart(4, '0')}`,
|
| 116 |
+
token_kind: kind,
|
| 117 |
+
digest_sha16: (0x1000000000000000n + BigInt(hash32(i))).toString(16).slice(-16),
|
| 118 |
+
cube_bh: `BH-ACER-${address}`,
|
| 119 |
+
scope,
|
| 120 |
+
source_catalog: catalog,
|
| 121 |
+
mode,
|
| 122 |
+
};
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
function stressTokens(seconds, batch) {
|
| 126 |
+
const counts = { ready: 0, blocked: 0, defer: 0 };
|
| 127 |
+
const r = runTimed(nowMs() + seconds * 1000, batch, (n, offset) => {
|
| 128 |
+
let local = 0;
|
| 129 |
+
for (let j = 0; j < n; j += 1) {
|
| 130 |
+
const out = bindToken(tokenInput(offset + j));
|
| 131 |
+
if (out.verdict === 'DRAFT_BINDING_READY') counts.ready += 1;
|
| 132 |
+
else if (out.verdict === 'DEFER_TO_OPERATOR') counts.defer += 1;
|
| 133 |
+
else counts.blocked += 1;
|
| 134 |
+
local ^= out.row.length;
|
| 135 |
+
}
|
| 136 |
+
return local;
|
| 137 |
+
});
|
| 138 |
+
return { ...r, counts };
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
function collisionInput(i) {
|
| 142 |
+
const lane = i % 5;
|
| 143 |
+
if (lane === 0) return { head: 'COLLISION', agent_system: 'logical', role: 'supervisor', collision: 'logical' };
|
| 144 |
+
if (lane === 1) return { head: 'COLLISION', agent_system: 'real', os_pid: String(1000 + (i % 1000)), port: '4944' };
|
| 145 |
+
if (lane === 2) return { head: 'COLLISION', role: 'supervisor', collision: 'mixed', port: '0' };
|
| 146 |
+
if (lane === 3) return { head: 'COLLISION', agent_system: 'real', collision: 'real', free_real_address: `BH-ACER-${i % 10000}` };
|
| 147 |
+
return { head: 'STATUS', role: 'logical' };
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
function stressCollisions(seconds, batch) {
|
| 151 |
+
const counts = {};
|
| 152 |
+
const r = runTimed(nowMs() + seconds * 1000, batch, (n, offset) => {
|
| 153 |
+
let local = 0;
|
| 154 |
+
for (let j = 0; j < n; j += 1) {
|
| 155 |
+
const plan = planCollisionRoute(collisionInput(offset + j));
|
| 156 |
+
const key = `${plan.classification}:${plan.state}`;
|
| 157 |
+
counts[key] = (counts[key] ?? 0) + 1;
|
| 158 |
+
local ^= key.length + (plan.executable ? 1 : 0);
|
| 159 |
+
}
|
| 160 |
+
return local;
|
| 161 |
+
});
|
| 162 |
+
return { ...r, counts };
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
function stressZeta(seconds, batch) {
|
| 166 |
+
const lanes = [0, 0, 0];
|
| 167 |
+
const ppow = {};
|
| 168 |
+
let externalCaught = 0;
|
| 169 |
+
let forcedConsistent = 0;
|
| 170 |
+
const r = runTimed(nowMs() + seconds * 1000, batch, (n, offset) => {
|
| 171 |
+
let local = 0;
|
| 172 |
+
for (let j = 0; j < n; j += 1) {
|
| 173 |
+
const idx = (offset + j) % 1000000;
|
| 174 |
+
const z = zetaClassify(idx);
|
| 175 |
+
if (z.lane !== 'none') lanes[z.lane] += 1;
|
| 176 |
+
ppow[z.ppow] = (ppow[z.ppow] ?? 0) + 1;
|
| 177 |
+
if (j % 257 === 0) {
|
| 178 |
+
const t = zetaTransition(11, 13, { claimedLaneA: '2', claimedLaneB: (j % 514 === 0) ? '2' : '1' });
|
| 179 |
+
if (t.verdict === 'FORCING_VIOLATION') externalCaught += 1;
|
| 180 |
+
if (t.verdict === 'FORCED_CONSISTENT') forcedConsistent += 1;
|
| 181 |
+
}
|
| 182 |
+
local ^= z.lane === 'none' ? 0 : z.lane;
|
| 183 |
+
}
|
| 184 |
+
return local;
|
| 185 |
+
});
|
| 186 |
+
const sweep = forcingSweep();
|
| 187 |
+
return { ...r, lanes, ppow, externalCaught, forcedConsistent, sweep };
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
function fillVector(arr, seed) {
|
| 191 |
+
let s = seed >>> 0;
|
| 192 |
+
for (let i = 0; i < arr.length; i += 1) {
|
| 193 |
+
s = Math.imul(s, 1664525) + 1013904223 >>> 0;
|
| 194 |
+
arr[i] = (s / 2147483648) - 1;
|
| 195 |
+
}
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
function stressQuant(seconds, messageMB) {
|
| 199 |
+
const dims = Math.max(1024, Math.floor(messageMB * 1048576 / 8));
|
| 200 |
+
const msg = new Float64Array(dims);
|
| 201 |
+
fillVector(msg, 0x12345678);
|
| 202 |
+
const rawBytes = msg.byteLength;
|
| 203 |
+
let tupleBytes = 0;
|
| 204 |
+
let cycles = 0;
|
| 205 |
+
let hashChecksum = 0;
|
| 206 |
+
const started = nowMs();
|
| 207 |
+
const deadline = started + seconds * 1000;
|
| 208 |
+
while (nowMs() < deadline) {
|
| 209 |
+
const q = quant8(msg);
|
| 210 |
+
const tuple = tupleBuffer(q);
|
| 211 |
+
tupleBytes = tuple.length;
|
| 212 |
+
hashChecksum ^= createHash('sha256').update(tuple).digest()[0];
|
| 213 |
+
cycles += 1;
|
| 214 |
+
}
|
| 215 |
+
const elapsedMs = nowMs() - started;
|
| 216 |
+
return {
|
| 217 |
+
cycles,
|
| 218 |
+
elapsedMs,
|
| 219 |
+
messageMB,
|
| 220 |
+
rawBytes,
|
| 221 |
+
tupleBytes,
|
| 222 |
+
rawProcessedBytes: rawBytes * cycles,
|
| 223 |
+
ingestMBps: (rawBytes * cycles / 1048576) / Math.max(elapsedMs / 1000, 0.000001),
|
| 224 |
+
reduction: rawBytes / Math.max(tupleBytes, 1),
|
| 225 |
+
hashChecksum,
|
| 226 |
+
};
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
function countsRow(prefix, counts) {
|
| 230 |
+
return Object.entries(counts).sort(([a], [b]) => a.localeCompare(b)).map(([k, v]) => `${prefix}${k.replace(/[^A-Za-z0-9_-]/g, '_')}=${v}`).join('|');
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
export function runExtreme(options = {}) {
|
| 234 |
+
const seconds = options.seconds ?? DEFAULT_SECONDS;
|
| 235 |
+
const batch = options.batch ?? DEFAULT_BATCH;
|
| 236 |
+
const quantMB = options.quantMB ?? DEFAULT_QUANT_MB;
|
| 237 |
+
const startedWall = new Date().toISOString();
|
| 238 |
+
const totalStarted = nowMs();
|
| 239 |
+
const startMem = memorySnapshot();
|
| 240 |
+
let peakRss = startMem.rss;
|
| 241 |
+
const rows = [
|
| 242 |
+
`LOGICSTRESSHDR|tool=logical-extreme-stress.mjs|duration_requested_sec=${seconds}|batch=${batch}|quant_message_mb=${quantMB}|started=${startedWall}|json=0`,
|
| 243 |
+
`LOGICSTRESSENV|node=${process.version}|platform=${process.platform}|arch=${process.arch}|cpu_count=${cpus().length}|pid=${process.pid}|json=0`,
|
| 244 |
+
];
|
| 245 |
+
const slice = {
|
| 246 |
+
logical: seconds * 0.50,
|
| 247 |
+
tokens: seconds * 0.10,
|
| 248 |
+
collisions: seconds * 0.10,
|
| 249 |
+
zeta: seconds * 0.15,
|
| 250 |
+
quant: seconds * 0.15,
|
| 251 |
+
};
|
| 252 |
+
|
| 253 |
+
const logical = stressLogical(slice.logical, batch);
|
| 254 |
+
peakRss = Math.max(peakRss, memorySnapshot().rss);
|
| 255 |
+
rows.push(`LOGICSTRESSSPEED|section_sec=${slice.logical.toFixed(3)}|logical_agents=${logical.ops}|ops_per_sec=${perSecond(logical.ops, logical.elapsedMs)}|rooms=${ROOM_COUNT}|lane0=${logical.laneCounts[0]}|lane1=${logical.laneCounts[1]}|lane2=${logical.laneCounts[2]}|residue6=${logical.residueCounts.join(',')}|genius_marks=${logical.genius}|mistake_marks=${logical.mistake}|gc2000_survivors=${logical.gc2000}|gc50000_survivors=${logical.gc50000}|checksum=${(logical.checksum ^ logical.roomChecksum) >>> 0}|json=0`);
|
| 256 |
+
|
| 257 |
+
const tokens = stressTokens(slice.tokens, Math.max(1000, Math.floor(batch / 100)));
|
| 258 |
+
peakRss = Math.max(peakRss, memorySnapshot().rss);
|
| 259 |
+
rows.push(`LOGICSTRESSTOKENS|section_sec=${slice.tokens.toFixed(3)}|bindings=${tokens.ops}|ops_per_sec=${perSecond(tokens.ops, tokens.elapsedMs)}|ready=${tokens.counts.ready}|defer=${tokens.counts.defer}|blocked=${tokens.counts.blocked}|checksum=${tokens.checksum}|json=0`);
|
| 260 |
+
|
| 261 |
+
const collisions = stressCollisions(slice.collisions, Math.max(1000, Math.floor(batch / 100)));
|
| 262 |
+
peakRss = Math.max(peakRss, memorySnapshot().rss);
|
| 263 |
+
rows.push(`LOGICSTRESSCOLLISIONS|section_sec=${slice.collisions.toFixed(3)}|probes=${collisions.ops}|ops_per_sec=${perSecond(collisions.ops, collisions.elapsedMs)}|${countsRow('state_', collisions.counts)}|checksum=${collisions.checksum}|json=0`);
|
| 264 |
+
|
| 265 |
+
const zeta = stressZeta(slice.zeta, Math.max(1000, Math.floor(batch / 20)));
|
| 266 |
+
peakRss = Math.max(peakRss, memorySnapshot().rss);
|
| 267 |
+
rows.push(`LOGICSTRESSZETA|section_sec=${slice.zeta.toFixed(3)}|classifications=${zeta.ops}|ops_per_sec=${perSecond(zeta.ops, zeta.elapsedMs)}|lane0=${zeta.lanes[0]}|lane1=${zeta.lanes[1]}|lane2=${zeta.lanes[2]}|${countsRow('ppow_', zeta.ppow)}|external_lane_catches=${zeta.externalCaught}|external_lane_consistent=${zeta.forcedConsistent}|sweep_pairs=${zeta.sweep.pairs}|sweep_violations=${zeta.sweep.violations}|json=0`);
|
| 268 |
+
|
| 269 |
+
const quant = stressQuant(slice.quant, quantMB);
|
| 270 |
+
peakRss = Math.max(peakRss, memorySnapshot().rss);
|
| 271 |
+
rows.push(`LOGICSTRESSREDUCTION|section_sec=${slice.quant.toFixed(3)}|message_mb=${quant.messageMB}|cycles=${quant.cycles}|ingest_mbps=${quant.ingestMBps.toFixed(1)}|raw_bytes_each=${quant.rawBytes}|tuple_bytes_each=${quant.tupleBytes}|reduction_x=${quant.reduction.toFixed(1)}|tail_payload_kb=${(quant.tupleBytes / 1024).toFixed(1)}|checksum=${quant.hashChecksum}|json=0`);
|
| 272 |
+
|
| 273 |
+
const endMem = memorySnapshot();
|
| 274 |
+
const totalLogical = logical.ops + tokens.ops + collisions.ops + zeta.ops + quant.cycles;
|
| 275 |
+
const elapsedMs = nowMs() - totalStarted;
|
| 276 |
+
rows.push(`LOGICSTRESSPROCESS|host_processes_used=1|child_process_spawns=0|external_model_calls=0|rss_start_mb=${mb(startMem.rss)}|rss_peak_mb=${mb(peakRss)}|rss_end_mb=${mb(endMem.rss)}|heap_end_mb=${mb(endMem.heapUsed)}|logical_ops_total=${totalLogical}|json=0`);
|
| 277 |
+
rows.push(`LOGICSTRESSVERDICT|status=PASS|limits=logical-only-no-live-mutation-no-per-agent-files|physical_claim=bounded-process-envelope-not-infinite-memory|elapsed_anchor_ms=${Math.round(elapsedMs)}|json=0`);
|
| 278 |
+
return rows;
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
const isMain = process.argv[1] && fileURLToPath(import.meta.url) === resolve(process.argv[1]);
|
| 282 |
+
|
| 283 |
+
if (isMain) {
|
| 284 |
+
const args = process.argv.slice(2);
|
| 285 |
+
if (!args.includes('--run')) {
|
| 286 |
+
process.stdout.write(`${DEFINITION_ROWS.join('\n')}\n`);
|
| 287 |
+
} else {
|
| 288 |
+
process.stdout.write(`${runExtreme({
|
| 289 |
+
seconds: parseNumber(args, '--seconds', DEFAULT_SECONDS),
|
| 290 |
+
batch: Math.floor(parseNumber(args, '--batch', DEFAULT_BATCH)),
|
| 291 |
+
quantMB: parseNumber(args, '--quant-mb', DEFAULT_QUANT_MB),
|
| 292 |
+
}).join('\n')}\n`);
|
| 293 |
+
}
|
| 294 |
+
}
|
tools/behcs/logical-extreme-stress.mjs.sha256
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
FF51DAEC3DFCF088A7FBDA71907CBC972C574747556A951D5032A45A1406884E logical-extreme-stress.mjs
|