diff --git a/client/electron/test/run-all.mjs b/client/electron/test/run-all.mjs index 2f532e0..9071d6f 100644 --- a/client/electron/test/run-all.mjs +++ b/client/electron/test/run-all.mjs @@ -560,8 +560,16 @@ try { * `indexOf` 会先命中自检自己;`lastIndexOf` 才指向真闸; * ② 再加一道自匹配断言(见下 `selfSrc.indexOf` 那条),宁可红也不许空转。 */ - const from = selfSrc.lastIndexOf('const dueStatic = STATIC_ONLY.filter'); - const to = selfSrc.lastIndexOf('const probeSummary = '); + /* + * ★ 锚点在**运行时拼**(dsh 2026-09-15 的建议):搜索键不许以字面量出现在搜索者自己的源码里。 + * 上一版用 `lastIndexOf` 治的是**位置**("可执行那处在更后面"),依赖"字面量只出现两次且顺序稳定" —— + * 而位置是会被搬动的(这次就是被搬了才出的第 7 例)。拼出来之后,源码里根本不存在那串字, + * 自检搬到哪儿都不会把自己当锚点;下面那条"区间里不许有 selfSrc.indexOf"的断言继续做兜底。 + */ + const GATE_START = 'const dueStatic = STATIC_ONLY' + '.filter'; + const GATE_END = 'const probeSummar' + 'y = '; // 同样拼着写:这串字本身也是搜索键 + const from = selfSrc.indexOf(GATE_START); + const to = selfSrc.indexOf(GATE_END); const GATE_MARKERS_OK = from >= 0 && to > from; /* * ⚠️ 必须**先去注释与字符串**再找 `process.exit(`:这条自检自己的报错文案里就有那串字,