Bläddra i källkod

chore(release): v0.8.1.10 real GNR BIOS training disable/failmode parsing, MemTest86 ECC continuation dedup & stage_errors exposure

XJKJ STL 1 månad sedan
förälder
incheckning
201b64dd2a

+ 1 - 1
VERSION

@@ -1 +1 @@
-0.8.1.9
+0.8.1.10

+ 1 - 1
docs/GRPC_API_ZH.md

@@ -1,4 +1,4 @@
-# XJKJ-STL 0.8.1.9:原生 gRPC 专用接口手册
+# XJKJ-STL 0.8.1.10:原生 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。
 
 

+ 6 - 4
docs/QT_CLIENT_API_ZH.md

@@ -1,4 +1,4 @@
-# Qt 纯净控制接口 v1(0.8.1.9)—— Qt 前端开发对接手册
+# Qt 纯净控制接口 v1(0.8.1.10)—— 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.9","mode":"hardware"}}
+{"v":1,"id":"info-1","ok":true,"result":{"version":"0.8.1.10","mode":"hardware"}}
 ```
 ```
 
 
 `mode` 为 `hardware` 或 `simulated`。模拟结果不能作为实机验收证据。
 `mode` 为 `hardware` 或 `simulated`。模拟结果不能作为实机验收证据。
@@ -81,7 +81,7 @@ Qt 自己维护并保存本地配置和 `qt-plans.json`(测试计划),不
 
 
 ```json
 ```json
 {
 {
-  "version":"0.8.1.9",
+  "version":"0.8.1.10",
   "mode":"hardware",
   "mode":"hardware",
   "server_id":"backend-instance-id",
   "server_id":"backend-instance-id",
   "stations":[
   "stations":[
@@ -118,6 +118,7 @@ Qt 自己维护并保存本地配置和 `qt-plans.json`(测试计划),不
           "started_unix_ms":"1793090400123"
           "started_unix_ms":"1793090400123"
         }
         }
       },
       },
+      "stage_errors":{"training":[],"rmt":[],"amt":[],"mt":[]},
       "channels":[
       "channels":[
         {
         {
           "cpu":0,
           "cpu":0,
@@ -151,6 +152,7 @@ Qt 自己维护并保存本地配置和 `qt-plans.json`(测试计划),不
 | `can_start` | 当前具备主机电源与控制台能力、没有冲突操作,且没有尚未结束的 Start;实际执行仍重新核验 |
 | `can_start` | 当前具备主机电源与控制台能力、没有冲突操作,且没有尚未结束的 Start;实际执行仍重新核验 |
 | `input` | 当前可操作的固件输入节点,见下文 |
 | `input` | 当前可操作的固件输入节点,见下文 |
 | `command` | 最近提交至该工位的 Qt 操作状态(同一后端的所有客户端可见);详细字段见 GetCommand |
 | `command` | 最近提交至该工位的 Qt 操作状态(同一后端的所有客户端可见);详细字段见 GetCommand |
+| `stage_errors` | 按 `training / rmt / amt / mt` 分类记录的本轮启动结构化阶段错误与通道禁用明细列表 |
 | `channels` | 对应 CPU、通道的阶段健康灯与有效温度;不凭聚合 AMT/MT PASS 推测每个 DIMM 已通过 |
 | `channels` | 对应 CPU、通道的阶段健康灯与有效温度;不凭聚合 AMT/MT PASS 推测每个 DIMM 已通过 |
 
 
 `input.stage` 是 **`uip1 / uip2 / amt / uefi`**,不是整体展示阶段。实际固件的 UIP2 可以位于 AMT 之后;此时整体 `phase` 为 `post`,操作节点仍为 `uip2`。第二颗 CPU 的 UIP1 仍是 `uip1`,由 `input.cpu` 区分。
 `input.stage` 是 **`uip1 / uip2 / amt / uefi`**,不是整体展示阶段。实际固件的 UIP2 可以位于 AMT 之后;此时整体 `phase` 为 `post`,操作节点仍为 `uip2`。第二颗 CPU 的 UIP1 仍是 `uip1`,由 `input.cpu` 区分。
@@ -363,7 +365,7 @@ Qt 自己维护并保存本地配置和 `qt-plans.json`(测试计划),不
 成功连接后自动推送状态,此后每秒一份:
 成功连接后自动推送状态,此后每秒一份:
 
 
 ```json
 ```json
-{"v":1,"event":"state","result":{"version":"0.8.1.9","mode":"hardware","server_id":"...","stations":[]}}
+{"v":1,"event":"state","result":{"version":"0.8.1.10","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.9:完整 WebSocket 接口手册
+# XJKJ-STL 0.8.1.10:完整 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`)。
 
 

+ 1 - 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.9"
+version = "0.8.1.10"
 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"

+ 1 - 1
qt-client/QT_CLEAN_CLIENT_ZH.md

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

+ 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.9"
+__version__ = "0.8.1.10"
 
 

+ 45 - 8
src/stl_backend/application/qt_clean.py

@@ -354,13 +354,26 @@ class QtCleanService:
                     (details.get("test_failure") or details.get("execution_error") or event.get("kind") == "error")):
                     (details.get("test_failure") or details.get("execution_error") or event.get("kind") == "error")):
                     record["test_failed"] = True
                     record["test_failed"] = True
                     record["failure_scope"] = event.get("phase", "")
                     record["failure_scope"] = event.get("phase", "")
+                    stage_name = {"bios_training": "training", "amemdiag": "amt"}.get(event.get("phase", ""), event.get("phase", ""))
+                    if stage_name not in ("training", "rmt", "amt", "mt"):
+                        stage_name = "training"
+                    err_bucket = record.setdefault("stage_errors", {"training": [], "rmt": [], "amt": [], "mt": []})
+                    err_bucket[stage_name].append({
+                        "stage": stage_name,
+                        "kind": event.get("kind", "error"),
+                        "message": event.get("message", ""),
+                        "cpu": details.get("cpu"),
+                        "channel": str(details["channel"]) if details.get("channel") is not None else "",
+                        "dimm": details.get("dimm"),
+                        "location": details.get("location", ""),
+                        "error_type": details.get("error_type", event.get("kind", "error")),
+                        "observed_unix_ms": int(event.get("observed_unix_ms") or 0),
+                    })
+                    err_bucket[stage_name] = err_bucket[stage_name][-128:]
                     if details.get("cpu") is not None and details.get("channel") is not None:
                     if details.get("cpu") is not None and details.get("channel") is not None:
                         try:
                         try:
                             key = (int(details["cpu"]), canonical_channel(details["channel"], self._runtime(sid).cfg["channels_per_cpu"]))
                             key = (int(details["cpu"]), canonical_channel(details["channel"], self._runtime(sid).cfg["channels_per_cpu"]))
                             record.setdefault("failed_channels", set()).add(key)
                             record.setdefault("failed_channels", set()).add(key)
-                            stage_name = {"bios_training": "training", "amemdiag": "amt"}.get(event.get("phase", ""), event.get("phase", ""))
-                            if stage_name not in ("training", "rmt", "amt", "mt"):
-                                stage_name = "training"
                             record.setdefault("failed_channel_stages", {}).setdefault(key, stage_name)
                             record.setdefault("failed_channel_stages", {}).setdefault(key, stage_name)
                         except (TypeError, ValueError, BenchError):
                         except (TypeError, ValueError, BenchError):
                             pass
                             pass
@@ -437,11 +450,10 @@ class QtCleanService:
         default_err_stage = record.get("failure_scope") if record.get("failure_scope") in ("training", "rmt", "amt", "mt") else "training"
         default_err_stage = record.get("failure_scope") if record.get("failure_scope") in ("training", "rmt", "amt", "mt") else "training"
         for key in record.get("failed_channels", set()):
         for key in record.get("failed_channels", set()):
             failed_channel_stages.setdefault(key, default_err_stage)
             failed_channel_stages.setdefault(key, default_err_stage)
-        if not record:
-            for (c, ch_val), st in getattr(observer, "channel_errors", {}).items():
-                nk = norm_key(c, ch_val)
-                if nk:
-                    failed_channel_stages.setdefault(nk, st if st in ("training", "rmt", "amt", "mt") else "training")
+        for (c, ch_val), st in getattr(observer, "channel_errors", {}).items():
+            nk = norm_key(c, ch_val)
+            if nk:
+                failed_channel_stages.setdefault(nk, st if st in ("training", "rmt", "amt", "mt") else "training")
 
 
         dimms_by_ch = {}
         dimms_by_ch = {}
         for d in fw.get("training_dimms", []):
         for d in fw.get("training_dimms", []):
@@ -560,6 +572,25 @@ class QtCleanService:
                                  "state": ch_state, "temperature_c": temperatures.get(key)})
                                  "state": ch_state, "temperature_c": temperatures.get(key)})
         return channels
         return channels
 
 
+    @staticmethod
+    def _stage_errors(fw, record):
+        result = {"training": [], "rmt": [], "amt": [], "mt": []}
+        boot_matches = (fw.get("boot_id") == record["boot_id"]
+                        if record.get("boot_id") else not record and bool(fw.get("boot_id")))
+        if record.get("state") == "starting" or fw.get("boot_pending"):
+            return result
+        if boot_matches:
+            fw_errors = fw.get("stage_errors", {})
+            for stage in ("training", "rmt", "amt", "mt"):
+                result[stage].extend(copy.deepcopy(fw_errors.get(stage, [])))
+        rec_errors = record.get("stage_errors", {})
+        for stage in ("training", "rmt", "amt", "mt"):
+            for item in rec_errors.get(stage, []):
+                if item not in result[stage]:
+                    result[stage].append(copy.deepcopy(item))
+            result[stage] = result[stage][-128:]
+        return result
+
     async def state(self, *, ws=None):
     async def state(self, *, ws=None):
         stations = []
         stations = []
         for sid, rt in self.bench.runtimes.items():
         for sid, rt in self.bench.runtimes.items():
@@ -598,6 +629,7 @@ class QtCleanService:
             temperatures = self._temperatures(rt, fw, record, started, live)
             temperatures = self._temperatures(rt, fw, record, started, live)
             channels = self._channels(rt, fw, rt.firmware if rt.run else rt.diagnostic.firmware,
             channels = self._channels(rt, fw, rt.firmware if rt.run else rt.diagnostic.firmware,
                                       record, started, temperatures)
                                       record, started, temperatures)
+            stage_errors = self._stage_errors(fw, record)
             connection = rt.snapshot["sol_state"] if rt.run else rt.diagnostic.state["state"]
             connection = rt.snapshot["sol_state"] if rt.run else rt.diagnostic.state["state"]
             if connection == "closed":
             if connection == "closed":
                 connection = "offline"
                 connection = "offline"
@@ -606,6 +638,7 @@ class QtCleanService:
                 "run_state": state, "started_unix_ms": str(started), "boot_id": fw.get("boot_id", ""),
                 "run_state": state, "started_unix_ms": str(started), "boot_id": fw.get("boot_id", ""),
                 "verdict": verdict, "verdict_scope": verdict_scope,
                 "verdict": verdict, "verdict_scope": verdict_scope,
                 "input": input_point, "command": command, "channels": channels,
                 "input": input_point, "command": command, "channels": channels,
+                "stage_errors": stage_errors,
                 "can_start": bool(not foreign and rt.device.capabilities().get("bmc_power") and rt.device.capabilities().get("console")
                 "can_start": bool(not foreign and rt.device.capabilities().get("bmc_power") and rt.device.capabilities().get("console")
                                   and not pending and not rt.run and not rt.finishing
                                   and not pending and not rt.run and not rt.finishing
                                   and not rt.diagnostic_operation and not self.bench.controls.boot_plans.active(sid))})
                                   and not rt.diagnostic_operation and not self.bench.controls.boot_plans.active(sid))})
@@ -968,6 +1001,10 @@ class QtCleanService:
                         "stage": target_key, "revision": slot["revision"], "enabled": enabled_val}
                         "stage": target_key, "revision": slot["revision"], "enabled": enabled_val}
         if at_prompt:
         if at_prompt:
             cur_order = STAGE_ORDER.get(point["stage"], 0)
             cur_order = STAGE_ORDER.get(point["stage"], 0)
+            if not input_id and target_key in ("uip1", "amt") and not intents[target_key]["consumed"]:
+                slot = apply_stage_intent_overwrite(intents, target_key, request)
+                self.auto_dispatched.add((sid, point["id"], target_key if target_key == "uip1" else action, slot["revision"]))
+                self._ensure_intent_watcher(sid)
             if point["stage"] != "amt" and request.get("run_amt") is not None and cur_order < 3:
             if point["stage"] != "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"})
                 apply_stage_intent_overwrite(intents, "amt", {**request, "action": "start_amt" if request["run_amt"] else "skip_amt"})
                 self._ensure_intent_watcher(sid)
                 self._ensure_intent_watcher(sid)

+ 52 - 0
src/stl_backend/domain/firmware.py

@@ -243,6 +243,7 @@ class FirmwareObservation:
         self._seen_ddr_training = False
         self._seen_ddr_training = False
         self.detected_sensor_channels = set()
         self.detected_sensor_channels = set()
         self.channel_errors = {}
         self.channel_errors = {}
+        self.stage_errors = {"training": [], "rmt": [], "amt": [], "mt": []}
 
 
     @staticmethod
     @staticmethod
     def _rank(phase):
     def _rank(phase):
@@ -455,6 +456,56 @@ class FirmwareObservation:
             stage_err = phase if phase in ("training", "rmt", "amt", "mt") else "training"
             stage_err = phase if phase in ("training", "rmt", "amt", "mt") else "training"
             self.channel_errors.setdefault((cpu, str(details["channel"])), stage_err)
             self.channel_errors.setdefault((cpu, str(details["channel"])), stage_err)
             changed = True
             changed = True
+        stage_err_key = phase if phase in ("training", "rmt", "amt", "mt") else "training"
+        if kind == "error" or details.get("test_failure") or details.get("execution_error"):
+            err_row = {
+                "stage": stage_err_key,
+                "kind": kind,
+                "message": event.get("message", ""),
+                "cpu": cpu if is_cpu else None,
+                "channel": str(details["channel"]) if "channel" in details else "",
+                "dimm": details.get("dimm"),
+                "location": details.get("location", ""),
+                "error_type": details.get("error_type", kind),
+                **stamp,
+            }
+            self.stage_errors[stage_err_key].append(err_row)
+            self.stage_errors[stage_err_key] = self.stage_errors[stage_err_key][-128:]
+            changed = True
+        elif kind in ("training_dimm", "training_channel") and details.get("state") == "disabled":
+            err_row = {
+                "stage": "training",
+                "kind": kind,
+                "message": event.get("message", ""),
+                "cpu": cpu if is_cpu else None,
+                "channel": str(details["channel"]) if "channel" in details else "",
+                "dimm": details.get("dimm"),
+                "location": details.get("location", ""),
+                "reason": details.get("reason", ""),
+                "error_type": details.get("evidence_type", kind),
+                **stamp,
+            }
+            self.stage_errors["training"].append(err_row)
+            self.stage_errors["training"] = self.stage_errors["training"][-128:]
+            changed = True
+        elif kind == "diagnostic" and details.get("code") in (
+            "bios_fail_mode", "hd_width_unmatch", "hd_size_unmatch", "hd_dimm_miss"
+        ):
+            err_row = {
+                "stage": stage_err_key,
+                "kind": kind,
+                "message": event.get("message", ""),
+                "cpu": cpu if is_cpu else None,
+                "channel": str(details["channel"]) if "channel" in details else "",
+                "dimm": details.get("dimm"),
+                "location": details.get("location", ""),
+                "reason": details.get("fail_mode", details.get("code", "")),
+                "error_type": details.get("code", "diagnostic"),
+                **stamp,
+            }
+            self.stage_errors[stage_err_key].append(err_row)
+            self.stage_errors[stage_err_key] = self.stage_errors[stage_err_key][-128:]
+            changed = True
         if kind == "uefi_directory":
         if kind == "uefi_directory":
             self.uefi_directory = details.get("path", "")
             self.uefi_directory = details.get("path", "")
             self.uefi_files.clear()
             self.uefi_files.clear()
@@ -590,6 +641,7 @@ class FirmwareObservation:
                 "active_rmt_cpus": sorted(self.active_rmt_cpus), "active_amt_cpus": sorted(self.active_amt_cpus),
                 "active_rmt_cpus": sorted(self.active_rmt_cpus), "active_amt_cpus": sorted(self.active_amt_cpus),
                 "training_dimms": copy.deepcopy(list(self.training_dimms.values())),
                 "training_dimms": copy.deepcopy(list(self.training_dimms.values())),
                 "training_channels": copy.deepcopy(list(self.training_channels.values())),
                 "training_channels": copy.deepcopy(list(self.training_channels.values())),
+                "stage_errors": copy.deepcopy(self.stage_errors),
                 "algorithm_progress": self.algorithm_progress.snapshot(live=live),
                 "algorithm_progress": self.algorithm_progress.snapshot(live=live),
                 "uefi_files": copy.deepcopy(list(self.uefi_files.values())),
                 "uefi_files": copy.deepcopy(list(self.uefi_files.values())),
                 "uefi_filesystems": copy.deepcopy(list(self.uefi_filesystems.values())),
                 "uefi_filesystems": copy.deepcopy(list(self.uefi_filesystems.values())),

+ 56 - 2
src/stl_backend/parsers.py

@@ -128,6 +128,7 @@ class IncrementalSolParser:
         self._uip_stages: dict[int, int] = {}
         self._uip_stages: dict[int, int] = {}
         self._amemdiag_algo_counts: dict[int, int] = {}
         self._amemdiag_algo_counts: dict[int, int] = {}
         self._previous_amt_error_line: int | None = None
         self._previous_amt_error_line: int | None = None
+        self._previous_mt_ecc_line: int | None = None
         self._uefi_directory = ""
         self._uefi_directory = ""
         self._dimm_table_cpu = None
         self._dimm_table_cpu = None
 
 
@@ -352,6 +353,8 @@ class IncrementalSolParser:
             self._active_amt_cpus.clear()
             self._active_amt_cpus.clear()
             self._uip_stages.clear()
             self._uip_stages.clear()
             self._amemdiag_algo_counts.clear()
             self._amemdiag_algo_counts.clear()
+            self._previous_amt_error_line = None
+            self._previous_mt_ecc_line = None
             self._uefi_directory = ""
             self._uefi_directory = ""
             self._dimm_table_cpu = None
             self._dimm_table_cpu = None
             emit("stage", "System BIOS boot banner observed", {"state": "initializing",
             emit("stage", "System BIOS boot banner observed", {"state": "initializing",
@@ -554,12 +557,39 @@ class IncrementalSolParser:
                        "reason": m[3] or "", "test_failure": False,
                        "reason": m[3] or "", "test_failure": False,
                        "evidence_type": "explicit_dimm_state"}
                        "evidence_type": "explicit_dimm_state"}
             emit("training_dimm", "Firmware DIMM enable state", details, phase="bios_training")
             emit("training_dimm", "Firmware DIMM enable state", details, phase="bios_training")
+        m = re.fullmatch(r"(N\d+\.C\d+\.D\d+):\s*FPT:\s*(DisableDIMM\(\)|MapOutDimm\(\)(?:\s*-\s*.*)?)", line, re.I)
+        if m:
+            emit("training_dimm", "Firmware DIMM enable state", {
+                **_location(m[1].upper()), "state": "disabled", "reason": m[2].strip(),
+                "test_failure": False, "evidence_type": "fpt_disable_dimm"}, phase="bios_training")
+        m = re.fullmatch(r"(N\d+\.C\d+\.D\d+):\s*(Mapping out DDR)", line, re.I)
+        if m:
+            emit("training_dimm", "Firmware DIMM enable state", {
+                **_location(m[1].upper()), "state": "disabled", "reason": m[2].strip(),
+                "test_failure": False, "evidence_type": "fpt_map_out_dimm"}, phase="bios_training")
+        m = re.fullmatch(r"\[HD_DisableDimm\]\s*(N\d+\.C\d+\.D\d+)(?::\s*(\S+))?", line, re.I)
+        if m:
+            details = {**_location(m[1].upper()), "state": "disabled", "reason": "HD_DisableDimm",
+                       "test_failure": False, "evidence_type": "hd_disable_dimm"}
+            if m[2]:
+                details["sn"] = m[2].strip()
+            emit("training_dimm", "Firmware DIMM enable state", details, phase="bios_training")
         m = re.fullmatch(r"(N\d+\.C\d+):\s*(?:Channel\s+)?(?:is\s+|status\s*[:=]\s*)?"
         m = re.fullmatch(r"(N\d+\.C\d+):\s*(?:Channel\s+)?(?:is\s+|status\s*[:=]\s*)?"
                          r"(enabled|disabled)(?:\s*[:;,(\-]\s*(.*))?", line, re.I)
                          r"(enabled|disabled)(?:\s*[:;,(\-]\s*(.*))?", line, re.I)
         if m:
         if m:
             emit("training_channel", "Firmware channel enable state", {
             emit("training_channel", "Firmware channel enable state", {
                 **_location(m[1].upper()), "state": m[2].lower(), "reason": m[3] or "",
                 **_location(m[1].upper()), "state": m[2].lower(), "reason": m[3] or "",
                 "test_failure": False, "evidence_type": "explicit_channel_state"}, phase="bios_training")
                 "test_failure": False, "evidence_type": "explicit_channel_state"}, phase="bios_training")
+        m = re.fullmatch(r"(N\d+\.C\d+(?:\.D\d+)?(?:\.SC\d+)?(?:\.R\d+)?(?:\.\S+)?):\s*Error:\s*(.+?,\s*disable channel)", line, re.I)
+        if m:
+            emit("training_channel", "Firmware channel enable state", {
+                **_location(m[1].upper()), "state": "disabled", "reason": m[2].strip(),
+                "test_failure": False, "evidence_type": "mrc_disable_channel"}, phase="bios_training")
+        m = re.fullmatch(r"\[BIOS\]\[FailMode\]\s*(N\d+\.C\d+(?:\.D\d+)?(?:\.\S+)?):\s*(.+)", line, re.I)
+        if m:
+            emit("diagnostic", "BIOS training fail mode", {
+                **_location(m[1].upper()), "code": "bios_fail_mode", "fail_mode": m[2].strip(),
+                "test_failure": False}, "warning", phase="bios_training")
 
 
         m = _TRAINING.search(line)
         m = _TRAINING.search(line)
         if m:
         if m:
@@ -830,7 +860,15 @@ class IncrementalSolParser:
                     "error" if err_cnt > 0 else "info", phase="mt")
                     "error" if err_cnt > 0 else "info", phase="mt")
         if "[MEM ERROR" in line or "[ECC Errors]" in line:
         if "[MEM ERROR" in line or "[ECC Errors]" in line:
             self.phase = "mt"
             self.phase = "mt"
-            details = {"error_type": "ecc" if "ECC" in line else "memory_compare", "test_failure": True}
+            is_coord_continuation = (
+                "(Chan,Slot,Rank,Bank,Row,Col):" in line
+                and self._previous_mt_ecc_line is not None
+                and number - self._previous_mt_ecc_line <= 2
+            )
+            details = {
+                "error_type": "ecc" if "ECC" in line else "memory_compare",
+                "test_failure": not is_coord_continuation,
+            }
             for pattern, key in ((r"Test:\s*(\d+)", "test_id"), (r"Address:\s*(?:0x)?([0-9A-Fa-f]+)", "address_hex"),
             for pattern, key in ((r"Test:\s*(\d+)", "test_id"), (r"Address:\s*(?:0x)?([0-9A-Fa-f]+)", "address_hex"),
                                  (r"ECC Corrected:\s*(yes|no)", "corrected"), (r"Syndrome:\s*([^,]+)", "syndrome")):
                                  (r"ECC Corrected:\s*(yes|no)", "corrected"), (r"Syndrome:\s*([^,]+)", "syndrome")):
                 found = re.search(pattern, line, re.I)
                 found = re.search(pattern, line, re.I)
@@ -841,10 +879,18 @@ class IncrementalSolParser:
                     if key == "address_hex": value = "0x" + value.upper()
                     if key == "address_hex": value = "0x" + value.upper()
                     details[key] = value
                     details[key] = value
             m = re.search(r"Channel(?:/|-|\s)Slot:\s*N(\d+)-(\d+)-(\d+)", line, re.I)
             m = re.search(r"Channel(?:/|-|\s)Slot:\s*N(\d+)-(\d+)-(\d+)", line, re.I)
+            if not m:
+                m = re.search(r"\(P(\d+),C(\d+),S(\d+),R\d+\)", line, re.I)
             if m:
             if m:
                 details.update(cpu=int(m[1]), channel=int(m[2]), dimm=int(m[3]),
                 details.update(cpu=int(m[1]), channel=int(m[2]), dimm=int(m[3]),
                                location=f"N{m[1]}.C{int(m[2]):02d}.D{m[3]}")
                                location=f"N{m[1]}.C{int(m[2]):02d}.D{m[3]}")
-            emit("error", "MemTest86 memory error", details, "error")
+            if "(P package,C channel,S slot,R rank):" in line:
+                self._previous_mt_ecc_line = number
+            if is_coord_continuation:
+                details["parent_line_no"] = self._previous_mt_ecc_line
+                emit("error_detail", "MemTest86 ECC coordinate detail", details, "info", phase="mt")
+            else:
+                emit("error", "MemTest86 memory error", details, "error")
 
 
         # Match explicit result fields, not generic 'passed', MP startup self-test,
         # Match explicit result fields, not generic 'passed', MP startup self-test,
         # '0 errors', 'memory latency - test completed', CSS or menu choices.
         # '0 errors', 'memory latency - test completed', CSS or menu choices.
@@ -865,6 +911,14 @@ class IncrementalSolParser:
             if m[1] is not None:
             if m[1] is not None:
                 details_fatal["cpu"] = int(m[1])
                 details_fatal["cpu"] = int(m[1])
             emit("error", "BIOS fatal error", details_fatal, "error")
             emit("error", "BIOS fatal error", details_fatal, "error")
+        m = re.search(r"!{3,}\s*X64 Exception Type\s*-\s*([^\r\n!]+?)\s*!{3,}", line, re.I)
+        if m:
+            details_exc: dict[str, Any] = {"exception": m[1].strip(), "test_failure": True,
+                                           "execution_error": True, "error_type": "uefi_exception"}
+            apic = re.search(r"CPU Apic ID\s*-\s*([0-9A-Fa-f]+)", m[1], re.I)
+            if apic:
+                details_exc["apic_id"] = apic[1]
+            emit("error", "UEFI X64 exception", details_exc, "error")
 
 
         m = re.fullmatch(r"Major Warning Code = (0x[0-9A-Fa-f]+), Minor Warning Code = (0x[0-9A-Fa-f]+),?", line)
         m = re.fullmatch(r"Major Warning Code = (0x[0-9A-Fa-f]+), Minor Warning Code = (0x[0-9A-Fa-f]+),?", line)
         if m:
         if m:

+ 3 - 1
src/stl_backend/web/stage-progress.js

@@ -31,11 +31,13 @@
     $('boot-current').textContent = main.id && main.id !== 'unknown' ? `${live ? '本轮已推进到' : '最后推进到'}:${mainLabel(progress)}` : '等待当前启动的阶段证据';
     $('boot-current').textContent = main.id && main.id !== 'unknown' ? `${live ? '本轮已推进到' : '最后推进到'}:${mainLabel(progress)}` : '等待当前启动的阶段证据';
     const container = $('boot-stages');
     const container = $('boot-stages');
     Object.assign(container.dataset, {source:station.run_id ? 'run' : 'diagnostic',runId:station.run_id || '',context:live ? 'current' : 'historical_session',bootId:progress.boot_id || '',mainPhase:main.id || 'unknown'});
     Object.assign(container.dataset, {source:station.run_id ? 'run' : 'diagnostic',runId:station.run_id || '',context:live ? 'current' : 'historical_session',bootId:progress.boot_id || '',mainPhase:main.id || 'unknown'});
+    const stageErrors = firmware.stage_errors || {};
     container.innerHTML = stages.map(row => {
     container.innerHTML = stages.map(row => {
       const observed = row.state !== 'unobserved', current = row.state === 'current';
       const observed = row.state !== 'unobserved', current = row.state === 'current';
       const status = current ? live ? '已到此阶段' : '最后到达' : observed ? '已观测' : '未观测';
       const status = current ? live ? '已到此阶段' : '最后到达' : observed ? '已观测' : '未观测';
       const details = count(row.step_count) ? `${count(row.step_count)} 个步骤 · 结束 ${count(row.completed_count)}` : '尚无步骤记录';
       const details = count(row.step_count) ? `${count(row.step_count)} 个步骤 · 结束 ${count(row.completed_count)}` : '尚无步骤记录';
-      const issues = count(row.failed_count) ? ` · 异常 ${count(row.failed_count)}` : '';
+      const errRecords = list(stageErrors[row.id]).length;
+      const issues = (count(row.failed_count) || errRecords) ? ` · 异常 ${Math.max(count(row.failed_count), errRecords)}` : '';
       return `<div class="boot-stage ${observed ? 'observed' : ''} ${current && live ? 'current' : ''}" data-phase="${esc(row.id)}" data-stage-state="${esc(row.state)}"><div class="boot-stage-name">${esc(row.label || row.id)}<span class="boot-stage-state">${status}</span></div><div class="boot-stage-time">${details}${issues}</div></div>`;
       return `<div class="boot-stage ${observed ? 'observed' : ''} ${current && live ? 'current' : ''}" data-phase="${esc(row.id)}" data-stage-state="${esc(row.state)}"><div class="boot-stage-name">${esc(row.label || row.id)}<span class="boot-stage-state">${status}</span></div><div class="boot-stage-time">${details}${issues}</div></div>`;
     }).join('') || '<p class="stage-empty">等待后端阶段数据。</p>';
     }).join('') || '<p class="stage-empty">等待后端阶段数据。</p>';
     const plan = control.boot_execution || {};
     const plan = control.boot_execution || {};

+ 39 - 0
tests/test_firmware_control.py

@@ -358,3 +358,42 @@ def test_uip_continuation_is_not_a_new_prompt_and_post_stage_is_observed():
     assert result["console_prompt"]["kind"] == "uefi"
     assert result["console_prompt"]["kind"] == "uefi"
     result = feed("\n[SYS_BIOS]Version:TEST, Release Date:10/26/2026, Vendor: AMI\n")
     result = feed("\n[SYS_BIOS]Version:TEST, Release Date:10/26/2026, Vendor: AMI\n")
     assert result["console_prompt"] == {}
     assert result["console_prompt"] == {}
+
+
+def test_real_gnr_bios_training_disable_and_mt_ecc_continuation_parsing():
+    parser, view = IncrementalSolParser(), FirmwareObservation()
+    raw = (
+        "N1.C06.D0: FPT: DisableDIMM()\n"
+        "N1.C02.D0: FPT: MapOutDimm() - reason 0x2\n"
+        "N1.C02.D0: Mapping out DDR\n"
+        "[HD_DisableDimm]N1.C6.D0:8BD601263250100055\n"
+        "[HD_DisableDIMM]N0.C3.D0:8BD601263250100055\n"
+        "N1.C06.D0.SC1.R0.S01: Error: Signal QCS0_B_n Best Eye Width   0 is smaller than minimum critical margin  20, disable channel\n"
+        "[BIOS][FailMode]N1.C5.D0.SC0.R0.Bit22: EW=0 is Small\n"
+        "[1] AMEMDIAG Test Start\n"
+        "N1.C00.D0.R0: Failure detected - Advanced Memtest Type 10, Checkpoint 0x80000015\n"
+        "2026-08-30 13:51:52 - [MEM ERROR - ECC Errors] Test: 6, (P package,C channel,S slot,R rank): (P1,C1,S0,R0), ECC Corrected: yes, Syndrome: 0x0, Channel/Slot: N1-1-0\n"
+        "2026-08-30 13:51:52 - [MEM ERROR - ECC Errors] Test: 6, (Chan,Slot,Rank,Bank,Row,Col): (1,0,N/A,N/A,N/A,N/A), ECC Corrected: yes, Syndrome: N/A, Channel/Slot: 1-0\n"
+        "!!!! X64 Exception Type - 12(#MC - Machine-Check)  CPU Apic ID - 00000001 !!!!\n"
+    )
+    events = parser.feed(raw.encode())
+    for idx, ev in enumerate(events):
+        view.observe(ev, 1000 + idx)
+    snap = view.snapshot()
+    dimms = {(d["cpu"], d["channel"], d["dimm"]): d for d in snap["training_dimms"]}
+    assert dimms[(1, 6, 0)]["training_state"] == "disabled"
+    assert dimms[(1, 6, 0)]["sn"] == "8BD601263250100055"
+    assert dimms[(1, 2, 0)]["training_state"] == "disabled"
+    assert dimms[(0, 3, 0)]["training_state"] == "disabled"
+    chans = {(c["cpu"], c["channel"]): c for c in snap["training_channels"]}
+    assert chans[(1, 6)]["state"] == "disabled"
+    mt_errors = [e for e in events if e["phase"] == "mt" and e["kind"] == "error"]
+    mt_details = [e for e in events if e["phase"] == "mt" and e["kind"] == "error_detail"]
+    assert len(mt_errors) == 2  # 1 MemTest86 ECC error + 1 X64 Exception
+    assert mt_errors[0]["details"]["cpu"] == 1
+    assert mt_errors[0]["details"]["channel"] == 1
+    assert len(mt_details) == 1
+    assert mt_details[0]["details"]["test_failure"] is False
+    assert len(snap["stage_errors"]["training"]) >= 5
+    assert len(snap["stage_errors"]["amt"]) == 1
+    assert len(snap["stage_errors"]["mt"]) == 2