feat(collect-data): 结果 Excel 追加「被过滤明细」sheet,品牌检测失败原因可见

task 32573 回传 600 行只留 1 行,被砍掉的 599 行在系统里只剩四个计数,
谁都答不出「是哪些 ASIN、死在哪一道」。四类被过滤行现在于提交时当场
逐行落库(V179 biz_collectdata_filtered_row),结果 Excel 追加第 3 个
sheet 供逐行对账。不在装配期回读 chunk 重判——去重库与无效品牌库读的
都是当前态,任务窗口期的写入会让判定漂移(错标/漏标/分类串台),
依据逐条写在 V179 头注释里。

同批:brandQueryFailedCount 与原因进历史 VO 和任务卡片;损耗通知不再对
「未配置代理」的用户承诺稍后重跑——补测队列两轮 21/21、28/28 全败、净增
0 行,那句是谎。

台账:XML_STATEMENT_TOTAL 141→143(新 mapper 两条写侧语句);静默 catch
棘轮 total 1028→1031、不重抛 579→582、只 log 181→182(三枚审计件容错,
逐处记名于 CatchSilenceRatchetTest 上方注释)。
This commit is contained in:
2026-10-28 19:31:50 +08:00
parent 0e2af88184
commit c4fc9784e8
30 changed files with 1384 additions and 52 deletions
@@ -686,6 +686,14 @@ function toCollectTaskView(item: CollectDataHistoryItem): TaskItemView {
const keywordProgress = taskKeywordProgress(item)
const stageProgress = taskStageProgress(item)
const shortfall = terminalKeywordShortfall(item)
// 品牌检测查不了的行:既不进结果、也没被判无效品牌,过去在界面上一个出口都没有
// (task 32573 回传 600 行、其中 173 行这么丢了,用户只看到"保留 1")。
// 这里只陈述事实与原因原文;该做什么的完整指引走通知,避免在 TS 里复刻一份
// BrandCheckFailureNotice 的归因映射而与之漂移。
const brandQueryFailedLine = item.brandQueryFailedCount
? `品牌检测未出结论:${item.brandQueryFailedCount} 行`
+ `${item.brandQueryFailedReason ? `(${item.brandQueryFailedReason})` : ''}`
: ''
const percent = taskProgressPercent(item)
const finishedAt = item.finishedAt ? formatDateTime(item.finishedAt) : isActive ? '进行中' : '-'
const extraLines: string[] = isActive
@@ -693,12 +701,14 @@ function toCollectTaskView(item: CollectDataHistoryItem): TaskItemView {
...(item.rowCount != null ? [`行数:${item.rowCount}`] : []),
`总数据去重过滤:${item.dedupeFilteredCount ?? 0}`,
`无效品牌过滤:${item.invalidFilteredCount ?? 0}`,
...(brandQueryFailedLine ? [brandQueryFailedLine] : []),
...(keywordProgress ? [keywordProgress] : []),
...(stageProgress ? [stageProgress] : []),
]
: [
`总数据去重过滤:${item.dedupeFilteredCount ?? 0}`,
`无效品牌过滤:${item.invalidFilteredCount ?? 0}`,
...(brandQueryFailedLine ? [brandQueryFailedLine] : []),
...(item.resultFilename ? [item.resultFilename] : []),
...(taskFilterSummary(item) ? [`筛选统计:${taskFilterSummary(item)}`] : []),
// 终态却没跑完全部关键词:把缺口写在卡片上。此前只有那根 25% 的进度条在说话,
@@ -63,6 +63,10 @@ export interface CollectDataHistoryItem {
dedupeFilteredCount?: number;
invalidFilteredCount?: number;
brandRejectedCount?: number;
/** 品牌检测未返回结果的行数:既不进结果、也没被判为无效品牌,过去在界面上完全不可见 */
brandQueryFailedCount?: number;
/** 查不了的原因(如「用户未配置代理」),用来把用户指向可行动的入口 */
brandQueryFailedReason?: string;
finalRowCount?: number;
totalRows?: number;
receivedRows?: number;
@@ -0,0 +1,47 @@
// 品牌检测「查不了」的行必须在任务卡上看得见。
//
// 现网 task 32573:客户端回传 600 行,其中 173 行因为该账号未配置代理而压根没发起品牌查询,
// 这些行既不进结果、也没被判为无效品牌(CollectDataService 对 rejected/queryFailed 的区分)。
// 而卡片只有「去重/无效品牌/品牌拒绝/保留」四格——brandQueryFailedCount 连历史 VO 都没出去,
// 前端类型里也没这个字段。于是用户看到的只有"保留 1",173 行去哪了没有任何交代。
//
// .vue 在本套件里挂不起来(没有 @vue/test-utils,见 task-terminal-completed-behavior.test.ts
// 的说明),所以按源码钉:字段要进类型、卡片两个分支都要真的渲染出来。
import { test } from 'node:test'
import assert from 'node:assert/strict'
import { fileURLToPath } from 'node:url'
import { dirname, resolve } from 'node:path'
import { readSource } from './helpers/task-terminal-ast-ruler.ts'
const here = dirname(fileURLToPath(import.meta.url))
const root = resolve(here, '..')
const COLLECT = 'src/pages/brand/components/BrandCollectDataTab.vue'
const TYPES = 'src/shared/api/types/modules/collect-data.ts'
test('品牌检测失败行数与原因必须进历史类型', () => {
const src = readSource(TYPES, root)
assert.match(src, /brandQueryFailedCount\?: number/,
'后端 CollectDataHistoryItemVo 已返回这个字段,前端类型不能再缺')
assert.match(src, /brandQueryFailedReason\?: string/,
'原因也要带上来,卡片才说得出「未配置代理」这类可行动的话')
})
test('卡片进行中与终态两个分支都要挂上这一行', () => {
const src = readSource(COLLECT, root)
assert.match(src, /const brandQueryFailedLine = item\.brandQueryFailedCount/,
'要先按行数算出这一行,0 行时不占版面')
const usages = src.match(/\.\.\.\(brandQueryFailedLine \? \[brandQueryFailedLine\] : \[\]\)/g) ?? []
assert.equal(usages.length, 2,
`进行中/终态两个 extraLines 分支各挂一次,实测 ${usages.length} 处`)
})
test('卡片不得再把无效品牌行数叫成「不符合 ASIN 过滤」', () => {
// invalidFilteredCount 是命中无效品牌库的行数,与用户自己设的 ASIN 筛选条件无关。
// 过去同一张卡上它一会儿叫「不符合 ASIN 过滤」一会儿叫「无效品牌」,两个名字指一个数。
const src = readSource(COLLECT, root)
assert.doesNotMatch(src, /不符合 ASIN 过滤/,
'这个名字指错了来源,统一为「无效品牌过滤」')
assert.match(src, /无效品牌过滤:\$\{item\.invalidFilteredCount/,
'必须仍读 invalidFilteredCount,只是把名字改对')
})