mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-18 10:12:00 +00:00
交叉表支持按文字导入的指标(如「高峰时段」一行写着「18-19」),堵上占位符陷阱:配方的 measures 分段加 text_measures(标签 → text / hour_range),落成文字列(时段存规范写法),空格、公式、占位符照块的取值规则,数字、日期、解析不了的时段报 value_not_text / value_not_hour_range;规则起草遇到无标题指标块里整行是文字的行(标签不带词表单位)按文字指标起草,并出卡片和问题要人确认(「不是」就去掉,回到按数字导入、试运行拒收),确认清单加 text_measure 项,前后对照报类型和存法变化;数值区不合格的格一行合成一条起草失败(不再一行 30 条)。陷阱:以前照「请添加占位符」把「18-19」加成占位符,整格静默存成空值、干跑照样通过——静态校验拒收含数字的占位符(placeholder_digits,重放和沿用现行配方的放行),value_not_number 的下一步按格子情况写:整行文字的提示改「指标类型」并给修复按钮 declare_text_measure,含数字的不再提示加占位符;标签带单位的拒按文字导入(text_measure_unit),文字列不能写单位(unit_on_text)。配方面板每个指标多一个「指标类型」下拉(数字 / 时段 / 文字)。默认值不进规范形式,已存配方的哈希不变。测试 tests/test_recipe_text_measures.py(合成夹具,假名);check-manage 加指标类型三项
This commit is contained in:
@@ -2528,13 +2528,34 @@ await section('数据 · 表格:按配方导入', async () => {
|
||||
check('勾选「没有小计行」:发 PUT,no_subtotals 为 true、没有配小计', noSub?.no_subtotals === true && !noSub?.subtotals,
|
||||
JSON.stringify(noSub ?? {}))
|
||||
await page.waitForTimeout(300)
|
||||
// 指标类型:整行是文字的指标(如「高峰时段」写着「18-19」)改按时段 / 文字导入,落成文字列、去掉单位;改回数字时按标签补回单位
|
||||
const kindSel = panel.locator('[data-field="/sheets/0/blocks/0/segments/0/text_measures/分区乙(人次)"]')
|
||||
const kindOptions = await kindSel.locator('option').evaluateAll((os) => os.map((o) => `${o.value}:${o.textContent}`))
|
||||
check('指标类型是下拉框:数字、时段、文字', JSON.stringify(kindOptions) === JSON.stringify([':数字', 'hour_range:时段', 'text:文字']),
|
||||
kindOptions.join(','))
|
||||
replies.recipe.push(echo())
|
||||
await kindSel.selectOption('hour_range')
|
||||
await until(async () => puts().length === 7, 4000)
|
||||
const k1 = puts()[6]?.body?.recipe
|
||||
check('改成「时段」:发 PUT,text_measures 写上 hour_range,这一列的单位去掉',
|
||||
k1?.sheets?.[0]?.blocks?.[0]?.segments?.[0]?.text_measures?.['分区乙(人次)']?.parser === 'hour_range'
|
||||
&& !('分区乙' in (k1?.tables?.[0]?.units ?? {})), JSON.stringify(k1?.tables?.[0]?.units ?? {}))
|
||||
await page.waitForTimeout(300)
|
||||
replies.recipe.push(echo())
|
||||
await kindSel.selectOption('')
|
||||
await until(async () => puts().length === 8, 4000)
|
||||
const k2 = puts()[7]?.body?.recipe
|
||||
check('改回「数字」:发 PUT,text_measures 去掉这一项,单位按标签补回「人次」',
|
||||
!('分区乙(人次)' in (k2?.sheets?.[0]?.blocks?.[0]?.segments?.[0]?.text_measures ?? {}))
|
||||
&& k2?.tables?.[0]?.units?.['分区乙'] === '人次', JSON.stringify(k2?.tables?.[0]?.units ?? {}))
|
||||
await page.waitForTimeout(300)
|
||||
// 有问题的配方:一条对得上字段(单位),一条对不上(挂到面板顶部)
|
||||
replies.recipe.push(echo({ recipe_problems: [
|
||||
{ path: '/tables/0/units/分区甲', code: 'unit_label_conflict', message: '表「日客流量」:列「分区甲」的单位与标签「分区甲(人次)」不一致' },
|
||||
{ path: '/sheets/0/blocks/0/label_offset', code: 'schema', message: '第 1 个工作表的交叉表:标签列偏移只能是紧挨日期的左侧一列' },
|
||||
] }))
|
||||
await panel.locator('[data-field="/tables/0/units/分区甲"]').selectOption('人')
|
||||
await until(async () => puts().length === 7, 4000)
|
||||
await until(async () => puts().length === 9, 4000)
|
||||
await page.waitForTimeout(300)
|
||||
const trialBtn = wizard().locator('[data-trial-run]')
|
||||
check('配方有问题时「试运行」禁用', await trialBtn.isDisabled())
|
||||
@@ -2548,8 +2569,8 @@ await section('数据 · 表格:按配方导入', async () => {
|
||||
await panel.locator('[data-recipe-paste-toggle]').click()
|
||||
await panel.locator('[data-recipe-paste] textarea').fill(JSON.stringify(FLOW_RECIPE))
|
||||
await panel.locator('[data-recipe-paste] button', { hasText: '保存配方' }).click()
|
||||
await until(async () => puts().length === 8, 4000)
|
||||
check('「粘贴配方」发 PUT,body 就是粘贴的配方', JSON.stringify(puts()[7]?.body?.recipe) === JSON.stringify(FLOW_RECIPE))
|
||||
await until(async () => puts().length === 10, 4000)
|
||||
check('「粘贴配方」发 PUT,body 就是粘贴的配方', JSON.stringify(puts()[9]?.body?.recipe) === JSON.stringify(FLOW_RECIPE))
|
||||
await page.waitForTimeout(300)
|
||||
check('……问题清掉以后「试运行」可用', await trialBtn.isEnabled())
|
||||
// 连续修改:上一次 PUT 还没回来就接着改。上一次回来时,排在后面的修改不能被服务端那份盖掉,
|
||||
|
||||
Reference in New Issue
Block a user