Files
leleka/engine/strata/tools/test_cyrillic_paths.py
T
Pavlo RatushnyiandClaude Sonnet 5.5 87e2633afe engine/strata: bring the Strata subtree to upstream 41cf05a0 (engine 0.1.50) with the local patches re-applied
Documented tree replacement (the history has no git-subtree metadata): 3-way merge of the old subtree
(570201a:engine/strata) against upstream 41cf05a06a25dd29103b7b27a2279a3f60c21876 (2026-10-25), merge base =
the old pin d9ab8435 (tree-identical to upstream 5b734e42; d9ab8435 is not an ancestor of upstream main).

Local patches re-applied by hand where they conflicted (15 files): STRATA_CUDA_STATIC profile, experimental KAR
experts and KAR PLE arms, keyless V-only arm (now beside upstream's K8V4 hybrid KV and fused norm+rope). Details,
conflict table and left-out files are in docs/upstream.md.

Left out (weights, captures, logs, media): new bench/results (2022 files), binary media and app assets (61),
docs/work/evidence (24), *.bin / *.gguf data files, and the 7 files the first import already left out.

scripts/build-cpu.sh: build the 11 CPU tests upstream registered since the old pin (they ran as "Not Run").
Checked: build-cpu.sh 16/16 ctest in WSL; sm_86 CUDA objects of the patched files compile, also with the KAR
macros on. No GPU run, no quality gate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 12:49:15 +01:00

55 lines
2.3 KiB
Python

"""#3202: a Windows 11 with Russian localization (cp1251 / cp866 code pages): a Cyrillic folder name must reach the engine,
the run config and the tools unchanged."""
import json
import os
import subprocess
import sys
import tempfile
import unittest
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))
WORD = "".join(chr(c) for c in (0x414, 0x43e, 0x43a, 0x443, 0x43c, 0x435, 0x43d, 0x442, 0x44b)) # "Документы"
class CyrillicFolder(unittest.TestCase):
def setUp(self):
self.tmp = tempfile.TemporaryDirectory(prefix=WORD + "-")
self.dir = Path(self.tmp.name)
def tearDown(self):
self.tmp.cleanup()
def test_run_config_in_a_cyrillic_folder_is_found_and_read(self):
from strata_control import discovery
cfg = self.dir / "strata-q2_0.json"
cfg.write_text(json.dumps({"exe": "x", "args": ["--native", str(self.dir / "m.gguf")]}, ensure_ascii=False), encoding="utf-8")
place = discovery.places(explicit=self.dir)[0]
self.assertEqual(place.configs, 1)
back = json.loads(discovery.config_files(self.dir)[0].read_text(encoding="utf-8"))
self.assertIn(WORD, back["args"][1])
def test_a_child_python_gets_the_path_as_an_argument_and_prints_it_back(self):
# the server starts the engine through serve.server.popen; the child reads the argument and its own file listing
from serve import server
(self.dir / "m.gguf").write_bytes(b"x")
env = dict(os.environ, PYTHONUTF8="1", PYTHONIOENCODING="utf-8")
code = "import sys, os; print(sys.argv[1]); print(os.path.exists(os.path.join(sys.argv[1], 'm.gguf')))"
proc = server.popen("test child", [sys.executable, "-c", code, str(self.dir)], role="test",
stdout=subprocess.PIPE, env=env)
out = proc.stdout.read().decode("utf-8").splitlines()
proc.wait(timeout=30)
self.assertEqual(out[0], str(self.dir))
self.assertEqual(out[1], "True")
def test_windows_launchers_set_utf8_mode(self):
for name in ("START-HERE.bat", "bin/strata.cmd", "bin/strata.ps1"):
text = (ROOT / name).read_text(encoding="utf-8")
self.assertIn("PYTHONUTF8", text, name)
if __name__ == "__main__":
unittest.main()