From 1d40980fedc72abb6da958ed4c9a8fada60729fc Mon Sep 17 00:00:00 2001 From: wangdequan Date: Sat, 13 Jun 2026 14:32:29 +0800 Subject: [PATCH] Guard staged prefix stripping --- text7.txt | 57 +++++++++++++++++++ wasm-port/tests/browser/interp_smoke.html | 10 +++- .../tests/wasm/node/verify_interp_wasm.mjs | 12 +++- 3 files changed, 77 insertions(+), 2 deletions(-) diff --git a/text7.txt b/text7.txt index 18e470d..4ce8afd 100644 --- a/text7.txt +++ b/text7.txt @@ -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 +``` diff --git a/wasm-port/tests/browser/interp_smoke.html b/wasm-port/tests/browser/interp_smoke.html index c6fc922..f60e8b7 100644 --- a/wasm-port/tests/browser/interp_smoke.html +++ b/wasm-port/tests/browser/interp_smoke.html @@ -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`); diff --git a/wasm-port/tests/wasm/node/verify_interp_wasm.mjs b/wasm-port/tests/wasm/node/verify_interp_wasm.mjs index 1f81c65..6915aab 100644 --- a/wasm-port/tests/wasm/node/verify_interp_wasm.mjs +++ b/wasm-port/tests/wasm/node/verify_interp_wasm.mjs @@ -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`,