Documented tree replacement (the history has no git-subtree metadata): 3-way merge of the old subtree (570201a:engine/strata) against upstream 41cf05a06a25dd29103b7b27a2279a3f60c21876 (2026-10-25), merge base = the old pin d9ab8435 (tree-identical to upstream 5b734e42; d9ab8435 is not an ancestor of upstream main). Local patches re-applied by hand where they conflicted (15 files): STRATA_CUDA_STATIC profile, experimental KAR experts and KAR PLE arms, keyless V-only arm (now beside upstream's K8V4 hybrid KV and fused norm+rope). Details, conflict table and left-out files are in docs/upstream.md. Left out (weights, captures, logs, media): new bench/results (2022 files), binary media and app assets (61), docs/work/evidence (24), *.bin / *.gguf data files, and the 7 files the first import already left out. scripts/build-cpu.sh: build the 11 CPU tests upstream registered since the old pin (they ran as "Not Run"). Checked: build-cpu.sh 16/16 ctest in WSL; sm_86 CUDA objects of the patched files compile, also with the KAR macros on. No GPU run, no quality gate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
44 lines
1.7 KiB
JavaScript
44 lines
1.7 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { EventEmitter } from 'node:events';
|
|
import { parseWindowsDiskLine, createWindowsDiskReader, diskRate } from '../server/system-telemetry.mjs';
|
|
|
|
function fakeSpawn(log) {
|
|
return (cmd, args) => {
|
|
const proc = new EventEmitter();
|
|
proc.stdout = new EventEmitter();
|
|
proc.stdout.unref = () => {};
|
|
proc.unref = () => {};
|
|
proc.kill = () => { proc.killed = true; };
|
|
log.push({ cmd, args, proc });
|
|
return proc;
|
|
};
|
|
}
|
|
|
|
test('one PowerShell is started and reused for every sample (#3939)', () => {
|
|
const log = [];
|
|
const reader = createWindowsDiskReader({ spawnFn: fakeSpawn(log), now: () => 1000 });
|
|
assert.equal(reader.read(), null, 'nothing before the first line');
|
|
reader.read(); reader.read();
|
|
assert.equal(log.length, 1);
|
|
log[0].proc.stdout.emit('data', '1000 2');
|
|
log[0].proc.stdout.emit('data', '000\n');
|
|
assert.deepEqual(reader.read(), { read: 1000, write: 2000, at: 1000 });
|
|
assert.equal(log.length, 1);
|
|
});
|
|
|
|
test('after repeated early exits it stops starting processes', () => {
|
|
const log = [];
|
|
const reader = createWindowsDiskReader({ spawnFn: fakeSpawn(log), maxStarts: 3 });
|
|
for (let i = 0; i < 6; i++) { reader.read(); log.at(-1).proc.emit('exit'); }
|
|
assert.equal(log.length, 3);
|
|
assert.equal(reader.read(), null);
|
|
});
|
|
|
|
test('garbage lines are ignored and a repeated reading gives no new rate', () => {
|
|
assert.equal(parseWindowsDiskLine('Name : x'), null);
|
|
assert.deepEqual(parseWindowsDiskLine('12 34\r'), { read: 12, write: 34 });
|
|
const prev = { time: 0, counters: { read: 0, write: 0, at: 1000 } };
|
|
assert.deepEqual(diskRate(prev, { read: 1048576, write: 0, at: 2000 }, 5000), { readMbs: 1, writeMbs: 0 });
|
|
});
|