okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
e39a52e33
main
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 ): 19return re .search (pattern , (ROOT / path ).read_text (encoding = "utf-8" ),re .MULTILINE ).group (1 ) 20 21 22class VersionBump (unittest .TestCase ): 23def 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). 37self .assertEqual (strata_cli .PRODUCT_VERSION ,"0.2.15" ) 38self .assertEqual (strata_cli .version (),"0.1.61" )# the CMake project version: Control 39self .assertEqual (first ("CMakeLists.txt" ,r"^project\(strata VERSION ([0-9.]+) " ),"0.1.61" ) 40self .assertIn ('STRATA_VERSION="0.1.60-metal"' , (ROOT / "metal" / "CMakeLists.txt" ).read_text (encoding = "utf-8" )) 41 42def test_every_place_the_app_version_lives_says_0_2_3 (self ): 43self .assertEqual (first ("apps/desktop/src-tauri/Cargo.toml" ,r'^version = "([^"]+)"' ),"0.2.15" ) 44lock = (ROOT / "apps/desktop/src-tauri/Cargo.lock" ).read_text (encoding = "utf-8" ) 45self .assertRegex (lock ,r'name = "strata-desktop"\r?\nversion = "0.2.15"' ) 46self .assertEqual (json .loads ((ROOT / "apps/desktop/package.json" ).read_text (encoding = "utf-8" ))["version" ],"0.2.15" ) 47host = json .loads ((ROOT / "apps/host/package.json" ).read_text (encoding = "utf-8" )) 48self .assertEqual (host ["version" ],"0.2.15" ) 49locked = json .loads ((ROOT / "apps/host/package-lock.json" ).read_text (encoding = "utf-8" )) 50self .assertEqual ((locked ["version" ],locked ["packages" ]["" ]["version" ]), ("0.2.15" ,"0.2.15" )) 51 52def test_the_documents_that_state_the_current_version_agree (self ): 53self .assertIn ("Version 0.2.15, engine 0.1.60." , (ROOT / "AGENTS.md" ).read_text (encoding = "utf-8" )) 54for 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" ): 55text = (ROOT / name ).read_text (encoding = "utf-8" ) 56self .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) 57self .assertNotIn ("Strata-0.2.2-" ,text ,name ) 58 59def test_version_prints_the_product_and_the_build (self ): 60done = subprocess .run ([sys .executable ,str (ROOT / "strata.py" ),"--version" ],capture_output = True ,text = True ,cwd = str (ROOT ), 61env = {** os .environ ,"STRATA_NO_HANDOVER" :"1" }) 62self .assertTrue (done .stdout .startswith ("strata 0.2.15 (build 0.1.61;" ),done .stdout ) 63 64 65class UpdateFromTheLastRelease (test_updater .UpdaterCase ): 66def feed_with_control (self ,version ): 67bundle = 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 ("" ) 71from feed_tool import build_feed ,pack_control 72 (self .release / "control" ).mkdir () 73pack_control (bundle ,self .release / "control" ,version = version ,platform = test_updater .PLATFORM ) 74build_feed (self .release ,key = self .key ,sequence = 1 ,control_dir = self .release / "control" ) 75 76def test_a_0_2_2_install_is_offered_control_0_1_48_and_a_0_2_3_install_is_current (self ): 77self .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" })) 80report = updater .check (self .ctx ()) 81self .assertEqual ((report ["control" ]["status" ],report ["control" ]["installed" ],report ["control" ]["offered" ]), 82 ("available" ,"0.1.47" ,"0.1.48" )) 83out = updater .run_update (self .ctx (),engine = False ,control = True ) 84self .assertEqual ((out ["exit_code" ],out ["results" ][0 ]["status" ]), (0 ,"updated" ),out ) 85self .assertEqual (updater .active_control (self .components )["version" ],"0.1.48" ) 86self .assertEqual (updater .check (self .ctx ())["control" ]["status" ],"current" ) 87 88def test_the_bumped_numbers_sort_above_the_last_release (self ): 89self .assertGreater (feedmod .version_key (strata_cli .version ()),feedmod .version_key ("0.1.47" )) 90self .assertGreater (feedmod .version_key ("0.1.48" ),feedmod .version_key ("0.1.46.3" )) 91self .assertGreater (feedmod .version_key ("0.1.48" ),feedmod .version_key ("0.1.45.3" ))