mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 15:58:53 +00:00
fix(control): the update check says when the person went back to the engine in use (#6830, Control side)
After `strata components rollback` the newer engine stays installed, pinned off and listed in "skipped". The check offered it as "available" like any update (owner, 11-01: a version the person switched away from is never hidden from an explicit update), and the app's install job, which runs the updater whenever the engine status is install or available, switched back to it after a model settings change: the pin and the skip were removed and the next eight starts failed (#6830, #6713). SAFETY.md says an engine is never updated by itself. The explicit update is unchanged (`strata update` still switches, with nothing to download). The engine part of the check report now carries `person_chose: true` and a note ("you went back to 0.1.45 ...") when the engine in use is the pinned one and the offered version is in skipped. The app's engine step has to read it: `wanted` in app/host/server/engine-step.mjs becomes `(status is install or available) and not engine.person_chose`; that file is APPTUI's. Tests in test_updater.py (Cli): the check after a rollback, the explicit update still switching, and a newer engine nobody left not being marked.
This commit is contained in:
1 parent
8a3b0e3c68
commit
5907fe7ff4
2 files changed
+44
No files matched your search
@@ -712,6 +712,15 @@ def _choose_engine(feed: feedmod.Feed, ctx: Context, state: State) -> tuple[dict
|
||||
if report["status"] == "available" and local:
|
||||
report["installed_locally"] = local
|
||||
report["download_bytes"] = 0
|
||||
# #6830: the person went back to the engine in use (`strata components rollback`, Settings > Engine): it is pinned and the newer one is in "skipped".
|
||||
# An explicit update still offers the newer engine (owner, 11-01), but anything that runs by itself (the app's install job: a model's settings, a
|
||||
# download) must not switch back: SAFETY.md, "an engine is never updated by itself". `person_chose` says so; the app's engine step reads it.
|
||||
pinned_name = section.get("pinned")
|
||||
if pinned_name and getattr(installed, "root", None) is not None and installed.root.name == pinned_name \
|
||||
and offered.version in (section.get("skipped") or []):
|
||||
report["person_chose"] = True
|
||||
report["note"] = (f"you went back to {installed.version} (the newer {offered.version} is installed and left alone); "
|
||||
"`strata update` or Update engine in Settings switches to it when you ask")
|
||||
if offered.version in (section.get("failed_unproven") or {}) and not ctx.force:
|
||||
# #5400: this engine was used without a test load (memory was short) and could not start the model; switching to it again by itself
|
||||
# would repeat that. The person can ask for it by name.
|
||||
|
||||
@@ -820,6 +820,41 @@ class Cli(UpdaterCase):
|
||||
self.assertIn("Engine moved to the newer version: 0.1.45 -> 0.1.46", text)
|
||||
self.assertNotIn("rolled back", text)
|
||||
|
||||
# #6830: after a rollback the newer engine stays installed; the check says the person went back (person_chose) so the app's install job leaves it alone
|
||||
def test_the_check_says_the_person_went_back_and_a_plain_update_still_switches(self):
|
||||
self.install_current()
|
||||
self.publish(("0.1.46", fx.GOOD_ENGINE))
|
||||
code, text, _ = self.cli("update", *self.common())
|
||||
self.assertEqual(code, 0, text)
|
||||
self.assertEqual(self.resolved(), "0.1.46")
|
||||
# nothing chosen yet: a newer engine in the feed is a plain update
|
||||
code, text, _ = self.cli("components", "rollback", *self.common())
|
||||
self.assertEqual(code, 0, text)
|
||||
self.assertEqual(self.resolved(), "0.1.45")
|
||||
section = updater.State(self.components).section("engine")
|
||||
self.assertEqual(section.get("skipped"), ["0.1.46"])
|
||||
self.assertTrue(section.get("pinned"))
|
||||
code, text, _ = self.cli("update", "--check", "--json", *self.common())
|
||||
engine = json.loads(text)["engine"]
|
||||
self.assertEqual(engine["status"], "available", "an explicit update still offers it")
|
||||
self.assertTrue(engine.get("person_chose"), "but the check says the person went back")
|
||||
self.assertIn("you went back to 0.1.45", engine["note"])
|
||||
self.assertEqual(engine.get("installed_locally") is not None, True)
|
||||
# the explicit update switches (nothing to download)
|
||||
code, text, _ = self.cli("update", *self.common())
|
||||
self.assertEqual(code, 0, text)
|
||||
self.assertEqual(self.resolved(), "0.1.46")
|
||||
code, text, _ = self.cli("update", "--check", "--json", *self.common())
|
||||
self.assertFalse(json.loads(text)["engine"].get("person_chose"))
|
||||
|
||||
def test_a_newer_engine_nobody_left_is_not_marked(self):
|
||||
self.install_current()
|
||||
self.publish(("0.1.46", fx.GOOD_ENGINE))
|
||||
code, text, _ = self.cli("update", "--check", "--json", *self.common())
|
||||
engine = json.loads(text)["engine"]
|
||||
self.assertEqual(engine["status"], "available")
|
||||
self.assertFalse(engine.get("person_chose"))
|
||||
|
||||
def test_a_first_install_does_not_claim_a_previous_engine_is_kept(self):
|
||||
self.publish(("0.1.46", fx.GOOD_ENGINE))
|
||||
code, text, _ = self.cli("update", *self.common())
|
||||
|
||||
Reference in new issue
Block a user