app: the engine step also reads person_chose (Control's word after a rollback); test

This commit is contained in:
Niko1221 committed 2026-11-23 14:03:23 +01:00
1 parent aa1398a307
commit 9d80fb2e44
2 files changed
+16 -1

No files matched your search

+1 -1
View File
@@ -39,7 +39,7 @@ export function createEngineStep({ control, signal = null, onChange = () => {} }
/* #6830: an engine the person chose or went back to (`strata components rollback`, Settings > Engine, `components use`) is pinned. A model's install or a change
of its settings never switches it: the job used to run the updater for the newer engine still on disk, which dropped the pin and the skipped list and put the
broken release back. The newer one stays offered in Settings > Engine and by `strata update`. */
if (usable && engine.pinned && engine.status === 'available') {
if (engine.status === 'available' && (engine.person_chose === true || (usable && engine.pinned))) { // person_chose: Control's own word for it (5907fe7ff); pinned alone covers a pin whose newer engine is not on disk
const here = engine.installed?.version ?? null, offered = engine.offered?.version ?? null;
set({ state: 'current', version: here, percent: 100, message: `The engine you chose${here ? ` (${here})` : ''} stays in use.${offered ? ` A newer one (${offered}) is offered: Settings > Engine switches to it.` : ''}` });
return { ...part };
+15
View File
@@ -127,6 +127,21 @@ test('#6830: a pinned engine (rolled back to, or chosen in Settings) is never re
assert.equal((await createEngineStep({ control: none }).run()).state, 'done');
});
test('#6830 (the word of the Control side): person_chose after a rollback keeps the engine in use and its pin; a settings save never calls the updater', async () => {
const c = control({
usable: true,
check: offer('available', { installed: { version: '0.1.64' }, offered: { version: '0.1.66' }, person_chose: true, installed_locally: '0.1.66', note: 'you went back to 0.1.64' }),
update: async () => { throw new Error('the updater must not run: it would drop the pin and the skip'); },
});
const part = await createEngineStep({ control: c }).run();
assert.deepEqual(c.calls, ['engine', 'updateCheck']);
assert.equal(part.state, 'current');
assert.equal(part.version, '0.1.64');
// the same check without it (nobody went back): the update with the model goes on as before
const free = control({ usable: true, check: offer('available', { installed: { version: '0.1.64' }, offered: { version: '0.1.66' } }), update: async () => ({ ok: true, results: [{ component: 'engine', status: 'updated', installed_after: { version: '0.1.66' } }] }) });
assert.equal((await createEngineStep({ control: free }).run()).state, 'done');
});
test('a first engine keeps the plain download words', async () => {
const messages = [];
const c = control({ check: offer(), update: async () => updated });