Guard SDK sim-config staging paths
This commit is contained in:
64
text7.txt
64
text7.txt
@@ -1822,3 +1822,67 @@ semantics。
|
||||
```bash
|
||||
git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d
|
||||
```
|
||||
|
||||
三十一、2026-06-13 继续执行记录:SDK sim-config staging path guard
|
||||
|
||||
1. 本批目标。
|
||||
|
||||
继续 staged path guard inventory 第二十六轮,处理 SDK sim-config staging plan 在 Node
|
||||
inventory 与 browser smoke 边界的 path map:
|
||||
|
||||
```text
|
||||
planSimConfigStaging(...)
|
||||
simMachine(...)
|
||||
loadSimMachineFiles(...)
|
||||
```
|
||||
|
||||
2. 已完成改动。
|
||||
|
||||
- Node sim-config inventory 新增 `assertSimConfigStagingPlan(...)`;
|
||||
- Node `simMachine(...)` 将 `/work/sim-inventory/<machineRel>` 收敛为 expected root 并
|
||||
检查 `plan.wasmDir`、`iniPath`、`programPath`、`file.path === file.wasmPath`、source
|
||||
root 和 duplicate staged path;
|
||||
- browser smoke 新增同名 `assertSimConfigStagingPlan(...)`;
|
||||
- browser `loadSimMachineFiles(...)` 将 `/work/browser-sim/<machineRel>` 收敛为 expected
|
||||
root 并同步检查 `plan.wasmDir`、`iniPath`、`programPath`、`file.path === file.wasmPath`、
|
||||
source root 和 duplicate staged path;
|
||||
- 未修改 SDK planner、interpreter、INI、tool、parameter、OPFS bridge 或 LinuxCNC-owned
|
||||
runtime semantics。
|
||||
|
||||
涉及文件:
|
||||
|
||||
```text
|
||||
wasm-port/tests/wasm/node/verify_sim_configs_inventory_wasm.mjs
|
||||
wasm-port/tests/browser/interp_smoke.html
|
||||
```
|
||||
|
||||
3. 已完成验证。
|
||||
|
||||
```bash
|
||||
git diff --check
|
||||
SKIP_INTERP_BUILD=1 wasm-port/tests/wasm/node/verify_sim_configs_inventory_wasm.sh
|
||||
SKIP_INI_BUILD=1 SKIP_INTERP_BUILD=1 wasm-port/tests/browser/verify_interp_browser.sh
|
||||
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_interp_wasm.sh
|
||||
wasm-port/tests/host/verify_host_smokes.sh
|
||||
```
|
||||
|
||||
提交建议:
|
||||
|
||||
```text
|
||||
Guard SDK sim-config staging paths
|
||||
```
|
||||
|
||||
4. 下一步工作建议。
|
||||
|
||||
继续 staged path guard inventory 第二十七轮,优先扫描 browser OPFS smoke 中仍以
|
||||
inline string 形式散落的 `opfs_*_staging` 断言,挑选 machine text/session/default-path
|
||||
相关的小批次收敛为专用 helper;仍只加 browser/OPFS/SDK boundary guard,不改变
|
||||
LinuxCNC-owned interpreter、INI、tool、parameter 或 runtime semantics。
|
||||
|
||||
下一轮第一条命令仍保持:
|
||||
|
||||
```bash
|
||||
git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d
|
||||
```
|
||||
|
||||
@@ -4511,18 +4511,49 @@
|
||||
generatedToolTablePath(toolTable.wasmPath, expectedWasmPath);
|
||||
}
|
||||
|
||||
function assertSimConfigStagingPlan(machineRel, plan, expectedWasmDir) {
|
||||
if (plan.wasmDir !== expectedWasmDir) {
|
||||
throw new Error(`${machineRel}: browser sim staging root drift`);
|
||||
}
|
||||
if (!plan.iniPath.startsWith(`${expectedWasmDir}/`)) {
|
||||
throw new Error(`${machineRel}: browser sim INI staging path drift`);
|
||||
}
|
||||
if (plan.programPath !== null && !plan.programPath.startsWith(`${expectedWasmDir}/`)) {
|
||||
throw new Error(`${machineRel}: browser sim program staging path drift`);
|
||||
}
|
||||
|
||||
const paths = [];
|
||||
for (const file of plan.files) {
|
||||
if (file.path !== file.wasmPath) {
|
||||
throw new Error(`${file.sourceRel}: browser sim path/wasmPath drift`);
|
||||
}
|
||||
if (!file.wasmPath.startsWith(`${expectedWasmDir}/`)) {
|
||||
throw new Error(`${file.sourceRel}: browser sim file staging root drift`);
|
||||
}
|
||||
if (!file.sourceRel.startsWith("configs/sim/")) {
|
||||
throw new Error(`${file.sourceRel}: browser sim source root drift`);
|
||||
}
|
||||
if (paths.includes(file.wasmPath)) {
|
||||
throw new Error(`${machineRel}: duplicate browser sim staging path ${file.wasmPath}`);
|
||||
}
|
||||
paths.push(file.wasmPath);
|
||||
}
|
||||
}
|
||||
|
||||
async function loadSimMachineFiles(machineRel, iniFile, programFile = null) {
|
||||
const iniText = await fetchText(
|
||||
`../../vendor/linuxcnc/configs/sim/${machineRel}/${iniFile}`,
|
||||
);
|
||||
const expectedWasmDir = `/work/browser-sim/${machineRel}`;
|
||||
const plan = planSimConfigStaging({
|
||||
manifestText: await fetchText("../../tools/source-manifest.txt"),
|
||||
machineRel,
|
||||
iniFile,
|
||||
iniText,
|
||||
programFile,
|
||||
wasmDir: `/work/browser-sim/${machineRel}`,
|
||||
wasmDir: expectedWasmDir,
|
||||
});
|
||||
assertSimConfigStagingPlan(machineRel, plan, expectedWasmDir);
|
||||
|
||||
return {
|
||||
...plan,
|
||||
|
||||
@@ -187,14 +187,16 @@ function simMachine(machineRel, iniFile, programFile, nativeToolTableRel) {
|
||||
resolve(vendorRoot, `configs/sim/${machineRel}/${iniFile}`),
|
||||
"utf8",
|
||||
);
|
||||
const expectedWasmDir = `/work/sim-inventory/${machineRel}`;
|
||||
const plan = planSimConfigStaging({
|
||||
manifestText,
|
||||
machineRel,
|
||||
iniFile,
|
||||
iniText,
|
||||
programFile,
|
||||
wasmDir: `/work/sim-inventory/${machineRel}`,
|
||||
wasmDir: expectedWasmDir,
|
||||
});
|
||||
assertSimConfigStagingPlan(machineRel, plan, expectedWasmDir);
|
||||
const machine = {
|
||||
...plan,
|
||||
files: plan.files.map((file) => ({
|
||||
@@ -207,6 +209,40 @@ function simMachine(machineRel, iniFile, programFile, nativeToolTableRel) {
|
||||
return withNativeToolTableFallback(machine, iniText, nativeToolTableRel);
|
||||
}
|
||||
|
||||
function assertSimConfigStagingPlan(machineRel, plan, expectedWasmDir) {
|
||||
assert.equal(plan.wasmDir, expectedWasmDir, `${machineRel}: sim staging root drift`);
|
||||
assert.ok(
|
||||
plan.iniPath.startsWith(`${expectedWasmDir}/`),
|
||||
`${machineRel}: sim INI staging path drift`,
|
||||
);
|
||||
if (plan.programPath !== null) {
|
||||
assert.ok(
|
||||
plan.programPath.startsWith(`${expectedWasmDir}/`),
|
||||
`${machineRel}: sim program staging path drift`,
|
||||
);
|
||||
}
|
||||
|
||||
const paths = [];
|
||||
for (const file of plan.files) {
|
||||
assert.equal(file.path, file.wasmPath, `${file.sourceRel}: path/wasmPath drift`);
|
||||
assert.ok(
|
||||
file.wasmPath.startsWith(`${expectedWasmDir}/`),
|
||||
`${file.sourceRel}: sim file staging root drift`,
|
||||
);
|
||||
assert.ok(
|
||||
file.sourceRel.startsWith("configs/sim/"),
|
||||
`${file.sourceRel}: sim source root drift`,
|
||||
);
|
||||
paths.push(file.wasmPath);
|
||||
}
|
||||
|
||||
assert.deepEqual(
|
||||
paths.filter((path, index) => paths.indexOf(path) !== index),
|
||||
[],
|
||||
`${machineRel}: duplicate sim staging paths`,
|
||||
);
|
||||
}
|
||||
|
||||
function firstIniValue(iniText, section, key) {
|
||||
let activeSection = "";
|
||||
for (const rawLine of iniText.split("\n")) {
|
||||
|
||||
Reference in New Issue
Block a user