From 0b1808f072b6d2faeabccda060eb70dcf3a9f5bc Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Fri, 30 Oct 2026 19:18:01 +0100 Subject: [PATCH] Update: a failed test start of the new engine names the kept log file to report (#4692) --- strata_control/updater.py | 6 +++++- tests/terminal/test_update_probe_hint.py | 23 +++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 tests/terminal/test_update_probe_hint.py diff --git a/strata_control/updater.py b/strata_control/updater.py index 891ea920..41bc0675 100644 --- a/strata_control/updater.py +++ b/strata_control/updater.py @@ -908,7 +908,11 @@ def _test_start_failure(component: ec.EngineComponent, started: dict, ctx: Conte return TestStartFailed(component.version, f"it was still loading the model after {minutes} minutes", busy=True, hint="Nothing was changed. A slow disk or a card that other programs are using can do this: close them and run " "`strata update` again." + kept) - return TestStartFailed(component.version, f"it did not answer a one-token probe ({error or started.get('state')}){tail}") + reason = f"it did not answer a one-token probe ({error or started.get('state')}){tail}" + # #4692: "report it with the log" named no log. The engine's words stay out of the sentence, but the person is told where the kept log is. + hint = (None if TestStartFailed.BUSY.search(reason) else + f"Run `strata update --force` to try again; if it fails again, report it with the log: {log}") + return TestStartFailed(component.version, reason, hint=hint) TEST_CONTEXT = 4096 diff --git a/tests/terminal/test_update_probe_hint.py b/tests/terminal/test_update_probe_hint.py new file mode 100644 index 00000000..ab18f2f5 --- /dev/null +++ b/tests/terminal/test_update_probe_hint.py @@ -0,0 +1,23 @@ +"""#4692: a failed one-token test start says where the kept engine log is (it said "report it with the log" and named none).""" +import tempfile +import unittest +from pathlib import Path +from types import SimpleNamespace + +from strata_control import updater + + +class ProbeHint(unittest.TestCase): + def test_the_message_names_the_kept_log(self): + with tempfile.TemporaryDirectory() as tmp: + ctx = SimpleNamespace(test_timeout=600, components=Path(tmp)) + component = SimpleNamespace(version="0.1.54") + exc = updater._test_start_failure(component, {"error": "process_exited", "state": "failed"}, ctx, " | boom") + text = str(exc) + self.assertIn("test-start-0.1.54.log", text) + self.assertIn("strata update --force", text) + self.assertNotIn("boom", text) # the engine's own words stay out of the sentence + + +if __name__ == "__main__": + unittest.main()