4b3aaff321
治理侧保存输入观测版本、自动复检及人工复核历史,输入变化失效、版本冲突和幂等重放不覆盖人工记录。批量质量数量使用完整筛选元数据,未采集原文不伪造快照,延迟旧扫描不回退新输入。 验证:全仓 make verify 退出码0,Go656及前端253通过;五包竞态、源/组织/质量隔离PG、真实只读源和隔离网页读回复核通过。默认91个可选集成跳过不计通过。未接AI模型,不写DobotAI源库,未推送、未合并、未部署。
52 lines
2.2 KiB
TypeScript
52 lines
2.2 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { parseQAQuality, parseQualitySummary, parseQualityHistory } from './qaQuality'
|
|
import { qualityFixture, summaryFixture, check, review } from './qaQuality.fixture'
|
|
import { parseQARecord, qaCellValue } from './qaOps'
|
|
describe('quality evidence contracts', () => {
|
|
it('renders effective manual labels in agreed columns without changing the rule result', () => {
|
|
const record = parseQARecord({
|
|
id: 'fixture',
|
|
status: 'succeeded',
|
|
question: '示例',
|
|
answer: '暂无已发布',
|
|
asked_at: '2026-10-17T12:00:00Z',
|
|
time_source: 'request_message.created_at',
|
|
asker: '',
|
|
trigger_person: '',
|
|
department: '',
|
|
region: '',
|
|
references: [],
|
|
media: [],
|
|
source_coverage: check.source,
|
|
feedback: { asker_value: '', up: 0, down: 0 },
|
|
coverage: check.result,
|
|
quality: qualityFixture,
|
|
})
|
|
expect(qaCellValue(record, 'coverage')).toBe('是')
|
|
expect(qaCellValue(record, 'is_correct')).toBe('是')
|
|
expect(qaCellValue(record, 'product_category')).toBe('MG400')
|
|
expect(record.coverage.verdict).toBe('uncovered')
|
|
})
|
|
|
|
it('separates immutable rule/source results and explicit human outcomes', () => {
|
|
const v = parseQAQuality(qualityFixture)
|
|
expect(v.effective.coverage).toBe('covered')
|
|
expect(v.automatic.result.verdict).toBe('uncovered')
|
|
})
|
|
it('rejects stale conclusions kept effective and forged revisions', () => {
|
|
expect(() =>
|
|
parseQAQuality({ ...qualityFixture, state: 'stale', input_epoch: 2, automatic: { ...check, input_epoch: 2 } })
|
|
).toThrow()
|
|
expect(() => parseQAQuality({ ...qualityFixture, revision: 2 })).toThrow()
|
|
})
|
|
it('keeps scope counts whole and conservative without made-up rates', () => {
|
|
expect(parseQualitySummary(summaryFixture).summary.total).toBe(3)
|
|
expect(() => parseQualitySummary({ ...summaryFixture, summary: { ...summaryFixture.summary, total: 4 } })).toThrow()
|
|
})
|
|
it('retains pageable human and automatic history independently', () => {
|
|
expect(
|
|
parseQualityHistory({ reviews: [review], checks: [check], next_review: 0, next_check: 0 }).reviews
|
|
).toHaveLength(1)
|
|
})
|
|
})
|