推进 INI 面板 G-code 回退来源 guard

This commit is contained in:
2026-06-14 15:39:18 +08:00
parent f204b7f113
commit a158f66071
3 changed files with 85 additions and 1 deletions

View File

@@ -379,6 +379,24 @@ TOOL_TABLE = browser-tool.tbl
() => uiDocument.getElementById("log")?.textContent.includes("Saved machine text files"),
"machine file save",
);
uiDocument.getElementById("load-session").click();
await waitFor(
() => uiDocument.getElementById("log")?.textContent.includes("Loaded machine session"),
"fallback machine session load",
);
uiDocument.getElementById("run-gcode").click();
await waitFor(
() => uiDocument.getElementById("log")?.textContent.includes("Ran G-code"),
"fallback G-code run",
);
const fallbackRunLog = uiDocument.getElementById("log").textContent;
if (
!fallbackRunLog.includes("Program: linuxcnc/gcode/ui-session.ngc -> /work/ui-session.ngc") ||
!fallbackRunLog.includes("Program source: default") ||
!fallbackRunLog.includes("canon_event=STRAIGHT_FEED")
) {
throw new Error(`UI fallback G-code run did not use default OPFS program path: ${fallbackRunLog}`);
}
uiDocument.getElementById("save-session-snapshot").click();
await waitFor(
() => uiDocument.getElementById("log")?.textContent.includes("Saved machine session snapshot"),
@@ -464,7 +482,10 @@ TOOL_TABLE = browser-tool.tbl
"UI G-code run status",
);
const runLog = uiDocument.getElementById("log").textContent;
if (!runLog.includes("Program: linuxcnc/gcode/ui-session.ngc -> /work/ui-session.ngc")) {
if (
!runLog.includes("Program: linuxcnc/gcode/ui-session.ngc -> /work/ui-session.ngc") ||
!runLog.includes("Program source: snapshot")
) {
throw new Error(`UI G-code run did not use snapshot OPFS program path: ${runLog}`);
}
if (