Files
Strata/apps/host/tests/policy-generated.test.mjs
T
Niko1221 efa9d6dbed DeepSeek out (5/7): the desktop app without DeepSeek; a DeepSeek model in the list says where its files are and is not loaded
- apps/host: the DeepSeek card, note, Speed (DeepSeek) setting, context list, picture tower, engine options, the
  "DeepSeek" engine family and its update line go (server/dsv41-context.mjs, server/native-ds-args.mjs,
  src/lib/deepseek-context.ts, src/lib/deepseek-speed.ts deleted; native-control, native-settings, engine-library,
  native-vision, GuidedSetup, NativeModels, NativeSettings, VersionPicker, EngineUpdateCard, PcFitCard, engine-list,
  native-catalog, default-context, native.ts edited). withoutVisionFlag, used by the Qwen path, moves into
  native-control.mjs unchanged.
- A model Control lists as retired (strata_control/models.py, commit 2) shows on the Models screen with its line
  (the owner's D2) and cannot be loaded: loadEngine stops with Control's refusal (D1) before any fetch, file write or
  start; the Manage list and Settings > Storage leave it out (their delete removes files). plain-errors.ts shows the
  refusal as Control wrote it, with the approved next step (English; translations come with the owner's word).
  The host's autostart clears a remembered DeepSeek model and logs the refusal instead of trying to load it.
- The "DeepSeek speed-ups" switch leaves strata_control/speed_switches.py (a DeepSeek config gets no switch);
  app_policy.py loses the DeepSeek rows; policy-generated.mjs and tests/data/policy-vectors.json regenerated with
  `python -m strata_control.app_policy`.
- Locales: the 16 DeepSeek-only keys leave all nine languages (fx62-fx69, fx72, fx75, fx77, fx78, fx80, fx81,
  vp03). DeepSeek as a cloud provider / search key and the DeepSeek Harness are untouched (owner).
- Tests: the six DeepSeek-only app test files go; the DeepSeek cases of the shared ones become "listed as retired,
  refused, nothing saved or started"; test_speed_switches.py loses the DeepSeek switch rows.
2026-11-11 11:42:22 +01:00

54 lines
3.7 KiB
JavaScript

/** The host's launch-policy tables come from strata_control (policy-generated.mjs, written by python -m strata_control.app_policy; tests/terminal/test_app_policy.py checks the file is current).
* Here: the host really uses them, and the screen's own copy of the family list (src/lib/drafting.ts) is the same list. */
import test from 'node:test';
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import { SPEED_SWITCH_TABLE, DRAFTING_FAMILIES, DFLASH2_MODEL_PATTERN } from '../server/policy-generated.mjs';
import { transform } from 'esbuild';
import * as S from '../server/native-settings.mjs';
test('the speed switches of the settings are the generated table, with the Speed group added where the table names none', () => {
assert.deepEqual(S.SPEED_SWITCHES.map(({ group, ...rest }) => rest), SPEED_SWITCH_TABLE.map(({ group, ...rest }) => rest));
assert.ok(S.SPEED_SWITCHES.every(s => s.group === (SPEED_SWITCH_TABLE.find(t => t.id === s.id).group ?? 'Speed')));
assert.deepEqual(SPEED_SWITCH_TABLE.map(s => s.id), ['faster_long_prompts', 'faster_12gb_nvidia', 'faster_radeon_9000', 'picture_reader']);
assert.equal(S.SPEED_SWITCHES.find(s => s.id === 'picture_reader').group, 'Image reading');
});
test('the drafting families and the model-name rule are the generated ones', () => {
assert.deepEqual(S.DRAFTING_FAMILIES, DRAFTING_FAMILIES);
const re = new RegExp(DFLASH2_MODEL_PATTERN, 'i');
assert.ok(re.test('qwen3.8-flash-next-iq3_s') && re.test('qwen3.8-flash-next-unsloth-ud-q4_k_xl') && !re.test('swift-1.5'));
assert.equal(S.resolveDrafter('auto', 'qwen3.8-flash-next-iq3_s', true, false), 'dflash2');
assert.equal(S.resolveDrafter('auto', 'swift-1.5-iq3_s', true, false), 'mtp');
});
test('the screen copy of the drafting families (src/lib/drafting.ts) is the generated list', async () => {
const ts = await readFile(new URL('../src/lib/drafting.ts', import.meta.url), 'utf8');
const m = /export const DRAFTING_FAMILIES = (\[[^\]]*\]);/.exec(ts);
assert.ok(m, 'DRAFTING_FAMILIES in src/lib/drafting.ts');
assert.deepEqual(JSON.parse(m[1].replaceAll("'", '"')), DRAFTING_FAMILIES);
});
/* The rules (where a switch applies, which models have a Drafting choice) are code in the host and in the screen; strata_control answers the same cases (policy-vectors.json, written by python -m strata_control.app_policy). */
const V = JSON.parse(await readFile(new URL('./data/policy-vectors.json', import.meta.url), 'utf8'));
const { code } = await transform(await readFile(new URL('../src/lib/drafting.ts', import.meta.url), 'utf8'), { loader: 'ts', format: 'esm' });
const T = await import(`data:text/javascript;base64,${Buffer.from(code).toString('base64')}`);
test('the host shows the speed switches strata_control shows, for every card, engine and model of the vectors', () => {
assert.ok(V.switches.length > 100);
for (const row of V.switches) {
const model = V.models[row.model];
const context = { backend: row.backend, gpus: [V.cards[row.card]], arch: model.arch ?? null, vision: !!model.vision };
const shown = S.SPEED_SWITCHES.filter(s => S.speedSwitchApplies(s.id, context)).map(s => s.id).sort();
assert.deepEqual(shown, row.shows, `${row.model} on ${row.backend} with ${row.card}`);
}
});
test('the host and the screen agree with strata_control on which models and families have a Drafting choice', () => {
for (const { name, supported } of V.names) assert.equal(S.resolveDrafter('dflash2', name, true, false) === 'dflash2', supported, name);
for (const { family, supported } of V.families) {
assert.equal(T.resolveDrafter('dflash2', family, true, false) === 'dflash2', supported, `screen: ${family}`);
assert.equal(S.resolveDrafter('dflash2', family, true, false) === 'dflash2', supported, `host: ${family}`);
}
});