mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-18 12:21:59 +00:00
期 3 反方审稿(前端)复核修正:要审的报告按服务端的认法定,校验报过的不再重复,补齐降档提示的反例检查和运行类别取不到时的说明,修好显示全部的焦点与去重,处理审稿记录没存上的情况
检查器 - 「要审的报告」留空时,照服务端 schema.challenge_report 的认法:先看直接连着的报告撰写节点,恰好一个就审它;不是一个时,整个上游只有一个才取那一个。以前只认第二步,「初稿 → 终稿 → 反方审稿」这种接法下会误报「上游有 2 个,请选择」,同模型提醒也不出。现在留空项写出实际会审的那份(「未选择:审上游的「终稿」」),同模型提醒也按同一套认法判断。 - 认法写成 nodePickField / upstreamModel 的 rule 选项。缺省是 'upstream'(只看整个上游),和 F1a 的 dual_check_card 一致,双盲复算以后也能直接用。 - 选中的节点在上游、类型却不对(例如输入节点),以前写成「不在上游」,现在照实写「不是报告撰写节点」,提示里说清它是哪类节点。判断顺序和服务端一致:先看存不存在,再看类型,最后看在不在上游。 - 画布校验已经在 report / model 字段上报过问题时,不再画本地那句提示,避免同一件事一琥珀一红说两遍。判断哪些问题属于本字段,用和 Inspector 挂字段时相同的 fieldOfIssue;下拉里照实标出的那一项保留。 - 文案里的设置入口统一写成「设置 → 偏好设置 → 核查」,和设置页的真实标签、双盲复算、证据裁判的写法一致。 审批卡 - 降档的原因改为常显在概况下面,不再只放在悬停提示和读屏文字里。 - 运行类别取不到时,不再悄悄不写降档:照实写「暂时无法确认运行类别;如为正式运行,被推翻的结论会使出具降档」,并给出重试按钮;窗口重新拿到焦点时也会再取一次。 - 「显示全部」补句时按 unit 去重:两边都有 unit 时只比 unit,有一边缺 unit 才比原文。以前原文相同、unit 不同的一句会被吞掉,被吞的可能正是被推翻的那句。条目缺 unit 时不再补假的 #i。 - 键盘按「显示全部」、补句那一行的重试、一句详情里的重试、运行类别的重试之后,焦点都会接到新出现的内容上,不再掉到 body。焦点已经被用户移到别处时不抢。 - 审稿记录没存上(artifact 为 null)时,每句只列判断,不能点开,整块说一句「反方审稿记录未保存,无法查看理由和查询」;「另有 N 句未列出」照常显示,只是不给「显示全部」。 检查(check-challenge 共 153 项) - 新增预览用例:正式运行且没有被推翻的结论(降档 / 只标注)、探索运行配只标注、运行类别取不到、原文相同而 unit 不同、审稿记录没存上、链式接法的检查器。 - 「只标注、探索运行、没有反方审稿」拆成各自独立的段,一段出错不会遮住其余几段。 - 新增的检查项包括:降档原因常显、取不到运行类别时的说明和重试(含窗口重新拿到焦点后再取)、显示全部和各处重试后的焦点、按 unit 去重、审稿记录没存上、链式接法、类型不对的节点、校验报过就不重复说,以及窄屏和深浅色下新增几行说明的对比度。 - 复核时用来证明检查不够的两个变异,M1(正式运行一律写降档)和 M10(探索运行也写只标注说明),连同本次各项修正的变异,都已逐一确认会被检查发现。
This commit is contained in:
@@ -94,7 +94,7 @@ const ORDER = [
|
||||
// 各项的耗时(秒)。只决定排队顺序:长的先开跑,短的填空,结果不受影响。新加的检查不在表里就按 60 秒算;
|
||||
// 拆开的两项看 SPLIT 里各份的 est。2026-09-29 八道并行、关浏览器不干等之后的实测
|
||||
const ESTIMATE = {
|
||||
challenge: 17,
|
||||
challenge: 30,
|
||||
stream: 173, chat: 160, studio: 149, manage: 145, runs: 112, publish: 92, shell: 87,
|
||||
evidence: 91, versions: 60, catalog: 45, 'ui-kit': 70, ui: 61, guards: 8, 'canvas-layout': 2, copy: 2, tokens: 1, trace: 1, decode: 1,
|
||||
// 占位,换成真检查时按实测改
|
||||
|
||||
+275
-43
@@ -1,12 +1,15 @@
|
||||
// 反方审稿的回归检查:审批卡上的反方审稿(run/ChallengeSummary.tsx)和检查器里反方审稿节点的配置(canvas/nodeDefs.ts 的
|
||||
// challenge、canvas/verifyFields.tsx)。
|
||||
//
|
||||
// 守的是这些「看着没坏、其实用不了」的地方:概况的句数和条目对不上、有被推翻的结论却不提醒降档、只标注时也写降档、
|
||||
// 探索运行里说出具、没经过反方审稿的报告也冒出一块空框(或者白发一次请求)、点开一句不取工件(或者每点一句取一次)、
|
||||
// 理由里的数字看不出引用了哪次查询、裸数字没被标出来、理由文档是另一个工件时不去取、查询的 SQL / 行数 / 截断不显示、
|
||||
// 工件取不到时卡死在加载中、条目只列前十句时看不到其余的;检查器里的字段写不进节点配置(或者写进去的不是约定的形状:
|
||||
// 跟随设置要把这一项拿掉,不能写成空字符串)、下拉里列出了下游的报告、选中的报告被删了还看着像「未选择」、反方模型和
|
||||
// 撰写报告的模型相同不提醒、节点卡片的摘要还写着功能开发中;窄屏(390px)被撑出横向滚动、浅色主题下标签看不清。
|
||||
// 守的是这些「看着没坏、其实用不了」的地方:概况的句数和条目对不上、有被推翻的结论却不提醒降档(或者原因只藏在悬停里)、
|
||||
// 没有被推翻的结论也写降档、只标注时也写降档、探索运行里说出具、运行类别取不到时降档提示悄悄消失、没经过反方审稿的报告
|
||||
// 也冒出一块空框(或者白发一次请求)、点开一句不取工件(或者每点一句取一次)、理由里的数字看不出引用了哪次查询、
|
||||
// 裸数字没被标出来、理由文档是另一个工件时不去取、查询的 SQL / 行数 / 截断不显示、工件取不到时卡死在加载中、
|
||||
// 审稿记录没存上时每句还能点开、条目只列前十句时看不到其余的(或者补的时候吞掉原文相同的另一句、键盘焦点掉到页面上);
|
||||
// 检查器里的字段写不进节点配置(或者写进去的不是约定的形状:跟随设置要把这一项拿掉,不能写成空字符串)、下拉里列出了
|
||||
// 下游的报告、留空时认的报告和服务端不一样(「初稿 → 终稿 → 反方审稿」审终稿)、选中的报告被删了还看着像「未选择」、
|
||||
// 选中的不是报告撰写节点却说成不在上游、反方模型和撰写报告的模型相同不提醒、画布校验已经报了的又在字段下面说一遍、
|
||||
// 节点卡片的摘要还写着功能开发中;窄屏(390px)被撑出横向滚动、浅色主题下标签看不清。
|
||||
//
|
||||
// 跑在预览页上:/preview.html?syn=challenge-*(用例见 frontend/src/dev/fixtures/challenge.tsx)。夹具在
|
||||
// frontend/src/dev/fixtures/challenge.json,理由文档是后端 run_verify_agent + compose_doc 真跑出来的(虚构的库和数字)。
|
||||
@@ -28,14 +31,27 @@ const ART = fx.challenge.artifact
|
||||
const DOC = fx.doc_u8
|
||||
const MANY = fx.many.artifact
|
||||
const BROKEN = 'e'.repeat(64)
|
||||
// challenge-approval-dup 的工件:同 many,只把补出来的 u30(被推翻)的原文改成和条目 u20 一字不差
|
||||
const DUP = 'd'.repeat(64)
|
||||
const DUP_CONTENT = {
|
||||
...fx.artifacts[MANY],
|
||||
claims: fx.artifacts[MANY].claims.map((c) => (c.unit === 'u30' ? { ...c, text: fx.many.items.find((it) => it.unit === 'u20').text } : c)),
|
||||
}
|
||||
const RUNS = fx.runs
|
||||
const RUN_CLASS = {
|
||||
[RUNS.formal]: 'formal', [RUNS.flag]: 'formal', [RUNS.explore]: 'exploratory', [RUNS.none]: 'formal',
|
||||
[RUNS.many]: 'formal', [RUNS.broken]: 'formal',
|
||||
[RUNS.many]: 'formal', [RUNS.broken]: 'formal', [RUNS.clear]: 'formal', [RUNS.clearFlag]: 'formal',
|
||||
[RUNS.exploreFlag]: 'exploratory', [RUNS.runfail]: 'formal', [RUNS.dup]: 'formal', [RUNS.norecord]: 'formal',
|
||||
}
|
||||
const LABEL = { stands: '经受住', weakened: '被削弱', refuted: '被推翻', inconclusive: '无法判断' }
|
||||
const FLAG_NOTE = '按节点设置,被推翻的结论只做标注,不影响出具档位'
|
||||
const DEGRADE_NOTE = '被推翻的结论计入出具缺口,本次正式运行将降档出具'
|
||||
const FAILED = '无法获取反方审稿的详细内容'
|
||||
// F3a 画布校验(schema._check_challenge)在同样情形下的说法:检查器按 field 挂在字段下面
|
||||
const SERVER_MANY = '「反方审稿」的上游有多个「报告撰写」节点(「写月报」、「写周报」),请在「要审的报告」中选择要审的那一份'
|
||||
const SERVER_GHOST = '「反方审稿」的「要审的报告」选择了「ghost」,但工作流中不存在这个节点'
|
||||
const SERVER_SAME = '反方模型与报告「写月报」的写作模型相同(「writer-large」),等于自己审自己,难以发现写作模型自身的错误。'
|
||||
+ '请在「反方模型」中选择另一个模型'
|
||||
|
||||
let failed = 0
|
||||
const check = (name, cond, detail = '') => {
|
||||
@@ -54,7 +70,8 @@ async function section(name, fn) {
|
||||
const browser = await chromium.launch({ executablePath: CHROME })
|
||||
|
||||
/**
|
||||
* 开一个预览用例。工件按夹具答(BROKEN 先答 404,state.broken 置 false 后答正常内容),运行类别按 RUN_CLASS 答;
|
||||
* 开一个预览用例。工件按夹具答(BROKEN 先答 404,state.broken 置 false 后答正常内容),运行类别按 RUN_CLASS 答
|
||||
* (runfail 先答 500,state.runFail 置 false 后照常答),画布校验答 state.issues;
|
||||
* 记下取了哪些工件、问了哪些运行、拦下了哪些写请求
|
||||
*/
|
||||
async function open(syn, { width = 1100, height = 900, theme = 'dark' } = {}) {
|
||||
@@ -62,14 +79,16 @@ async function open(syn, { width = 1100, height = 900, theme = 'dark' } = {}) {
|
||||
ctx.setDefaultTimeout(6000)
|
||||
const page = await ctx.newPage()
|
||||
const hits = { artifacts: [], runs: [], writes: [] }
|
||||
const state = { broken: true }
|
||||
const state = { broken: true, runFail: true, issues: [] }
|
||||
const errors = []
|
||||
page.on('pageerror', (e) => errors.push(e.message))
|
||||
page.on('dialog', (d) => { errors.push(`原生对话框:${d.message()}`); void d.dismiss() })
|
||||
await page.route((u) => new URL(u).pathname.startsWith('/api/'), async (route) => {
|
||||
const req = route.request()
|
||||
const path = new URL(req.url()).pathname
|
||||
if (req.method() === 'POST' && path === '/api/workflows/validate') return route.fulfill({ json: { ok: true, issues: [] } })
|
||||
if (req.method() === 'POST' && path === '/api/workflows/validate') {
|
||||
return route.fulfill({ json: { ok: !state.issues.some((i) => i.level === 'error'), issues: state.issues } })
|
||||
}
|
||||
if (req.method() === 'POST' && path === '/api/workflows/variables') return route.fulfill({ json: { variables: [], issues: [] } })
|
||||
// 画布载入一张图时会找(没有就建)它的助手会话:答一份假的,不碰真实会话
|
||||
if (path === '/api/conversations') {
|
||||
@@ -84,6 +103,7 @@ async function open(syn, { width = 1100, height = 900, theme = 'dark' } = {}) {
|
||||
const id = decodeURIComponent(art[1])
|
||||
hits.artifacts.push(id)
|
||||
if (id === BROKEN && !state.broken) return route.fulfill({ json: { id, content: fx.artifacts[ART] } })
|
||||
if (id === DUP) return route.fulfill({ json: { id, content: DUP_CONTENT } })
|
||||
const content = fx.artifacts[id]
|
||||
return content ? route.fulfill({ json: { id, content } })
|
||||
: route.fulfill({ status: 404, json: { detail: '工件不存在,可能已被删除' } })
|
||||
@@ -92,6 +112,7 @@ async function open(syn, { width = 1100, height = 900, theme = 'dark' } = {}) {
|
||||
if (run) {
|
||||
const id = decodeURIComponent(run[1])
|
||||
hits.runs.push(id)
|
||||
if (id === RUNS.runfail && state.runFail) return route.fulfill({ status: 500, json: { detail: '服务暂时不可用' } })
|
||||
return RUN_CLASS[id] ? route.fulfill({ json: { id, run_class: RUN_CLASS[id], status: 'interrupted' } })
|
||||
: route.fulfill({ status: 404, json: { detail: '运行不存在' } })
|
||||
}
|
||||
@@ -128,8 +149,13 @@ await section('审批卡:概况与降档提示', async () => {
|
||||
&& counts.refuted === '被推翻 1 句' && counts.inconclusive === '无法判断 1 句', JSON.stringify(counts))
|
||||
await page.waitForSelector('[data-challenge-degrade]')
|
||||
check('正式运行、没写处理方式(按降档)、有被推翻的:醒目提示「出具会降档」',
|
||||
(await text(page.locator('[data-challenge-degrade]'))).startsWith('出具会降档'))
|
||||
(await text(page.locator('[data-challenge-degrade]'))) === '出具会降档')
|
||||
// 原因不能只放在悬停提示和读屏文字里:触屏、键盘用户看不到(只标注那一档反而有常显的说明)
|
||||
const note = page.locator('[data-challenge-degrade-note]')
|
||||
check('降档的原因常显在概况下面,不靠悬停', await note.count() === 1 && await note.isVisible() && (await text(note)) === DEGRADE_NOTE
|
||||
&& (await page.locator('[data-challenge-degrade]').getAttribute('title')) === null, await note.count() ? await text(note) : '没有')
|
||||
check('不是只标注:没有「只做标注」那句', await page.locator('[data-challenge-flag]').count() === 0)
|
||||
check('运行类别取到了:没有「暂时无法确认运行类别」', await page.locator('[data-challenge-runclass]').count() === 0)
|
||||
const rows = await block.locator('[data-challenge-item]').evaluateAll((els) => els.map((el) => ({
|
||||
unit: el.getAttribute('data-challenge-item'),
|
||||
tag: el.querySelector('[data-challenge-tag]')?.textContent?.trim(),
|
||||
@@ -225,41 +251,96 @@ await section('点开一句:取工件,显示理由与查询', async () => {
|
||||
await ctx.close()
|
||||
})
|
||||
|
||||
await section('只标注、探索运行、没有反方审稿', async () => {
|
||||
{
|
||||
const { ctx, page, hits, errors } = await open('challenge-approval-flag')
|
||||
// 下面几段各开各的页面、各自成段:一段中途出错(比如等一个不该出现的元素超时)不遮住其余几段
|
||||
await section('只标注:不写降档', async () => {
|
||||
const { ctx, page, hits, errors } = await open('challenge-approval-flag')
|
||||
await page.locator('[data-challenge="write"]').waitFor()
|
||||
await runClassSettled(page, hits, RUNS.flag)
|
||||
const all = await text(page.locator('[data-challenge="write"]'))
|
||||
check('只标注:不写「出具会降档」', await page.locator('[data-challenge-degrade], [data-challenge-degrade-note]').count() === 0
|
||||
&& !all.includes('降档'), all)
|
||||
check('只标注:写明被推翻的结论只做标注', (await text(page.locator('[data-challenge-flag]'))) === FLAG_NOTE)
|
||||
check('只标注:页面没有报错', errors.length === 0, errors.join(';'))
|
||||
await ctx.close()
|
||||
})
|
||||
|
||||
await section('探索运行:不说出具', async () => {
|
||||
const { ctx, page, hits, errors } = await open('challenge-approval-explore')
|
||||
await page.locator('[data-challenge="write"]').waitFor()
|
||||
await runClassSettled(page, hits, RUNS.explore)
|
||||
const all = await text(page.locator('[data-challenge="write"]'))
|
||||
check('探索运行:反方审稿里不说任何和出具有关的话', !all.includes('出具')
|
||||
&& await page.locator('[data-challenge-degrade], [data-challenge-degrade-note], [data-challenge-flag]').count() === 0, all)
|
||||
check('探索运行:概况和条目照常显示', (await text(page.locator('[data-challenge-count="refuted"]'))) === '被推翻 1 句'
|
||||
&& await page.locator('[data-challenge-item]').count() === 4)
|
||||
check('探索运行:页面没有报错', errors.length === 0, errors.join(';'))
|
||||
await ctx.close()
|
||||
})
|
||||
|
||||
await section('探索运行配只标注:同样不说出具', async () => {
|
||||
const { ctx, page, hits, errors } = await open('challenge-approval-explore-flag')
|
||||
await page.locator('[data-challenge="write"]').waitFor()
|
||||
await runClassSettled(page, hits, RUNS.exploreFlag)
|
||||
const all = await text(page.locator('[data-challenge="write"]'))
|
||||
check('探索运行、只标注:不写「只做标注、不影响出具档位」', await page.locator('[data-challenge-flag]').count() === 0 && !all.includes('出具'), all)
|
||||
check('探索运行、只标注:也不写降档', await page.locator('[data-challenge-degrade], [data-challenge-degrade-note]').count() === 0)
|
||||
check('探索运行、只标注:页面没有报错', errors.length === 0, errors.join(';'))
|
||||
await ctx.close()
|
||||
})
|
||||
|
||||
await section('正式运行、没有被推翻的结论:不写降档', async () => {
|
||||
for (const [syn, run, what] of [['challenge-approval-clear', RUNS.clear, '按降档'], ['challenge-approval-clear-flag', RUNS.clearFlag, '只标注']]) {
|
||||
const { ctx, page, hits, errors } = await open(syn)
|
||||
await page.locator('[data-challenge="write"]').waitFor()
|
||||
await runClassSettled(page, hits, RUNS.flag)
|
||||
await runClassSettled(page, hits, run)
|
||||
const all = await text(page.locator('[data-challenge="write"]'))
|
||||
check('只标注:不写「出具会降档」', await page.locator('[data-challenge-degrade]').count() === 0 && !all.includes('降档'), all)
|
||||
check('只标注:写明被推翻的结论只做标注', (await text(page.locator('[data-challenge-flag]'))) === FLAG_NOTE)
|
||||
check('只标注:页面没有报错', errors.length === 0, errors.join(';'))
|
||||
await ctx.close()
|
||||
}
|
||||
{
|
||||
const { ctx, page, hits, errors } = await open('challenge-approval-explore')
|
||||
await page.locator('[data-challenge="write"]').waitFor()
|
||||
await runClassSettled(page, hits, RUNS.explore)
|
||||
const all = await text(page.locator('[data-challenge="write"]'))
|
||||
check('探索运行:反方审稿里不说任何和出具有关的话', !all.includes('出具') && await page.locator('[data-challenge-degrade], [data-challenge-flag]').count() === 0, all)
|
||||
check('探索运行:概况和条目照常显示', (await text(page.locator('[data-challenge-count="refuted"]'))) === '被推翻 1 句'
|
||||
&& await page.locator('[data-challenge-item]').count() === 4)
|
||||
check('探索运行:页面没有报错', errors.length === 0, errors.join(';'))
|
||||
await ctx.close()
|
||||
}
|
||||
{
|
||||
const { ctx, page, hits, errors } = await open('challenge-approval-none')
|
||||
await page.locator('[data-approval-report="write"]').waitFor()
|
||||
await page.waitForTimeout(500)
|
||||
check('报告没有经过反方审稿:什么都不画', await page.locator('[data-challenge]').count() === 0)
|
||||
check('报告没有经过反方审稿:不问运行类别、不取工件', !hits.runs.includes(RUNS.none) && hits.artifacts.length === 0,
|
||||
`${hits.runs.join('、')} / ${hits.artifacts.join('、')}`)
|
||||
check('报告核对概况照常显示', (await text(page.locator('[data-approval-report="write"]'))).includes('报告「写月报」的核对'))
|
||||
check('没有反方审稿:页面没有报错', errors.length === 0, errors.join(';'))
|
||||
check(`正式运行、${what}、被推翻 0 句:概况照实写 0 句`, (await text(page.locator('[data-challenge-count="refuted"]'))) === '被推翻 0 句'
|
||||
&& await page.locator('[data-challenge-item]').count() === 3, all)
|
||||
check(`正式运行、${what}、被推翻 0 句:既不写降档,也不写只做标注`,
|
||||
await page.locator('[data-challenge-degrade], [data-challenge-degrade-note], [data-challenge-flag]').count() === 0
|
||||
&& !all.includes('降档') && !all.includes('只做标注'), all)
|
||||
check(`正式运行、${what}、被推翻 0 句:页面没有报错`, errors.length === 0, errors.join(';'))
|
||||
await ctx.close()
|
||||
}
|
||||
})
|
||||
|
||||
await section('运行类别取不到:说明并可重试', async () => {
|
||||
const { ctx, page, hits, state, errors } = await open('challenge-approval-runfail')
|
||||
await page.locator('[data-challenge="write"]').waitFor()
|
||||
await runClassSettled(page, hits, RUNS.runfail)
|
||||
const failedLine = page.locator('[data-challenge-runclass="failed"]')
|
||||
check('取不到:不写降档,也不装作没事——写明暂时无法确认运行类别', await page.locator('[data-challenge-degrade]').count() === 0
|
||||
&& await failedLine.count() === 1 && (await text(failedLine)).startsWith('暂时无法确认运行类别'),
|
||||
await failedLine.count() ? await text(failedLine) : '没有说明')
|
||||
// 窗口重新拿到焦点时再取一次(store 对出错的槽会重发)
|
||||
await page.evaluate(() => window.dispatchEvent(new Event('focus')))
|
||||
for (let i = 0; i < 30 && hits.runs.filter((r) => r === RUNS.runfail).length < 2; i++) await page.waitForTimeout(100)
|
||||
check('窗口重新拿到焦点:再取一次运行类别', hits.runs.filter((r) => r === RUNS.runfail).length === 2, hits.runs.join('、'))
|
||||
state.runFail = false
|
||||
await failedLine.locator('button', { hasText: '重试' }).focus()
|
||||
await page.keyboard.press('Enter')
|
||||
await page.waitForSelector('[data-challenge-degrade]')
|
||||
check('按重试:取到正式运行后写「出具会降档」,说明随之消失', await failedLine.count() === 0
|
||||
&& hits.runs.filter((r) => r === RUNS.runfail).length === 3, hits.runs.join('、'))
|
||||
await page.waitForTimeout(100)
|
||||
check('按重试:那一行拿掉后焦点接到概况上,不掉到页面上', await page.evaluate(() =>
|
||||
document.activeElement?.hasAttribute('data-challenge-counts') ?? false), await page.evaluate(() => document.activeElement?.tagName))
|
||||
check('取不到:页面没有报错', errors.length === 0, errors.join(';'))
|
||||
await ctx.close()
|
||||
})
|
||||
|
||||
await section('没有反方审稿:什么都不画', async () => {
|
||||
const { ctx, page, hits, errors } = await open('challenge-approval-none')
|
||||
await page.locator('[data-approval-report="write"]').waitFor()
|
||||
await page.waitForTimeout(500)
|
||||
check('报告没有经过反方审稿:什么都不画', await page.locator('[data-challenge]').count() === 0)
|
||||
check('报告没有经过反方审稿:不问运行类别、不取工件', !hits.runs.includes(RUNS.none) && hits.artifacts.length === 0,
|
||||
`${hits.runs.join('、')} / ${hits.artifacts.join('、')}`)
|
||||
check('报告核对概况照常显示', (await text(page.locator('[data-approval-report="write"]'))).includes('报告「写月报」的核对'))
|
||||
check('没有反方审稿:页面没有报错', errors.length === 0, errors.join(';'))
|
||||
await ctx.close()
|
||||
})
|
||||
|
||||
await section('工件取不到:说明并可重试', async () => {
|
||||
const { ctx, page, state, hits, errors } = await open('challenge-approval-broken')
|
||||
await toggle(page, 'u3').click()
|
||||
@@ -268,10 +349,16 @@ await section('工件取不到:说明并可重试', async () => {
|
||||
&& await detail(page, 'u3').locator('button', { hasText: '重试' }).count() === 1)
|
||||
check('取不到:不停在「正在加载」', await page.locator('[data-challenge-detail-state="loading"]').count() === 0)
|
||||
state.broken = false
|
||||
await detail(page, 'u3').locator('button', { hasText: '重试' }).click()
|
||||
// 用键盘按重试:按钮在加载时就拿掉了,取到之后焦点得接到理由上
|
||||
await detail(page, 'u3').locator('button', { hasText: '重试' }).focus()
|
||||
await page.keyboard.press('Enter')
|
||||
await detail(page, 'u3').locator('[data-challenge-doc]').waitFor()
|
||||
check('重试:再取一次,取到后显示理由', hits.artifacts.filter((a) => a === BROKEN).length === 2
|
||||
&& (await text(detail(page, 'u3').locator('[data-challenge-doc]'))).includes('151,000'))
|
||||
await page.waitForTimeout(100)
|
||||
check('键盘按重试:取到后焦点落到这一句的理由上,不掉到页面上', await page.evaluate(() =>
|
||||
document.activeElement?.matches('[data-challenge-detail="u3"] [data-challenge-rationale]') ?? false),
|
||||
await page.evaluate(() => document.activeElement?.tagName))
|
||||
check('取不到:页面没有报错', errors.length === 0, errors.join(';'))
|
||||
await ctx.close()
|
||||
})
|
||||
@@ -284,10 +371,18 @@ await section('超过十句:显示全部', async () => {
|
||||
&& (await text(page.locator('[data-challenge-count="refuted"]'))) === '被推翻 2 句')
|
||||
check('写明另有几句未列出', (await text(page.locator('[data-challenge-more]'))).startsWith('另有 2 句未列出'))
|
||||
check('没要之前不取工件', hits.artifacts.length === 0)
|
||||
await page.locator('[data-challenge-show-all]').click()
|
||||
// 用键盘按:按钮所在那一行补齐后会拿掉,焦点得落到补出来的第一句上,不能掉到页面上、下一个 Tab 跳过新补的几句
|
||||
await page.locator('[data-challenge-show-all]').focus()
|
||||
await page.keyboard.press('Enter')
|
||||
await page.waitForFunction(() => document.querySelectorAll('[data-challenge-item]').length === 12)
|
||||
check('显示全部:从工件里补齐其余两句,排在后面', JSON.stringify(await page.locator('[data-challenge-item]').evaluateAll((els) =>
|
||||
els.slice(10).map((el) => el.getAttribute('data-challenge-item')))) === JSON.stringify(['u30', 'u31']) && hits.artifacts.includes(MANY))
|
||||
await page.waitForTimeout(100)
|
||||
const focused = await page.evaluate(() => ({
|
||||
toggle: document.activeElement?.hasAttribute('data-challenge-toggle') ?? false,
|
||||
unit: document.activeElement?.closest('[data-challenge-item]')?.getAttribute('data-challenge-item') ?? document.activeElement?.tagName,
|
||||
}))
|
||||
check('键盘按「显示全部」:焦点落到补出来的第一句上', focused.toggle && focused.unit === 'u30', JSON.stringify(focused))
|
||||
check('显示全部之后不再写「另有」', await page.locator('[data-challenge-more]').count() === 0)
|
||||
check('补出来的一句带着自己的判断标签', (await text(item(page, 'u30').locator('[data-challenge-tag]'))) === '被推翻')
|
||||
await toggle(page, 'u30').click()
|
||||
@@ -298,6 +393,43 @@ await section('超过十句:显示全部', async () => {
|
||||
await ctx.close()
|
||||
})
|
||||
|
||||
await section('显示全部:原文相同、unit 不同的一句不被吞掉', async () => {
|
||||
// 同一句结论在摘要和正文各出现一次、各自被选中审稿:补的时候按 unit 认,不按原文
|
||||
const { ctx, page, hits, errors } = await open('challenge-approval-dup')
|
||||
await page.locator('[data-challenge="write"]').waitFor()
|
||||
await page.locator('[data-challenge-show-all]').click()
|
||||
await item(page, 'u31').waitFor()
|
||||
const units = await page.locator('[data-challenge-item]').evaluateAll((els) => els.map((el) => el.getAttribute('data-challenge-item')))
|
||||
check('补齐十二句,原文和 u20 相同的 u30 也在', units.length === 12 && units.includes('u30') && hits.artifacts.includes(DUP), JSON.stringify(units))
|
||||
check('补出来的 u30 带着自己的判断(被推翻)', await item(page, 'u30').count() === 1
|
||||
&& (await text(item(page, 'u30').locator('[data-challenge-tag]'))) === '被推翻')
|
||||
await toggle(page, 'u20').click()
|
||||
await detail(page, 'u20').locator('[data-challenge-rationale-text]').waitFor()
|
||||
check('点开原文相同的 u20:显示的是 u20 自己的理由', !(await text(detail(page, 'u20'))).includes('白汀区的退款金额高于云屿区这一说法与查询结果不符'),
|
||||
await text(detail(page, 'u20')))
|
||||
check('原文相同:页面没有报错', errors.length === 0, errors.join(';'))
|
||||
await ctx.close()
|
||||
})
|
||||
|
||||
await section('审稿记录没存上:不能展开,说明原因', async () => {
|
||||
const { ctx, page, hits, errors } = await open('challenge-approval-norecord')
|
||||
const block = page.locator('[data-challenge="write"]')
|
||||
await block.waitFor()
|
||||
await page.waitForTimeout(300)
|
||||
check('概况、判断照常列出', (await text(block.locator('[data-challenge-count="stands"]'))) === '经受住 7 句'
|
||||
&& await block.locator('[data-challenge-item]').count() === 10)
|
||||
check('每句不再是能点开的按钮(点开也看不到东西)', await block.locator('[data-challenge-toggle]').count() === 0
|
||||
&& await block.locator('[data-challenge-item] [data-challenge-tag]').count() === 10)
|
||||
const norecord = block.locator('[data-challenge-norecord]')
|
||||
check('整块说一句审稿记录没存上、看不了理由和查询', await norecord.count() === 1
|
||||
&& (await text(norecord)) === '反方审稿记录未保存,无法查看理由和查询', await norecord.count() ? await text(norecord) : '没有')
|
||||
check('「另有 N 句未列出」照样交代,只是没有「显示全部」', (await text(block.locator('[data-challenge-more]'))) === '另有 2 句未列出'
|
||||
&& await block.locator('[data-challenge-show-all]').count() === 0)
|
||||
check('没有工件 id:不发取工件的请求', hits.artifacts.length === 0, hits.artifacts.join('、'))
|
||||
check('审稿记录没存上:页面没有报错', errors.length === 0, errors.join(';'))
|
||||
await ctx.close()
|
||||
})
|
||||
|
||||
await section('检查器:字段写进节点配置', async () => {
|
||||
const { ctx, page, hits, errors } = await open('challenge-inspector', { width: 1280, height: 1000 })
|
||||
await page.locator('[data-field="report"]').waitFor()
|
||||
@@ -356,7 +488,10 @@ await section('检查器:字段写进节点配置', async () => {
|
||||
const group = page.locator('[data-field="enabled"] [role="radiogroup"]')
|
||||
check('启用:一组单选,组名是「启用」,默认跟随设置', (await group.getAttribute('aria-label')) === '启用'
|
||||
&& (await group.getAttribute('data-tri-state')) === 'follow' && !('enabled' in (await config(page))))
|
||||
check('跟随设置时说明跟的是哪一项', (await text(page.locator('[data-tri-hint]'))) === '使用「设置 → 核查」中「反方审稿 · 启用」的值')
|
||||
// 指到真实存在的入口:设置页的标签是 模型接入 / 偏好设置 / 运行环境,「核查」一节在偏好设置里
|
||||
check('跟随设置时说明跟的是哪一项(入口写全:设置 → 偏好设置 → 核查)',
|
||||
(await text(page.locator('[data-tri-hint]'))) === '使用「设置 → 偏好设置 → 核查」中「反方审稿 · 启用」的值')
|
||||
check('检查器里提到设置的地方都写全入口', !(await text(panel)).includes('「设置 → 核查」'))
|
||||
await group.locator('[data-tri="off"]').click()
|
||||
check('点关闭:写进 enabled: false', (await config(page))?.enabled === false && (await group.getAttribute('data-tri-state')) === 'off')
|
||||
await page.keyboard.press('ArrowLeft')
|
||||
@@ -395,12 +530,86 @@ await section('检查器:字段写进节点配置', async () => {
|
||||
await page.waitForTimeout(100)
|
||||
check('选中的报告已不在画布上:照实标出,并提醒', (await report.evaluate((s) => s.options[s.selectedIndex]?.textContent)) === 'ghost(已不在画布上)'
|
||||
&& await page.locator('[data-node-pick-hint="missing"]').count() === 1)
|
||||
// 选中的是上游的输入节点(助手改图、导入 JSON 会写出这种配置):它在上游,错在类型,不能说成「不在上游」
|
||||
await page.evaluate(() => {
|
||||
const s = window.__studio.getState()
|
||||
const n = s.nodes.find((x) => x.id === 'critic')
|
||||
s.updateNode('critic', { config: { ...n.data.config, report: 'input' } })
|
||||
})
|
||||
await page.waitForTimeout(100)
|
||||
const notReport = page.locator('[data-node-pick-hint="wrongType"]')
|
||||
check('选中的是上游的非报告节点:下拉照实标「不是报告撰写节点」,提示说清它是哪类节点',
|
||||
(await report.evaluate((s) => s.options[s.selectedIndex]?.textContent)) === '输入(input)(不是报告撰写节点)'
|
||||
&& await notReport.count() === 1 && (await text(notReport)) === '所选节点是「输入」节点,不是报告撰写节点,请重新选择'
|
||||
&& await page.locator('[data-node-pick-hint="notUpstream"]').count() === 0,
|
||||
`${await report.evaluate((s) => s.options[s.selectedIndex]?.textContent)} · ${await notReport.count() ? await text(notReport) : '没有提示'}`)
|
||||
await shot(page, 'inspector-dark')
|
||||
check('检查器:没有发出任何写请求', hits.writes.length === 0, hits.writes.join('、'))
|
||||
check('检查器:页面没有报错', errors.length === 0, errors.join(';'))
|
||||
await ctx.close()
|
||||
})
|
||||
|
||||
await section('检查器:链式接法按服务端的认法定要审的报告', async () => {
|
||||
// schema.challenge_report:留空时先看直接连着的报告撰写节点,恰好一个就审它(「初稿 → 终稿 → 反方审稿」审终稿),
|
||||
// 否则才看整个上游是否只有一个
|
||||
const { ctx, page, errors } = await open('challenge-inspector-chain', { width: 1280, height: 1000 })
|
||||
await page.locator('[data-field="report"]').waitFor()
|
||||
const report = page.locator('[data-field="report"] select')
|
||||
const options = await report.locator('option').evaluateAll((els) => els.map((o) => [o.value, o.textContent]))
|
||||
check('留空那一项写出实际会审的那份(终稿),两份上游报告都可选', JSON.stringify(options) === JSON.stringify([
|
||||
['', '未选择:审上游的「终稿」'], ['draft', '初稿(draft)'], ['final', '终稿(final)']]), JSON.stringify(options))
|
||||
check('服务端照常审终稿、不报错:检查器也不要求选择', await page.locator('[data-node-pick-hint]').count() === 0,
|
||||
await page.locator('[data-node-pick-hint]').count() ? await text(page.locator('[data-node-pick-hint]')) : '')
|
||||
check('反方模型和终稿的模型相同:提醒', await page.locator('[data-verify-same-model]').count() === 1
|
||||
&& (await text(page.locator('[data-verify-same-model]'))).includes('「writer-large」'))
|
||||
// 改成审初稿(模型不同):同模型提醒随之消失
|
||||
await report.selectOption('draft')
|
||||
check('改审初稿:配置写进 report,同模型提醒消失', (await config(page))?.report === 'draft'
|
||||
&& await page.locator('[data-verify-same-model]').count() === 0)
|
||||
await shot(page, 'inspector-chain-dark')
|
||||
check('链式接法:页面没有报错', errors.length === 0, errors.join(';'))
|
||||
await ctx.close()
|
||||
})
|
||||
|
||||
await section('检查器:画布校验报了就不重复说', async () => {
|
||||
// 服务端(F3a 的 _check_challenge)在同样情形下会发 report / model 字段上的问题,检查器把它们挂在字段下面;
|
||||
// 本地那句提示再画一遍就是同一件事说两遍,还一句琥珀一句红(同结论句裁判「校验也会报,报了就不重复说」)
|
||||
const { ctx, page, state, errors } = await open('challenge-inspector', { width: 1280, height: 1000 })
|
||||
await page.locator('[data-field="report"]').waitFor()
|
||||
const reportField = page.locator('[data-field="report"]')
|
||||
const settle = async (issues, wait) => {
|
||||
state.issues = issues
|
||||
await page.evaluate(() => window.__studio.getState().analyzeNow())
|
||||
if (wait) await page.getByText(wait, { exact: false }).first().waitFor()
|
||||
await page.waitForTimeout(150)
|
||||
}
|
||||
check('校验没报时:本地提醒照常(上游有两个)', await page.locator('[data-node-pick-hint="many"]').count() === 1)
|
||||
await settle([{ level: 'error', node_id: 'critic', field: 'report', code: 'challenge.report_invalid', message: SERVER_MANY }], SERVER_MANY)
|
||||
check('校验报了「上游有多个」:字段下只剩服务端那一句', await page.locator('[data-node-pick-hint]').count() === 0
|
||||
&& (await text(reportField)).includes(SERVER_MANY), await text(reportField))
|
||||
await page.evaluate(() => {
|
||||
const s = window.__studio.getState()
|
||||
const n = s.nodes.find((x) => x.id === 'critic')
|
||||
s.updateNode('critic', { config: { ...n.data.config, report: 'ghost' } })
|
||||
})
|
||||
await settle([{ level: 'error', node_id: 'critic', field: 'report', code: 'challenge.report_invalid', message: SERVER_GHOST }], SERVER_GHOST)
|
||||
check('校验报了「不存在这个节点」:不再画本地的「已不在画布上」提示,下拉里照实标出的那一项保留',
|
||||
await page.locator('[data-node-pick-hint]').count() === 0
|
||||
&& (await reportField.locator('select').evaluate((s) => s.options[s.selectedIndex]?.textContent)) === 'ghost(已不在画布上)',
|
||||
await text(reportField))
|
||||
await reportField.locator('select').selectOption('write')
|
||||
await page.locator('[data-field="model"] input').fill('writer-large')
|
||||
await settle([], null)
|
||||
check('校验没报同模型时:本地提醒照常', await page.locator('[data-verify-same-model]').count() === 1)
|
||||
await settle([{ level: 'warning', node_id: 'critic', field: 'model', code: 'challenge.same_model', message: SERVER_SAME }], SERVER_SAME)
|
||||
const modelField = page.locator('[data-field="model"]')
|
||||
check('校验报了「模型相同」:字段下只剩服务端那一句', await page.locator('[data-verify-same-model]').count() === 0
|
||||
&& (await text(modelField)).includes(SERVER_SAME), await text(modelField))
|
||||
await shot(page, 'inspector-dedupe-dark')
|
||||
check('校验报重复:页面没有报错', errors.length === 0, errors.join(';'))
|
||||
await ctx.close()
|
||||
})
|
||||
|
||||
/** 页面和某个容器都没有横向滚动(SQL 框自己的滚动条不算) */
|
||||
async function overflow(page, sel) {
|
||||
return page.evaluate((s) => {
|
||||
@@ -465,6 +674,29 @@ await section('窄屏与深浅色', async () => {
|
||||
check(`390px(${theme}):页面没有报错`, errors.length === 0, errors.join(';'))
|
||||
await ctx.close()
|
||||
}
|
||||
// 这次新加的几行说明(降档原因、运行类别取不到、审稿记录没存上):窄屏不撑宽,深浅色都看得清
|
||||
for (const theme of ['dark', 'light']) {
|
||||
const notes = [
|
||||
['challenge-approval', '[data-challenge-degrade-note]'],
|
||||
['challenge-approval-runfail', '[data-challenge-runclass="failed"] span'],
|
||||
['challenge-approval-norecord', '[data-challenge-norecord]'],
|
||||
]
|
||||
for (const [syn, sel] of notes) {
|
||||
const { ctx, page, errors } = await open(syn, { width: 390, height: 844, theme })
|
||||
await page.locator(sel).waitFor()
|
||||
const o = await overflow(page, '[data-challenge="write"]')
|
||||
const c = await page.evaluate((s) => ({
|
||||
fg: getComputedStyle(document.querySelector(s)).color,
|
||||
bg: getComputedStyle(document.querySelector('[data-challenge="write"]')).backgroundColor,
|
||||
base: getComputedStyle(document.body).backgroundColor,
|
||||
}), sel)
|
||||
const r = contrast(c.fg, c.bg, c.base)
|
||||
check(`390px(${theme})${syn}:说明不横向溢出、对比度 ≥ 4.5`, o.page <= 0 && o.box <= 1 && r >= 4.5, `${JSON.stringify(o)} · ${r.toFixed(2)}`)
|
||||
await shot(page, `${syn.replace('challenge-', '')}-narrow-${theme}`)
|
||||
check(`390px(${theme})${syn}:页面没有报错`, errors.length === 0, errors.join(';'))
|
||||
await ctx.close()
|
||||
}
|
||||
}
|
||||
{
|
||||
const { ctx, page } = await open('challenge-approval-dense', { width: 1100, height: 900 })
|
||||
await page.locator('[data-challenge="write"]').waitFor()
|
||||
|
||||
Reference in New Issue
Block a user