mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-21 04:32:05 +00:00
数据目录阶段 0 前端:证据面板给不完整的指标标「结果不完整」并写明原因,截断切开的 Agent 字段标「已截断」,运行时间线说清指标不完整的原因和下一步
This commit is contained in:
@@ -1316,6 +1316,28 @@ await section('agent 字段按出处核对(可点击证据第二期):抽
|
||||
&& !odd.some((s) => /undefined|NaN/.test(`${s.title}${s.sub ?? ''}`)), odd.map((s) => s.title).join(' | '))
|
||||
})
|
||||
|
||||
await section('口径卡指标不完整(数据目录阶段 0):截断的查询结果整组拿来算的指标,警告说人话并指到 SQL', async () => {
|
||||
const E = (seq, type, node_id, data = {}) => ({ seq, type, node_id, ts: 1790000000 + seq, data })
|
||||
// 原话和 backend/app/engine/nodes/metrics.py 的 _incomplete_reason 同一个句式。先核对后端源码还是这么说的
|
||||
const INCOMPLETE = '指标「入园人次」基于被截断的查询结果计算(只取回了前 1000 行),结果不完整'
|
||||
const metricsPy = readFileSync(`${root}backend/app/engine/nodes/metrics.py`, 'utf8')
|
||||
check('后端发指标不完整警告的格式还是夹具里这一种', metricsPy.includes('code="metric_incomplete"')
|
||||
&& metricsPy.includes('message=f"指标「{m[\'name\']}」{m[\'incomplete_reason\']}"')
|
||||
&& metricsPy.includes('f"基于被截断的查询结果计算(只取回了{fetched[0]}),结果不完整"'),
|
||||
'改了 metrics.py 的说法就同步改 decode.ts 的 explainLog 和这里的夹具')
|
||||
const all = flatten(mod.decodeRun([
|
||||
E(1, 'node.started', 'card', { node_type: 'metrics' }),
|
||||
E(2, 'log', 'card', { level: 'warn', code: 'metric_incomplete', metric: 'visits', message: INCOMPLETE }),
|
||||
E(3, 'node.finished', 'card', { duration_ms: 3 }),
|
||||
]))
|
||||
const inc = all.find((s) => s.code === 'metric_incomplete')
|
||||
check('metric_incomplete 说人话:标题点名哪个指标不完整', inc?.title === '指标「入园人次」结果不完整', inc?.title)
|
||||
check('……原因放副标题,原话留在展开区', inc?.sub === '基于被截断的查询结果计算(只取回了前 1000 行)' && inc?.detail === INCOMPLETE,
|
||||
`${inc?.sub} / ${inc?.detail}`)
|
||||
check('……是提醒(warn),下一步指到 SQL,节点本身照样成功', inc?.level === 'warn' && !!inc?.next?.includes('SQL')
|
||||
&& all.find((s) => s.kind === 'node')?.status === 'done', `${inc?.level} ${inc?.next}`)
|
||||
})
|
||||
|
||||
await section('结论句裁判(可点击证据第四期):裁判调用单独成行、几条警告说人话、封存后按需裁判有记录', async () => {
|
||||
const E = (seq, type, node_id, data = {}) => ({ seq, type, node_id, ts: 1790000000 + seq, data })
|
||||
// 原话和后端同一个格式:engine/judge.py 的 run_request、engine/nodes/report.py 的改写一次。先核对后端源码还是这么说的
|
||||
|
||||
@@ -1010,6 +1010,32 @@ await section('caliber', '口径卡来源和升版处置', async () => {
|
||||
await none.ctx.close()
|
||||
})
|
||||
|
||||
await section('incomplete', '截断的查询结果整组算出来的指标:标「结果不完整」并写明原因,完整的指标不标', async () => {
|
||||
await openQ(page, '45,678.5元', { wait: '[data-ev-expression]' })
|
||||
check('完整的指标不出不完整标识', await panel(page).locator('[data-ev-incomplete], [data-ev-incomplete-reason]').count() === 0)
|
||||
check('……输入也不标「已截断」', !(await panel(page).locator('[data-ev-input]').allInnerTexts()).some((t) => t.includes('已截断')))
|
||||
await page.keyboard.press('Escape')
|
||||
// 接口的形状:backend/app/api/evidence.py 的指标步骤带 incomplete / incomplete_reason,输入带 Agent 字段证据里的 truncated
|
||||
const REASON = '基于被截断的查询结果计算(只取回了前 1000 行),结果不完整'
|
||||
const cut = await probeQ((id, body) => ({ ...body, chain: (body.chain ?? []).map((st) => (st.step === 'metric'
|
||||
? { ...st, incomplete: true, incomplete_reason: REASON } : st.step === 'input' ? { ...st, truncated: true } : st)) }))
|
||||
await openQ(cut.page, '45,678.5元', { wait: '[data-ev-incomplete]' })
|
||||
const p = cut.page.locator('[data-evidence-panel]')
|
||||
const chip = p.locator('[data-ev-incomplete]')
|
||||
check('指标名旁有「结果不完整」标识,悬停看原因', (await chip.innerText().catch(() => '')) === '结果不完整'
|
||||
&& await chip.getAttribute('title') === REASON, await chip.innerText().catch(() => ''))
|
||||
const why = await p.locator('[data-ev-incomplete-reason]').innerText().catch(() => '')
|
||||
check('原因写在指标下面', why === REASON, why)
|
||||
const warn = await tokenColor(cut.page, 'color', 'var(--st-waiting)')
|
||||
check('用提醒色(不是失败色:值是真算出来的,只是不全)', await chip.evaluate((el) => getComputedStyle(el).color) === warn)
|
||||
const inputs = await p.locator('[data-ev-input]').allInnerTexts()
|
||||
check('被截断切开的 Agent 字段输入标「已截断」', inputs.some((t) => t.includes('(已截断)')), inputs.join('|'))
|
||||
const source = await p.locator('[data-ev-sources]').innerText().catch(() => '')
|
||||
check('……输入来源写明与快照一致、但只含取回的部分行', source.includes('与快照一致;查询结果已截断,该字段只含取回的部分行'),
|
||||
source.replace(/\s+/g, ' ').slice(0, 160))
|
||||
await cut.ctx.close()
|
||||
})
|
||||
|
||||
await section('q-narrow', '查询步骤在 360px:栏内展开、底部抽屉都不横向滚动;减少动效', async () => {
|
||||
const overflow = () => page.evaluate((sel) => {
|
||||
const el = document.querySelector(sel)
|
||||
|
||||
Reference in New Issue
Block a user