Guard staged prefix stripping

This commit is contained in:
2026-06-13 14:32:29 +08:00
parent dfc343b6e7
commit 1d40980fed
3 changed files with 77 additions and 2 deletions

View File

@@ -235,3 +235,60 @@ Guard staged prefix stripping
```bash
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
```

View File

@@ -4694,10 +4694,18 @@
}
}
function stripInterpIniContextStagingPrefix(name, wasmPath) {
const prefix = `/work/browser-interp/${name}/`;
if (!wasmPath.startsWith(prefix)) {
throw new Error(`browser_interp_${name}_staging_prefix: path drift ${wasmPath}`);
}
return wasmPath.slice(prefix.length);
}
function assertInterpIniContextNgcStaging(name, files, plan) {
const stagedNgcFiles = plan.files
.filter((file) => file.sourceRel.endsWith(".ngc"))
.map((file) => file.wasmPath.replace(`/work/browser-interp/${name}/`, ""))
.map((file) => stripInterpIniContextStagingPrefix(name, file.wasmPath))
.sort();
if (stagedNgcFiles.join(",") !== files.join(",")) {
throw new Error(`browser_interp_${name}_staging_manifest: list drift`);

View File

@@ -297,11 +297,21 @@ function assertInterpRegressionFileStaging(name, filename, wasmPath) {
);
}
function stripInterpIniContextStagingPrefix(name, wasmPath) {
const prefix = `/work/interp/${name}/`;
assert.equal(
wasmPath.startsWith(prefix),
true,
`interp ${name} staging prefix drift: ${wasmPath}`,
);
return wasmPath.slice(prefix.length);
}
function assertInterpIniContextNgcStaging(name, files, plan) {
assert.deepEqual(
plan.files
.filter((file) => file.sourceRel.endsWith(".ngc"))
.map((file) => file.wasmPath.replace(`/work/interp/${name}/`, ""))
.map((file) => stripInterpIniContextStagingPrefix(name, file.wasmPath))
.sort(),
files,
`interp ${name} staging manifest drift`,