No recognised engine: the app still downloads the model and warns in its card; loading names the next step
setup.py control_engine_step stops only for strata launch (STRATA_NEED_ENGINE=1); the app warns and continues. The Models card and the first-run download card show the owner's plain warning before and during the download; the load refusal says the same with Settings > Engine.
This commit is contained in:
1 parent
979da9d2bc
commit
e6ab4c024d
17 files changed
+83
-18
No files matched your search
@@ -25,6 +25,8 @@ const safeId=value=>typeof value==='string'&&/^[a-z0-9_-]{1,80}$/i.test(value);
|
||||
const busy=requests=>requests.some(r=>['queued','generating'].includes(r.state));
|
||||
function readJson(path,fallback={}){try{return JSON.parse(readFileSync(path,'utf8').replace(/^\uFEFF/,''));}catch{return fallback;}}
|
||||
|
||||
/** The plain words for "no usable engine": the model still downloads, but loading needs the engine (owner decision 2026-10-18). */
|
||||
export const ENGINE_NOT_RECOGNISED='Strata didn’t recognise an engine for this computer. The model is downloaded, but it can’t run until the right engine is installed. Open Settings → Engine.';
|
||||
export function createNativeControl({directory,requests=()=>[],changed=()=>{},spawnProcess=spawn,fetcher=fetch,modelsDirectory,nativeDataDirectory=value=>value,beforeLoad=async()=>{},hardwareProbe=()=>[],control=null,ready=null,appUpdater=null,defaultRepo=process.env.STRATA_NATIVE_REPO??resolve(ROOT,'../../Strata')}={}){
|
||||
mkdirSync(directory,{recursive:true});
|
||||
const settingsPath=join(directory,'native-host.json');
|
||||
@@ -204,7 +206,7 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
|
||||
return {cfg,resources,visionPreferences,parallelChoice,parallelNote};
|
||||
}
|
||||
async function loadEngine(job,args){
|
||||
await refresh(true);if(job.state!=='running')return;const {config,entry,path:configFile}=record(args.model);assertSettingsFile(configFile);if(packaged){const engine=await control.engine();if(!engine.usable)throw new Error(engine.notice??'No engine for this PC was found.');}if(!entry.ready)throw new Error('Some model files are missing. Use Download / repair to restore them.');
|
||||
await refresh(true);if(job.state!=='running')return;const {config,entry,path:configFile}=record(args.model);assertSettingsFile(configFile);if(packaged){const engine=await control.engine();if(!engine.usable)throw new Error(ENGINE_NOT_RECOGNISED+(engine.notice?` ${engine.notice}`:''));}if(!entry.ready)throw new Error('Some model files are missing. Use Download / repair to restore them.');
|
||||
if(externalRunning().length)throw new Error('A Strata server is already running outside this UI. Stop it before loading here, or connect its API in Settings → Models.');
|
||||
if(args.multiple&&instances.size>=8)throw new Error('Unload an instance before adding another. Up to eight native instances can run here.');
|
||||
const {cfg,resources,visionPreferences,parallelChoice,parallelNote:chosenNote}=buildConfig(args,config);
|
||||
@@ -345,7 +347,7 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
|
||||
async function tuneOff(args){await refresh();const {path}=tuneConfig(args);return autotuner.off(path);}
|
||||
async function autotune(job,args){
|
||||
await refresh(true);if(job.state!=='running')return;
|
||||
if(packaged){const engine=await control.engine();if(!engine.usable)throw new Error(engine.notice??'No engine for this PC was found.');}
|
||||
if(packaged){const engine=await control.engine();if(!engine.usable)throw new Error(ENGINE_NOT_RECOGNISED+(engine.notice?` ${engine.notice}`:''));}
|
||||
const {path}=tuneConfig(args);
|
||||
if(externalRunning().length)throw new Error('Stop the native server running outside this UI before tuning.');
|
||||
if(busy(requests().filter(r=>instances.has(r.instanceId))))throw new Error('Finish requests before tuning.');
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { tr } from '../lib/i18n';
|
||||
import { Icon } from './ui';
|
||||
import type { NativeState } from '../lib/native';
|
||||
|
||||
/** The app could not find or recognise an engine for this computer (none installed and none in the feed, another card family, a driver that is too old). It still downloads the model
|
||||
* (owner decision 2026-10-18) and says so before and during the download; loading says the same with the next step. */
|
||||
export const engineMissing = (native: NativeState | null | undefined) => !!native?.engine && native.engine.usable === false;
|
||||
|
||||
export function EngineWarning({ native }: { native: NativeState | null | undefined }) {
|
||||
if (!engineMissing(native)) return null;
|
||||
return <div className="engine-warning" role="status"><Icon name="info" size={18}/><div><p>{tr("Strata didn’t recognise an engine for this computer. The model will download, but it may not run until the right engine is installed (Settings → Engine).")}</p>{native?.engine?.notice ? <small className="muted">{native.engine.notice}</small> : null}</div></div>;
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import { downloadCounter, modelFolderLabel, onboardingError } from '../lib/onboa
|
||||
import { installProgress, installStage, stageText, useDownloadEta } from '../lib/download-eta';
|
||||
import { VersionPicker } from './VersionPicker';
|
||||
import { DownloadParts } from './DownloadParts';
|
||||
import { EngineWarning } from './EngineWarning';
|
||||
import { recommendedVersions } from '../lib/native-fit';
|
||||
import { nativeCatalogModels, catalogVersionLabel } from '../lib/native-catalog';
|
||||
type Choices = NonNullable<NonNullable<SetupState['choices']>['onboarding']>;
|
||||
@@ -194,7 +195,7 @@ export function GuidedSetup() {
|
||||
{tr(folderOpen ? <OnboardingFolder directory={folder} onChoose={path => void perform(async () => { await nativeAction('directory', { directory: path }); setDirectory(path); setFolderOpen(false); setPlan(null); })}/> : null)}
|
||||
</> : <div className="onboard-engine-connect"><Icon name="models" size={24}/><strong>{tr("Connect your Strata installation")}</strong><Btn onClick={() => void skip(false, 'Engine')}>{tr("Connect engine")}</Btn></div>)}
|
||||
</div> : step === 3 ? <div className="onboard-prepare-stage">
|
||||
<section className="onboard-download"><div className="onboard-download-identity"><Icon name="models" size={19}/><strong>{tr(selectedFamily?.title)}</strong><span>{tr(version ? catalogVersionLabel(version) : '')}</span><small>{tr(version?.model)}</small></div><OnboardingArt kind="download" progress={progress?.percent ?? 0} counter={counter}/><div className="onboard-download-info">
|
||||
<section className="onboard-download"><EngineWarning native={native}/><div className="onboard-download-identity"><Icon name="models" size={19}/><strong>{tr(selectedFamily?.title)}</strong><span>{tr(version ? catalogVersionLabel(version) : '')}</span><small>{tr(version?.model)}</small></div><OnboardingArt kind="download" progress={progress?.percent ?? 0} counter={counter}/><div className="onboard-download-info">
|
||||
{tr(preparing ? <div><strong className="onboard-download-status">{tr(progress ? stageText(installStage(installJob?.result?.install)) : 'Preparing your model…')}</strong><div className="onboard-progress" data-indeterminate={!progress}>{tr(progress ? <progress max={100} value={progress.percent ?? 0} aria-label={tr("Current file download progress")}/> : <span />)}</div><DownloadParts parts={installJob?.result?.install?.parts}/><div className="onboard-progress-meta"><span>{tr(progress ? `${progress.percent ?? 0}%${Number.isFinite(progress.done_gb) && Number.isFinite(progress.total_gb) ? ` · ${progress.done_gb!.toFixed(1)} / ${progress.total_gb!.toFixed(1)} GB` : ''}` : 'Getting files ready…')}</span><div className="onboard-progress-actions">{tr(eta ? <span aria-live="off">{eta}</span> : null)}<button disabled={pending} onClick={() => void perform(async () => { await nativeAction(`operations/${installJob!.id}/cancel`); })}>{tr("Stop")}</button></div></div></div> : <>{tr(stopped ? <OnboardingError message={installJob?.error ?? 'Download stopped. Ready when you are.'} onFolder={changeDownloadFolder}/> : null)}{tr(plan?.plan?.disk_short ? <OnboardingError message={plan.plan.disk_short} onFolder={changeDownloadFolder}/> : null)}</>)}
|
||||
<small className="onboard-download-location" title={tr(folder)}><Icon name="folder" size={16}/><span><span>{tr("Save to")}</span><strong>{tr(modelFolderLabel(folder))}</strong></span>{tr(!preparing ? <button type="button" onClick={changeDownloadFolder}>{tr("Change")}</button> : null)}</small>
|
||||
</div></section><OnboardingTour page={tour} onChange={setTour}/>
|
||||
|
||||
@@ -9,6 +9,7 @@ import { Btn, Dialog, ErrorNotice, Icon, Select } from './ui';
|
||||
import { installProgress, installStage, stageText, useDownloadEta } from '../lib/download-eta';
|
||||
import { useKept } from '../lib/kept-state';
|
||||
import { DownloadParts } from './DownloadParts';
|
||||
import { EngineWarning } from './EngineWarning';
|
||||
import { sizeGb } from '../lib/format';
|
||||
import { NativeDeleteDialog } from './NativeDelete';
|
||||
import { plainFailureText } from '../lib/plain-errors';
|
||||
@@ -181,6 +182,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
|
||||
{tr(selectedSize?.imagesCapable && !selectedSize.images ? <p className="small muted native-spill-note">{tr("This model can read pictures, but the engine installed here does not include the picture reader yet, so Read pictures is off. Update the engine in Settings → About to turn it on.")}</p> : null)}
|
||||
{tr(selectedSize?.images ? <><div className="native-image-reading"><label><input type="checkbox" checked={vision !== 'no'} disabled={!selectedSize?.images || !!active} onChange={e => setVision(e.target.checked ? 'yes' : 'no')}/><span><strong>{tr("Read pictures ")}<small>{tr("On by default")}</small></strong><small>{tr("Understand photos, screenshots and charts. The picture files download automatically. Turn it off to save memory.")}</small></span></label>{tr(expert && vision !== 'no' ? <Select ariaLabel={tr("Image encoder device")} value={vision === 'yes' ? 'yes' : vision} options={[{ value: 'yes', label: 'Automatic' }, { value: 'gpu', label: 'GPU' }, { value: 'cpu', label: 'CPU' }]} onChange={setVision}/> : null)}</div>{tr(vision !== 'no' && installed?.ready && installed.visionPrepared === false ? <div className="native-vision-missing" role="status"><span>{tr("Picture reading needs a few more files that are not on this computer yet.")}</span><Btn size="sm" disabled={pending || !!active} onClick={() => void download()}>{tr("Download picture-reading files")}</Btn></div> : null)}</> : null)}
|
||||
</> : null)}
|
||||
<EngineWarning native={native}/>
|
||||
{tr(active ? <NativeProgress job={active} label={jobLabel(active)}/> : null)}
|
||||
{tr(job?.state === 'error' ? <ErrorNotice message={job.error ?? job.summary} action={tr("Retry")} onRetry={() => void load()}/> : null)}
|
||||
{tr(error ? <ErrorNotice message={error}/> : null)}
|
||||
|
||||
@@ -10,6 +10,8 @@ export interface NativeJob {id:string;kind:string;guided?:boolean;model?:string;
|
||||
export interface NativeInstance {id:string;apiModelId:string;model:string;label:string;aliases?:string[];vision?:boolean;resourceProfile?:'work'|'performance'|null;context?:number;port:number;gpus:number[];status:'loading'|'ready'|'unloading'|'error';phase:string;loadedAt:string;error:string|null;metrics:Record<string,any>|null}
|
||||
export interface NativeState {
|
||||
/** The picture reader (strata-vision) is installed with the engine, so models marked for pictures can read them here. */
|
||||
/** Strata Control's view of the engine for this computer (the app): usable false = none found or recognised; `notice` says why in plain words. */
|
||||
engine?:{usable:boolean;notice?:string|null;version?:string|null};
|
||||
visionReader?: boolean;available:boolean;repo:string;downloadDirectory?:string;version?:string|null;summary:string;error:string|null;catalog:{families:NativeFamily[];contexts:number[];recommendation:{family:string|null;model:string|null;context?:number;why?:string};context_note:string}|null;installed:{models:{model:string;config:string;model_name:string;ready:boolean;/** The picture-reading files are on this computer (notes-split-agent8.md, item 8). */visionPrepared?:boolean;context?:number;kv?:string;images?:string;visionEnabled?:boolean;visionDevice?:string;lowRamMode?:string;resourceProfile?:'work'|'performance';dataFolder?:string;diskGb?:number;diskBytes?:number;/** Files this model shares with another (the picture reader, the draft layer): counted once, in `usage`. */sharedBytes?:number;/** What Delete frees: files in Strata's own folders that no other model uses. */removableGb?:number;missing_files?:string[]}[];/** What all models take on disk, from their real files, shared files counted once. */usage?:{total_bytes:number;total_gb:number;shared_bytes:number;shared_gb:number;models:Record<string,{bytes:number;gb:number}>}|null;data_folder:string;engine:{version:string|null}}|null;hardware:{ram_gb:number;gpus:{index:number;name:string;vram_gb:number;usable:boolean}[]}|null;fields:NativeField[];instances:NativeInstance[];defaultId:string|null;jobs:NativeJob[];capabilities:{responses?:boolean;updates:boolean;rollback:boolean;calibration:boolean;componentUpdates?:boolean}}
|
||||
let state:NativeState|null=null;
|
||||
const listeners=new Set<()=>void>();
|
||||
|
||||
@@ -3248,5 +3248,7 @@
|
||||
"s3252": "Von mehr als einem Modell genutzt",
|
||||
"s3253": "Diese Dateien liegen in deinem eigenen Ordner und bleiben dort. Nur der Eintrag in Strata wird entfernt.",
|
||||
"s3254": "Das laufende Modell wird entladen.",
|
||||
"s3255": "Lokal"
|
||||
"s3255": "Lokal",
|
||||
"s3256": "Strata hat für diesen Computer keine passende Engine erkannt. Das Modell wird trotzdem heruntergeladen, läuft aber möglicherweise erst, wenn die richtige Engine installiert ist (Einstellungen → Engine).",
|
||||
"s3257": "Strata hat für diesen Computer keine passende Engine erkannt. Das Modell ist heruntergeladen, läuft aber erst, wenn die richtige Engine installiert ist. Öffne Einstellungen → Engine."
|
||||
}
|
||||
@@ -3248,5 +3248,7 @@
|
||||
"s3252": "Used by more than one model",
|
||||
"s3253": "These files are in your own folder, so they stay there. Only the entry in Strata is removed.",
|
||||
"s3254": "The running model will be unloaded.",
|
||||
"s3255": "Local"
|
||||
"s3255": "Local",
|
||||
"s3256": "Strata didn’t recognise an engine for this computer. The model will download, but it may not run until the right engine is installed (Settings → Engine).",
|
||||
"s3257": "Strata didn’t recognise an engine for this computer. The model is downloaded, but it can’t run until the right engine is installed. Open Settings → Engine."
|
||||
}
|
||||
@@ -3248,5 +3248,7 @@
|
||||
"s3252": "Los usa más de un modelo",
|
||||
"s3253": "Estos archivos están en tu propia carpeta y se quedan allí. Solo se quita la entrada en Strata.",
|
||||
"s3254": "El modelo en ejecución se descargará de la memoria.",
|
||||
"s3255": "Local"
|
||||
"s3255": "Local",
|
||||
"s3256": "Strata no reconoció un motor para este equipo. El modelo se descargará, pero puede que no funcione hasta que se instale el motor adecuado (Ajustes → Motor).",
|
||||
"s3257": "Strata no reconoció un motor para este equipo. El modelo está descargado, pero no podrá funcionar hasta que se instale el motor adecuado. Abre Ajustes → Motor."
|
||||
}
|
||||
@@ -3248,5 +3248,7 @@
|
||||
"s3252": "複数のモデルで使われています",
|
||||
"s3253": "これらのファイルはあなた自身のフォルダーにあるため、そのまま残ります。Strata 上の項目だけが削除されます。",
|
||||
"s3254": "動作中のモデルの読み込みを解除します。",
|
||||
"s3255": "ローカル"
|
||||
"s3255": "ローカル",
|
||||
"s3256": "Strata がこのパソコン用のエンジンを認識できませんでした。モデルはダウンロードされますが、適切なエンジンをインストールするまで動作しない場合があります(設定 → エンジン)。",
|
||||
"s3257": "Strata がこのパソコン用のエンジンを認識できませんでした。モデルはダウンロード済みですが、適切なエンジンをインストールするまで動作しません。設定 → エンジン を開いてください。"
|
||||
}
|
||||
@@ -3248,5 +3248,7 @@
|
||||
"s3252": "여러 모델에서 함께 사용",
|
||||
"s3253": "이 파일들은 내 폴더에 있으므로 그대로 남습니다. Strata의 항목만 삭제됩니다.",
|
||||
"s3254": "실행 중인 모델을 해제합니다.",
|
||||
"s3255": "로컬"
|
||||
"s3255": "로컬",
|
||||
"s3256": "Strata가 이 컴퓨터용 엔진을 인식하지 못했습니다. 모델은 다운로드되지만 올바른 엔진을 설치하기 전에는 실행되지 않을 수 있습니다(설정 → 엔진).",
|
||||
"s3257": "Strata가 이 컴퓨터용 엔진을 인식하지 못했습니다. 모델은 다운로드되었지만 올바른 엔진을 설치하기 전에는 실행할 수 없습니다. 설정 → 엔진을 열어 주세요."
|
||||
}
|
||||
@@ -3248,5 +3248,7 @@
|
||||
"s3252": "Usados por mais de um modelo",
|
||||
"s3253": "Esses arquivos estão na sua própria pasta e continuam lá. Só a entrada no Strata é removida.",
|
||||
"s3254": "O modelo em execução será descarregado.",
|
||||
"s3255": "Local"
|
||||
"s3255": "Local",
|
||||
"s3256": "A Strata não reconheceu um mecanismo para este computador. O modelo será baixado, mas pode não funcionar até que o mecanismo certo seja instalado (Configurações → Mecanismo).",
|
||||
"s3257": "A Strata não reconheceu um mecanismo para este computador. O modelo foi baixado, mas não vai funcionar até que o mecanismo certo seja instalado. Abra Configurações → Mecanismo."
|
||||
}
|
||||
@@ -3248,5 +3248,7 @@
|
||||
"s3252": "Используются несколькими моделями",
|
||||
"s3253": "Эти файлы лежат в вашей папке и останутся там. Из Strata удаляется только запись.",
|
||||
"s3254": "Работающая модель будет выгружена.",
|
||||
"s3255": "Локальная"
|
||||
"s3255": "Локальная",
|
||||
"s3256": "Strata не распознала движок для этого компьютера. Модель всё равно скачается, но может не запуститься, пока не будет установлен нужный движок (Настройки → Движок).",
|
||||
"s3257": "Strata не распознала движок для этого компьютера. Модель скачана, но не запустится, пока не будет установлен нужный движок. Откройте Настройки → Движок."
|
||||
}
|
||||
@@ -3248,5 +3248,7 @@
|
||||
"s3252": "被多个模型共用",
|
||||
"s3253": "这些文件在你自己的文件夹中,会保留在原处,只会从 Strata 中移除该条目。",
|
||||
"s3254": "将卸载运行中的模型。",
|
||||
"s3255": "本地"
|
||||
"s3255": "本地",
|
||||
"s3256": "Strata 没有识别出适用于这台电脑的引擎。模型仍会下载,但在安装正确的引擎之前可能无法运行(设置 → 引擎)。",
|
||||
"s3257": "Strata 没有识别出适用于这台电脑的引擎。模型已下载,但在安装正确的引擎之前无法运行。请打开 设置 → 引擎。"
|
||||
}
|
||||
@@ -251,3 +251,7 @@
|
||||
.native-parts li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-top: 1px solid var(--st-line-soft); }
|
||||
.native-parts li[data-state="done"] > span::before { content: "\2713\00a0"; color: var(--st-accent-text); }
|
||||
.native-parts li[data-state="downloading"] > span { font-weight: 700; }
|
||||
.engine-warning { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; padding: 12px 14px; border-radius: var(--st-r-md); background: var(--st-warn-tint); color: var(--st-warn-text); font-size: var(--st-fs-sm); }
|
||||
.engine-warning p { margin: 0; }
|
||||
.engine-warning svg { flex: none; margin-top: 1px; }
|
||||
.engine-warning small { display: block; margin-top: 4px; }
|
||||
@@ -147,3 +147,19 @@ test('4d: picture reading is on unless the person turned it off (no saved choice
|
||||
assert.match(screen, /setVision\(installed\.visionEnabled === false \? 'no'/);
|
||||
assert.match(screen, /else\s+setVision\('yes'\)/, 'a version that is not downloaded starts with Read pictures on');
|
||||
});
|
||||
|
||||
test('no recognised engine: the app still downloads, warns in the card, and loading says it with the next step', async () => {
|
||||
const { ENGINE_NOT_RECOGNISED } = await import('../server/native-control.mjs');
|
||||
assert.match(ENGINE_NOT_RECOGNISED, /Settings → Engine/);
|
||||
assert.match(ENGINE_NOT_RECOGNISED, /didn’t recognise an engine/);
|
||||
const source = readSource(new URL('../server/native-control.mjs', import.meta.url), 'utf8');
|
||||
assert.equal((source.match(/ENGINE_NOT_RECOGNISED\+/g) ?? []).length, 2, 'both load paths use it');
|
||||
const models = readSource(new URL('../src/components/NativeModels.tsx', import.meta.url), 'utf8');
|
||||
const guided = readSource(new URL('../src/components/GuidedSetup.tsx', import.meta.url), 'utf8');
|
||||
assert.match(models, /<EngineWarning native=\{native\}\/>/);
|
||||
assert.match(guided, /<EngineWarning native=\{native\}\/>/);
|
||||
const warn = readSource(new URL('../src/components/EngineWarning.tsx', import.meta.url), 'utf8');
|
||||
assert.match(warn, /The model will download, but it may not run until the right engine is installed \(Settings → Engine\)\./);
|
||||
// the install is not refused for a missing engine (only the engine-minimum refusal for a version that is too old stays)
|
||||
assert.doesNotMatch(source.slice(source.indexOf('async function install(job,args)'), source.indexOf('function terminate')), /engine\.usable/);
|
||||
});
|
||||
@@ -5938,16 +5938,16 @@ def control_engine_step(gpu, vision):
|
||||
ok(f"engine component: {found.version} ({found.platform}-{found.backend}) in {eng}")
|
||||
except EC.EngineMissing as e:
|
||||
plain = getattr(e, "plain_notice", None) or getattr(e, "driver_notice", None)
|
||||
if plain or os.environ.get("STRATA_NEED_ENGINE") == "1":
|
||||
# The model is tens of GB: when the engine is a dead end for this PC (a build for another card family, a driver that is too
|
||||
# old) or the caller (strata launch) needs one now, stop before step 5 instead of after the download.
|
||||
if os.environ.get("STRATA_NEED_ENGINE") == "1":
|
||||
# strata launch needs an engine now: stop before step 5 instead of after the download. The app does not stop (owner
|
||||
# decision 2026-10-18): it says so in its download card and still downloads the model.
|
||||
fail(plain or "no engine is installed for this PC",
|
||||
"get the engine that matches this graphics card (`strata update`, or the app's Settings), then run this again; "
|
||||
"nothing was downloaded and files already downloaded are kept")
|
||||
eng = home() / "engine"
|
||||
meta = {"version": "99.0.0", "source": "local", "component": "missing"} # its version is checked when it loads
|
||||
warn(f"no engine is installed for this PC yet ({e}). The model is downloaded and prepared now; install the engine "
|
||||
"component for your GPU (a later step of the app, or the Terminal) before loading it")
|
||||
warn(f"{plain + ' ' if plain else ''}no engine is installed for this PC yet ({e}). The model is downloaded and prepared now; "
|
||||
"install the engine component for your GPU (the app's Settings, or the Terminal) before loading it")
|
||||
if vision != "none":
|
||||
if (eng / VEXE).is_file():
|
||||
ok(f"image encoder: {eng / VEXE} (carried by the engine component)")
|
||||
|
||||
@@ -140,13 +140,23 @@ class SetupControlStep(unittest.TestCase):
|
||||
except SystemExit as e:
|
||||
return e, out.getvalue()
|
||||
|
||||
def test_wrong_family_stops_before_the_download(self):
|
||||
def test_wrong_family_stops_before_the_download_for_launch(self):
|
||||
exc = ec.EngineMissing("nothing matched", Path("/c"), notice=WRONG_FAMILY)
|
||||
res, out = self.step(exc, {})
|
||||
res, out = self.step(exc, {"STRATA_NEED_ENGINE": "1"})
|
||||
self.assertIsInstance(res, SystemExit)
|
||||
self.assertIn("Ask for the RX 9000 build.", out)
|
||||
self.assertIn("nothing was downloaded", out)
|
||||
|
||||
def test_the_app_with_a_wrong_family_engine_warns_and_still_downloads(self):
|
||||
"""Owner decision 2026-10-18: the app downloads the model anyway and warns (its card says so)."""
|
||||
env = {k: v for k, v in os.environ.items() if k != "STRATA_NEED_ENGINE"}
|
||||
exc = ec.EngineMissing("nothing matched", Path("/c"), notice=WRONG_FAMILY)
|
||||
with mock.patch.dict(os.environ, env, clear=True):
|
||||
res, out = self.step(exc, {})
|
||||
self.assertNotIsInstance(res, SystemExit)
|
||||
self.assertIn("Ask for the RX 9000 build.", out)
|
||||
self.assertIn("The model is downloaded and prepared now", out)
|
||||
|
||||
def test_no_engine_stops_before_the_download_for_launch(self):
|
||||
res, out = self.step(ec.EngineMissing("the component folder holds no engine package", Path("/c")), {"STRATA_NEED_ENGINE": "1"})
|
||||
self.assertIsInstance(res, SystemExit)
|
||||
|
||||
Reference in new issue
Block a user