用户提供的历史百分比独立持久化,按ISO自然周和截止范围读取,不伪造分子分母、记录数或冻结时间。现有两张趋势图与PNG共用来源分色/分段及两位小数;缺失周留空,关键词筛选不借用无明细历史,当前指标与原冻结证据不变。 验证:完整make verify退出0;镜像全量隔离PG race退出0,新增来源/精度/关键词/租户/截止/不可变和安全down回归先失败后通过。前端输入/来源及缺失周回归先红后绿。治理库上线前原生备份与真实恢复已完成,71表行数和28张QA表内容哈希一致,独立主密钥同时受限备份。 当前仅完成开发验证,真实数据候选浏览器验收、正式25周导入与应用上线需继续完成。不修改源生产数据库、原问答、已有模型自动开关或隧道;用户原始报表和图像只保存于私有证据目录,不入Git。
This commit is contained in:
@@ -1,6 +1,36 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { parseQADashboard } from './qaDashboardData'
|
||||
import { dashboardFixture } from './qaDashboard.fixture'
|
||||
const reported = {
|
||||
week: '2026WK40',
|
||||
week_start: '2026-09-28T00:00:00+08:00',
|
||||
week_end: '2026-10-05T00:00:00+08:00',
|
||||
coverage_percent: 57.23,
|
||||
correctness_percent: 92.34,
|
||||
source: 'user_provided_history',
|
||||
}
|
||||
describe('reported historical rates', () => {
|
||||
it('keeps supplied percentages without inventing denominator or freeze time', () => {
|
||||
const result = parseQADashboard({ ...dashboardFixture, reported_weeks: [reported] })
|
||||
expect(result.reported_weeks).toEqual([reported])
|
||||
expect(result.frozen_weeks).toEqual(parseQADashboard(dashboardFixture).frozen_weeks)
|
||||
expect(result.quality).toEqual(parseQADashboard(dashboardFixture).quality)
|
||||
})
|
||||
it('rejects invalid, duplicate, future, wrongly labelled and keyword-scoped supplied history', () => {
|
||||
for (const input of [
|
||||
{ ...dashboardFixture, reported_weeks: [reported, reported] },
|
||||
{ ...dashboardFixture, reported_weeks: [{ ...reported, denominator: 100 }] },
|
||||
{ ...dashboardFixture, reported_weeks: [{ ...reported, coverage_percent: 100.01 }] },
|
||||
{ ...dashboardFixture, reported_weeks: [{ ...reported, correctness_percent: null }] },
|
||||
{ ...dashboardFixture, reported_weeks: [{ ...reported, source: 'frozen' }] },
|
||||
{ ...dashboardFixture, reported_weeks: [{ ...reported, week: '2026WK41' }] },
|
||||
{ ...dashboardFixture, reported_weeks: [{ ...reported, week_end: '2027-01-01T00:00:00+08:00' }] },
|
||||
{ ...dashboardFixture, keyword: 'needle', reported_weeks: [reported] },
|
||||
])
|
||||
expect(() => parseQADashboard(input)).toThrow()
|
||||
})
|
||||
})
|
||||
|
||||
describe('complete dashboard data contract', () => {
|
||||
it('keeps distinct cumulative, week, month and genuinely frozen periods', () => {
|
||||
const data = parseQADashboard(dashboardFixture)
|
||||
|
||||
Reference in New Issue
Block a user