Guard local gcode fixture staging

This commit is contained in:
2026-06-13 14:48:25 +08:00
parent 0132cb34ee
commit dbf55e8230
3 changed files with 119 additions and 40 deletions

102
text7.txt
View File

@@ -236,6 +236,63 @@ Guard staged prefix stripping
git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d
``` ```
七、2026-06-13 继续执行记录staged prefix stripping guard
1. 本批目标。
按本文件第一候选批次继续 staged path guard inventory 第二轮,收敛 INI-context helper
内的 inline prefix strip
```text
assertInterpIniContextNgcStaging(...)
```
2. 已完成改动。
- Node 侧新增 `stripInterpIniContextStagingPrefix(...)`
- browser 侧新增 `stripInterpIniContextStagingPrefix(...)`
- 两侧均先检查 staged `wasmPath` 带有期望前缀,再用 `slice(...)` 取相对路径;
- 删除两侧 `file.wasmPath.replace(...)` 的静默前缀剥离;
- 保持 browser 不枚举目录;
- 未修改 INI、O-word、parameter、remap 或 interpreter 语义。
涉及文件:
```text
wasm-port/tests/wasm/node/verify_interp_wasm.mjs
wasm-port/tests/browser/interp_smoke.html
```
3. 本批建议验证。
```bash
git diff --check
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
SKIP_INI_BUILD=1 SKIP_INTERP_BUILD=1 wasm-port/tests/browser/verify_interp_browser.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 staged prefix stripping
```
4. 下一步工作建议。
继续 staged path guard inventory 第三轮,优先扫描剩余 `wasmPath` 字符串拼接、prefix
strip 或 helper 旁路点,只选择已有 Node/browser coverage 且不依赖 HAL/task/tool
DB/Python remap/user-M process 的小批次。
下一轮第一条命令仍保持:
```bash
git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d
```
八、2026-06-13 继续执行记录fiveaxis staging manifest guard 八、2026-06-13 继续执行记录fiveaxis staging manifest guard
1. 本批目标。 1. 本批目标。
@@ -302,41 +359,49 @@ Node/browser 成对覆盖、且可以用 fixed manifest 或 single-file staging
git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d git status --short && git log -5 --oneline && tail -n 120 text7.txt && awk '/^[一二三四五六七八九十百]+、/ {print}' text7.txt | sort | uniq -d
``` ```
、2026-06-13 继续执行记录:staged prefix stripping guard 、2026-06-13 继续执行记录:local gcode fixture staging guard
1. 本批目标。 1. 本批目标。
按本文件第一候选批次继续 staged path guard inventory 第轮,收敛 INI-context helper 继续 staged path guard inventory 第轮,优先处理已有 Node/browser 成对覆盖的 local
内的 inline prefix strip fixture direct `/work/...` 写入点
```text ```text
assertInterpIniContextNgcStaging(...) coordinate_offsets.ngc
position_params.ngc
``` ```
2. 已完成改动。 2. 已完成改动。
- Node 侧新增 `stripInterpIniContextStagingPrefix(...)` - 修正 `text7.txt` 中第七/第八条记录顺序,避免后续记录继续乱序
- browser 侧新增 `stripInterpIniContextStagingPrefix(...)` - Node 侧新增 `writeLocalGcodeFixture(...)`
- 两侧均先检查 staged `wasmPath` 带有期望前缀,再用 `slice(...)` 取相对路径 - browser 侧新增 `writeLocalGcodeFixture(...)`
- 删除两侧 `file.wasmPath.replace(...)` 的静默前缀剥离 - `coordinate_offsets` 和 `position_params` 两侧均改为 helper 写入
- 保持 browser 不枚举目录 - helper 显式检查 staged `wasmPath` 与期望路径一致
- 未修改 INI、O-word、parameter、remap 或 interpreter 语义。 - browser 侧仍不枚举目录;
- 未修改 G-code、canon expected、parameter、tool table 或 interpreter 语义。
涉及文件: 涉及文件:
```text ```text
text7.txt
wasm-port/tests/wasm/node/verify_interp_wasm.mjs wasm-port/tests/wasm/node/verify_interp_wasm.mjs
wasm-port/tests/browser/interp_smoke.html wasm-port/tests/browser/interp_smoke.html
``` ```
3. 本批建议验证。 3. 已完成的目标验证。
```bash ```bash
git diff --check git diff --check
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 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 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 SKIP_INTERP_BUILD=1 wasm-port/tests/wasm/node/verify_sim_configs_inventory_wasm.sh
wasm-port/tests/host/verify_host_smokes.sh wasm-port/tests/host/verify_host_smokes.sh
``` ```
@@ -344,14 +409,15 @@ wasm-port/tests/host/verify_host_smokes.sh
如果通过,提交建议: 如果通过,提交建议:
```text ```text
Guard staged prefix stripping Guard local gcode fixture staging
``` ```
4. 下一步工作建议。 5. 下一步工作建议。
继续 staged path guard inventory 第轮,优先扫描剩余 `wasmPath` 字符串拼接、prefix 继续 staged path guard inventory 第轮,优先处理 `runVendorNcFile(...)` /
strip 或 helper 旁路点,只选择已有 Node/browser coverage 且不依赖 HAL/task/tool `runVendorNcFileWithToolTable(...)` 这类 vendor `nc_files` direct/context helper
DB/Python remap/user-M process 的小批次。 增加 single-file root parity 和 context file manifest guard仍暂不碰 parameter/tool
table runtime state tests。
下一轮第一条命令仍保持: 下一轮第一条命令仍保持:

View File

@@ -4320,6 +4320,14 @@
} }
} }
async function writeLocalGcodeFixture(interp, fixtureName, wasmPath, expectedWasmPath) {
if (wasmPath !== expectedWasmPath) {
throw new Error(`browser_${fixtureName}_local_gcode_staging: path drift`);
}
interp.writeTextFile(wasmPath, await fetchText(`../fixtures/gcode/${fixtureName}.ngc`));
return wasmPath;
}
async function loadSimMachineFiles(machineRel, iniFile, programFile = null) { async function loadSimMachineFiles(machineRel, iniFile, programFile = null) {
const iniText = await fetchText( const iniText = await fetchText(
`../../vendor/linuxcnc/configs/sim/${machineRel}/${iniFile}`, `../../vendor/linuxcnc/configs/sim/${machineRel}/${iniFile}`,
@@ -5228,11 +5236,12 @@
spindleOrientOffsetExpectedText, spindleOrientOffsetExpectedText,
); );
const coordinateOffsetsText = await fetchText( const coordinateOffsetsPath = await writeLocalGcodeFixture(
`../fixtures/gcode/${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}.ngc`, interp,
INTERP_COORDINATE_OFFSETS_FILE_FIXTURE,
`/work/${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}.ngc`,
`/work/${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}.ngc`,
); );
const coordinateOffsetsPath = `/work/${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}.ngc`;
interp.writeTextFile(coordinateOffsetsPath, coordinateOffsetsText);
verifyExpectedOutput( verifyExpectedOutput(
`${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}_file`, `${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}_file`,
interp.runFile(coordinateOffsetsPath), interp.runFile(coordinateOffsetsPath),
@@ -5243,11 +5252,12 @@
).trimEnd(), ).trimEnd(),
); );
const positionParamsText = await fetchText( const positionParamsPath = await writeLocalGcodeFixture(
`../fixtures/gcode/${INTERP_POSITION_PARAMS_FILE_FIXTURE}.ngc`, interp,
INTERP_POSITION_PARAMS_FILE_FIXTURE,
`/work/${INTERP_POSITION_PARAMS_FILE_FIXTURE}.ngc`,
`/work/${INTERP_POSITION_PARAMS_FILE_FIXTURE}.ngc`,
); );
const positionParamsPath = `/work/${INTERP_POSITION_PARAMS_FILE_FIXTURE}.ngc`;
interp.writeTextFile(positionParamsPath, positionParamsText);
verifyExpectedOutput( verifyExpectedOutput(
`${INTERP_POSITION_PARAMS_FILE_FIXTURE}_file`, `${INTERP_POSITION_PARAMS_FILE_FIXTURE}_file`,
interp.runFile(positionParamsPath), interp.runFile(positionParamsPath),

View File

@@ -106,6 +106,15 @@ function writeVendorTextFile(sourcePath, wasmPath, targetInterp = interp) {
targetInterp.writeTextFile(wasmPath, readFileSync(sourcePath, "utf8")); targetInterp.writeTextFile(wasmPath, readFileSync(sourcePath, "utf8"));
} }
function writeLocalGcodeFixture(fixtureName, wasmPath, expectedWasmPath, targetInterp = interp) {
assert.equal(wasmPath, expectedWasmPath, `${fixtureName} local gcode staging path drift`);
targetInterp.writeTextFile(
wasmPath,
readFileSync(resolve(rootDir, `tests/fixtures/gcode/${fixtureName}.ngc`), "utf8"),
);
return wasmPath;
}
function stageInterpIniContext(name, programFile = "test.ngc") { function stageInterpIniContext(name, programFile = "test.ngc") {
const sourceRootRel = `tests/interp/${name}`; const sourceRootRel = `tests/interp/${name}`;
const iniText = readFileSync( const iniText = readFileSync(
@@ -767,13 +776,10 @@ verifyExpectedOutput(
].join("\n"), ].join("\n"),
); );
const coordinateOffsetsFilePath = `/work/${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}.ngc`; const coordinateOffsetsFilePath = writeLocalGcodeFixture(
interp.writeTextFile( INTERP_COORDINATE_OFFSETS_FILE_FIXTURE,
coordinateOffsetsFilePath, `/work/${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}.ngc`,
readFileSync( `/work/${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}.ngc`,
resolve(rootDir, `tests/fixtures/gcode/${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}.ngc`),
"utf8",
),
); );
verifyExpectedOutput( verifyExpectedOutput(
`${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}_file`, `${INTERP_COORDINATE_OFFSETS_FILE_FIXTURE}_file`,
@@ -787,13 +793,10 @@ verifyExpectedOutput(
).trimEnd(), ).trimEnd(),
); );
const positionParamsFilePath = "/work/position_params.ngc"; const positionParamsFilePath = writeLocalGcodeFixture(
interp.writeTextFile( INTERP_POSITION_PARAMS_FILE_FIXTURE,
positionParamsFilePath, `/work/${INTERP_POSITION_PARAMS_FILE_FIXTURE}.ngc`,
readFileSync( `/work/${INTERP_POSITION_PARAMS_FILE_FIXTURE}.ngc`,
resolve(rootDir, `tests/fixtures/gcode/${INTERP_POSITION_PARAMS_FILE_FIXTURE}.ngc`),
"utf8",
),
); );
verifyExpectedOutput( verifyExpectedOutput(
`${INTERP_POSITION_PARAMS_FILE_FIXTURE}_file`, `${INTERP_POSITION_PARAMS_FILE_FIXTURE}_file`,