test(guard): 桌面存储镜像层纳入棘轮(11→17),非 storage-* 模块仍禁止直调
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 51s

This commit is contained in:
qiqi committed 2026-11-17 10:34:50 +08:00
1 parent 7ba5b830f2
commit 3389bc4f17
1 file changed
+4 -1
+4 -1
View File
@@ -35,7 +35,10 @@ for (const f of files) {
assert.deepStrictEqual(offenders, [], '存储直调只允许出现在 src/storage-*.js(封装本体)与 app.js(待迁移);违规:' + offenders.join(', '))
// ② 棘轮:只降不升(每迁移一批就把数字调小)
const MAX_DIRECT = 11 // 2026-11-06 批次2b后 = src 6(降级运行时本体)+ app.js 5(lsXxx helper 本体)
// 2026-11-17 桌面版:新增 src/storage-file.js(文件镜像层,属 storage-* 封装本体),
// 需要直调 localStorage 做「首次迁移 + 目录指针读取」,故总数 11 → 17。
// 守卫 ①(非 storage-* 的 src 模块禁止直调)不变。
const MAX_DIRECT = 17 // 2026-11-17 = src 12(含 storage-file 新增 6)+ app.js 5
const MAX_APP_DIRECT = 5 // app.js 仅剩 lsGet/lsSet/lsRemove/lsRawGet/lsRawSet 本体 5 处(这是封装,不是绕过)
assert.ok(total <= MAX_DIRECT, '存储直调总数不得增加(现 ' + total + ' / 上限 ' + MAX_DIRECT + ');新代码请用 IWBStorageLocal.getStore()')
assert.ok(appDirect <= MAX_APP_DIRECT, 'app.js 直调不得增加(现 ' + appDirect + ' / 上限 ' + MAX_APP_DIRECT + ')')