Guard restore-parameter negative staging
This commit is contained in:
66
text7.txt
66
text7.txt
@@ -955,3 +955,69 @@ filesystem staging guard,不改变 parameter runtime semantics。
|
||||
```bash
|
||||
git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d
|
||||
```
|
||||
|
||||
十八、2026-06-13 继续执行记录:restore-parameter negative staging guard
|
||||
|
||||
1. 本批目标。
|
||||
|
||||
继续 staged path guard inventory 第十三轮,处理 Node/browser 成对覆盖的
|
||||
restore-parameter negative fixture paths:
|
||||
|
||||
```text
|
||||
missing.var
|
||||
out-of-order.var
|
||||
missing-required.var
|
||||
```
|
||||
|
||||
2. 已完成改动。
|
||||
|
||||
- Node 侧新增 `generatedParameterPath(...)`;
|
||||
- Node 侧新增 `writeGeneratedParameterFixture(...)`;
|
||||
- browser 侧新增 `generatedParameterPath(...)`;
|
||||
- browser 侧新增 `writeGeneratedParameterFixture(...)`;
|
||||
- missing-file、out-of-order、missing-required 三类 restore-parameter path 均增加
|
||||
explicit path parity guard;
|
||||
- 未修改 generated parameter fixture 内容、expected output 或 parameter runtime
|
||||
semantics。
|
||||
|
||||
涉及文件:
|
||||
|
||||
```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 restore-parameter negative staging
|
||||
```
|
||||
|
||||
5. 下一步工作建议。
|
||||
|
||||
继续 staged path guard inventory 第十四轮,优先扫描剩余 direct generated staging
|
||||
点;可选择普通 restore-parameter direct fixture 或 tool-table direct fixture,但仍需
|
||||
只加 filesystem path guard,不改变 parameter/tool table runtime semantics。
|
||||
|
||||
下一轮第一条命令仍保持:
|
||||
|
||||
```bash
|
||||
git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d
|
||||
```
|
||||
|
||||
@@ -4446,6 +4446,19 @@
|
||||
return { disabledIniPath, iniPath, parameterPath, programPath };
|
||||
}
|
||||
|
||||
function generatedParameterPath(wasmPath, expectedWasmPath) {
|
||||
if (wasmPath !== expectedWasmPath) {
|
||||
throw new Error(`browser_parameter_fixture_${expectedWasmPath}_staging: path drift`);
|
||||
}
|
||||
return wasmPath;
|
||||
}
|
||||
|
||||
function writeGeneratedParameterFixture(interp, wasmPath, expectedWasmPath, text) {
|
||||
const checkedPath = generatedParameterPath(wasmPath, expectedWasmPath);
|
||||
interp.writeTextFile(checkedPath, text);
|
||||
return checkedPath;
|
||||
}
|
||||
|
||||
async function loadSimMachineFiles(machineRel, iniFile, programFile = null) {
|
||||
const iniText = await fetchText(
|
||||
`../../vendor/linuxcnc/configs/sim/${machineRel}/${iniFile}`,
|
||||
@@ -8718,11 +8731,17 @@
|
||||
|
||||
verifyExpectedOutput(
|
||||
"restore_parameters_missing_file",
|
||||
interp.restoreParameters("/work/browser-missing.var"),
|
||||
interp.restoreParameters(
|
||||
generatedParameterPath("/work/browser-missing.var", "/work/browser-missing.var"),
|
||||
),
|
||||
"restore_parameters=0",
|
||||
);
|
||||
const outOfOrderParameterFilePath = "/work/browser-out-of-order.var";
|
||||
interp.writeTextFile(outOfOrderParameterFilePath, "5220 1\n5161 2\n");
|
||||
const outOfOrderParameterFilePath = writeGeneratedParameterFixture(
|
||||
interp,
|
||||
"/work/browser-out-of-order.var",
|
||||
"/work/browser-out-of-order.var",
|
||||
"5220 1\n5161 2\n",
|
||||
);
|
||||
verifyExpectedOutput(
|
||||
"restore_parameters_out_of_order",
|
||||
interp.restoreParameters(outOfOrderParameterFilePath),
|
||||
@@ -8732,8 +8751,12 @@
|
||||
].join("\n"),
|
||||
);
|
||||
|
||||
const missingRequiredParameterFilePath = "/work/browser-missing-required.var";
|
||||
interp.writeTextFile(missingRequiredParameterFilePath, "5161 3.5\n5220 1\n");
|
||||
const missingRequiredParameterFilePath = writeGeneratedParameterFixture(
|
||||
interp,
|
||||
"/work/browser-missing-required.var",
|
||||
"/work/browser-missing-required.var",
|
||||
"5161 3.5\n5220 1\n",
|
||||
);
|
||||
verifyExpectedOutput(
|
||||
"restore_parameters_missing_required",
|
||||
interp.restoreParameters(missingRequiredParameterFilePath),
|
||||
|
||||
@@ -208,6 +208,17 @@ function writeG92PersistenceStaging(wasmDir, expectedWasmDir, targetInterp = int
|
||||
return { disabledIniPath, iniPath, parameterPath, programPath };
|
||||
}
|
||||
|
||||
function generatedParameterPath(wasmPath, expectedWasmPath) {
|
||||
assert.equal(wasmPath, expectedWasmPath, `parameter fixture ${expectedWasmPath} staging path drift`);
|
||||
return wasmPath;
|
||||
}
|
||||
|
||||
function writeGeneratedParameterFixture(wasmPath, expectedWasmPath, text, targetInterp = interp) {
|
||||
const checkedPath = generatedParameterPath(wasmPath, expectedWasmPath);
|
||||
targetInterp.writeTextFile(checkedPath, text);
|
||||
return checkedPath;
|
||||
}
|
||||
|
||||
function stageInterpIniContext(name, programFile = "test.ngc") {
|
||||
const sourceRootRel = `tests/interp/${name}`;
|
||||
const iniText = readFileSync(
|
||||
@@ -3724,12 +3735,15 @@ verifyExpectedOutput(
|
||||
);
|
||||
verifyExpectedOutput(
|
||||
"restore_parameters_missing_file",
|
||||
interp.restoreParameters("/work/missing.var"),
|
||||
interp.restoreParameters(generatedParameterPath("/work/missing.var", "/work/missing.var")),
|
||||
"restore_parameters=0",
|
||||
);
|
||||
|
||||
const outOfOrderParameterFilePath = "/work/out-of-order.var";
|
||||
interp.writeTextFile(outOfOrderParameterFilePath, "5220 1\n5161 2\n");
|
||||
const outOfOrderParameterFilePath = writeGeneratedParameterFixture(
|
||||
"/work/out-of-order.var",
|
||||
"/work/out-of-order.var",
|
||||
"5220 1\n5161 2\n",
|
||||
);
|
||||
verifyExpectedOutput(
|
||||
"restore_parameters_out_of_order",
|
||||
interp.restoreParameters(outOfOrderParameterFilePath),
|
||||
@@ -3739,8 +3753,11 @@ verifyExpectedOutput(
|
||||
].join("\n"),
|
||||
);
|
||||
|
||||
const missingRequiredParameterFilePath = "/work/missing-required.var";
|
||||
interp.writeTextFile(missingRequiredParameterFilePath, "5161 3.5\n5220 1\n");
|
||||
const missingRequiredParameterFilePath = writeGeneratedParameterFixture(
|
||||
"/work/missing-required.var",
|
||||
"/work/missing-required.var",
|
||||
"5161 3.5\n5220 1\n",
|
||||
);
|
||||
verifyExpectedOutput(
|
||||
"restore_parameters_missing_required",
|
||||
interp.restoreParameters(missingRequiredParameterFilePath),
|
||||
|
||||
Reference in New Issue
Block a user