An old Terminal that cannot hand over to a new Control is told to run the install command once more (TUI stress #4, H03)
The Terminals before 0.2.1.3 (0.2.0-beta, 0.2.1, 0.2.1.1, 0.2.1.2) install a newer Control and report "updated", but their launcher has no hand-over, so the old Control keeps running. Their updater test-starts the staged Control with --version (STRATA_NO_ACQUIRE=1, no STRATA_HANDOVER, from the .s staging folder) and shows the first 120 characters of the answer when that fails. Control now answers that start with one plain sentence and exit 7, so the old updater keeps the old Control and prints the sentence instead of "updated". Every updater that can hand over sets STRATA_HANDOVER and is not touched. Release note added.
This commit is contained in:
1 parent
6f8800aefe
commit
c924d3c9d7
4 files changed
+87
-3
No files matched your search
@@ -4,6 +4,7 @@
|
||||
|
||||
- **Strix Halo decodes about 9% faster.** The hyper-connection weights are read as 8-bit (Q8_0) on gfx1151 by default: 5 interleaved pairs on IQ3_S gave +7.9% to +10.7% on JSON, code, tool calls, chat and an agent transcript. Answers are not bit-identical: they can differ in near-tie tokens, about as much as the engine's own CPU-versus-GPU expert rounding does (the numbers are in docs/AMD_HIP.md). `STRATA_HC_Q8=0` restores the old read.
|
||||
|
||||
## Version numbers
|
||||
## Updating the Terminal from 0.2.0-beta or 0.2.1
|
||||
|
||||
- The app is 0.2.3. Control (the Terminal's tools) and the engine are 0.1.48. The engine source changed since 0.2.2, so the engine packages are rebuilt.
|
||||
- **Run the install command once more.** The Terminal that came with 0.2.0-beta, 0.2.1, 0.2.1.1 and 0.2.1.2 cannot switch to a newer Control by itself, so `strata update` reported "updated" and kept running the old one. From 0.2.3 on, that update says so instead: "This Terminal cannot switch to the new Control by itself. Run the Strata install command once more to update it." The install command keeps your models and settings. A Terminal from 0.2.1.3 or newer updates with `strata update`.
|
||||
- **Version numbers.** The app is 0.2.3, Control (the Terminal's tools) is 0.1.48 and the engine is 0.1.48 (the engine source changed since 0.2.2, so the engine packages are rebuilt).
|
||||
@@ -29,7 +29,10 @@ def _preflight(argv):
|
||||
|
||||
if __name__ == "__main__":
|
||||
# a newer Control installed by `strata update` takes over before anything heavy is imported (stdlib only)
|
||||
from strata_cli.handover import maybe_hand_over
|
||||
from strata_cli.handover import maybe_hand_over, refuse_old_updater
|
||||
refused = refuse_old_updater(sys.argv[1:])
|
||||
if refused is not None:
|
||||
raise SystemExit(refused)
|
||||
handed = maybe_hand_over(sys.argv[1:])
|
||||
if handed is not None:
|
||||
raise SystemExit(handed)
|
||||
|
||||
@@ -161,3 +161,27 @@ def maybe_hand_over(argv, environ=None, root=None, running=None, execv=None, run
|
||||
except OSError as exc:
|
||||
warn(f"strata: could not start the updated Control {version} ({exc.strerror or exc}); running {running} instead.")
|
||||
return None
|
||||
|
||||
|
||||
#: What a Terminal older than 0.1.46.2 cannot do: its strata.py has no hand-over, so a Control it installs is never used. Its updater
|
||||
#: (which cannot be changed any more) test-starts the new Control with `--version` and prints the first 120 characters of the answer
|
||||
#: when that fails, so this is the sentence it shows. No quote marks in it: the old updater prints it as a Python string.
|
||||
OLD_LAUNCHER_TEXT = "This Terminal cannot switch to the new Control by itself. Run the Strata install command once more to update it."
|
||||
OLD_LAUNCHER_EXIT = 7
|
||||
_STAGE_FOLDER = ".s" # strata_control.updater.STAGE_DIR: the folder a Control is test-started from
|
||||
|
||||
|
||||
def refuse_old_updater(argv, environ=None, tree=None) -> int | None:
|
||||
"""0.2.0-beta's Terminal (Control 0.1.45.3) and the other releases before 0.1.46.2 install a newer Control and report success, but their
|
||||
launcher never switches to it (no hand-over code), so the update would change nothing. They test-start the staged Control with
|
||||
`--version`, with STRATA_NO_ACQUIRE=1 and without STRATA_HANDOVER (every updater that can hand over sets it). This Control, started that
|
||||
way from the updater's staging folder, says in one plain sentence what to do and exits non-zero, so the old updater keeps the old
|
||||
Control and shows the sentence instead of 'updated'. Returns the exit code to use, or None for any other start."""
|
||||
environ = os.environ if environ is None else environ
|
||||
if list(argv) != ["--version"] or environ.get("STRATA_NO_ACQUIRE") != "1" or environ.get(ENV_GUARD):
|
||||
return None
|
||||
tree = Path(__file__).resolve().parents[1] if tree is None else Path(tree)
|
||||
if tree.parent.name != _STAGE_FOLDER:
|
||||
return None
|
||||
sys.stdout.write(OLD_LAUNCHER_TEXT + "\n")
|
||||
return OLD_LAUNCHER_EXIT
|
||||
@@ -0,0 +1,56 @@
|
||||
"""0.2.3 RC stress test, #4 (H03): a Terminal that cannot hand over to a newer Control is told so instead of being told "updated"."""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from strata_cli import handover
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
class OldLauncherIsToldTheTruth(unittest.TestCase):
|
||||
"""The Terminals before 0.2.1.3 have no hand-over. Their updater test-starts the staged Control with `--version`, with
|
||||
STRATA_NO_ACQUIRE=1 and without STRATA_HANDOVER: this Control refuses that start in one plain sentence."""
|
||||
|
||||
def staged_tree(self, parent=".s"):
|
||||
base = Path(self.enterContext(tempfile.TemporaryDirectory(prefix="strata-stage-"))) / parent / "ab12"
|
||||
base.mkdir(parents=True)
|
||||
shutil.copy2(ROOT / "strata.py", base / "strata.py")
|
||||
for package in ("strata_cli", "strata_control"):
|
||||
shutil.copytree(ROOT / package, base / package, ignore=shutil.ignore_patterns("__pycache__"))
|
||||
return base
|
||||
|
||||
def run_version(self, tree, **env):
|
||||
base = {k: v for k, v in os.environ.items() if not k.startswith("STRATA_")}
|
||||
return subprocess.run([sys.executable, str(tree / "strata.py"), "--version"], capture_output=True, text=True, cwd=str(tree),
|
||||
env={**base, "PYTHONNOUSERSITE": "1", **env})
|
||||
|
||||
def test_an_old_updaters_test_start_is_refused_with_one_plain_sentence(self):
|
||||
done = self.run_version(self.staged_tree(), STRATA_NO_ACQUIRE="1")
|
||||
self.assertEqual(done.returncode, handover.OLD_LAUNCHER_EXIT)
|
||||
self.assertEqual(done.stdout.strip(), handover.OLD_LAUNCHER_TEXT)
|
||||
self.assertLessEqual(len(handover.OLD_LAUNCHER_TEXT), 120, "the old updater shows only the first 120 characters")
|
||||
self.assertNotIn("'", handover.OLD_LAUNCHER_TEXT)
|
||||
|
||||
def test_the_current_updaters_test_start_and_a_normal_start_are_not_touched(self):
|
||||
tree = self.staged_tree()
|
||||
for env in ({"STRATA_NO_ACQUIRE": "1", "STRATA_HANDOVER": "1"}, {}):
|
||||
done = self.run_version(tree, **env)
|
||||
self.assertEqual(done.returncode, 0, done.stderr)
|
||||
self.assertTrue(done.stdout.startswith("strata 0.2.3 (build "), done.stdout)
|
||||
elsewhere = self.staged_tree(parent="terminal") # not the updater's staging folder
|
||||
self.assertEqual(self.run_version(elsewhere, STRATA_NO_ACQUIRE="1").returncode, 0)
|
||||
|
||||
def test_only_a_bare_version_start_is_refused(self):
|
||||
tree = self.staged_tree()
|
||||
self.assertIsNone(handover.refuse_old_updater(["status"], {"STRATA_NO_ACQUIRE": "1"}, tree))
|
||||
self.assertEqual(handover.refuse_old_updater(["--version"], {"STRATA_NO_ACQUIRE": "1"}, tree), handover.OLD_LAUNCHER_EXIT)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user