fix(reconciliation): R6 改用 removal_candidates 视图,定时批每日只占一个名额
build / build (push) Successful in 2m28s

白盒补充复核提出的三项:
- P1 R6 与 /monitor/overview「需下架」计数口径不一致:R6 原先只在扫描结果里存在
  且上游 parse_status=completed 时才生成,上游仍在 processing/finalizing 或单条读取
  失败导致扫描缺行时,总览有数、对账无记录(陷阱 15)。改为直接由 removal_candidates
  视图行生成,台账细节按 publication 回填,计数与总览同一来源;补单测覆盖
  「上游 processing」「扫描未见」两种差异。
- P2 定时批失败后每个 tick 都重建:每日占位只排除 running/succeeded,failed 不占位,
  一次失败当天会每分钟刷批。占位条件加入 failed,重跑改为显式手动触发;补 PG 集成用例。
- P2 队列不可用时前端显示 0 等待 · 0 运行:改为按 available 判定并显示不可用文案;
  补组件用例。
This commit is contained in:
2026-12-01 18:56:05 +08:00
committed by zheromiku
parent a655f4cca8
commit 082f77fc18
6 changed files with 190 additions and 17 deletions
+44 -1
View File
@@ -1,6 +1,7 @@
import { renderToStaticMarkup } from 'react-dom/server'
import { describe, expect, it, vi } from 'vitest'
import { FindingDetail, ReconciliationFindingsView } from './ReconciliationFindings'
import { FindingDetail, ReconciliationFindingsView, ServiceStrip } from './ReconciliationFindings'
import type { MonitorOverview } from './monitor'
import type { ReconciliationFinding, ReconciliationRun } from './reconciliationApi'
const run: ReconciliationRun = {
@@ -114,3 +115,45 @@ describe('reconciliation findings', () => {
expect(html).toContain('在 WeKnora 中打开')
})
})
describe('ServiceStrip queue availability', () => {
const overview = (queues: MonitorOverview['weknora_queues']) =>
({ weknora_queues: queues, health: [] }) as unknown as MonitorOverview
it('states an unavailable queue instead of rendering 0 waiting · 0 active', () => {
const html = renderToStaticMarkup(
<ServiceStrip
overview={overview({ available: false, queues_error: true, workers_error: false, queues: [], timestamp: 0 })}
/>
)
expect(html).toContain('队列不可用')
expect(html).not.toContain('0 等待')
})
it('prints queue depth when the queue is available', () => {
const html = renderToStaticMarkup(
<ServiceStrip
overview={overview({
available: true,
queues_error: false,
workers_error: false,
timestamp: 0,
queues: [
{
name: 'default',
pool: 'default',
pending: 2,
active: 1,
scheduled: 0,
retry: 0,
archived: 0,
processed: 0,
failed: 0,
},
],
})}
/>
)
expect(html).toContain('2 等待 · 1 运行')
})
})
+1 -1
View File
@@ -75,7 +75,7 @@ export function ServiceStrip({ overview }: { overview: MonitorOverview | null })
<section className="monitor-service-strip" aria-label="服务与队列">
<span>
WeKnora 队列:
{queue ? (
{queue?.available ? (
<b>
{queue.queues.reduce((sum, item) => sum + item.pending, 0)} 等待 ·{' '}
{queue.queues.reduce((sum, item) => sum + item.active, 0)} 运行