okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Version 0.2.15 / Control 0.1.61: app and Terminal 0.2.15, Control 0.1.61; every engine package stays 0.1.60 (the v0.2.14 files, carried by absolute url)e39a52e33

main
7.2 KiB91 linesraw
1"""0.2.3 RC stress test, #3 (H01): the version bump is complete and consistent, and a 0.2.2 install sees the update."""
2
3import json
4import os
5import re
6import subprocess
7import sys
8import unittest
9from pathlib import Path
10
11import strata_cli
12from strata_control import feed as feedmod, updater
13from tests.terminal import test_updater
14
15ROOT = Path(__file__).resolve().parents[2]
16
17
18def first(path, pattern):
19    return re.search(pattern, (ROOT / path).read_text(encoding="utf-8"), re.MULTILINE).group(1)
20
21
22class VersionBump(unittest.TestCase):
23    def test_the_terminal_is_0_2_4_2_and_control_is_0_1_49_2_while_the_app_stays_0_2_3(self):
24        # 0.2.13 (owner 2026-11-08, release of main before Qwen4): Terminal and app are 0.2.13; Control and every engine package (Qwen, DeepSeek, Metal, SYCL, aarch64) are 0.1.59 (the CMake project version).
25        # 0.2.12 (owner 2026-11-06, release of rounds 0215/0216/0217): Terminal and app are 0.2.12; Control and every engine package (Qwen, DeepSeek, Metal, SYCL, aarch64) are 0.1.58 (the CMake project version).
26        # 0.2.11 (coordinator 2026-11-04; the owner can still rename it 0.2.10.1): Terminal and app are 0.2.11; Control and every engine package (Qwen, DeepSeek, Metal, SYCL, aarch64) are 0.1.57 (the CMake project version).
27        # 0.2.10 (the 0.2.9 update, owner 2026-11-02): Terminal and app are 0.2.10; Control and every engine package (Qwen, DeepSeek, Metal, SYCL, aarch64) are 0.1.56 (the CMake project version).
28        # 0.2.9.1 (a label prepared on 10-31 for a DeepSeek-only Windows AMD hotfix and never published: no tag, no 0.1.55.1 assets on v0.2.9) (DeepSeek engine only, the Windows AMD package): the DeepSeek engine is 0.1.55.1 (the CMake project version); the Terminal, the app and Control (0.1.55) and every other engine package stay as 0.2.9 shipped them.
29        # 0.2.9: Terminal and app are 0.2.9; Control and every engine package (Qwen, DeepSeek, Metal, SYCL, aarch64) are 0.1.55.
30        # 0.2.8.1 (Control-only): the Terminal is 0.2.8.1 and Control 0.1.55 (the CMake project version); the app stays 0.2.8 and every engine package 0.1.54 (as 0.2.3.1 did for the Terminal).
31        # 0.2.8: Terminal and app are 0.2.8; Control and every engine package (Qwen, DeepSeek, Metal, SYCL, aarch64) are 0.1.54 (both engines changed since 0.2.7.1).
32        # 0.2.7.1 (DGX Spark): Control and the linux-aarch64 engine packages are 0.1.53 (the CMake project version); the app and the Terminal stay 0.2.7, the Metal engine 0.1.52.
33        # 0.2.7: Terminal and app are 0.2.7; Control and every engine package (Qwen, DeepSeek, Metal) are 0.1.52 (the CMake project version; the Qwen and DeepSeek C++ both changed since 0.2.6)
34        # 0.2.13.1 (Control-only, Linux x86_64: the app on an Intel Arc card, ARCFIX): the Terminal is 0.2.13.1 and Control 0.1.59.1 (the CMake project version); the app stays 0.2.13 and every engine package 0.1.59 (as 0.2.8.1 and 0.2.3.1 did).
35        # 0.2.14.1 (Control-only: the drafter fixes of the Terminal and Control): the Terminal is 0.2.14.1 and Control 0.1.60.1; the app stays 0.2.14 and every engine package 0.1.60.
36        # 0.2.15 (an app + Control fix release): the app and the Terminal are 0.2.15 and Control 0.1.61; every engine package stays 0.1.60 (the v0.2.14 files).
37        self.assertEqual(strata_cli.PRODUCT_VERSION, "0.2.15")
38        self.assertEqual(strata_cli.version(), "0.1.61")              # the CMake project version: Control
39        self.assertEqual(first("CMakeLists.txt", r"^project\(strata VERSION ([0-9.]+) "), "0.1.61")
40        self.assertIn('STRATA_VERSION="0.1.60-metal"', (ROOT / "metal" / "CMakeLists.txt").read_text(encoding="utf-8"))
41
42    def test_every_place_the_app_version_lives_says_0_2_3(self):
43        self.assertEqual(first("apps/desktop/src-tauri/Cargo.toml", r'^version = "([^"]+)"'), "0.2.15")
44        lock = (ROOT / "apps/desktop/src-tauri/Cargo.lock").read_text(encoding="utf-8")
45        self.assertRegex(lock, r'name = "strata-desktop"\r?\nversion = "0.2.15"')
46        self.assertEqual(json.loads((ROOT / "apps/desktop/package.json").read_text(encoding="utf-8"))["version"], "0.2.15")
47        host = json.loads((ROOT / "apps/host/package.json").read_text(encoding="utf-8"))
48        self.assertEqual(host["version"], "0.2.15")
49        locked = json.loads((ROOT / "apps/host/package-lock.json").read_text(encoding="utf-8"))
50        self.assertEqual((locked["version"], locked["packages"][""]["version"]), ("0.2.15", "0.2.15"))
51
52    def test_the_documents_that_state_the_current_version_agree(self):
53        self.assertIn("Version 0.2.15, engine 0.1.60.", (ROOT / "AGENTS.md").read_text(encoding="utf-8"))
54        for name in ("README.md", "README.de.md", "README.es.md", "README.fr.md", "README.ja.md", "README.pl.md", "README.pt-BR.md", "README.zh-CN.md"):
55            text = (ROOT / name).read_text(encoding="utf-8")
56            self.assertRegex(text, r"Strata-0[.]2[.][0-9]+-", name)       # (the restyled READMEs state the app version through the download buttons; their owner moves them to the release)
57            self.assertNotIn("Strata-0.2.2-", text, name)
58
59    def test_version_prints_the_product_and_the_build(self):
60        done = subprocess.run([sys.executable, str(ROOT / "strata.py"), "--version"], capture_output=True, text=True, cwd=str(ROOT),
61                              env={**os.environ, "STRATA_NO_HANDOVER": "1"})
62        self.assertTrue(done.stdout.startswith("strata 0.2.15 (build 0.1.61;"), done.stdout)
63
64
65class UpdateFromTheLastRelease(test_updater.UpdaterCase):
66    def feed_with_control(self, version):
67        bundle = self.root / "control-bundle"
68        (bundle / "strata_control").mkdir(parents=True)
69        (bundle / "strata.py").write_text(f"print('strata 0.2.3 (build {version})')\n")
70        (bundle / "strata_control" / "__init__.py").write_text("")
71        from feed_tool import build_feed, pack_control
72        (self.release / "control").mkdir()
73        pack_control(bundle, self.release / "control", version=version, platform=test_updater.PLATFORM)
74        build_feed(self.release, key=self.key, sequence=1, control_dir=self.release / "control")
75
76    def test_a_0_2_2_install_is_offered_control_0_1_48_and_a_0_2_3_install_is_current(self):
77        self.feed_with_control("0.1.48")
78        (self.components / "control").mkdir(parents=True)
79        (self.components / "control" / "active.json").write_text(json.dumps({"version": "0.1.47", "folder": "0.1.47"}))
80        report = updater.check(self.ctx())
81        self.assertEqual((report["control"]["status"], report["control"]["installed"], report["control"]["offered"]),
82                         ("available", "0.1.47", "0.1.48"))
83        out = updater.run_update(self.ctx(), engine=False, control=True)
84        self.assertEqual((out["exit_code"], out["results"][0]["status"]), (0, "updated"), out)
85        self.assertEqual(updater.active_control(self.components)["version"], "0.1.48")
86        self.assertEqual(updater.check(self.ctx())["control"]["status"], "current")
87
88    def test_the_bumped_numbers_sort_above_the_last_release(self):
89        self.assertGreater(feedmod.version_key(strata_cli.version()), feedmod.version_key("0.1.47"))
90        self.assertGreater(feedmod.version_key("0.1.48"), feedmod.version_key("0.1.46.3"))
91        self.assertGreater(feedmod.version_key("0.1.48"), feedmod.version_key("0.1.45.3"))