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>
62 lines
4.4 KiB
JavaScript
62 lines
4.4 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { readFile } from 'node:fs/promises';
|
|
import { engineRefusal, engineTooOld, markEngine, parseEngineVersion } from '../server/engine-version.mjs';
|
|
import { nativeFixture } from './helpers/native-fixture.mjs';
|
|
|
|
test('engine versions compare as numbers, a missing part counting as zero', () => {
|
|
assert.deepEqual(parseEngineVersion('0.1.45.3'), [0, 1, 45, 3]);
|
|
assert.deepEqual(parseEngineVersion('v0.1.45'), [0, 1, 45]);
|
|
assert.equal(parseEngineVersion('dev'), null);
|
|
assert.equal(engineTooOld('0.1.45', '0.1.45.1'), true, 'the released 0.1.45 stops at v4 files: too old for Gyro');
|
|
assert.equal(engineTooOld('0.1.45.1', '0.1.45.1'), false);
|
|
assert.equal(engineTooOld('0.1.45.3', '0.1.45.1'), false);
|
|
assert.equal(engineTooOld('0.1.46', '0.1.45.1'), false);
|
|
assert.equal(engineTooOld('0.1.44.1', '0.1.45.1'), true);
|
|
assert.equal(engineTooOld('0.1.45', null), false, 'no minimum: never too old');
|
|
assert.equal(engineTooOld(null, '0.1.45.1'), false, 'an unreadable version is not called too old');
|
|
assert.equal(engineTooOld('0.1.40', '0.1.45.1', 'local'), false, 'an engine built from this checkout has it whatever its number says');
|
|
});
|
|
|
|
const catalog = () => ({ families: [{ family: 'qwen', sizes: [{ id: 'q2_0', model: 'Q2_0', engine_min: null }] }, { family: 'gyro', sizes: [{ id: 'gyro-gyro-s', model: 'Gyro-S', engine_min: '0.1.45.1' }, { id: 'gyro-gyro-m', model: 'Gyro-M', engine_min: '0.1.45.1' }] }] });
|
|
|
|
test('the catalog marks the sizes an older engine cannot read; the refusal says what to do', () => {
|
|
const marked = markEngine(catalog(), { version: '0.1.45' });
|
|
assert.deepEqual(marked.families.flatMap(f => f.sizes.map(s => [s.id, s.needsNewerEngine])), [['q2_0', false], ['gyro-gyro-s', true], ['gyro-gyro-m', true]]);
|
|
const text = engineRefusal(marked, 'gyro-gyro-s', { version: '0.1.45' });
|
|
assert.match(text, /^This model needs a newer engine: Gyro-S needs engine 0\.1\.45\.1 or newer, and this one is 0\.1\.45\. Update the engine in Settings, then try again\.$/);
|
|
assert.equal(engineRefusal(marked, 'q2_0', { version: '0.1.45' }), null);
|
|
const fresh = markEngine(catalog(), { version: '0.1.45.3' });
|
|
assert.ok(fresh.families.every(f => f.sizes.every(s => !s.needsNewerEngine)));
|
|
assert.equal(markEngine(null, {}), null);
|
|
});
|
|
|
|
test('with an older engine installed the app refuses to download or load Gyro, with the plain sentence; a new enough engine goes on', async () => {
|
|
const old = nativeFixture({ engineStatus: { version: '0.1.45', backend: 'cuda' } });
|
|
try {
|
|
old.catalog.families.push({ family: 'gyro', title: 'Qwen3.8-Flash-Next (Gyro)', about: '', images: false, sizes: [{ id: 'iq2_xs', model: 'Gyro-S', download_gb: 58, ram_needed_gb: 28, about: '', on_this_pc: 'fits', installed: true, engine_min: '0.1.45.1' }] });
|
|
old.catalog.families[0].sizes[0].engine_min = '0.1.45.1';
|
|
const state = await old.control.refresh(true);
|
|
const sizes = state.catalog.families.flatMap(f => f.sizes);
|
|
assert.ok(sizes.find(s => s.engine_min).needsNewerEngine);
|
|
const id = sizes.find(s => s.engine_min).id;
|
|
assert.throws(() => old.control.operation('load', { model: id }), /This model needs a newer engine: .* needs engine 0\.1\.45\.1 or newer, and this one is 0\.1\.45\./);
|
|
assert.throws(() => old.control.operation('install', { model: id }), /needs a newer engine/);
|
|
assert.equal(old.control.state().jobs.length, 0, 'nothing was started');
|
|
} finally { await old.cleanup(); }
|
|
const ok = nativeFixture({ engineStatus: { version: '0.1.45.3', backend: 'cuda' } });
|
|
try {
|
|
ok.catalog.families[0].sizes[0].engine_min = '0.1.45.1';
|
|
const state = await ok.control.refresh(true);
|
|
assert.ok(state.catalog.families[0].sizes.every(s => !s.needsNewerEngine));
|
|
} finally { await ok.cleanup(); }
|
|
});
|
|
|
|
test('the screens use the existing "needs a newer engine" notice for a size, and the buttons are held back', async () => {
|
|
const models = await readFile(new URL('../src/components/NativeModels.tsx', import.meta.url), 'utf8');
|
|
assert.match(models, /selectedFamily && \(!selectedSize \|\| selectedSize\.needsNewerEngine\) \? <><h2 className="h3">\{tr\("This model needs a newer engine\."\)\}/);
|
|
assert.match(models, /!!selectedSize\.needsNewerEngine\}/);
|
|
const guided = await readFile(new URL('../src/components/GuidedSetup.tsx', import.meta.url), 'utf8');
|
|
assert.equal((guided.match(/needsNewerEngine/g) ?? []).length, 3);
|
|
});
|