Explorar o código

chore(release): v0.8.1.11 pre-StartTest stage intent overwrite & DDR5 raw error coordinate extraction

XJKJ STL hai 1 mes
pai
achega
46c5893db2

+ 1 - 1
README.md

@@ -1,6 +1,6 @@
 # XJKJ-STL 高温内存测试平台
 # XJKJ-STL 高温内存测试平台
 
 
-当前开发版:`0.8.1.4`。唯一 Git 分支:`dev`。
+当前开发版:`0.8.1.11`。唯一 Git 分支:`dev`。
 
 
 一台 Linux 后端管理四个工位;Qt 保留前端开发人员原有界面,界面仅展示状态、BIOS UART 原文和提交动作。实际 BMC、固件阶段、诊断采集、失败判断、命令队列均由后端完成。
 一台 Linux 后端管理四个工位;Qt 保留前端开发人员原有界面,界面仅展示状态、BIOS UART 原文和提交动作。实际 BMC、固件阶段、诊断采集、失败判断、命令队列均由后端完成。
 
 

+ 1 - 1
VERSION

@@ -1 +1 @@
-0.8.1.10
+0.8.1.11

+ 1 - 1
docs/GRPC_API_ZH.md

@@ -1,4 +1,4 @@
-# XJKJ-STL 0.8.1.10:原生 gRPC 专用接口手册
+# XJKJ-STL 0.8.1.11:原生 gRPC 专用接口手册
 
 
 **只开发原生 gRPC 客户端,请只看这份;Qt 前端精简纯净版 WebSocket 对接请看 [QT_CLIENT_API_ZH.md](QT_CLIENT_API_ZH.md)。** 直接使用 `stl.v1.BenchService` 和 protobuf 消息;没有 WebSocket 风格的 JSON 请求 id,但控制动作仍需要持久 command_id。
 **只开发原生 gRPC 客户端,请只看这份;Qt 前端精简纯净版 WebSocket 对接请看 [QT_CLIENT_API_ZH.md](QT_CLIENT_API_ZH.md)。** 直接使用 `stl.v1.BenchService` 和 protobuf 消息;没有 WebSocket 风格的 JSON 请求 id,但控制动作仍需要持久 command_id。
 
 

+ 4 - 4
docs/QT_CLIENT_API_ZH.md

@@ -1,4 +1,4 @@
-# Qt 纯净控制接口 v1(0.8.1.10)—— Qt 前端开发对接手册
+# Qt 纯净控制接口 v1(0.8.1.11)—— Qt 前端开发对接手册
 
 
 本文档面向 **Qt 前端开发人员**,定义后端专为极简 Qt UI 提供的**纯净版 WebSocket 接口**。
 本文档面向 **Qt 前端开发人员**,定义后端专为极简 Qt UI 提供的**纯净版 WebSocket 接口**。
 
 
@@ -70,7 +70,7 @@ Qt 自己维护并保存本地配置和 `qt-plans.json`(测试计划),不
 ```
 ```
 
 
 ```json
 ```json
-{"v":1,"id":"info-1","ok":true,"result":{"version":"0.8.1.10","mode":"hardware"}}
+{"v":1,"id":"info-1","ok":true,"result":{"version":"0.8.1.11","mode":"hardware"}}
 ```
 ```
 
 
 `mode` 为 `hardware` 或 `simulated`。模拟结果不能作为实机验收证据。
 `mode` 为 `hardware` 或 `simulated`。模拟结果不能作为实机验收证据。
@@ -81,7 +81,7 @@ Qt 自己维护并保存本地配置和 `qt-plans.json`(测试计划),不
 
 
 ```json
 ```json
 {
 {
-  "version":"0.8.1.10",
+  "version":"0.8.1.11",
   "mode":"hardware",
   "mode":"hardware",
   "server_id":"backend-instance-id",
   "server_id":"backend-instance-id",
   "stations":[
   "stations":[
@@ -365,7 +365,7 @@ Qt 自己维护并保存本地配置和 `qt-plans.json`(测试计划),不
 成功连接后自动推送状态,此后每秒一份:
 成功连接后自动推送状态,此后每秒一份:
 
 
 ```json
 ```json
-{"v":1,"event":"state","result":{"version":"0.8.1.10","mode":"hardware","server_id":"...","stations":[]}}
+{"v":1,"event":"state","result":{"version":"0.8.1.11","mode":"hardware","server_id":"...","stations":[]}}
 ```
 ```
 
 
 有新增 BIOS UART 原始字节时自动推送(后端按每个工位的会话和字节偏移维护游标):
 有新增 BIOS UART 原始字节时自动推送(后端按每个工位的会话和字节偏移维护游标):

+ 1 - 1
docs/WEBSOCKET_API_ZH.md

@@ -1,4 +1,4 @@
-# XJKJ-STL 0.8.1.10:完整 WebSocket 接口手册
+# XJKJ-STL 0.8.1.11:完整 WebSocket 接口手册
 
 
 **Qt 前端精简纯净版对接请看 [QT_CLIENT_API_ZH.md](QT_CLIENT_API_ZH.md)(地址:`ws://192.168.2.79:8080/ws?view=qt-clean`)。** 本文是 `/ws`(或 `/ws?view=full`)的全部业务和诊断接口。后端同时支持三个接口:完整 WebSocket(`/ws`)、完整原生 gRPC(`:50051`)、Qt 专用精简纯净 WebSocket(`/ws?view=qt-clean`)。
 **Qt 前端精简纯净版对接请看 [QT_CLIENT_API_ZH.md](QT_CLIENT_API_ZH.md)(地址:`ws://192.168.2.79:8080/ws?view=qt-clean`)。** 本文是 `/ws`(或 `/ws?view=full`)的全部业务和诊断接口。后端同时支持三个接口:完整 WebSocket(`/ws`)、完整原生 gRPC(`:50051`)、Qt 专用精简纯净 WebSocket(`/ws?view=qt-clean`)。
 
 

+ 2 - 1
pyproject.toml

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
 
 
 [project]
 [project]
 name = "xjkj-stl-backend"
 name = "xjkj-stl-backend"
-version = "0.8.1.10"
+version = "0.8.1.11"
 description = "Four-station memory thermal test backend with WebSocket and gRPC"
 description = "Four-station memory thermal test backend with WebSocket and gRPC"
 readme = "README.md"
 readme = "README.md"
 requires-python = ">=3.11"
 requires-python = ">=3.11"
@@ -25,5 +25,6 @@ stl_backend = ["web/*.html", "web/*.css", "web/*.js", "domain/*.json"]
 
 
 [tool.pytest.ini_options]
 [tool.pytest.ini_options]
 asyncio_mode = "auto"
 asyncio_mode = "auto"
+pythonpath = ["src"]
 testpaths = ["tests"]
 testpaths = ["tests"]
 
 

+ 1 - 1
qt-client/QT_CLEAN_CLIENT_ZH.md

@@ -1,4 +1,4 @@
-# Qt 纯净版临时客户端 0.8.1.10
+# Qt 纯净版临时客户端 0.8.1.11
 
 
 本目录基于上传的 XJKJ-STL Qt 工程制作;原始工程另存,界面布局沿用原来的 `.ui`。它只连接独立接口 `/ws?view=qt-clean`。
 本目录基于上传的 XJKJ-STL Qt 工程制作;原始工程另存,界面布局沿用原来的 `.ui`。它只连接独立接口 `/ws?view=qt-clean`。
 
 

+ 1 - 1
qt-client/src/main.cpp

@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
 
 
     QApplication app(argc, argv);
     QApplication app(argc, argv);
     app.setApplicationName(QStringLiteral("HOVSE SLT Pro"));
     app.setApplicationName(QStringLiteral("HOVSE SLT Pro"));
-    app.setApplicationVersion(QStringLiteral("0.8.1.4"));
+    app.setApplicationVersion(QStringLiteral("0.8.1.11"));
     app.setOrganizationName(QStringLiteral("XJKJ"));
     app.setOrganizationName(QStringLiteral("XJKJ"));
 
 
     applyAppFont(app);
     applyAppFont(app);

+ 1 - 1
src/stl_backend/__init__.py

@@ -1,3 +1,3 @@
 """XJKJ-STL memory thermal testing backend."""
 """XJKJ-STL memory thermal testing backend."""
-__version__ = "0.8.1.10"
+__version__ = "0.8.1.11"
 
 

+ 39 - 9
src/stl_backend/application/qt_clean.py

@@ -748,7 +748,14 @@ class QtCleanService:
         tail = await self.bench.read_event_queue(0, sid, 1)
         tail = await self.bench.read_event_queue(0, sid, 1)
         record = {"state": "starting", "started_unix_ms": 0, "boot_id": "", "error_cursor": tail["latest_sequence"]}
         record = {"state": "starting", "started_unix_ms": 0, "boot_id": "", "error_cursor": tail["latest_sequence"]}
         self.records[sid] = record
         self.records[sid] = record
-        self.stage_intents[sid] = default_stage_intents()
+        prior_intents = self.stage_intents.get(sid, {})
+        fresh_intents = default_stage_intents()
+        for key, slot in prior_intents.items():
+            if slot.get("pending") and not slot.get("consumed"):
+                preserved = copy.deepcopy(slot)
+                preserved.pop("wait_for_boot_after", None)
+                fresh_intents[key] = preserved
+        self.stage_intents[sid] = fresh_intents
         self.auto_dispatched = {k for k in self.auto_dispatched if k[0] != sid}
         self.auto_dispatched = {k for k in self.auto_dispatched if k[0] != sid}
         rt.diagnostic_operation = True
         rt.diagnostic_operation = True
         try:
         try:
@@ -785,6 +792,8 @@ class QtCleanService:
                 if (fw["boot_id"] and fw["boot_id"] != old_boot and not fw["boot_pending"] and
                 if (fw["boot_id"] and fw["boot_id"] != old_boot and not fw["boot_pending"] and
                     fw["boot_started_unix_ms"] >= requested_at and interactive):
                     fw["boot_started_unix_ms"] >= requested_at and interactive):
                     record.update(state="running", boot_id=fw["boot_id"], started_unix_ms=fw["boot_started_unix_ms"])
                     record.update(state="running", boot_id=fw["boot_id"], started_unix_ms=fw["boot_started_unix_ms"])
+                    if any(slot.get("pending") for slot in self.stage_intents.get(sid, {}).values()):
+                        self._ensure_intent_watcher(sid)
                     await self._note(rt, "新的 BIOS 已进入可交互阶段;开始按 Qt 本地计划处理阶段输入。")
                     await self._note(rt, "新的 BIOS 已进入可交互阶段;开始按 Qt 本地计划处理阶段输入。")
                     return {"power_action": action, "previous_power": previous, "previous_boot_id": old_boot,
                     return {"power_action": action, "previous_power": previous, "previous_boot_id": old_boot,
                             "boot_id": fw["boot_id"], "boot_observed": True,
                             "boot_id": fw["boot_id"], "boot_observed": True,
@@ -893,6 +902,9 @@ class QtCleanService:
         rt = self._runtime(sid)
         rt = self._runtime(sid)
         if rt.diagnostic_operation or self.bench.closing:
         if rt.diagnostic_operation or self.bench.closing:
             return
             return
+        rec_state = self.records.get(sid, {}).get("state", "idle")
+        if rec_state in ("starting", "failed", "completed"):
+            return
         if sid in self.last_commands:
         if sid in self.last_commands:
             last_item = await self.bench.get_queue_item(self.last_commands[sid])
             last_item = await self.bench.get_queue_item(self.last_commands[sid])
             if last_item["state"] not in ("succeeded", "failed", "interrupted"):
             if last_item["state"] not in ("succeeded", "failed", "interrupted"):
@@ -902,6 +914,11 @@ class QtCleanService:
         if not point["ready"]:
         if not point["ready"]:
             return
             return
         intents = self.stage_intents.setdefault(sid, default_stage_intents())
         intents = self.stage_intents.setdefault(sid, default_stage_intents())
+        cur_boot = fw.get("boot_id", "")
+        for slot in intents.values():
+            wait_boot = slot.get("wait_for_boot_after")
+            if wait_boot and (wait_boot == "__pre_start__" or cur_boot == wait_boot):
+                return
         stage = point["stage"]
         stage = point["stage"]
         if stage != "uip1" and intents["uip1"]["pending"] and STAGE_ORDER.get(stage, 0) > 1:
         if stage != "uip1" and intents["uip1"]["pending"] and STAGE_ORDER.get(stage, 0) > 1:
             intents["uip1"]["pending"] = False
             intents["uip1"]["pending"] = False
@@ -938,7 +955,7 @@ class QtCleanService:
                     "arguments": {"input_id": point["id"], "action": act, "amt": amt_cfg, "run_amt": slot["run_amt"]},
                     "arguments": {"input_id": point["id"], "action": act, "amt": amt_cfg, "run_amt": slot["run_amt"]},
                 })
                 })
                 self.last_commands[sid] = cmd_id
                 self.last_commands[sid] = cmd_id
-        elif stage == "uip2" and (intents["amt"]["consumed"] or intents["mt"]["pending"]):
+        elif stage == "uip2" and (intents["amt"]["consumed"] or intents["mt"]["pending"] or intents["uip1"]["consumed"]):
             key = (sid, point["id"], "continue_uip", 0)
             key = (sid, point["id"], "continue_uip", 0)
             if key not in self.auto_dispatched:
             if key not in self.auto_dispatched:
                 self.auto_dispatched.add(key)
                 self.auto_dispatched.add(key)
@@ -972,6 +989,8 @@ class QtCleanService:
         input_id = request.get("input_id", "")
         input_id = request.get("input_id", "")
         intents = self.stage_intents.setdefault(sid, default_stage_intents())
         intents = self.stage_intents.setdefault(sid, default_stage_intents())
         target_key = stage_target_for_action(action)
         target_key = stage_target_for_action(action)
+        record = self.records.get(sid, {})
+        rec_state = record.get("state", "idle")
         if point["stage"] == "amt" and request.get("run_amt") is False and action == "start_amt":
         if point["stage"] == "amt" and request.get("run_amt") is False and action == "start_amt":
             action = "skip_amt"
             action = "skip_amt"
         valid_token = (
         valid_token = (
@@ -980,20 +999,31 @@ class QtCleanService:
             or (point["stage"] == "uefi" and input_id in self.uefi_tokens.get(node, set()))
             or (point["stage"] == "uefi" and input_id in self.uefi_tokens.get(node, set()))
         )
         )
         at_prompt = bool(point["ready"] and valid_token and action in point["actions"])
         at_prompt = bool(point["ready"] and valid_token and action in point["actions"])
+        if not input_id and rec_state in ("completed", "failed"):
+            at_prompt = False
         if not at_prompt and target_key in ("uip1", "amt", "mt"):
         if not at_prompt and target_key in ("uip1", "amt", "mt"):
-            record = self.records.get(sid, {})
-            boot_id = record.get("boot_id") or fw.get("boot_id", "")
             stale_boot_token = bool(input_id and input_id != point.get("id", ""))
             stale_boot_token = bool(input_id and input_id != point.get("id", ""))
-            cur_stage = point["stage"] if point["ready"] else (
-                "starting" if record.get("state") == "starting" else fw.get("observed_phase", "boot"))
-            cur_order = STAGE_ORDER.get(cur_stage, 0)
+            observed_stage = point["stage"] if point["ready"] else fw.get("observed_phase", "boot")
+            observed_order = STAGE_ORDER.get(observed_stage, 0)
             target_order = {"uip1": 1, "amt": 3, "mt": 5}[target_key]
             target_order = {"uip1": 1, "amt": 3, "mt": 5}[target_key]
+            pre_start = rec_state in ("idle", "completed", "failed")
+            cur_order = 0 if pre_start else (0 if rec_state == "starting" else observed_order)
+            if pre_start and intents[target_key]["consumed"]:
+                intents[target_key]["consumed"] = False
             if not stale_boot_token and cur_order < target_order and not intents[target_key]["consumed"]:
             if not stale_boot_token and cur_order < target_order and not intents[target_key]["consumed"]:
                 slot = apply_stage_intent_overwrite(intents, target_key, request)
                 slot = apply_stage_intent_overwrite(intents, target_key, request)
+                if pre_start and (rec_state in ("completed", "failed") or observed_order >= target_order):
+                    slot["wait_for_boot_after"] = fw.get("boot_id", "") or "__pre_start__"
                 if target_key != "amt" and request.get("run_amt") is not None and cur_order < 3:
                 if target_key != "amt" and request.get("run_amt") is not None and cur_order < 3:
-                    apply_stage_intent_overwrite(intents, "amt", {**request, "action": "start_amt" if request["run_amt"] else "skip_amt"})
+                    intents["amt"]["consumed"] = False if pre_start else intents["amt"]["consumed"]
+                    amt_slot = apply_stage_intent_overwrite(intents, "amt", {**request, "action": "start_amt" if request["run_amt"] else "skip_amt"})
+                    if pre_start and (rec_state in ("completed", "failed") or observed_order >= 3):
+                        amt_slot["wait_for_boot_after"] = fw.get("boot_id", "") or "__pre_start__"
                 if target_key != "mt" and request.get("run_mt") is not None and cur_order < 5:
                 if target_key != "mt" and request.get("run_mt") is not None and cur_order < 5:
-                    apply_stage_intent_overwrite(intents, "mt", {**request, "action": "start_mt" if request["run_mt"] else "skip_mt"})
+                    intents["mt"]["consumed"] = False if pre_start else intents["mt"]["consumed"]
+                    mt_slot = apply_stage_intent_overwrite(intents, "mt", {**request, "action": "start_mt" if request["run_mt"] else "skip_mt"})
+                    if pre_start and (rec_state in ("completed", "failed") or observed_order >= 5):
+                        mt_slot["wait_for_boot_after"] = fw.get("boot_id", "") or "__pre_start__"
                 self._ensure_intent_watcher(sid)
                 self._ensure_intent_watcher(sid)
                 enabled_val = slot.get("run_amt" if target_key == "amt" else "run_mt" if target_key == "mt" else "run_rmt")
                 enabled_val = slot.get("run_amt" if target_key == "amt" else "run_mt" if target_key == "mt" else "run_rmt")
                 await self._note(rt, f"阶段 {target_key} 意图已预置/覆盖(revision={slot['revision']}),到达阶段后自动执行。")
                 await self._note(rt, f"阶段 {target_key} 意图已预置/覆盖(revision={slot['revision']}),到达阶段后自动执行。")

+ 47 - 2
src/stl_backend/parsers.py

@@ -766,8 +766,37 @@ class IncrementalSolParser:
             if ("Logical Rank" in line or "Error on rising strobe:" in line
             if ("Logical Rank" in line or "Error on rising strobe:" in line
                     or "Error on falling strobe:" in line):
                     or "Error on falling strobe:" in line):
                 # Context is kept separate so a subsequent CPU event cannot steal a DIMM SN.
                 # Context is kept separate so a subsequent CPU event cannot steal a DIMM SN.
-                emit("error_detail", "AMT diagnostic continuation", {
-                     "parent_line_no": self._previous_amt_error_line, "test_failure": False}, phase="amt")
+                cont_details: dict[str, Any] = {
+                    "parent_line_no": self._previous_amt_error_line,
+                    "test_failure": False,
+                }
+                coord_m = re.search(
+                    r"(?:\[(?P<algo_tag>[^\]]+)\])?\s*Logical Rank\s*=\s*(?P<rank>\d+),\s*"
+                    r"Subrank\s*=\s*(?P<subrank>\d+),\s*Bank\s*=\s*(?P<bank>\d+),\s*"
+                    r"Row\s*=\s*(?P<row>0x[0-9A-Fa-f]+|\d+),\s*"
+                    r"Column\s*=\s*(?P<col>0x[0-9A-Fa-f]+|\d+)"
+                    r"(?:,\s*Chunk\s*=\s*(?P<chunk>0x[0-9A-Fa-f]+|\d+))?",
+                    line,
+                    re.I,
+                )
+                if coord_m:
+                    bank_id = int(coord_m["bank"])
+                    cont_details.update(
+                        rank=int(coord_m["rank"]),
+                        subrank=int(coord_m["subrank"]),
+                        row=coord_m["row"],
+                        column=coord_m["col"],
+                    )
+                    if 0 <= bank_id < 32:
+                        cont_details["bank"] = bank_id
+                    if coord_m["algo_tag"]:
+                        cont_details["algorithm_tag"] = coord_m["algo_tag"]
+                    if coord_m["chunk"]:
+                        cont_details["chunk"] = coord_m["chunk"]
+                dq_m = re.search(r"Error on (rising|falling) strobe:\s*(0x[0-9A-Fa-f]+)", line, re.I)
+                if dq_m:
+                    cont_details[f"dq_{dq_m[1].lower()}_hex"] = dq_m[2]
+                emit("error_detail", "AMT diagnostic continuation", cont_details, phase="amt")
 
 
         m = _DRAM.search(line)
         m = _DRAM.search(line)
         if m:
         if m:
@@ -888,6 +917,22 @@ class IncrementalSolParser:
                 self._previous_mt_ecc_line = number
                 self._previous_mt_ecc_line = number
             if is_coord_continuation:
             if is_coord_continuation:
                 details["parent_line_no"] = self._previous_mt_ecc_line
                 details["parent_line_no"] = self._previous_mt_ecc_line
+                tuple_m = re.search(
+                    r"\(Chan,Slot,Rank,Bank,Row,Col\):\s*\((\d+),(\d+),(\d+),(\d+),(0x[0-9A-Fa-f]+|\d+),(0x[0-9A-Fa-f]+|\d+)\)",
+                    line,
+                    re.I,
+                )
+                if tuple_m:
+                    bank_id = int(tuple_m[4])
+                    details.update(
+                        channel=int(tuple_m[1]),
+                        dimm=int(tuple_m[2]),
+                        rank=int(tuple_m[3]),
+                        row=tuple_m[5],
+                        column=tuple_m[6],
+                    )
+                    if 0 <= bank_id < 32:
+                        details["bank"] = bank_id
                 emit("error_detail", "MemTest86 ECC coordinate detail", details, "info", phase="mt")
                 emit("error_detail", "MemTest86 ECC coordinate detail", details, "info", phase="mt")
             else:
             else:
                 emit("error", "MemTest86 memory error", details, "error")
                 emit("error", "MemTest86 memory error", details, "error")

+ 27 - 0
tests/test_phase_details_parser.py

@@ -148,3 +148,30 @@ def test_amt_details_keep_algorithm_identity_and_zero_execution_verdict():
     assert summary["details"]["algorithms_executed"] == 0
     assert summary["details"]["algorithms_executed"] == 0
     assert summary["details"]["verdict_supported"] is False
     assert summary["details"]["verdict_supported"] is False
     assert all(e["details"].get("detail_label") for e in events)
     assert all(e["details"].get("detail_label") for e in events)
+
+
+def test_amt_and_mt_error_detail_coordinates_keep_valid_ddr5_bank_0_to_31():
+    events = parse(
+        "N0.C02.D0.SC1.R0: Failure detected - Advanced Memtest Type 20, Checkpoint 0x000000B0\n"
+        "[B-SCM_2_RS]Logical Rank = 0, Subrank = 0, Bank = 31, Row = 0x3F98, Column = 0x4C0, Chunk = 0xFFFF\n"
+        "DQ[39:0] Error on rising strobe:  0x0000000400\n"
+        "DQ[39:0] Error on falling strobe: 0x0000000400\n"
+        "2026-10-08 14:18:44 - [MEM ERROR - ECC Errors] (P package,C channel,S slot,R rank): (P0,C5,S0,R0)\n"
+        "2026-10-08 14:18:44 - [MEM ERROR - ECC Errors] (Chan,Slot,Rank,Bank,Row,Col): (5,0,0,16,24212,896)\n"
+    )
+    amt_details = [e["details"] for e in events if e["kind"] == "error_detail" and e["phase"] == "amt"]
+    assert len(amt_details) == 3
+    assert amt_details[0]["algorithm_tag"] == "B-SCM_2_RS"
+    assert amt_details[0]["bank"] == 31
+    assert amt_details[0]["row"] == "0x3F98"
+    assert amt_details[0]["column"] == "0x4C0"
+    assert amt_details[1]["dq_rising_hex"] == "0x0000000400"
+    assert amt_details[2]["dq_falling_hex"] == "0x0000000400"
+
+    mt_details = [e["details"] for e in events if e["kind"] == "error_detail" and e["phase"] == "mt"]
+    assert len(mt_details) == 1
+    assert mt_details[0]["channel"] == 5
+    assert mt_details[0]["bank"] == 16
+    assert mt_details[0]["row"] == "24212"
+    assert mt_details[0]["column"] == "896"
+

+ 40 - 0
tests/test_stage_intents.py

@@ -110,6 +110,46 @@ class StageIntentTests(unittest.IsolatedAsyncioTestCase):
         self.assertNotIn(b"amemdiag 1\r", self.rt.device.sent_commands)
         self.assertNotIn(b"amemdiag 1\r", self.rt.device.sent_commands)
         self.assertIn(b"118.efi\r", self.rt.device.sent_commands)
         self.assertIn(b"118.efi\r", self.rt.device.sent_commands)
 
 
+    async def test_prestage_before_start_test_with_overwrite_auto_consumes_all_stages(self):
+        # Send stage intents BEFORE StartTest is called, with multiple overwrites
+        r1 = await self.command("StageAction", {"station_id": "S1", "command_id": "pre-rmt-1", "action": "continue_uip", "run_rmt": False})
+        self.assertEqual(r1["result"]["confirmation"], "staged")
+        self.assertFalse(r1["result"]["enabled"])
+        r2 = await self.command("StageAction", {"station_id": "S1", "command_id": "pre-rmt-2", "action": "continue_uip", "run_rmt": True})
+        self.assertEqual(r2["result"]["confirmation"], "staged")
+        self.assertTrue(r2["result"]["enabled"])
+        self.assertEqual(r2["result"]["revision"], 2)
+
+        a1 = await self.command("StageAction", {"station_id": "S1", "command_id": "pre-amt-1", "action": "start_amt"})
+        self.assertTrue(a1["result"]["enabled"])
+        a2 = await self.command("StageAction", {"station_id": "S1", "command_id": "pre-amt-2", "action": "skip_amt"})
+        self.assertFalse(a2["result"]["enabled"])
+        a3 = await self.command("StageAction", {"station_id": "S1", "command_id": "pre-amt-3", "action": "start_amt"})
+        self.assertTrue(a3["result"]["enabled"])
+        self.assertEqual(a3["result"]["revision"], 3)
+
+        m1 = await self.command("StageAction", {"station_id": "S1", "command_id": "pre-mt-1", "action": "start_mt"})
+        self.assertTrue(m1["result"]["enabled"])
+        m2 = await self.command("StageAction", {"station_id": "S1", "command_id": "pre-mt-2", "action": "skip_mt"})
+        self.assertFalse(m2["result"]["enabled"])
+
+        # Now start the test; all pre-staged intents must be preserved and automatically consumed!
+        start_res = await self.command("StartTest", {"station_id": "S1", "command_id": "pre-start-1"})
+        self.assertEqual(start_res["state"], "succeeded")
+
+        async with asyncio.timeout(8):
+            while True:
+                st = await self.current()
+                if st["run_state"] == "completed":
+                    break
+                await asyncio.sleep(0.02)
+
+        st = await self.current()
+        self.assertEqual(st["verdict"], "pass")
+        self.assertIn(b"rmt enable\r", self.rt.device.sent_commands)
+        self.assertIn(b"amemdiag 1\r", self.rt.device.sent_commands)
+        self.assertNotIn(b"118.efi\r", self.rt.device.sent_commands)
+
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":
     unittest.main()
     unittest.main()

+ 1 - 1
validation/build_windows_release.ps1

@@ -1,7 +1,7 @@
 param(
 param(
     [Parameter(Mandatory=$true)][string]$QtRoot,
     [Parameter(Mandatory=$true)][string]$QtRoot,
     [Parameter(Mandatory=$true)][string]$MingwRoot,
     [Parameter(Mandatory=$true)][string]$MingwRoot,
-    [string]$ReleaseRoot = 'C:\Users\Administrator\delivery\XJKJ-STL-Qt-Clean-0.8.1.4'
+    [string]$ReleaseRoot = 'C:\Users\Administrator\delivery\XJKJ-STL-Qt-Clean-0.8.1.11'
 )
 )
 $ErrorActionPreference = 'Stop'
 $ErrorActionPreference = 'Stop'
 $ProgressPreference = 'SilentlyContinue'
 $ProgressPreference = 'SilentlyContinue'

+ 1 - 1
validation/launch_windows_demo.ps1

@@ -1,4 +1,4 @@
-param([string]$ReleaseRoot = 'C:\Users\Administrator\delivery\XJKJ-STL-Qt-Clean-0.8.1.4')
+param([string]$ReleaseRoot = 'C:\Users\Administrator\delivery\XJKJ-STL-Qt-Clean-0.8.1.11')
 $ErrorActionPreference = 'Stop'
 $ErrorActionPreference = 'Stop'
 $ProgressPreference = 'SilentlyContinue'
 $ProgressPreference = 'SilentlyContinue'
 $appRoot = Join-Path $ReleaseRoot 'app'
 $appRoot = Join-Path $ReleaseRoot 'app'

+ 1 - 1
validation/package_windows_dev.py

@@ -7,7 +7,7 @@ from pathlib import Path
 import struct
 import struct
 import zipfile
 import zipfile
 
 
-VERSION = "0.8.1.4"
+VERSION = "0.8.1.11"
 UI_HASHES = {
 UI_HASHES = {
     "src/mainwindow.ui": "e2ed5a4aaadf0d089eab4e4b6791357423482c2adb9ef7c8c7a01f0b1caddabd",
     "src/mainwindow.ui": "e2ed5a4aaadf0d089eab4e4b6791357423482c2adb9ef7c8c7a01f0b1caddabd",
     "src/style/app.qss": "b4774ac879b64a07fbb361c5e763e0355ed4cb0051e37c412bec38dcbcba8558",
     "src/style/app.qss": "b4774ac879b64a07fbb361c5e763e0355ed4cb0051e37c412bec38dcbcba8558",

+ 1 - 1
validation/run_windows_live.ps1

@@ -1,4 +1,4 @@
-param([string]$ReleaseRoot = 'C:\Users\Administrator\delivery\XJKJ-STL-Qt-Clean-0.8.1.4')
+param([string]$ReleaseRoot = 'C:\Users\Administrator\delivery\XJKJ-STL-Qt-Clean-0.8.1.11')
 $ErrorActionPreference = 'Stop'
 $ErrorActionPreference = 'Stop'
 $ProgressPreference = 'SilentlyContinue'
 $ProgressPreference = 'SilentlyContinue'
 $appRoot = Join-Path $ReleaseRoot 'app'
 $appRoot = Join-Path $ReleaseRoot 'app'

+ 1 - 1
validation/run_windows_validation.py

@@ -7,7 +7,7 @@ from pathlib import Path
 import subprocess
 import subprocess
 
 
 parser = argparse.ArgumentParser()
 parser = argparse.ArgumentParser()
-parser.add_argument('--release', type=Path, default=Path(r'C:\Users\Administrator\delivery\XJKJ-STL-Qt-Clean-0.8.1.4'))
+parser.add_argument('--release', type=Path, default=Path(r'C:\Users\Administrator\delivery\XJKJ-STL-Qt-Clean-0.8.1.11'))
 args = parser.parse_args()
 args = parser.parse_args()
 app = args.release / 'app'
 app = args.release / 'app'
 evidence = args.release / 'evidence'
 evidence = args.release / 'evidence'

+ 1 - 1
validation/schedule_windows_dev.ps1

@@ -1,6 +1,6 @@
 param(
 param(
     [ValidateSet('live','demo')][string]$Mode='live',
     [ValidateSet('live','demo')][string]$Mode='live',
-    [string]$ReleaseRoot='C:\Users\Administrator\delivery\XJKJ-STL-Qt-Clean-0.8.1.4'
+    [string]$ReleaseRoot='C:\Users\Administrator\delivery\XJKJ-STL-Qt-Clean-0.8.1.11'
 )
 )
 $ErrorActionPreference='Stop'
 $ErrorActionPreference='Stop'
 $taskName = if ($Mode -eq 'live') {'XJKJ-Qt-Dev-Live'} else {'XJKJ-Qt-Dev-Demo'}
 $taskName = if ($Mode -eq 'live') {'XJKJ-Qt-Dev-Live'} else {'XJKJ-Qt-Dev-Demo'}