Files
Strata/tests/terminal/test_drafting_switch.py
T
Niko1221 dd96b53187 DeepSeek out (4/7): setup, strata launch, strata update, Settings > Engine and the model catalog without DeepSeek
The Python side of the product no longer knows DeepSeek-V4.1-Flash (the refusal of commit 2 answers every way
it can still come in):
- setup.py: MULTI_FILE_FAMILIES / the DSV41_* pins, install_dsv41, mac_dsv41_setup, the engine package fetch and
  its helpers, the --check line, the menu row and --family deepseek41 go; model_alias is the identity; a hidden
  --dsv41-package answers the "no longer offers" line; the AMD one-card widening and the per-start card memory,
  which acted on DeepSeek configs only, go; setup_config.py loses Dsv41Inputs / dsv41_config_for.
- strata_control: dsv41_{context,engine,fit,flags,parallel,paths,sets}.py and gpu_pick.py are deleted;
  folder_use.in_use is dsv41_paths.in_use (every package kind used it); updater: no DeepSeek engine step, report
  or notice (discover_run_config leaves DeepSeek configs out through retired.py); engine_library: the Qwen family
  and the shape engines only ("deepseek" answers the "no longer offers" line); engine_component / engine_update:
  no DeepSeek offer; feed.py does not read the dsv41 member (it may stay in the feed for older Strata);
  cfg_paths / runtime: no engine-dsv41 repair; models.py: no DeepSeek import preview; the one-line deepseek41
  guards in vram_fit, amd_four_card, split_engine, replica_profile go (pictures.py keeps a retired.py guard).
- strata launch: no DeepSeek rows, Speed step, tuner, context list, picture tower, --parallel words or engine
  package; --dsv41-package, --speed, --full-quality and --dspark stay hidden and answer the "no longer offers"
  line. The --context help loses its DeepSeek parenthesis ([DRAFT] until the owner reads it).
- tools/strata_mcp.py (the catalog of the app, the Terminal and the MCP tools): no DeepSeek rows or plans; rows keep
  "multi_file": False, "disk_gb" / "rdna4_faster": None as every Qwen size had them.
- tests: the DeepSeek-only files go (tests/terminal 21 + the launch speed file, tools 4, fixtures); the DeepSeek
  cases leave the shared ones; the snapshot matrix loses its DeepSeek set and its 8 goldens (every Qwen golden is
  unchanged byte for byte); new: each dropped launch flag answers the line, an engine-dsv41 folder is neither
  listed nor touched, a DeepSeek config is left as it was by the path repair.
2026-11-11 11:37:48 +01:00

77 lines
4.1 KiB
Python

"""Changing the model must not carry a Drafting choice to a model that has none (owner, 2026-11-02): the Coder, Swift and NVFP4 builds have only the MTP.
The Terminal's wizard goes back to Auto when the model changes to one of them, and the Q4_0-selector pack is made only where the installed engine reads it.
"""
from __future__ import annotations
import tempfile
import unittest
from pathlib import Path
from types import SimpleNamespace
from unittest import mock
from strata_cli.launch import modelstate
from strata_cli.launch import settings as S
from strata_cli.launch.runner import derive_config
from strata_control import drafting
class TheChoiceStaysWithItsFamily(unittest.TestCase):
def test_qwen_gyro_and_unsloth_keep_it(self):
for family in ("qwen", "gyro", "unsloth"):
for choice in (None, "auto", "mtp", "dflash2", "off"):
self.assertEqual(modelstate.drafting_for_family(choice, family), choice, (family, choice))
def test_every_other_family_goes_back_to_auto(self):
for family in ("coder", "swift", "nvfp4"):
for choice in ("auto", "mtp", "dflash2", "off"):
self.assertIsNone(modelstate.drafting_for_family(choice, family), (family, choice))
self.assertEqual(modelstate.drafting_for_family("mtp", None), "mtp", "no family yet: nothing to decide")
def test_the_model_list_does_it_when_the_person_changes_model(self):
from strata_cli.launch.screens import ModelScreen
rows = [SimpleNamespace(family=f, model="m", verdict="fits", title=f) for f in ("qwen", "coder", "gyro")]
for target, choice, want in (("coder", "off", None), ("gyro", "dflash2", "dflash2"), ("qwen", "mtp", "mtp")):
s = S.LaunchSettings(family="qwen", model="m", drafting=choice)
fake = SimpleNamespace(ctx=SimpleNamespace(settings=s, notes=[]), rows=rows, input_open=lambda: False,
menu=lambda target=target: SimpleNamespace(current=SimpleNamespace(key=(target, "m"))))
ModelScreen.commit(fake)
self.assertEqual((s.family, s.drafting), (target, want), (target, choice))
# and back to Qwen after the Coder: Auto (the choice that was made for the other model is gone), which the person can change again
s = S.LaunchSettings(family="qwen", model="m", drafting="mtp")
for target in ("coder", "qwen"):
fake = SimpleNamespace(ctx=SimpleNamespace(settings=s, notes=[]), rows=rows, input_open=lambda: False,
menu=lambda target=target: SimpleNamespace(current=SimpleNamespace(key=(target, "m"))))
ModelScreen.commit(fake)
self.assertIsNone(s.drafting)
class AQwenLaunchWritesItsDraftingChoice(unittest.TestCase):
def test_qwen_still_writes_it(self):
base = {"exe": "component:strata-engine", "args": ["--pack", "/d/packs/x", "--mtp", "/d/mtp/rt"], "port": 8080, "model_name": "qwen3.8-flash-next-iq3_s"}
for family in ("qwen", "gyro", "unsloth"):
cfg = derive_config(base, S.LaunchSettings(family=family, drafting="dflash2"), bool_flags=frozenset())
self.assertEqual(cfg["drafting"], "dflash2", family)
class TheSelectorPackIsMadeWhereTheEngineReadsIt(unittest.TestCase):
def test_the_engine_decides(self):
with tempfile.TemporaryDirectory() as tmp:
reads = Path(tmp) / "reads.exe"
reads.write_bytes(b"x" * 100 + drafting._MARK_SELQ4 + b"y" * 100)
sycl = Path(tmp) / "sycl.exe"
sycl.write_bytes(b"x" * 300)
for exe, want in ((reads, True), (sycl, False), (None, False), (Path(tmp) / "missing.exe", False)):
with mock.patch.object(drafting, "installed_engine_exe", return_value=exe):
self.assertEqual(drafting.engine_has_selector_q4(), want, exe)
def test_a_launch_converts_only_for_such_an_engine(self):
import inspect
from strata_cli.launch import runner
source = inspect.getsource(runner)
self.assertIn("drafting.needs_conversion(**want) and drafting.engine_has_selector_q4()", source)
if __name__ == "__main__":
unittest.main()