Round 12 drift loop on ts2 (5 random baseline per module) surfaced:
- BS-新38: 5/8 modules fail BS-56 when --enCode='round12-foo' contains '-'.
Add autoStripEnCode() helper + apply at 7 create.ts action entries.
workflow/_validate.ts also de-dupes: import shared ENCODE_REGEXP+validateEnCode
instead of local copy (was 5th duplicate).
- BS-新39: 4/5 DI hit 'name cannot be repeated' (BS-47 EXIST002) at backend.
Root cause: di/create.ts:251 hardcoded category filter, step machine only
scans one category so cross-category enCode duplicates slipped through.
Fix: remove hardcoded filter, scan all DIs platform-wide. Better error msg.
- BS-新40: 5/5 report rebuild lost cells — baseline f_content 126k-466k chars
ureport XML replaced by default '{cells:[]}'' stub.
Fix: add --from-json-file option (mirrors di/create.ts pattern), reads full
baseline body and overrides required fields.
Tests: 28/28 PASS
- tests/integration/drift/round12-cross-module.spec.ts (Round 12 sweep)
- tests/integration/drift/round12-fix-batch1.spec.ts (batch 1 regression)
Docs: docs/drift/2026-07-15-round12-summary.md + ...-fix-batch1.md
Co-Authored-By: Claude <[email protected]>
110 lines
4.9 KiB
TypeScript
110 lines
4.9 KiB
TypeScript
/**
|
|
* ts2-datascreen-drift.spec.ts — Round 15 (ts2 应用) datascreen drift 测试 (2026-07-15)
|
|
*
|
|
* 目的: drift loop 首次覆盖 datascreen 模块. 在 ts2 重建 5 个 baseline 大屏, 验证
|
|
* 组件 config / 持久化 / 元数据保留情况.
|
|
*
|
|
* 数据源:
|
|
* - baseline: 5 随机 (数据大屏模板5/3/82/68/59, systemId=664077319056394182)
|
|
* - rebuilt: ts2
|
|
*
|
|
* 漂移类别 (Round 15 ts2 实测, 严重):
|
|
* - BS-drift-DS-1: component_config_lost (5/5) — construct 报告 9 组件, info 拉回 0
|
|
* 持久化路径有问题; --template=base 固定 9 demo 组件也无法保留 baseline
|
|
* - BS-drift-DS-2: bigscreen_list_empty — 重建后 list 返 0 条 (跨 system_id 不可见?)
|
|
* - BS-drift-DS-3: info_missing_enCode_status — bigscreen info 响应缺字段
|
|
*
|
|
* baseline 抓取建议: fetch-baseline.sh 应增补 `bigscreen info --id=X` 调用, 存
|
|
* config.detail + config.component (组件 name/title/prop/type)
|
|
*/
|
|
|
|
import { describe, it, expect } from 'vitest'
|
|
import { existsSync, readFileSync } from 'fs'
|
|
|
|
const REBUILT_DS = [
|
|
{ baselineId: '571466291888231', baselineTitle: '数据大屏模板5', baselineCategory: 1, baselineComponentCount: 36,
|
|
constructReportedComponents: 9, persistedComponents: 0,
|
|
rebuiltId: '846970512398615045' },
|
|
{ baselineId: '571466291888217', baselineTitle: '数据大屏模板3', baselineCategory: 1, baselineComponentCount: 31,
|
|
constructReportedComponents: 9, persistedComponents: 0,
|
|
rebuiltId: '846970699472962053' },
|
|
{ baselineId: '571466291892314', baselineTitle: '数据大屏模板82', baselineCategory: 1, baselineComponentCount: 42,
|
|
constructReportedComponents: 9, persistedComponents: 0,
|
|
rebuiltId: '846970713213501957' },
|
|
{ baselineId: '571466291892298', baselineTitle: '数据大屏模板68', baselineCategory: 1, baselineComponentCount: 26,
|
|
constructReportedComponents: 9, persistedComponents: 0,
|
|
rebuiltId: '846970896018047493' },
|
|
{ baselineId: '571466291888238', baselineTitle: '数据大屏模板59', baselineCategory: 1, baselineComponentCount: 9,
|
|
constructReportedComponents: 9, persistedComponents: 0,
|
|
rebuiltId: '846970909611786757' },
|
|
]
|
|
|
|
describe('ts2-datascreen-drift: component_config_lost (construct 9 → persist 0) — BS-drift-DS-1', () => {
|
|
/**
|
|
* 漂移模式: --template=base 固定构造 9 个 demo 组件, 本身已丢 baseline 真实组件.
|
|
* 更严重: construct 报告 "9 组件已写入", info 拉回 component=[] (持久化为 0).
|
|
* 命中: 5/5.
|
|
*/
|
|
it.each(REBUILT_DS)(
|
|
'BS-drift-DS-1: $baselineTitle baseline $baselineComponentCount 组件 → construct 报 $constructReportedComponents → persist 0',
|
|
({ baselineComponentCount, constructReportedComponents, persistedComponents }) => {
|
|
expect(baselineComponentCount).toBeGreaterThan(0)
|
|
expect(constructReportedComponents).toBe(9)
|
|
expect(persistedComponents).toBe(0) // 漂移证据
|
|
}
|
|
)
|
|
|
|
it('BS-drift-DS-1: 5/5 baseline 组件数 > 0, 但持久化后全 0', () => {
|
|
const allLoss = REBUILT_DS.every(d => d.persistedComponents === 0)
|
|
expect(allLoss).toBe(true)
|
|
})
|
|
})
|
|
|
|
describe('ts2-datascreen-drift: bigscreen_list_empty (跨 system_id 不可见) — BS-drift-DS-2', () => {
|
|
/**
|
|
* 漂移模式: ts2 重建大屏后, `dacli bigscreen list` 返 0 条; 同样的 baseline 大屏
|
|
* (workSystem) 在 workSystem 切应用时 list 也返 0. 疑似 list 端点对当前
|
|
* system_id 过滤, 跨 app 不可见.
|
|
*/
|
|
it('BS-drift-DS-2: ts2-list-after.json 存在但 records=0', () => {
|
|
const f = '/tmp/dacli-loop/ts2/datascreen/ts2-list-after.json'
|
|
if (existsSync(f)) {
|
|
const d = JSON.parse(readFileSync(f, 'utf-8'))
|
|
expect(d.records.length).toBe(0)
|
|
}
|
|
})
|
|
})
|
|
|
|
describe('ts2-datascreen-drift: info_missing_enCode_status — BS-drift-DS-3', () => {
|
|
/**
|
|
* 漂移模式: bigscreen info 响应缺 enCode 和 status 字段, AI 自动化脚本判断不出 release 状态.
|
|
*/
|
|
it.each(REBUILT_DS)(
|
|
'BS-drift-DS-3: $baselineTitle 重建后 info 缺 enCode/status (dacli fetch 拿不到完整 schema)',
|
|
({ baselineId }) => {
|
|
// 重建大屏 id 用 dacli info 应能查; 但缺字段, 记录此限制
|
|
// 不强制断言, 仅标记已知问题
|
|
expect(baselineId).toMatch(/^\d+$/)
|
|
}
|
|
)
|
|
})
|
|
|
|
describe('ts2-datascreen-drift: baseline 明细可获取 (亮点)', () => {
|
|
/**
|
|
* 亮点: 5 个 baseline 大屏 `dacli bigscreen info --id=X` 跨 app 成功返回,
|
|
* 组件级 diff 可行, 解决了本轮元数据盲点.
|
|
*/
|
|
it('5 个 baseline 明细文件存在 (baseline-XXX.json)', () => {
|
|
for (const d of REBUILT_DS) {
|
|
const f = `/tmp/dacli-loop/ts2/datascreen/baseline-${d.baselineId}.json`
|
|
expect(existsSync(f)).toBe(true)
|
|
}
|
|
})
|
|
})
|
|
|
|
describe('ts2-datascreen-drift: 整体回归', () => {
|
|
it('5 个 baseline 全部成功重建 (5/5, 但组件全丢)', () => {
|
|
expect(REBUILT_DS.length).toBe(5)
|
|
})
|
|
})
|