Guard G92 persistence staging

This commit is contained in:
2026-06-13 15:42:28 +08:00
parent e2615fb178
commit d5138c0953
3 changed files with 198 additions and 92 deletions

View File

@@ -824,3 +824,70 @@ table runtime state tests 和 blocked runtime promotion。
```bash
git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d
```
十六、2026-06-13 继续执行记录G92 persistence staging manifest guard
1. 本批目标。
继续 staged path guard inventory 第十一轮,处理 Node/browser 成对覆盖的
`g52/g92-persistence` 固定 staging directory
```text
test.ngc
startup.var
persist.ini
disabled.ini
```
2. 已完成改动。
- Node 侧新增 `writeG92PersistenceStaging(...)`
- browser 侧新增 `writeG92PersistenceStaging(...)`
- 四个 generated fixture 文件增加 fixed manifest、duplicate-free 和 root/path
parity guard
- enabled/disabled 两个 G92 persistence 验证均改为使用 helper 返回的 guarded path
- browser 侧仍不枚举目录;
- 未修改 generated fixture 内容、expected output、parameter semantics 或 interpreter
语义。
涉及文件:
```text
wasm-port/tests/wasm/node/verify_interp_wasm.mjs
wasm-port/tests/browser/interp_smoke.html
```
3. 已完成的目标验证。
```bash
git diff --check
SKIP_INTERP_BUILD=1 wasm-port/tests/wasm/node/verify_interp_wasm.sh
SKIP_INI_BUILD=1 SKIP_INTERP_BUILD=1 wasm-port/tests/browser/verify_interp_browser.sh
```
4. 本批剩余建议验证。
```bash
wasm-port/tools/verify_vendor_sync.sh
wasm-port/tools/verify_no_standalone_cnc_semantics.sh
SKIP_INTERP_BUILD=1 wasm-port/tests/wasm/node/verify_sim_configs_inventory_wasm.sh
wasm-port/tests/host/verify_host_smokes.sh
```
如果通过,提交建议:
```text
Guard G92 persistence staging
```
5. 下一步工作建议。
继续 staged path guard inventory 第十二轮,优先扫描剩余 generated/direct staging
点;可选候选包括 user-M helper staging 或 restore-parameter negative fixtures但继续
避开 parameter/tool table runtime state semantics 和 blocked runtime promotion。
下一轮第一条命令仍保持:
```bash
git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d
```

View File

@@ -4383,6 +4383,69 @@
};
}
function writeG92PersistenceStaging(interp, wasmDir, expectedWasmDir) {
if (wasmDir !== expectedWasmDir) {
throw new Error("browser_g92_persistence_staging_root: path drift");
}
const files = ["test.ngc", "startup.var", "persist.ini", "disabled.ini"];
if (files.length !== new Set(files).size) {
throw new Error("browser_g92_persistence_staging_manifest: list drift");
}
for (const file of files) {
if (`${wasmDir}/${file}` !== `${expectedWasmDir}/${file}`) {
throw new Error(`browser_g92_persistence_${file}_staging: path drift`);
}
}
const programPath = `${wasmDir}/test.ngc`;
const parameterPath = `${wasmDir}/startup.var`;
const iniPath = `${wasmDir}/persist.ini`;
const disabledIniPath = `${wasmDir}/disabled.ini`;
interp.writeTextFile(
programPath,
[
"(PRINT,Startup G92 params: #5210 #5211 #5212 #5213)",
"M30",
"",
].join("\n"),
);
interp.writeTextFile(
parameterPath,
[
"5210 1",
"5211 1.25",
"5212 2.5",
"5213 3.75",
"5220 1",
"",
].join("\n"),
);
interp.writeTextFile(
iniPath,
[
"[RS274NGC]",
"PARAMETER_FILE = startup.var",
"[TRAJ]",
"COORDINATES = X Y Z",
"",
].join("\n"),
);
interp.writeTextFile(
disabledIniPath,
[
"[RS274NGC]",
"PARAMETER_FILE = startup.var",
"DISABLE_G92_PERSISTENCE = 1",
"[TRAJ]",
"COORDINATES = X Y Z",
"",
].join("\n"),
);
return { disabledIniPath, iniPath, parameterPath, programPath };
}
async function loadSimMachineFiles(machineRel, iniFile, programFile = null) {
const iniText = await fetchText(
`../../vendor/linuxcnc/configs/sim/${machineRel}/${iniFile}`,
@@ -8633,62 +8696,22 @@
].join("\n"),
);
const g92PersistenceDir = "/work/browser-interp/g52/g92-persistence";
const g92PersistenceProgramPath = `${g92PersistenceDir}/test.ngc`;
const g92PersistenceParameterPath = `${g92PersistenceDir}/startup.var`;
const g92PersistenceIniPath = `${g92PersistenceDir}/persist.ini`;
const g92PersistenceDisabledIniPath = `${g92PersistenceDir}/disabled.ini`;
interp.writeTextFile(
g92PersistenceProgramPath,
[
"(PRINT,Startup G92 params: #5210 #5211 #5212 #5213)",
"M30",
"",
].join("\n"),
);
interp.writeTextFile(
g92PersistenceParameterPath,
[
"5210 1",
"5211 1.25",
"5212 2.5",
"5213 3.75",
"5220 1",
"",
].join("\n"),
);
interp.writeTextFile(
g92PersistenceIniPath,
[
"[RS274NGC]",
"PARAMETER_FILE = startup.var",
"[TRAJ]",
"COORDINATES = X Y Z",
"",
].join("\n"),
);
interp.writeTextFile(
g92PersistenceDisabledIniPath,
[
"[RS274NGC]",
"PARAMETER_FILE = startup.var",
"DISABLE_G92_PERSISTENCE = 1",
"[TRAJ]",
"COORDINATES = X Y Z",
"",
].join("\n"),
const g92Persistence = writeG92PersistenceStaging(
interp,
"/work/browser-interp/g52/g92-persistence",
"/work/browser-interp/g52/g92-persistence",
);
verifyExpectedOutput(
"browser_interp_g92_persistence_enabled",
runWithCapturedPrints(() =>
interp.runFileWithIni(g92PersistenceProgramPath, g92PersistenceIniPath),
interp.runFileWithIni(g92Persistence.programPath, g92Persistence.iniPath),
).prints,
"Startup G92 params: 1.000000 1.250000 2.500000 3.750000",
);
verifyExpectedOutput(
"browser_interp_g92_persistence_disabled",
runWithCapturedPrints(() =>
interp.runFileWithIni(g92PersistenceProgramPath, g92PersistenceDisabledIniPath),
interp.runFileWithIni(g92Persistence.programPath, g92Persistence.disabledIniPath),
).prints,
"Startup G92 params: 0.000000 0.000000 0.000000 0.000000",
);

View File

@@ -151,6 +151,63 @@ function writeIniToolTableFixtureStaging(wasmDir, expectedWasmDir, targetInterp
};
}
function writeG92PersistenceStaging(wasmDir, expectedWasmDir, targetInterp = interp) {
assert.equal(wasmDir, expectedWasmDir, "g92 persistence staging root drift");
const files = ["test.ngc", "startup.var", "persist.ini", "disabled.ini"];
assert.equal(new Set(files).size, files.length, "g92 persistence staging manifest duplicate");
for (const file of files) {
assert.equal(`${wasmDir}/${file}`, `${expectedWasmDir}/${file}`, `g92 persistence ${file} staging path drift`);
}
const programPath = `${wasmDir}/test.ngc`;
const parameterPath = `${wasmDir}/startup.var`;
const iniPath = `${wasmDir}/persist.ini`;
const disabledIniPath = `${wasmDir}/disabled.ini`;
targetInterp.writeTextFile(
programPath,
[
"(PRINT,Startup G92 params: #5210 #5211 #5212 #5213)",
"M30",
"",
].join("\n"),
);
targetInterp.writeTextFile(
parameterPath,
[
"5210 1",
"5211 1.25",
"5212 2.5",
"5213 3.75",
"5220 1",
"",
].join("\n"),
);
targetInterp.writeTextFile(
iniPath,
[
"[RS274NGC]",
"PARAMETER_FILE = startup.var",
"[TRAJ]",
"COORDINATES = X Y Z",
"",
].join("\n"),
);
targetInterp.writeTextFile(
disabledIniPath,
[
"[RS274NGC]",
"PARAMETER_FILE = startup.var",
"DISABLE_G92_PERSISTENCE = 1",
"[TRAJ]",
"COORDINATES = X Y Z",
"",
].join("\n"),
);
return { disabledIniPath, iniPath, parameterPath, programPath };
}
function stageInterpIniContext(name, programFile = "test.ngc") {
const sourceRootRel = `tests/interp/${name}`;
const iniText = readFileSync(
@@ -3578,62 +3635,21 @@ verifyExpectedOutput(
].join("\n"),
);
const g92PersistenceDir = "/work/interp/g52/g92-persistence";
const g92PersistenceProgramPath = `${g92PersistenceDir}/test.ngc`;
const g92PersistenceParameterPath = `${g92PersistenceDir}/startup.var`;
const g92PersistenceIniPath = `${g92PersistenceDir}/persist.ini`;
const g92PersistenceDisabledIniPath = `${g92PersistenceDir}/disabled.ini`;
interp.writeTextFile(
g92PersistenceProgramPath,
[
"(PRINT,Startup G92 params: #5210 #5211 #5212 #5213)",
"M30",
"",
].join("\n"),
);
interp.writeTextFile(
g92PersistenceParameterPath,
[
"5210 1",
"5211 1.25",
"5212 2.5",
"5213 3.75",
"5220 1",
"",
].join("\n"),
);
interp.writeTextFile(
g92PersistenceIniPath,
[
"[RS274NGC]",
"PARAMETER_FILE = startup.var",
"[TRAJ]",
"COORDINATES = X Y Z",
"",
].join("\n"),
);
interp.writeTextFile(
g92PersistenceDisabledIniPath,
[
"[RS274NGC]",
"PARAMETER_FILE = startup.var",
"DISABLE_G92_PERSISTENCE = 1",
"[TRAJ]",
"COORDINATES = X Y Z",
"",
].join("\n"),
const g92Persistence = writeG92PersistenceStaging(
"/work/interp/g52/g92-persistence",
"/work/interp/g52/g92-persistence",
);
verifyExpectedOutput(
"interp_g92_persistence_enabled_wasm",
runWithCapturedPrints(() =>
interp.runFileWithIni(g92PersistenceProgramPath, g92PersistenceIniPath),
interp.runFileWithIni(g92Persistence.programPath, g92Persistence.iniPath),
).prints,
"Startup G92 params: 1.000000 1.250000 2.500000 3.750000",
);
verifyExpectedOutput(
"interp_g92_persistence_disabled_wasm",
runWithCapturedPrints(() =>
interp.runFileWithIni(g92PersistenceProgramPath, g92PersistenceDisabledIniPath),
interp.runFileWithIni(g92Persistence.programPath, g92Persistence.disabledIniPath),
).prints,
"Startup G92 params: 0.000000 0.000000 0.000000 0.000000",
);