eea617b3e6
代理按「提取次数」计费而不是按流量,所以把同一批店铺重复派发一次就是真花钱。三处改动的 共同口径是「用户多点一次启动,不再多买一轮」。纯逻辑各抽成一个可单测的模块,页面只接线。 - dispatch-row-prune:查 ASIN 页匹配好的店铺交给后台执行后从结果表里移除。删行本身一句 filter, 两个坑要钉住——行键口径必须与该页 rowKeyForMatch 一致(名字带两端空格的行删不掉,就留着 下次再买一轮);历史行明细靠本地匹配表回退(withQueryAsinFallback 读 matchedItems),直接删行 等于把已派发店铺的历史明细一起删掉 ⇒ 移除的行进一份上限 50 的归档,继续当回退数据源。 - candidate-selection-memory:候选店铺每天重拉时保住勾选。记的是店铺名不是行 id(候选行会被 删了再加、id 会变,店铺名才是人眼认的那个身份);键按 uid + 页签隔离;selection-change 只带 当前渲染窗口里的行,整份覆盖会把别的页刚记住的勾选一起抹掉 ⇒ 只按本窗口可见行重算; 店铺已被删除时不得恢复勾选(否则匹配的是不存在的店)。 - 跟价页摘掉 processMatchedQueue 这条旧逐行派发路径:入口只有 if (autoQueueEnabled),而本页 从来没把它置 true ⇒ 永远进不去。留着不是无害死代码——它是一套能重复买提取的并行派发路径, 谁接错一次就再花钱。用例反向钉「不得回流」,不给死代码补测试。 验证:frontend-vue 定向 29/0(dispatch-row-prune 7、candidate-selection-memory 5、 wiring 10、query-asin-dispatch-prune 5、price-track-dead-queue-removed 反向钉 2), 全量 710/0(含本会话另加的到期弹窗 9 支,那 9 支随上一笔走)。接线由 wiring 用例钉住 "纯模块真被这两个页面 import",不是只测纯函数。
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
import { test } from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { readFileSync } from 'node:fs'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { dirname, join } from 'node:path'
|
|
|
|
/**
|
|
* 跟价页「旧逐行派发」死代码守卫(2026-10-04 C 档收尾)。
|
|
*
|
|
* processMatchedQueue 是循环派发(pushToPythonLoopQueue → runLoopExecution)之前的实现,
|
|
* 入口只有 `if (autoQueueEnabled.value)`,而 autoQueueEnabled 在本页从来没被置 true ⇒ 永远进不去。
|
|
* 留着它不是无害死代码:它是一套能重复买提取的并行派发路径,谁接错一次就再花钱。
|
|
* 所以这里反向钉住"不得回流",而不是给死代码补测试。
|
|
*/
|
|
|
|
const PAGE = join(
|
|
dirname(fileURLToPath(import.meta.url)),
|
|
'../src/pages/brand/components/BrandPriceTrackTab.vue',
|
|
)
|
|
const source = readFileSync(PAGE, 'utf8')
|
|
|
|
test('跟价页不再保留旧逐行派发队列及其开关', () => {
|
|
for (const symbol of [
|
|
'processMatchedQueue',
|
|
'nextMatchedQueueItem',
|
|
'autoQueueEnabled',
|
|
'queueWorkerRunning',
|
|
]) {
|
|
assert.ok(!source.includes(symbol), `${symbol} 仍在跟价页:旧的重复派发路径没清干净`)
|
|
}
|
|
})
|
|
|
|
test('跟价页启动仍只接循环派发一条路径', () => {
|
|
assert.match(source, /@click="pushToPythonLoopQueue"/, '启动按钮没接循环派发')
|
|
assert.ok(source.includes('async function runLoopExecution('), '循环派发实现不见了')
|
|
})
|