mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-19 10:42:01 +00:00
Excel 导入改造期 3:网格交互、自助修复、按期累积——每月的报表可以累积成一份跨月的表,漂移了点修复按钮就能接着导入,网格上框一块就能写进配方,版本页可以回滚、移除一期、清除原件
按期累积(新 recipe_accumulate;table_versions 扩展) - 按统计期出的交叉表报表首次导入时默认「按期累积」,由人确认;一期一个构建,两期及以上物化成一份新的 SQLite 快照,不用视图 - 统计期完全相同要勾「替换该期」,部分重叠拒收,中间有空缺要确认;物化前逐期核对库哈希和行号,并集上另加行数守恒、主键唯一、日期落在所属统计期三条核对 - 配方演进分三档:新增列(早期各期为空值)、退役的列和表保留旧值(只在这次才退役时要勾)、不兼容变化只能显式「重新开始累积」 - 快照 id 在累积时含目标配方和模式;同样的输入物化两次库哈希相同,同一文件换名再传直接复用 - 说明按期合并,任何一期没核对过就不写「已核对」;各期维度取值不同、退役列、合计表都有提示,经过数字检查 修复按钮(新 recipe_fixes;执行器给问题带结构化参数) - 加入标签、移除标签、声明为合计行、分段标题改名、编辑恒等式成员、按锚点忽略行/列/区域外文字、声明占位符、声明隐藏行处理、工作表改名 - 服务端算补丁,先预览新旧配方对照、再应用,可以撤销;补丁封闭,不引入正则、自由文本常量和写死坐标;修复进确认清单 - 只改分段标题、新标题仍含原来选的词时沿用已确认的常量,不算破坏性变更;修复后只查改动过的段的认领,没改的关系交给试运行核对 框选转锚点(新 recipe_select) - 网格上框选(鼠标、键盘、区域输入),按八种用途换算成按文字认的锚点,立刻干跑比对;配方里不存坐标,泛化不了时列出原因 - 整张表挪位后同一配方照样认得;框进合计行、夹着小计、表下说明都有明确的处理 确认与对照(recipe_confirm、recipe_diff、新 recipe_compare) - 改配方后确认清单只列有变化的项(同时按本期数据比较),不用每修一次重勾十来项;新旧配方对照界面;按规则重新起草并把名字对齐到现行配方 - 改配方后已体现在配方里的回答保留,矛盾的列出来请人重答 - 「排除的行」写进回执和导入清单:隐藏行、跳过的空行、按配方忽略的行、停止后的文字行、只核对不另存的合计行 版本页(新 source_versions、api/source_versions;前端 VersionsDialog) - 快照与导入记录列表、启用旧版本(可写理由)、查看清单、移除一期、作废接受、清除原件;写操作带界面看到的当前版本,并发改动回 409,不静默丢期 - 除当前版本和被运行引用的版本外,再保留最近 3 个版本供回滚;遮罩列丢失要明确确认 期 1、期 2 遗留 - 重传撞上被改过的构建文件:能用本次上传恢复就隔离旧文件再恢复,否则回 409,不再是 500 - 跳过空行的列表不再把表下隔一行的说明读成数据;不像说明的单格行要人确认;受影响的配方构建换 id - 版本存储加进程级文件锁:第二个进程拿不到锁时不清理、不回收,写操作回 503(部署本来就是单进程)
This commit is contained in:
@@ -78,13 +78,14 @@ const ORDER = [
|
||||
'chat', // 问数据
|
||||
'runs', // 记录
|
||||
'manage', // 数据、工具、知识、设置
|
||||
'versions', // 上传表格的版本:回滚、清单、移除一期、清除原件
|
||||
'ui', // 各页面端到端,连真数据
|
||||
]
|
||||
// 各项的耗时(秒)。只决定排队顺序:长的先开跑,短的填空,结果不受影响。新加的检查不在表里就按 60 秒算;
|
||||
// 拆开的两项看 SPLIT 里各份的 est。2026-09-29 八道并行、关浏览器不干等之后的实测
|
||||
const ESTIMATE = {
|
||||
stream: 173, chat: 160, studio: 149, manage: 145, runs: 112, publish: 92, shell: 87,
|
||||
evidence: 85, 'ui-kit': 70, ui: 61, guards: 8, 'canvas-layout': 2, copy: 2, tokens: 1, trace: 1, decode: 1,
|
||||
evidence: 85, versions: 60, 'ui-kit': 70, ui: 61, guards: 8, 'canvas-layout': 2, copy: 2, tokens: 1, trace: 1, decode: 1,
|
||||
}
|
||||
// 最慢的两项按段拆成几份。用的是它们自己的段过滤:最后一份用 *_SKIP 兜住「其余全部」,以后新加的段
|
||||
// 不用改这里也跑得到(拆出去的那几份要是一段都没对上,那一份会报「一项都没跑」)。
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -912,6 +912,61 @@ await section('confirmDialog / promptDialog', async () => {
|
||||
await page.waitForTimeout(100)
|
||||
check('回车提交,返回去掉首尾空白的名字', (await result()) === '"月度经营分析"')
|
||||
|
||||
// 空输入:默认(allowEmpty 关)报「不能为空」、确认禁用、回车不提交;打开 allowEmpty(版本页「启用」收可选理由)
|
||||
// 时空输入和只有空白都能确认,返回空字符串,非空时 validate 照旧生效
|
||||
const dialogText = (t) => page.locator('[role="dialog"]').getByText(t, { exact: true }).count()
|
||||
await page.click('#open-prompt')
|
||||
await page.waitForSelector('[role="dialog"]')
|
||||
await page.waitForTimeout(80)
|
||||
const createBtn = page.getByRole('button', { name: '新建', exact: true })
|
||||
await input.fill(' ')
|
||||
await page.waitForTimeout(50)
|
||||
check('默认不允许空:只有空白时报「不能为空」并禁用确认', (await dialogText('不能为空')) === 1 && await createBtn.isDisabled())
|
||||
await input.fill('')
|
||||
await input.press('Enter')
|
||||
await page.waitForTimeout(100)
|
||||
check('……清空后回车不提交,确认仍禁用', (await dialogOpen()) === 1 && await createBtn.isDisabled())
|
||||
await page.getByRole('button', { name: '取消' }).click()
|
||||
await page.waitForTimeout(100)
|
||||
check('……取消返回 null', (await result()) === 'null')
|
||||
|
||||
const openOptional = () => page.evaluate(() => {
|
||||
window.__optional = undefined
|
||||
void window.__ui.promptDialog({
|
||||
title: '启用这个版本?', label: '理由(可选)', confirmLabel: '启用', allowEmpty: true,
|
||||
validate: (v) => (v.length > 6 ? '理由太长' : null),
|
||||
}).then((v) => { window.__optional = v })
|
||||
})
|
||||
const optional = () => page.evaluate(() => window.__optional)
|
||||
const enableBtn = page.getByRole('button', { name: '启用', exact: true })
|
||||
await openOptional()
|
||||
await page.waitForSelector('[role="dialog"]')
|
||||
await page.waitForTimeout(80)
|
||||
check('allowEmpty:空输入时确认可用,不报「不能为空」', !(await enableBtn.isDisabled()) && (await dialogText('不能为空')) === 0)
|
||||
await input.fill(' ')
|
||||
await page.waitForTimeout(50)
|
||||
check('……只有空白也可用,不报「不能为空」', !(await enableBtn.isDisabled()) && (await dialogText('不能为空')) === 0)
|
||||
await input.fill('这段理由写得太长了')
|
||||
await page.waitForTimeout(50)
|
||||
check('……填了内容时 validate 照旧生效(报原因、禁用)', (await dialogText('理由太长')) === 1 && await enableBtn.isDisabled())
|
||||
await input.fill(' ')
|
||||
await input.press('Enter')
|
||||
await page.waitForTimeout(100)
|
||||
check('……空着回车确认,返回空字符串(不是 null)', (await dialogOpen()) === 0 && (await optional()) === '', JSON.stringify(await optional()))
|
||||
await openOptional()
|
||||
await page.waitForSelector('[role="dialog"]')
|
||||
await page.waitForTimeout(80)
|
||||
await input.fill(' 传错了 ')
|
||||
await enableBtn.click()
|
||||
await page.waitForTimeout(100)
|
||||
check('……填了就返回去掉首尾空白的文字', (await optional()) === '传错了', JSON.stringify(await optional()))
|
||||
await openOptional()
|
||||
await page.waitForSelector('[role="dialog"]')
|
||||
await page.waitForTimeout(80)
|
||||
await page.getByRole('button', { name: '取消' }).click()
|
||||
await page.waitForTimeout(100)
|
||||
check('……取消仍返回 null', (await optional()) === null, JSON.stringify(await optional()))
|
||||
|
||||
// 嵌套:弹窗里再弹确认,Esc 只关一层
|
||||
await page.click('#open-dirty')
|
||||
await page.waitForSelector('[role="dialog"]')
|
||||
@@ -1055,6 +1110,49 @@ await section('管理页共用件:页头、连通胶囊、单选组、删除
|
||||
await page.evaluate(() => window.__ui.toast.dismiss())
|
||||
})
|
||||
|
||||
await section('提示条 Notice、回执块(期 3 共用件:导入向导、修复面板、版本页都用这一份)', async () => {
|
||||
await page.locator('#notice-demo').scrollIntoViewIfNeeded()
|
||||
const notices = page.locator('#notice-demo [data-notice]')
|
||||
check('Notice:三种语气各一条', (await notices.count()) === 3)
|
||||
const tones = await notices.evaluateAll((els) => els.map((el) => ({
|
||||
tone: el.getAttribute('data-notice'), demo: el.getAttribute('data-demo-notice'), role: el.getAttribute('role'),
|
||||
icons: el.querySelectorAll(':scope > svg[aria-hidden="true"]').length,
|
||||
border: getComputedStyle(el).borderTopColor, cls: el.className,
|
||||
})))
|
||||
const sameNode = tones.every((t) => t.tone === t.demo)
|
||||
check('attr 原样挂在根节点上(与 data-notice 同一个元素)', sameNode, sameNode ? '' : JSON.stringify(tones.map((t) => [t.tone, t.demo])))
|
||||
check('info 是 status(礼貌播报),warn、err 是 alert', tones.map((t) => `${t.tone}:${t.role}`).join(',') === 'info:status,warn:alert,err:alert')
|
||||
check('每条一个图标,不进读屏', tones.every((t) => t.icons === 1))
|
||||
const distinct = new Set(tones.map((t) => t.border)).size === 3
|
||||
check('三种语气的边框颜色互不相同', distinct, distinct ? '' : tones.map((t) => t.border).join(' | '))
|
||||
const merged = /\brounded-lg\b/.test(tones[2].cls) && /\bmt-1\b/.test(tones[2].cls)
|
||||
check('className 追加在默认样式之后', merged, merged ? '' : tones[2].cls)
|
||||
check('children 原样渲染(第二行的细节在提示条里)', (await page.locator('#notice-demo [data-notice="err"] #notice-detail').count()) === 1)
|
||||
|
||||
const sum = page.locator('#receipt-demo [data-receipt-summary]')
|
||||
await sum.scrollIntoViewIfNeeded()
|
||||
check('回执摘要:非空单元格总数和「全部有去处」', /非空单元格 771 个,全部有去处/.test(await sum.locator('[data-summary-ledger]').innerText()))
|
||||
check('回执摘要:表与行数', (await sum.locator('[data-summary-table="日客流"]').getAttribute('data-rows')) === '30')
|
||||
check('回执摘要:占位符、规范写法', (await sum.locator('[data-summary-placeholders]').innerText()).includes('「·」30 格')
|
||||
&& (await sum.locator('[data-summary-canonicalized]').getAttribute('data-summary-canonicalized')) === '17')
|
||||
check('排除的行:逐项列出', (await sum.locator('[data-excluded-reason]').count()) === 3
|
||||
&& (await sum.locator('[data-summary-excluded]').getAttribute('data-summary-excluded')) === '3')
|
||||
const text = await sum.innerText()
|
||||
const reasons = !/ignored_rows|total_not_kept|mystery_reason/.test(text)
|
||||
&& text.includes('按配方忽略的行') && text.includes('只核对、不另存的合计行') && text.includes('其他原因')
|
||||
check('排除的行:原因写中文,不露枚举值;认不出的写「其他原因」', reasons, reasons ? '' : text.replace(/\s+/g, ' ').slice(0, 200))
|
||||
check('排除的行:锚点原文、行号区间、格数', text.includes('「补录(人次)」') && text.includes('第 32 行')
|
||||
&& text.includes('第 28–30 行') && text.includes('93 格'))
|
||||
check('排除的行的根节点同时带 data-rows-excluded 和规格里的旧名 data-rows-dropped',
|
||||
(await sum.locator('[data-rows-excluded][data-rows-dropped]').count()) === 1)
|
||||
await sum.locator('[data-excluded-rows="32-32"]').click()
|
||||
check('点行号定位到那一行(工作表!A行号)', (await page.locator('#receipt-focus').innerText()) === '客流汇总!A32')
|
||||
const unrecorded = page.locator('#receipt-unrecorded [data-summary-excluded]')
|
||||
check('回执里没有 rows_excluded(期 3 之前的导入):写「未记录」,不当作「没有」',
|
||||
(await unrecorded.getAttribute('data-summary-excluded')) === 'unrecorded'
|
||||
&& (await unrecorded.innerText()).includes('这次导入未记录排除的行'))
|
||||
})
|
||||
|
||||
await section('空态:catalog 的表没取回来时不说「还没有」', async () => {
|
||||
const sourceEmpty = page.locator('#empty-source-demo')
|
||||
await page.evaluate(() => window.__ui.useCatalog.getState().refresh())
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user