feat(cms): record hand-run legal translation reviews in the CMS (MITHOME-113)

Validation of legal translations is a manual flow (user decision): copy
the prompt, run it in any vendor's model, paste the answer back. The
legal validation block now holds the prompt panel and a list of reviews
(model, date, verdict, pasted answer, notes) instead of a model list and
report link. Approval needs two distinct models whose latest complete
review does not reject; a newer review supersedes a model's rejection.
The locale path collector now looks through row/collapsible wrappers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Do Siki
2026-09-29 11:19:54 +02:00
co-authored by Claude Opus 5.5
parent acd1ff2ed9
commit bff08edafe
12 changed files with 190 additions and 96 deletions
+36 -15
View File
@@ -1,25 +1,46 @@
import { missingLegalValidation, validateLegalApproval } from './legal-validation'
import { acceptingModels, validateLegalApproval } from './legal-validation'
const complete = { models: ['Claude Fable 5.1', 'Claude Opus 5.5'], validatedAt: '2026-09-29', reportRef: 'docs/legal-translation-validation.md' }
const review = (model: string, verdict = 'approve', reviewedAt = '2026-09-29', result = '| Section | … |') => ({
model,
verdict,
reviewedAt,
result,
})
const approve = (reviews: ReturnType<typeof review>[]) =>
validateLegalApproval('approved', { siblingData: { legalValidation: { reviews } } })
describe('legal approval rule (MITHOME-113)', () => {
it('should accept a complete validation record', () => {
expect(missingLegalValidation(complete)).toBeUndefined()
expect(validateLegalApproval('approved', { siblingData: { legalValidation: complete } })).toBe(true)
it('should accept two distinct models with complete, non-rejecting reviews', () => {
expect(approve([review('Claude Opus 5.5'), review('GPT-5', 'approve-with-changes')])).toBe(true)
})
it.each([
[{ ...complete, models: ['Claude Opus 5.5'] }, 'validáló modell'],
[{ ...complete, models: ['Claude Opus 5.5', ' Claude Opus 5.5 '] }, 'validáló modell'],
[{ ...complete, validatedAt: null }, 'dátuma'],
[{ ...complete, reportRef: ' ' }, 'riport'],
[undefined, 'validáló modell'],
])('should reject approval when the record is incomplete (%#)', (record, missing) => {
const result = validateLegalApproval('approved', { siblingData: { legalValidation: record } })
expect(result).toEqual(expect.stringContaining(missing))
it('should not count the same model twice (case- and space-insensitive)', () => {
expect(approve([review('Claude Opus 5.5'), review(' claude opus 5.5 ')])).toEqual(expect.stringContaining('Jelenleg: 1'))
})
it.each(['none', 'ai-draft', undefined])('should not require a record for status %s', (status) => {
it('should ignore incomplete reviews (no pasted answer)', () => {
expect(approve([review('Claude Opus 5.5'), review('GPT-5', 'approve', '2026-09-29', ' ')])).toEqual(expect.any(String))
})
it('should not count a model whose latest verdict is reject', () => {
expect(approve([review('Claude Opus 5.5'), review('GPT-5', 'reject')])).toEqual(expect.any(String))
})
it('should let a newer review of the same model supersede its rejection', () => {
const reviews = [review('GPT-5', 'reject', '2026-09-28'), review('GPT-5', 'approve', '2026-09-30'), review('Claude Opus 5.5')]
expect(acceptingModels({ reviews })).toEqual(['GPT-5', 'Claude Opus 5.5'])
expect(approve(reviews)).toBe(true)
})
it('should keep an older approval superseded by a newer rejection out', () => {
expect(acceptingModels({ reviews: [review('GPT-5', 'approve', '2026-09-28'), review('GPT-5', 'reject', '2026-09-30')] })).toEqual([])
})
it.each(['none', 'ai-draft', undefined])('should not require reviews for status %s', (status) => {
expect(validateLegalApproval(status, { siblingData: {} })).toBe(true)
})
it('should handle a missing record', () => {
expect(acceptingModels(undefined)).toEqual([])
})
})