From 107df67e3013fea7923da585d14ea4dd6c19f474 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Mon, 23 Nov 2026 19:53:12 +0100 Subject: [PATCH] app: test that picking or adopting a model never fetches a newer engine over the chosen one (#6875) The engine chosen in Settings > Engine is pinned; the install job's engine step (the same job for a download and for the person's own GGUF folder) leaves a pinned engine alone since rc0 (9d80fb2e4, 5907fe7ff, #6830). The reporter's case on 0.2.18 to 0.2.20 was this path. packaged-control.test.mjs now runs both jobs (a model to download, and a GGUF folder) against a feed that offers a newer engine: with a chosen engine the updater is not called and the message says the chosen engine stays in use; with no pin the engine still follows the feed with the model. The test fails on f65f2d614 (0.2.20 plus fixes) and passes on rc1. --- app/host/tests/packaged-control.test.mjs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/app/host/tests/packaged-control.test.mjs b/app/host/tests/packaged-control.test.mjs index c8932e5e2e..55aec48f9a 100644 --- a/app/host/tests/packaged-control.test.mjs +++ b/app/host/tests/packaged-control.test.mjs @@ -556,6 +556,30 @@ test('packaged: the install job also fetches the engine through Control (merge o } finally { await g.native.close(); g.cleanup(); } }); +test('#6875: picking a model (a download, or adopting files the person already has) never fetches a newer engine over the one the person chose in Settings', async () => { + const chosen = { engine: { status: 'available', installed: { version: '0.1.63' }, offered: { version: '0.1.66' }, download_bytes: 5e8, pinned: '0.1.63-windows-x86_64-cuda-cuda13' } }; + const f = packagedFixture({ engineUsable: true, updater: { report: chosen, async update() { throw new Error('the engine updater must not run for a chosen engine'); } } }); + try { + await f.native.refresh(true); + for (const args of [{ family: 'qwen', model: 'Q2_0' }, { family: 'qwen', model: 'IQ3_S', gguf_dir: 'D:/models/iq3s' }]) { // a model to download, and the person's own GGUF folder + const job = await finish(f.native, f.native.operation('install', args).id); + assert.equal(job.state, 'done', job.error); + assert.equal(job.result.install.engine.state, 'current'); + assert.match(job.result.install.engine.message, /^The engine you chose \(0\.1\.63\) stays in use\./); + } + assert.deepEqual(f.calls.filter(c => c[0] === 'update'), [], 'no engine download'); + } finally { await f.native.close(); f.cleanup(); } + // an engine nobody chose still follows the feed with the model (#4823), also when the model is adopted + const free = { engine: { ...chosen.engine, pinned: null } }; + const g = packagedFixture({ engineUsable: true, updater: { report: free, async update() { return { ok: true, results: [{ component: 'engine', status: 'updated', installed_after: { version: '0.1.66' } }] }; } } }); + try { + await g.native.refresh(true); + const job = await finish(g.native, g.native.operation('install', { family: 'qwen', model: 'IQ3_S', gguf_dir: 'D:/models/iq3s' }).id); + assert.equal(job.state, 'done', job.error); + assert.deepEqual(g.calls.filter(c => c[0] === 'update'), [['update', true, false]]); + } finally { await g.native.close(); g.cleanup(); } +}); + test('packaged: a model install that fails does not cancel the engine download it started (DL99: a retry would fail the same way again)', async () => { const report = { engine: { status: 'install', offered: { version: '0.1.46' }, download_bytes: 5e8 } }; const seen = { finished: false, aborted: null };