2e29b611c9
Phase 1A — Haftungs-kritische Fixes: - SIL/PL-Badges als "Vorab-Einschaetzung" mit Tooltip gekennzeichnet - Coverage-Disclaimer in CE-Akte, Projekt-Uebersicht und Print-Export - Norm-Referenzen: 42 Kapitelverweise durch Themen-Deskriptoren ersetzt Phase 1B — Massnahmen-Verkabelung: - 16 neue Massnahmen (M201-M216) fuer bisher unabgedeckte Kategorien (communication_failure, hmi_error, firmware_corruption, maintenance, sensor_fault, mode_confusion) - Kategorie-Fallback im Initialize-Endpoint: ordnet Massnahmen aus der Bibliothek automatisch per HazardCategory zu (max 8 pro Kategorie) - Total: 225 → 241 Massnahmen, 0 Kategorien ohne Massnahmen Phase 1C — Explainability Engine: - MatchReason Struct in PatternMatch (type, tag, met) - Pattern Engine schreibt fuer jeden Match strukturierte Begruendungen - Frontend zeigt "Erkannt weil: Komponente X, Energie Y, Kein Ausschluss Z" Weitere Aenderungen: - BAuA/OSHA Regulatory Hints: 3 Enrich-Endpoints (per Hazard, per Measure, Batch) - Dokumente-Tab in IACE-Bibliothek (36.708 Chunks aus Qdrant) - Varianten-UX: Basis-Projekt-Summary auf Varianten-Seite - Projekt-Initialisierung: POST /initialize kettet Parse→Komponenten→Patterns→Hazards→Massnahmen→Normen - 18 pre-existing TS-Fehler gefixt, Route-Konflikt behoben - Component-Library + Measures-Library Tests aktualisiert Tests: Go alle bestanden, TS 0 Fehler, Playwright 141+ bestanden Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
60 lines
1.9 KiB
TypeScript
60 lines
1.9 KiB
TypeScript
/**
|
|
* Tests for RAG Config — ensures all document types have valid mappings.
|
|
*/
|
|
|
|
import { describe, it, expect } from 'vitest'
|
|
import { DOCUMENT_RAG_CONFIG } from '../rag-config'
|
|
import type { ScopeDocumentType } from '@/lib/sdk/compliance-scope-types'
|
|
|
|
// All 18 ScopeDocumentType values
|
|
const ALL_DOCUMENT_TYPES: ScopeDocumentType[] = [
|
|
'vvt', 'lf', 'tom', 'av_vertrag', 'dsi', 'betroffenenrechte',
|
|
'dsfa', 'daten_transfer', 'datenpannen', 'einwilligung',
|
|
'vertragsmanagement', 'schulung', 'audit_log', 'risikoanalyse',
|
|
'notfallplan', 'zertifizierung', 'datenschutzmanagement', 'iace_ce_assessment',
|
|
]
|
|
|
|
// Known RAG collections in bp-core-rag-service
|
|
const VALID_COLLECTIONS = [
|
|
'bp_dsfa_corpus',
|
|
'bp_compliance_datenschutz',
|
|
'bp_compliance_gesetze',
|
|
'bp_compliance_recht',
|
|
'bp_compliance_ce',
|
|
]
|
|
|
|
describe('DOCUMENT_RAG_CONFIG', () => {
|
|
it('should have an entry for all 18 ScopeDocumentType values', () => {
|
|
for (const docType of ALL_DOCUMENT_TYPES) {
|
|
expect(DOCUMENT_RAG_CONFIG[docType]).toBeDefined()
|
|
}
|
|
})
|
|
|
|
it('should have exactly 18 entries', () => {
|
|
expect(Object.keys(DOCUMENT_RAG_CONFIG)).toHaveLength(18)
|
|
})
|
|
|
|
it('should use valid collection names', () => {
|
|
for (const [, config] of Object.entries(DOCUMENT_RAG_CONFIG)) {
|
|
expect(VALID_COLLECTIONS).toContain(config.collection)
|
|
}
|
|
})
|
|
|
|
it('should have non-empty queries for all types', () => {
|
|
for (const [, config] of Object.entries(DOCUMENT_RAG_CONFIG)) {
|
|
expect(config.query).toBeTruthy()
|
|
expect(config.query.length).toBeGreaterThan(5)
|
|
}
|
|
})
|
|
|
|
it('should have DSFA mapped to bp_dsfa_corpus', () => {
|
|
expect(DOCUMENT_RAG_CONFIG.dsfa!.collection).toBe('bp_dsfa_corpus')
|
|
})
|
|
|
|
it('should have unique queries for each document type', () => {
|
|
const queries = Object.values(DOCUMENT_RAG_CONFIG).map(c => c.query)
|
|
const uniqueQueries = new Set(queries)
|
|
expect(uniqueQueries.size).toBe(queries.length)
|
|
})
|
|
})
|