{"file":"server/scale/scale.mjs","version":318,"total":448,"from":1,"to":448,"lines":[{"n":1,"text":"#!/usr/bin/env node","atom":"a1523","author":"speed","version":152},{"n":2,"text":"// A scale harness for abso's open server (server/). It talks HTTP directly, as the client does, so one machine can","atom":"a1523","author":"speed","version":152},{"n":3,"text":"// play thousands of agents across many projects. Each project is its own Durable Object and Artifacts repo, so total","atom":"a1523","author":"speed","version":152},{"n":4,"text":"// pushes a second should grow with the number of projects while each project's own latency stays flat.","atom":"a1523","author":"speed","version":152},{"n":5,"text":"//","atom":"a1523","author":"speed","version":152},{"n":6,"text":"//   node server/scale/scale.mjs --server <url> [--projects 10] [--agents 5] [--rounds 3] [--overlap 0.2]","atom":"a1523","author":"speed","version":152},{"n":7,"text":"//   node server/scale/scale.mjs --server <url> --ramp","atom":"a1523","author":"speed","version":152},{"n":8,"text":"//","atom":"a1523","author":"speed","version":152},{"n":9,"text":"// The token comes from ABSO_TOKEN, or from the file --token-file names. It is never printed. README.md says more.","atom":"a1523","author":"speed","version":152},{"n":10,"text":"","atom":"a1523","author":"speed","version":152},{"n":11,"text":"import { createHash, randomBytes } from \"node:crypto\";","atom":"a1523","author":"speed","version":152},{"n":12,"text":"import { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";","atom":"a1523","author":"speed","version":152},{"n":13,"text":"import { dirname, join, resolve } from \"node:path\";","atom":"a1527","author":"speed","version":152},{"n":14,"text":"import { fileURLToPath } from \"node:url\";","atom":"a1523","author":"speed","version":152},{"n":15,"text":"","atom":"a1523","author":"speed","version":152},{"n":16,"text":"const HERE = dirname(fileURLToPath(import.meta.url));","atom":"a1523","author":"speed","version":152},{"n":17,"text":"const HOT_LINES = 40;","atom":"a1523","author":"speed","version":152},{"n":18,"text":"/** The ramp's stages: projects × agents per project. */","atom":"a1523","author":"speed","version":152},{"n":19,"text":"export const RAMP = [","atom":"a1523","author":"speed","version":152},{"n":20,"text":"\t[1, 1],","atom":"a1523","author":"speed","version":152},{"n":21,"text":"\t[10, 5],","atom":"a1523","author":"speed","version":152},{"n":22,"text":"\t[50, 10],","atom":"a1523","author":"speed","version":152},{"n":23,"text":"\t[100, 10],","atom":"a1523","author":"speed","version":152},{"n":24,"text":"\t[200, 20],","atom":"a1523","author":"speed","version":152},{"n":25,"text":"];","atom":"a1523","author":"speed","version":152},{"n":26,"text":"","atom":"a1523","author":"speed","version":152},{"n":27,"text":"function parseArgs(argv) {","atom":"a1523","author":"speed","version":152},{"n":28,"text":"\tconst o = {","atom":"a1523","author":"speed","version":152},{"n":29,"text":"\t\tserver: \"\",","atom":"a1523","author":"speed","version":152},{"n":30,"text":"\t\tprojects: 10,","atom":"a1523","author":"speed","version":152},{"n":31,"text":"\t\tagents: 5,","atom":"a1523","author":"speed","version":152},{"n":32,"text":"\t\trounds: 3,","atom":"a1523","author":"speed","version":152},{"n":33,"text":"\t\toverlap: 0.2,","atom":"a1523","author":"speed","version":152},{"n":34,"text":"\t\tprefix: \"\",","atom":"a1523","author":"speed","version":152},{"n":35,"text":"\t\tconcurrency: 256,","atom":"a1523","author":"speed","version":152},{"n":36,"text":"\t\tmaxSeconds: 240,","atom":"a1523","author":"speed","version":152},{"n":37,"text":"\t\tartifactsSample: 5,","atom":"a1523","author":"speed","version":152},{"n":38,"text":"\t\tartifactsWait: 180,","atom":"a1523","author":"speed","version":152},{"n":39,"text":"\t\ttokenFile: \"\",","atom":"a1523","author":"speed","version":152},{"n":40,"text":"\t\tramp: false,","atom":"a1523","author":"speed","version":152},{"n":41,"text":"\t\tstopErrorRate: 0.02,","atom":"a1523","author":"speed","version":152},{"n":42,"text":"\t\tout: join(HERE, \"results\"),","atom":"a1523","author":"speed","version":152},{"n":43,"text":"\t};","atom":"a1523","author":"speed","version":152},{"n":44,"text":"\tfor (let i = 0; i < argv.length; i++) {","atom":"a1523","author":"speed","version":152},{"n":45,"text":"\t\tconst a = argv[i];","atom":"a1523","author":"speed","version":152},{"n":46,"text":"\t\tconst next = () => {","atom":"a1523","author":"speed","version":152},{"n":47,"text":"\t\t\tconst v = argv[++i];","atom":"a1523","author":"speed","version":152},{"n":48,"text":"\t\t\tif (v === undefined) throw new Error(`${a} needs a value`);","atom":"a1523","author":"speed","version":152},{"n":49,"text":"\t\t\treturn v;","atom":"a1523","author":"speed","version":152},{"n":50,"text":"\t\t};","atom":"a1523","author":"speed","version":152},{"n":51,"text":"\t\tif (a === \"--server\") o.server = next().replace(/\\/+$/, \"\");","atom":"a1523","author":"speed","version":152},{"n":52,"text":"\t\telse if (a === \"--projects\") o.projects = Number(next());","atom":"a1523","author":"speed","version":152},{"n":53,"text":"\t\telse if (a === \"--agents\") o.agents = Number(next());","atom":"a1523","author":"speed","version":152},{"n":54,"text":"\t\telse if (a === \"--rounds\") o.rounds = Number(next());","atom":"a1523","author":"speed","version":152},{"n":55,"text":"\t\telse if (a === \"--overlap\") o.overlap = Number(next());","atom":"a1523","author":"speed","version":152},{"n":56,"text":"\t\telse if (a === \"--prefix\") o.prefix = next();","atom":"a1523","author":"speed","version":152},{"n":57,"text":"\t\telse if (a === \"--concurrency\") o.concurrency = Number(next());","atom":"a1523","author":"speed","version":152},{"n":58,"text":"\t\telse if (a === \"--max-seconds\") o.maxSeconds = Number(next());","atom":"a1523","author":"speed","version":152},{"n":59,"text":"\t\telse if (a === \"--artifacts-sample\") o.artifactsSample = Number(next());","atom":"a1523","author":"speed","version":152},{"n":60,"text":"\t\telse if (a === \"--artifacts-wait\") o.artifactsWait = Number(next());","atom":"a1523","author":"speed","version":152},{"n":61,"text":"\t\telse if (a === \"--token-file\") o.tokenFile = next();","atom":"a1523","author":"speed","version":152},{"n":62,"text":"\t\telse if (a === \"--out\") o.out = next();","atom":"a1523","author":"speed","version":152},{"n":63,"text":"\t\telse if (a === \"--ramp\") o.ramp = true;","atom":"a1523","author":"speed","version":152},{"n":64,"text":"\t\telse if (a === \"--help\" || a === \"-h\") o.help = true;","atom":"a1523","author":"speed","version":152},{"n":65,"text":"\t\telse throw new Error(`unknown argument ${a}`);","atom":"a1523","author":"speed","version":152},{"n":66,"text":"\t}","atom":"a1523","author":"speed","version":152},{"n":67,"text":"\treturn o;","atom":"a1523","author":"speed","version":152},{"n":68,"text":"}","atom":"a1523","author":"speed","version":152},{"n":69,"text":"","atom":"a1523","author":"speed","version":152},{"n":70,"text":"/** The value at fraction q of sorted numbers (nearest rank), or null when there are none. */","atom":"a1523","author":"speed","version":152},{"n":71,"text":"export function percentile(sorted, q) {","atom":"a1523","author":"speed","version":152},{"n":72,"text":"\tif (sorted.length === 0) return null;","atom":"a1523","author":"speed","version":152},{"n":73,"text":"\treturn sorted[Math.min(sorted.length - 1, Math.max(0, Math.ceil(q * sorted.length) - 1))];","atom":"a1523","author":"speed","version":152},{"n":74,"text":"}","atom":"a1523","author":"speed","version":152},{"n":75,"text":"","atom":"a1523","author":"speed","version":152},{"n":76,"text":"const round = (n, places = 1) => (n === null || n === undefined ? null : Math.round(n * 10 ** places) / 10 ** places);","atom":"a1523","author":"speed","version":152},{"n":77,"text":"","atom":"a1523","author":"speed","version":152},{"n":78,"text":"/** At most `limit` calls in flight at once. */","atom":"a1523","author":"speed","version":152},{"n":79,"text":"function limiter(limit) {","atom":"a1523","author":"speed","version":152},{"n":80,"text":"\tlet active = 0;","atom":"a1523","author":"speed","version":152},{"n":81,"text":"\tconst queue = [];","atom":"a1523","author":"speed","version":152},{"n":82,"text":"\tconst release = () => {","atom":"a1523","author":"speed","version":152},{"n":83,"text":"\t\tactive--;","atom":"a1523","author":"speed","version":152},{"n":84,"text":"\t\tconst next = queue.shift();","atom":"a1523","author":"speed","version":152},{"n":85,"text":"\t\tif (next) next();","atom":"a1523","author":"speed","version":152},{"n":86,"text":"\t};","atom":"a1523","author":"speed","version":152},{"n":87,"text":"\treturn async (work) => {","atom":"a1523","author":"speed","version":152},{"n":88,"text":"\t\tif (active >= limit) await new Promise((ok) => queue.push(ok));","atom":"a1523","author":"speed","version":152},{"n":89,"text":"\t\tactive++;","atom":"a1523","author":"speed","version":152},{"n":90,"text":"\t\ttry {","atom":"a1523","author":"speed","version":152},{"n":91,"text":"\t\t\treturn await work();","atom":"a1523","author":"speed","version":152},{"n":92,"text":"\t\t} finally {","atom":"a1523","author":"speed","version":152},{"n":93,"text":"\t\t\trelease();","atom":"a1523","author":"speed","version":152},{"n":94,"text":"\t\t}","atom":"a1523","author":"speed","version":152},{"n":95,"text":"\t};","atom":"a1523","author":"speed","version":152},{"n":96,"text":"}","atom":"a1523","author":"speed","version":152},{"n":97,"text":"","atom":"a1523","author":"speed","version":152},{"n":98,"text":"/** Latencies by operation, statuses, and the counts the summary reports. */","atom":"a1523","author":"speed","version":152},{"n":99,"text":"class Stats {","atom":"a1523","author":"speed","version":152},{"n":100,"text":"\tops = new Map();","atom":"a1523","author":"speed","version":152},{"n":101,"text":"\tstatuses = new Map();","atom":"a1523","author":"speed","version":152},{"n":102,"text":"\terrors = new Map();","atom":"a1523","author":"speed","version":152},{"n":103,"text":"\trequests = 0;","atom":"a1523","author":"speed","version":152},{"n":104,"text":"\tpushes = 0;","atom":"a1523","author":"speed","version":152},{"n":105,"text":"\theld = 0;","atom":"a1523","author":"speed","version":152},{"n":106,"text":"\tsettled = 0;","atom":"a1523","author":"speed","version":152},{"n":107,"text":"\theldAfterRetry = 0;","atom":"a1523","author":"speed","version":152},{"n":108,"text":"\tperProject = new Map();","atom":"a1523","author":"speed","version":152},{"n":109,"text":"\ttime(op, ms, status) {","atom":"a1523","author":"speed","version":152},{"n":110,"text":"\t\tif (!this.ops.has(op)) this.ops.set(op, []);","atom":"a1523","author":"speed","version":152},{"n":111,"text":"\t\tthis.ops.get(op).push(ms);","atom":"a1523","author":"speed","version":152},{"n":112,"text":"\t\tthis.requests++;","atom":"a1523","author":"speed","version":152},{"n":113,"text":"\t\tthis.statuses.set(status, (this.statuses.get(status) ?? 0) + 1);","atom":"a1523","author":"speed","version":152},{"n":114,"text":"\t\tif (status === \"network\" || Number(status) >= 400) {","atom":"a1523","author":"speed","version":152},{"n":115,"text":"\t\t\tconst key = `${op} ${status}`;","atom":"a1523","author":"speed","version":152},{"n":116,"text":"\t\t\tthis.errors.set(key, (this.errors.get(key) ?? 0) + 1);","atom":"a1523","author":"speed","version":152},{"n":117,"text":"\t\t}","atom":"a1523","author":"speed","version":152},{"n":118,"text":"\t}","atom":"a1523","author":"speed","version":152},{"n":119,"text":"\tpushed(project) {","atom":"a1523","author":"speed","version":152},{"n":120,"text":"\t\tthis.pushes++;","atom":"a1523","author":"speed","version":152},{"n":121,"text":"\t\tthis.perProject.set(project, (this.perProject.get(project) ?? 0) + 1);","atom":"a1523","author":"speed","version":152},{"n":122,"text":"\t}","atom":"a1523","author":"speed","version":152},{"n":123,"text":"\terrorCount() {","atom":"a1523","author":"speed","version":152},{"n":124,"text":"\t\tlet n = 0;","atom":"a1523","author":"speed","version":152},{"n":125,"text":"\t\tfor (const v of this.errors.values()) n += v;","atom":"a1523","author":"speed","version":152},{"n":126,"text":"\t\treturn n;","atom":"a1523","author":"speed","version":152},{"n":127,"text":"\t}","atom":"a1523","author":"speed","version":152},{"n":128,"text":"\tlatency() {","atom":"a1523","author":"speed","version":152},{"n":129,"text":"\t\tconst out = {};","atom":"a1523","author":"speed","version":152},{"n":130,"text":"\t\tfor (const [op, list] of [...this.ops].sort()) {","atom":"a1523","author":"speed","version":152},{"n":131,"text":"\t\t\tconst s = [...list].sort((a, b) => a - b);","atom":"a1523","author":"speed","version":152},{"n":132,"text":"\t\t\tout[op] = {","atom":"a1523","author":"speed","version":152},{"n":133,"text":"\t\t\t\tcount: s.length,","atom":"a1523","author":"speed","version":152},{"n":134,"text":"\t\t\t\tp50: round(percentile(s, 0.5)),","atom":"a1523","author":"speed","version":152},{"n":135,"text":"\t\t\t\tp95: round(percentile(s, 0.95)),","atom":"a1523","author":"speed","version":152},{"n":136,"text":"\t\t\t\tp99: round(percentile(s, 0.99)),","atom":"a1523","author":"speed","version":152},{"n":137,"text":"\t\t\t\tmax: round(s.at(-1)),","atom":"a1523","author":"speed","version":152},{"n":138,"text":"\t\t\t};","atom":"a1523","author":"speed","version":152},{"n":139,"text":"\t\t}","atom":"a1523","author":"speed","version":152},{"n":140,"text":"\t\treturn out;","atom":"a1523","author":"speed","version":152},{"n":141,"text":"\t}","atom":"a1523","author":"speed","version":152},{"n":142,"text":"}","atom":"a1523","author":"speed","version":152},{"n":143,"text":"","atom":"a1523","author":"speed","version":152},{"n":144,"text":"class Client {","atom":"a1523","author":"speed","version":152},{"n":145,"text":"\tconstructor(server, token, stats, limit) {","atom":"a1523","author":"speed","version":152},{"n":146,"text":"\t\tthis.server = server;","atom":"a1523","author":"speed","version":152},{"n":147,"text":"\t\tthis.token = token;","atom":"a1523","author":"speed","version":152},{"n":148,"text":"\t\tthis.stats = stats;","atom":"a1523","author":"speed","version":152},{"n":149,"text":"\t\tthis.limit = limit;","atom":"a1523","author":"speed","version":152},{"n":150,"text":"\t}","atom":"a1523","author":"speed","version":152},{"n":151,"text":"\t/** One request, timed. Answers {status, body}; a network failure is status \"network\". */","atom":"a1523","author":"speed","version":152},{"n":152,"text":"\tasync call(method, path, body, op, raw) {","atom":"a1523","author":"speed","version":152},{"n":153,"text":"\t\treturn this.limit(async () => {","atom":"a1523","author":"speed","version":152},{"n":154,"text":"\t\t\tconst t0 = performance.now();","atom":"a1523","author":"speed","version":152},{"n":155,"text":"\t\t\tlet status = \"network\";","atom":"a1523","author":"speed","version":152},{"n":156,"text":"\t\t\ttry {","atom":"a1523","author":"speed","version":152},{"n":157,"text":"\t\t\t\tconst res = await fetch(`${this.server}${path}`, {","atom":"a1523","author":"speed","version":152},{"n":158,"text":"\t\t\t\t\tmethod,","atom":"a1523","author":"speed","version":152},{"n":159,"text":"\t\t\t\t\theaders: {","atom":"a1523","author":"speed","version":152},{"n":160,"text":"\t\t\t\t\t\tauthorization: `Bearer ${this.token}`,","atom":"a1523","author":"speed","version":152},{"n":161,"text":"\t\t\t\t\t\t\"x-abso-client\": \"abso-scale/1\",","atom":"a1523","author":"speed","version":152},{"n":162,"text":"\t\t\t\t\t\t...(raw","atom":"a1527","author":"speed","version":152},{"n":163,"text":"\t\t\t\t\t\t\t? { \"content-type\": \"application/octet-stream\" }","atom":"a1527","author":"speed","version":152},{"n":164,"text":"\t\t\t\t\t\t\t: body !== undefined","atom":"a1527","author":"speed","version":152},{"n":165,"text":"\t\t\t\t\t\t\t\t? { \"content-type\": \"application/json\" }","atom":"a1527","author":"speed","version":152},{"n":166,"text":"\t\t\t\t\t\t\t\t: {}),","atom":"a1527","author":"speed","version":152},{"n":167,"text":"\t\t\t\t\t},","atom":"a1523","author":"speed","version":152},{"n":168,"text":"\t\t\t\t\t...(raw ? { body: raw } : body !== undefined ? { body: JSON.stringify(body) } : {}),","atom":"a1523","author":"speed","version":152},{"n":169,"text":"\t\t\t\t\tsignal: AbortSignal.timeout(120_000),","atom":"a1523","author":"speed","version":152},{"n":170,"text":"\t\t\t\t});","atom":"a1523","author":"speed","version":152},{"n":171,"text":"\t\t\t\tstatus = String(res.status);","atom":"a1523","author":"speed","version":152},{"n":172,"text":"\t\t\t\tconst text = await res.text();","atom":"a1523","author":"speed","version":152},{"n":173,"text":"\t\t\t\tlet parsed;","atom":"a1523","author":"speed","version":152},{"n":174,"text":"\t\t\t\ttry {","atom":"a1523","author":"speed","version":152},{"n":175,"text":"\t\t\t\t\tparsed = JSON.parse(text);","atom":"a1523","author":"speed","version":152},{"n":176,"text":"\t\t\t\t} catch {","atom":"a1523","author":"speed","version":152},{"n":177,"text":"\t\t\t\t\tparsed = text;","atom":"a1523","author":"speed","version":152},{"n":178,"text":"\t\t\t\t}","atom":"a1523","author":"speed","version":152},{"n":179,"text":"\t\t\t\treturn { status: res.status, body: parsed };","atom":"a1523","author":"speed","version":152},{"n":180,"text":"\t\t\t} catch (e) {","atom":"a1523","author":"speed","version":152},{"n":181,"text":"\t\t\t\treturn { status: 0, body: { error: e instanceof Error ? e.message : String(e) } };","atom":"a1523","author":"speed","version":152},{"n":182,"text":"\t\t\t} finally {","atom":"a1523","author":"speed","version":152},{"n":183,"text":"\t\t\t\tthis.stats.time(op, performance.now() - t0, status);","atom":"a1523","author":"speed","version":152},{"n":184,"text":"\t\t\t}","atom":"a1523","author":"speed","version":152},{"n":185,"text":"\t\t});","atom":"a1523","author":"speed","version":152},{"n":186,"text":"\t}","atom":"a1523","author":"speed","version":152},{"n":187,"text":"}","atom":"a1523","author":"speed","version":152},{"n":188,"text":"","atom":"a1523","author":"speed","version":152},{"n":189,"text":"const sleep = (ms) => new Promise((ok) => setTimeout(ok, ms));","atom":"a1523","author":"speed","version":152},{"n":190,"text":"const hotText = () => Array.from({ length: HOT_LINES }, (_, i) => `hot line ${i + 1}`).join(\"\\n\") + \"\\n\";","atom":"a1523","author":"speed","version":152},{"n":191,"text":"","atom":"a1523","author":"speed","version":152},{"n":192,"text":"/** Makes a project: one starting file per agent is left to the agents; init holds the hot file, a readme and a blob. */","atom":"a1523","author":"speed","version":152},{"n":193,"text":"async function initProject(client, project) {","atom":"a1523","author":"speed","version":152},{"n":194,"text":"\tconst bytes = randomBytes(256);","atom":"a1523","author":"speed","version":152},{"n":195,"text":"\tconst sha = createHash(\"sha256\").update(bytes).digest(\"hex\");","atom":"a1523","author":"speed","version":152},{"n":196,"text":"\tconst put = await client.call(\"PUT\", `/p/${project}/blobs/${sha}`, undefined, \"blob\", bytes);","atom":"a1523","author":"speed","version":152},{"n":197,"text":"\tif (put.status !== 200) return { ok: false, why: `blob ${put.status}` };","atom":"a1523","author":"speed","version":152},{"n":198,"text":"\tconst init = await client.call(","atom":"a1523","author":"speed","version":152},{"n":199,"text":"\t\t\"POST\",","atom":"a1523","author":"speed","version":152},{"n":200,"text":"\t\t`/p/${project}/init`,","atom":"a1523","author":"speed","version":152},{"n":201,"text":"\t\t{ files: { \"README.md\": `# ${project}\\n\\nA scale run.\\n`, \"hot.txt\": hotText() }, blobs: { \"logo.bin\": sha } },","atom":"a1523","author":"speed","version":152},{"n":202,"text":"\t\t\"init\",","atom":"a1523","author":"speed","version":152},{"n":203,"text":"\t);","atom":"a1523","author":"speed","version":152},{"n":204,"text":"\treturn init.status === 200 ? { ok: true } : { ok: false, why: `init ${init.status}` };","atom":"a1523","author":"speed","version":152},{"n":205,"text":"}","atom":"a1523","author":"speed","version":152},{"n":206,"text":"","atom":"a1523","author":"speed","version":152},{"n":207,"text":"/** One agent: join, say what it starts on, then rounds of edit, record and publish. A held push pulls and retries once. */","atom":"a1523","author":"speed","version":152},{"n":208,"text":"async function runAgent(client, stats, project, agent, o, deadline) {","atom":"a1523","author":"speed","version":152},{"n":209,"text":"\tconst base = `/p/${project}/a/${agent}`;","atom":"a1523","author":"speed","version":152},{"n":210,"text":"\tconst view = new Map();","atom":"a1523","author":"speed","version":152},{"n":211,"text":"\tconst take = (files) => {","atom":"a1523","author":"speed","version":152},{"n":212,"text":"\t\tfor (const [path, text] of Object.entries(files ?? {})) {","atom":"a1523","author":"speed","version":152},{"n":213,"text":"\t\t\tif (text === null) view.delete(path);","atom":"a1523","author":"speed","version":152},{"n":214,"text":"\t\t\telse view.set(path, text);","atom":"a1523","author":"speed","version":152},{"n":215,"text":"\t\t}","atom":"a1523","author":"speed","version":152},{"n":216,"text":"\t};","atom":"a1523","author":"speed","version":152},{"n":217,"text":"\tconst join = await client.call(\"POST\", `${base}/sync`, {}, \"sync\");","atom":"a1523","author":"speed","version":152},{"n":218,"text":"\tif (join.status !== 200) return;","atom":"a1523","author":"speed","version":152},{"n":219,"text":"\ttake(join.body.files);","atom":"a1523","author":"speed","version":152},{"n":220,"text":"\tawait client.call(\"POST\", `${base}/starting`, { text: `Scale run: ${agent} edits its own file` }, \"starting\");","atom":"a1523","author":"speed","version":152},{"n":221,"text":"\tconst own = `agents/${agent}.txt`;","atom":"a1523","author":"speed","version":152},{"n":222,"text":"\tlet mine = \"\";","atom":"a1523","author":"speed","version":152},{"n":223,"text":"\tfor (let r = 1; r <= o.rounds && Date.now() < deadline; r++) {","atom":"a1523","author":"speed","version":152},{"n":224,"text":"\t\tconst hot = Math.random() < o.overlap;","atom":"a1523","author":"speed","version":152},{"n":225,"text":"\t\tlet files;","atom":"a1523","author":"speed","version":152},{"n":226,"text":"\t\tif (hot) {","atom":"a1523","author":"speed","version":152},{"n":227,"text":"\t\t\t// Pull first, as an agent does before it touches a file others work on.","atom":"a1523","author":"speed","version":152},{"n":228,"text":"\t\t\tconst pulled = await client.call(\"POST\", `${base}/sync`, {}, \"sync\");","atom":"a1523","author":"speed","version":152},{"n":229,"text":"\t\t\tif (pulled.status !== 200) continue;","atom":"a1523","author":"speed","version":152},{"n":230,"text":"\t\t\ttake(pulled.body.files);","atom":"a1523","author":"speed","version":152},{"n":231,"text":"\t\t\tconst lines = (view.get(\"hot.txt\") ?? hotText()).split(\"\\n\");","atom":"a1523","author":"speed","version":152},{"n":232,"text":"\t\t\tconst at = Math.floor(Math.random() * Math.min(3, lines.length - 1));","atom":"a1527","author":"speed","version":152},{"n":233,"text":"\t\t\tlines[at] = `hot line ${at + 1}, as ${agent} wants it in round ${r}`;","atom":"a1523","author":"speed","version":152},{"n":234,"text":"\t\t\tfiles = { \"hot.txt\": lines.join(\"\\n\") };","atom":"a1523","author":"speed","version":152},{"n":235,"text":"\t\t} else {","atom":"a1523","author":"speed","version":152},{"n":236,"text":"\t\t\tmine += `${agent} round ${r}\\n`;","atom":"a1523","author":"speed","version":152},{"n":237,"text":"\t\t\tfiles = { [own]: mine };","atom":"a1523","author":"speed","version":152},{"n":238,"text":"\t\t}","atom":"a1523","author":"speed","version":152},{"n":239,"text":"\t\tconst rec = await client.call(\"POST\", `${base}/record`, { files }, \"record\");","atom":"a1523","author":"speed","version":152},{"n":240,"text":"\t\tif (rec.status !== 200) continue;","atom":"a1523","author":"speed","version":152},{"n":241,"text":"\t\tfor (const [p, t] of Object.entries(files)) view.set(p, t);","atom":"a1523","author":"speed","version":152},{"n":242,"text":"\t\tlet pub = await client.call(\"POST\", `${base}/publish`, { message: `${agent} round ${r}` }, \"publish\");","atom":"a1523","author":"speed","version":152},{"n":243,"text":"\t\tif (pub.status === 200 && pub.body.ok === false) {","atom":"a1523","author":"speed","version":152},{"n":244,"text":"\t\t\tstats.held++;","atom":"a1523","author":"speed","version":152},{"n":245,"text":"\t\t\t// Settle: pull (both sides' lines come back), then push with both sides kept, as abso push --as-is does.","atom":"a1523","author":"speed","version":152},{"n":246,"text":"\t\t\tconst pulled = await client.call(\"POST\", `${base}/sync`, {}, \"sync\");","atom":"a1523","author":"speed","version":152},{"n":247,"text":"\t\t\tif (pulled.status === 200) take(pulled.body.files);","atom":"a1523","author":"speed","version":152},{"n":248,"text":"\t\t\tpub = await client.call(","atom":"a1527","author":"speed","version":152},{"n":249,"text":"\t\t\t\t\"POST\",","atom":"a1527","author":"speed","version":152},{"n":250,"text":"\t\t\t\t`${base}/publish`,","atom":"a1527","author":"speed","version":152},{"n":251,"text":"\t\t\t\t{ message: `${agent} round ${r}, settled`, asIs: true },","atom":"a1527","author":"speed","version":152},{"n":252,"text":"\t\t\t\t\"publish\",","atom":"a1527","author":"speed","version":152},{"n":253,"text":"\t\t\t);","atom":"a1527","author":"speed","version":152},{"n":254,"text":"\t\t\tif (pub.status === 200 && pub.body.ok === true) stats.settled++;","atom":"a1523","author":"speed","version":152},{"n":255,"text":"\t\t\telse if (pub.status === 200) stats.heldAfterRetry++;","atom":"a1523","author":"speed","version":152},{"n":256,"text":"\t\t}","atom":"a1523","author":"speed","version":152},{"n":257,"text":"\t\tif (pub.status === 200 && pub.body.ok === true) {","atom":"a1523","author":"speed","version":152},{"n":258,"text":"\t\t\tstats.pushed(project);","atom":"a1523","author":"speed","version":152},{"n":259,"text":"\t\t\tstats.lastPush.set(project, Date.now());","atom":"a1523","author":"speed","version":152},{"n":260,"text":"\t\t}","atom":"a1523","author":"speed","version":152},{"n":261,"text":"\t\tawait client.call(\"POST\", `${base}/news`, {}, \"news\");","atom":"a1523","author":"speed","version":152},{"n":262,"text":"\t}","atom":"a1523","author":"speed","version":152},{"n":263,"text":"}","atom":"a1523","author":"speed","version":152},{"n":264,"text":"","atom":"a1523","author":"speed","version":152},{"n":265,"text":"/** For a sample of projects: how long after its last push until /out says Artifacts holds shared's newest version. */","atom":"a1523","author":"speed","version":152},{"n":266,"text":"async function artifactsLag(client, projects, stats, o) {","atom":"a1523","author":"speed","version":152},{"n":267,"text":"\tconst sample = projects.slice(0, o.artifactsSample);","atom":"a1523","author":"speed","version":152},{"n":268,"text":"\tconst until = Date.now() + o.artifactsWait * 1000;","atom":"a1523","author":"speed","version":152},{"n":269,"text":"\tconst results = await Promise.all(","atom":"a1523","author":"speed","version":152},{"n":270,"text":"\t\tsample.map(async (project) => {","atom":"a1523","author":"speed","version":152},{"n":271,"text":"\t\t\tfor (;;) {","atom":"a1523","author":"speed","version":152},{"n":272,"text":"\t\t\t\tconst out = await client.call(\"GET\", `/p/${project}/out`, undefined, \"out\");","atom":"a1523","author":"speed","version":152},{"n":273,"text":"\t\t\t\tconst b = out.body ?? {};","atom":"a1523","author":"speed","version":152},{"n":274,"text":"\t\t\t\tif (out.status === 200 && b.version !== null && b.pushed && b.pushed.version >= b.version) {","atom":"a1523","author":"speed","version":152},{"n":275,"text":"\t\t\t\t\tconst last = stats.lastPush.get(project) ?? stats.started;","atom":"a1523","author":"speed","version":152},{"n":276,"text":"\t\t\t\t\treturn { project, version: b.version, seconds: round((Date.now() - last) / 1000), error: null };","atom":"a1523","author":"speed","version":152},{"n":277,"text":"\t\t\t\t}","atom":"a1523","author":"speed","version":152},{"n":278,"text":"\t\t\t\tif (out.status === 200 && b.artifacts === \"unbound\")","atom":"a1523","author":"speed","version":152},{"n":279,"text":"\t\t\t\t\treturn { project, version: b.version, seconds: null, error: \"artifacts unbound\" };","atom":"a1523","author":"speed","version":152},{"n":280,"text":"\t\t\t\tif (Date.now() > until)","atom":"a1523","author":"speed","version":152},{"n":281,"text":"\t\t\t\t\treturn {","atom":"a1523","author":"speed","version":152},{"n":282,"text":"\t\t\t\t\t\tproject,","atom":"a1523","author":"speed","version":152},{"n":283,"text":"\t\t\t\t\t\tversion: b.version ?? null,","atom":"a1523","author":"speed","version":152},{"n":284,"text":"\t\t\t\t\t\tseconds: null,","atom":"a1523","author":"speed","version":152},{"n":285,"text":"\t\t\t\t\t\terror: b.error ? `not pushed: ${JSON.stringify(b.error).slice(0, 160)}` : \"not pushed in time\",","atom":"a1523","author":"speed","version":152},{"n":286,"text":"\t\t\t\t\t};","atom":"a1523","author":"speed","version":152},{"n":287,"text":"\t\t\t\tawait sleep(3000);","atom":"a1523","author":"speed","version":152},{"n":288,"text":"\t\t\t}","atom":"a1523","author":"speed","version":152},{"n":289,"text":"\t\t}),","atom":"a1523","author":"speed","version":152},{"n":290,"text":"\t);","atom":"a1523","author":"speed","version":152},{"n":291,"text":"\tconst done = results","atom":"a1527","author":"speed","version":152},{"n":292,"text":"\t\t.map((r) => r.seconds)","atom":"a1527","author":"speed","version":152},{"n":293,"text":"\t\t.filter((s) => s !== null)","atom":"a1527","author":"speed","version":152},{"n":294,"text":"\t\t.sort((a, b) => a - b);","atom":"a1527","author":"speed","version":152},{"n":295,"text":"\treturn {","atom":"a1523","author":"speed","version":152},{"n":296,"text":"\t\tsampled: sample.length,","atom":"a1523","author":"speed","version":152},{"n":297,"text":"\t\tpushedOut: done.length,","atom":"a1523","author":"speed","version":152},{"n":298,"text":"\t\tp50Seconds: percentile(done, 0.5),","atom":"a1523","author":"speed","version":152},{"n":299,"text":"\t\tmaxSeconds: done.at(-1) ?? null,","atom":"a1523","author":"speed","version":152},{"n":300,"text":"\t\tprojects: results,","atom":"a1523","author":"speed","version":152},{"n":301,"text":"\t};","atom":"a1523","author":"speed","version":152},{"n":302,"text":"}","atom":"a1523","author":"speed","version":152},{"n":303,"text":"","atom":"a1523","author":"speed","version":152},{"n":304,"text":"/** One stage: P projects × A agents × R rounds. */","atom":"a1523","author":"speed","version":152},{"n":305,"text":"export async function runStage(o, token, name) {","atom":"a1523","author":"speed","version":152},{"n":306,"text":"\tconst stats = new Stats();","atom":"a1523","author":"speed","version":152},{"n":307,"text":"\tstats.lastPush = new Map();","atom":"a1523","author":"speed","version":152},{"n":308,"text":"\tconst client = new Client(o.server, token, stats, limiter(o.concurrency));","atom":"a1523","author":"speed","version":152},{"n":309,"text":"\tconst projects = Array.from({ length: o.projects }, (_, i) => `${o.prefix}-${name}-p${i + 1}`.toLowerCase());","atom":"a1523","author":"speed","version":152},{"n":310,"text":"\tstats.started = Date.now();","atom":"a1523","author":"speed","version":152},{"n":311,"text":"\tconst made = await Promise.all(projects.map((p) => initProject(client, p)));","atom":"a1523","author":"speed","version":152},{"n":312,"text":"\tconst live = projects.filter((_, i) => made[i].ok);","atom":"a1523","author":"speed","version":152},{"n":313,"text":"\tconst initSeconds = (Date.now() - stats.started) / 1000;","atom":"a1523","author":"speed","version":152},{"n":314,"text":"\tconst t0 = Date.now();","atom":"a1523","author":"speed","version":152},{"n":315,"text":"\tconst deadline = t0 + o.maxSeconds * 1000;","atom":"a1523","author":"speed","version":152},{"n":316,"text":"\tawait Promise.all(","atom":"a1523","author":"speed","version":152},{"n":317,"text":"\t\tlive.flatMap((p) =>","atom":"a1523","author":"speed","version":152},{"n":318,"text":"\t\t\tArray.from({ length: o.agents }, (_, a) => runAgent(client, stats, p, `agent-${a + 1}`, o, deadline)),","atom":"a1523","author":"speed","version":152},{"n":319,"text":"\t\t),","atom":"a1523","author":"speed","version":152},{"n":320,"text":"\t);","atom":"a1523","author":"speed","version":152},{"n":321,"text":"\tconst seconds = (Date.now() - t0) / 1000;","atom":"a1523","author":"speed","version":152},{"n":322,"text":"\tconst lag = await artifactsLag(client, live, stats, o);","atom":"a1523","author":"speed","version":152},{"n":323,"text":"\tconst perProject = [...stats.perProject.values()].map((n) => n / seconds).sort((a, b) => a - b);","atom":"a1523","author":"speed","version":152},{"n":324,"text":"\treturn {","atom":"a1523","author":"speed","version":152},{"n":325,"text":"\t\tstage: name,","atom":"a1523","author":"speed","version":152},{"n":326,"text":"\t\tserver: o.server,","atom":"a1523","author":"speed","version":152},{"n":327,"text":"\t\tat: new Date(t0).toISOString(),","atom":"a1523","author":"speed","version":152},{"n":328,"text":"\t\tprojects: o.projects,","atom":"a1523","author":"speed","version":152},{"n":329,"text":"\t\tprojectsMade: live.length,","atom":"a1523","author":"speed","version":152},{"n":330,"text":"\t\tagentsPerProject: o.agents,","atom":"a1523","author":"speed","version":152},{"n":331,"text":"\t\tagents: live.length * o.agents,","atom":"a1523","author":"speed","version":152},{"n":332,"text":"\t\trounds: o.rounds,","atom":"a1523","author":"speed","version":152},{"n":333,"text":"\t\toverlap: o.overlap,","atom":"a1523","author":"speed","version":152},{"n":334,"text":"\t\tinitSeconds: round(initSeconds),","atom":"a1523","author":"speed","version":152},{"n":335,"text":"\t\tseconds: round(seconds),","atom":"a1523","author":"speed","version":152},{"n":336,"text":"\t\tcutShort: Date.now() > deadline,","atom":"a1523","author":"speed","version":152},{"n":337,"text":"\t\tpushes: stats.pushes,","atom":"a1523","author":"speed","version":152},{"n":338,"text":"\t\tpushesPerSecond: round(stats.pushes / seconds, 2),","atom":"a1523","author":"speed","version":152},{"n":339,"text":"\t\tpushesPerSecondPerProject: {","atom":"a1523","author":"speed","version":152},{"n":340,"text":"\t\t\tp50: round(percentile(perProject, 0.5), 3),","atom":"a1523","author":"speed","version":152},{"n":341,"text":"\t\t\tmin: round(perProject[0] ?? null, 3),","atom":"a1523","author":"speed","version":152},{"n":342,"text":"\t\t\tmax: round(perProject.at(-1) ?? null, 3),","atom":"a1523","author":"speed","version":152},{"n":343,"text":"\t\t},","atom":"a1523","author":"speed","version":152},{"n":344,"text":"\t\theld: stats.held,","atom":"a1523","author":"speed","version":152},{"n":345,"text":"\t\tsettledOnRetry: stats.settled,","atom":"a1523","author":"speed","version":152},{"n":346,"text":"\t\theldAfterRetry: stats.heldAfterRetry,","atom":"a1523","author":"speed","version":152},{"n":347,"text":"\t\trequests: stats.requests,","atom":"a1523","author":"speed","version":152},{"n":348,"text":"\t\trequestsPerSecond: round(stats.requests / seconds, 1),","atom":"a1523","author":"speed","version":152},{"n":349,"text":"\t\terrors: stats.errorCount(),","atom":"a1523","author":"speed","version":152},{"n":350,"text":"\t\terrorRate: round(stats.errorCount() / Math.max(1, stats.requests), 4),","atom":"a1523","author":"speed","version":152},{"n":351,"text":"\t\terrorsByStatus: Object.fromEntries(stats.errors),","atom":"a1523","author":"speed","version":152},{"n":352,"text":"\t\tstatuses: Object.fromEntries(stats.statuses),","atom":"a1523","author":"speed","version":152},{"n":353,"text":"\t\tlatencyMs: stats.latency(),","atom":"a1523","author":"speed","version":152},{"n":354,"text":"\t\tartifacts: lag,","atom":"a1523","author":"speed","version":152},{"n":355,"text":"\t\tfailedProjects: projects.filter((_, i) => !made[i].ok).map((p, i) => ({ project: p, why: made[i]?.why })),","atom":"a1523","author":"speed","version":152},{"n":356,"text":"\t};","atom":"a1523","author":"speed","version":152},{"n":357,"text":"}","atom":"a1523","author":"speed","version":152},{"n":358,"text":"","atom":"a1523","author":"speed","version":152},{"n":359,"text":"export function summaryRow(r) {","atom":"a1523","author":"speed","version":152},{"n":360,"text":"\tconst pub = r.latencyMs.publish ?? {};","atom":"a1523","author":"speed","version":152},{"n":361,"text":"\tconst lag = r.artifacts.p50Seconds === null ? \"n/a\" : `${r.artifacts.p50Seconds} s (max ${r.artifacts.maxSeconds} s)`;","atom":"a1523","author":"speed","version":152},{"n":362,"text":"\treturn `| ${r.projectsMade}×${r.agentsPerProject} | ${r.agents} | ${r.pushes} | ${r.pushesPerSecond} | ${pub.p50 ?? \"n/a\"} | ${pub.p95 ?? \"n/a\"} | ${r.held} (${r.heldAfterRetry} still held) | ${r.errors} (${(r.errorRate * 100).toFixed(2)}%) | ${lag} (${r.artifacts.pushedOut}/${r.artifacts.sampled}) |`;","atom":"a1523","author":"speed","version":152},{"n":363,"text":"}","atom":"a1523","author":"speed","version":152},{"n":364,"text":"","atom":"a1523","author":"speed","version":152},{"n":365,"text":"export const SUMMARY_HEAD = [","atom":"a1523","author":"speed","version":152},{"n":366,"text":"\t\"| Stage (projects×agents) | Agents | Pushes | Pushes/s | Push p50 ms | Push p95 ms | Held | Errors | Artifacts lag p50 (pushed/sampled) |\",","atom":"a1523","author":"speed","version":152},{"n":367,"text":"\t\"|---|---|---|---|---|---|---|---|---|\",","atom":"a1523","author":"speed","version":152},{"n":368,"text":"];","atom":"a1523","author":"speed","version":152},{"n":369,"text":"","atom":"a1523","author":"speed","version":152},{"n":370,"text":"function latencyTable(r) {","atom":"a1523","author":"speed","version":152},{"n":371,"text":"\tconst lines = [\"| Operation | Count | p50 ms | p95 ms | p99 ms | max ms |\", \"|---|---|---|---|---|---|\"];","atom":"a1523","author":"speed","version":152},{"n":372,"text":"\tfor (const [op, l] of Object.entries(r.latencyMs))","atom":"a1527","author":"speed","version":152},{"n":373,"text":"\t\tlines.push(`| ${op} | ${l.count} | ${l.p50} | ${l.p95} | ${l.p99} | ${l.max} |`);","atom":"a1527","author":"speed","version":152},{"n":374,"text":"\treturn lines.join(\"\\n\");","atom":"a1523","author":"speed","version":152},{"n":375,"text":"}","atom":"a1523","author":"speed","version":152},{"n":376,"text":"","atom":"a1523","author":"speed","version":152},{"n":377,"text":"function readToken(o) {","atom":"a1523","author":"speed","version":152},{"n":378,"text":"\tif (o.tokenFile)","atom":"a1527","author":"speed","version":152},{"n":379,"text":"\t\treturn readFileSync(","atom":"a1527","author":"speed","version":152},{"n":380,"text":"\t\t\to.tokenFile.replace(/^~(?=$|[\\\\/])/, process.env.USERPROFILE ?? process.env.HOME ?? \"~\"),","atom":"a1527","author":"speed","version":152},{"n":381,"text":"\t\t\t\"utf8\",","atom":"a1527","author":"speed","version":152},{"n":382,"text":"\t\t).trim();","atom":"a1527","author":"speed","version":152},{"n":383,"text":"\treturn (process.env.ABSO_TOKEN ?? \"\").trim();","atom":"a1523","author":"speed","version":152},{"n":384,"text":"}","atom":"a1523","author":"speed","version":152},{"n":385,"text":"","atom":"a1523","author":"speed","version":152},{"n":386,"text":"async function main() {","atom":"a1523","author":"speed","version":152},{"n":387,"text":"\tconst o = parseArgs(process.argv.slice(2));","atom":"a1523","author":"speed","version":152},{"n":388,"text":"\tif (o.help || !o.server) {","atom":"a1523","author":"speed","version":152},{"n":389,"text":"\t\tconsole.log(readFileSync(join(HERE, \"README.md\"), \"utf8\"));","atom":"a1523","author":"speed","version":152},{"n":390,"text":"\t\treturn;","atom":"a1523","author":"speed","version":152},{"n":391,"text":"\t}","atom":"a1523","author":"speed","version":152},{"n":392,"text":"\tconst token = readToken(o);","atom":"a1523","author":"speed","version":152},{"n":393,"text":"\tif (!token) throw new Error(\"no token: set ABSO_TOKEN or pass --token-file <file>\");","atom":"a1523","author":"speed","version":152},{"n":394,"text":"\tconst runId = Date.now().toString(36);","atom":"a1523","author":"speed","version":152},{"n":395,"text":"\to.prefix ||= `scale-${runId}`;","atom":"a1523","author":"speed","version":152},{"n":396,"text":"\tmkdirSync(o.out, { recursive: true });","atom":"a1523","author":"speed","version":152},{"n":397,"text":"\tconst stages = o.ramp ? RAMP : [[o.projects, o.agents]];","atom":"a1523","author":"speed","version":152},{"n":398,"text":"\tconst rows = [];","atom":"a1523","author":"speed","version":152},{"n":399,"text":"\tconst files = [];","atom":"a1523","author":"speed","version":152},{"n":400,"text":"\tfor (const [projects, agents] of stages) {","atom":"a1523","author":"speed","version":152},{"n":401,"text":"\t\tconst name = `${projects}x${agents}`;","atom":"a1523","author":"speed","version":152},{"n":402,"text":"\t\tconsole.error(`stage ${name}: ${projects} projects × ${agents} agents × ${o.rounds} rounds on ${o.server}`);","atom":"a1523","author":"speed","version":152},{"n":403,"text":"\t\tconst r = await runStage({ ...o, projects, agents }, token, name);","atom":"a1523","author":"speed","version":152},{"n":404,"text":"\t\tconst file = join(o.out, `${o.prefix}-${name}.json`);","atom":"a1523","author":"speed","version":152},{"n":405,"text":"\t\twriteFileSync(file, `${JSON.stringify(r, null, \"\\t\")}\\n`);","atom":"a1523","author":"speed","version":152},{"n":406,"text":"\t\tfiles.push(file);","atom":"a1523","author":"speed","version":152},{"n":407,"text":"\t\trows.push(r);","atom":"a1523","author":"speed","version":152},{"n":408,"text":"\t\tconsole.log(`\\n### Stage ${name}\\n\\n${SUMMARY_HEAD.join(\"\\n\")}\\n${summaryRow(r)}\\n\\n${latencyTable(r)}\\n`);","atom":"a1523","author":"speed","version":152},{"n":409,"text":"\t\tif (r.errorRate > o.stopErrorRate || r.projectsMade < r.projects) {","atom":"a1523","author":"speed","version":152},{"n":410,"text":"\t\t\tconsole.log(","atom":"a1527","author":"speed","version":152},{"n":411,"text":"\t\t\t\t`Stopped after stage ${name}: errors ${(r.errorRate * 100).toFixed(2)}%, projects made ${r.projectsMade} of ${r.projects}.`,","atom":"a1527","author":"speed","version":152},{"n":412,"text":"\t\t\t);","atom":"a1527","author":"speed","version":152},{"n":413,"text":"\t\t\tbreak;","atom":"a1523","author":"speed","version":152},{"n":414,"text":"\t\t}","atom":"a1523","author":"speed","version":152},{"n":415,"text":"\t}","atom":"a1523","author":"speed","version":152},{"n":416,"text":"\tif (rows.length > 1) {","atom":"a1523","author":"speed","version":152},{"n":417,"text":"\t\tconst summary = {","atom":"a1527","author":"speed","version":152},{"n":418,"text":"\t\t\tprefix: o.prefix,","atom":"a1527","author":"speed","version":152},{"n":419,"text":"\t\t\tserver: o.server,","atom":"a1527","author":"speed","version":152},{"n":420,"text":"\t\t\trounds: o.rounds,","atom":"a1527","author":"speed","version":152},{"n":421,"text":"\t\t\toverlap: o.overlap,","atom":"a1527","author":"speed","version":152},{"n":422,"text":"\t\t\tstages: rows","atom":"a1527","author":"speed","version":152},{"n":423,"text":"\t\t\t\t.map((r) => ({","atom":"a1527","author":"speed","version":152},{"n":424,"text":"\t\t\t\t\t...r,","atom":"a1527","author":"speed","version":152},{"n":425,"text":"\t\t\t\t\tlatencyMs: { publish: r.latencyMs.publish, record: r.latencyMs.record, sync: r.latencyMs.sync },","atom":"a1527","author":"speed","version":152},{"n":426,"text":"\t\t\t\t}))","atom":"a1527","author":"speed","version":152},{"n":427,"text":"\t\t\t\t.map(({ artifacts, statuses, ...r }) => ({","atom":"a1527","author":"speed","version":152},{"n":428,"text":"\t\t\t\t\t...r,","atom":"a1527","author":"speed","version":152},{"n":429,"text":"\t\t\t\t\tartifacts: {","atom":"a1527","author":"speed","version":152},{"n":430,"text":"\t\t\t\t\t\tsampled: artifacts.sampled,","atom":"a1527","author":"speed","version":152},{"n":431,"text":"\t\t\t\t\t\tpushedOut: artifacts.pushedOut,","atom":"a1527","author":"speed","version":152},{"n":432,"text":"\t\t\t\t\t\tp50Seconds: artifacts.p50Seconds,","atom":"a1527","author":"speed","version":152},{"n":433,"text":"\t\t\t\t\t\tmaxSeconds: artifacts.maxSeconds,","atom":"a1527","author":"speed","version":152},{"n":434,"text":"\t\t\t\t\t},","atom":"a1527","author":"speed","version":152},{"n":435,"text":"\t\t\t\t})),","atom":"a1527","author":"speed","version":152},{"n":436,"text":"\t\t};","atom":"a1527","author":"speed","version":152},{"n":437,"text":"\t\twriteFileSync(join(o.out, `${o.prefix}-ramp.json`), `${JSON.stringify(summary, null, \"\\t\")}\\n`);","atom":"a1523","author":"speed","version":152},{"n":438,"text":"\t\tconsole.log(`\\n## Ramp ${o.prefix}\\n\\n${SUMMARY_HEAD.join(\"\\n\")}\\n${rows.map(summaryRow).join(\"\\n\")}\\n`);","atom":"a1523","author":"speed","version":152},{"n":439,"text":"\t}","atom":"a1523","author":"speed","version":152},{"n":440,"text":"\tconsole.error(`results: ${files.join(\", \")}`);","atom":"a1523","author":"speed","version":152},{"n":441,"text":"}","atom":"a1523","author":"speed","version":152},{"n":442,"text":"","atom":"a1523","author":"speed","version":152},{"n":443,"text":"if (process.argv[1] && fileURLToPath(import.meta.url) === resolve(process.argv[1])) {","atom":"a1527","author":"speed","version":152},{"n":444,"text":"\tmain().catch((e) => {","atom":"a1523","author":"speed","version":152},{"n":445,"text":"\t\tconsole.error(e instanceof Error ? e.message : String(e));","atom":"a1523","author":"speed","version":152},{"n":446,"text":"\t\tprocess.exit(1);","atom":"a1523","author":"speed","version":152},{"n":447,"text":"\t});","atom":"a1523","author":"speed","version":152},{"n":448,"text":"}","atom":"a1523","author":"speed","version":152}],"atoms":[{"atom":"a1523","author":"speed","message":"","time":1791908247030,"timeIso":"2026-10-13T16:17:27.030Z","publish":{"draft":null,"version":152,"agent":"speed","message":"Scale harness for the open server, and its first ramp on abso-open","time":1791908902587,"timeIso":"2026-10-13T16:28:22.587Z"}},{"atom":"a1527","author":"speed","message":"","time":1791908508190,"timeIso":"2026-10-13T16:21:48.190Z","publish":{"draft":null,"version":152,"agent":"speed","message":"Scale harness for the open server, and its first ramp on abso-open","time":1791908902587,"timeIso":"2026-10-13T16:28:22.587Z"}}]}