fix(sdk): Align scope types with engine output + project isolation + optional block progress
Some checks failed
CI/CD / go-lint (push) Has been skipped
CI/CD / python-lint (push) Has been skipped
CI/CD / nodejs-lint (push) Has been skipped
CI/CD / test-go-ai-compliance (push) Successful in 46s
CI/CD / test-python-backend-compliance (push) Successful in 42s
CI/CD / test-python-document-crawler (push) Successful in 29s
CI/CD / test-python-dsms-gateway (push) Successful in 25s
CI/CD / deploy-hetzner (push) Failing after 2s

Type alignment (root cause of client-side crash):
- RiskFlag: id/title/description → severity/category/message/recommendation
- ScopeGap: id/title/recommendation/relatedDocuments → gapType/currentState/targetState/effort
- NextAction: id/priority:number/effortDays → actionType/priority:string/estimatedEffort
- ScopeReasoning: details → factors + impact
- TriggeredHardTrigger: {rule: HardTriggerRule} → flat fields (ruleId, description, etc.)
- All UI components updated to match engine output shape

Project isolation:
- Scope localStorage key now includes projectId (prevents data leak between projects)

Optional block progress:
- Blocks with only optional questions now show green checkmark when any question answered

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-11 14:58:29 +01:00
parent 46048554cb
commit cb48b8289e
7 changed files with 185 additions and 152 deletions

View File

@@ -1664,7 +1664,7 @@ export class ComplianceScopeEngine {
step: 'hard_trigger_evaluation',
description: `${triggers.length} Hard Trigger Rule(s) aktiviert`,
factors: triggers.map(
(t) => `${t.ruleId}: ${t.description} (${t.legalReference})`
(t) => `${t.ruleId}: ${t.description}${t.legalReference ? ` (${t.legalReference})` : ''}`
),
impact: `Höchstes Trigger-Level: ${this.getMaxTriggerLevel(triggers)}`,
})

View File

@@ -154,12 +154,20 @@ export interface HardTriggerRule {
* Getriggerter Hard Trigger mit Kontext
*/
export interface TriggeredHardTrigger {
/** Die getriggerte Regel */
rule: HardTriggerRule;
/** Der tatsächlich gefundene Wert */
matchedValue: unknown;
/** Erklärung warum getriggert */
explanation: string;
/** Regel-ID */
ruleId: string;
/** Kategorie */
category: string;
/** Beschreibung */
description: string;
/** Rechtsgrundlage */
legalReference?: string;
/** Mindest-Level */
minimumLevel: ComplianceDepthLevel;
/** DSFA erforderlich? */
requiresDSFA: boolean;
/** Pflichtdokumente */
mandatoryDocuments: string[];
}
// ============================================================================
@@ -229,14 +237,12 @@ export interface RequiredDocument {
documentType: ScopeDocumentType;
/** Anzeigename */
label: string;
/** Ist Pflicht? */
required: boolean;
/** Erforderliche Tiefe (z.B. "Basis", "Standard", "Detailliert") */
depth: string;
/** Konkrete Anforderungen/Inhalte */
detailItems: string[];
/** Geschätzter Aufwand */
estimatedEffort: string;
/** Pflicht oder empfohlen */
requirement: 'mandatory' | 'recommended';
/** Priorität */
priority: 'high' | 'medium' | 'low';
/** Geschätzter Aufwand in Stunden */
estimatedEffort: number;
/** Von welchen Triggern/Regeln gefordert */
triggeredBy: string[];
/** Link zum SDK-Schritt */
@@ -247,14 +253,12 @@ export interface RequiredDocument {
* Risiko-Flag
*/
export interface RiskFlag {
/** Eindeutige ID */
id: string;
/** Schweregrad */
severity: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
/** Titel */
title: string;
severity: string;
/** Kategorie */
category: string;
/** Beschreibung */
description: string;
message: string;
/** Rechtsgrundlage */
legalReference?: string;
/** Empfehlung zur Behebung */
@@ -265,38 +269,44 @@ export interface RiskFlag {
* Identifizierte Lücke in der Compliance
*/
export interface ScopeGap {
/** Eindeutige ID */
id: string;
/** Gap-Typ */
gapType: string;
/** Schweregrad */
severity: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
/** Titel */
title: string;
severity: string;
/** Beschreibung */
description: string;
/** Empfehlung zur Schließung */
recommendation: string;
/** Betroffene Dokumente */
relatedDocuments: ScopeDocumentType[];
/** Erforderlich für Level */
requiredFor: ComplianceDepthLevel;
/** Aktueller Zustand */
currentState: string;
/** Zielzustand */
targetState: string;
/** Aufwand in Stunden */
effort: number;
/** Priorität */
priority: string;
}
/**
* Nächster empfohlener Schritt
*/
export interface NextAction {
/** Eindeutige ID */
id: string;
/** Priorität (1 = höchste) */
priority: number;
/** Aktionstyp */
actionType: 'create_document' | 'establish_process' | 'implement_technical' | 'organizational_change';
/** Titel */
title: string;
/** Beschreibung */
description: string;
/** Geschätzter Aufwand */
estimatedEffort: string;
/** Betroffene Dokumente */
relatedDocuments: ScopeDocumentType[];
/** Priorität */
priority: string;
/** Geschätzter Aufwand in Stunden */
estimatedEffort: number;
/** Dokumenttyp (optional) */
documentType?: ScopeDocumentType;
/** Link zum SDK-Schritt */
sdkStepUrl?: string;
/** Blocker */
blockers: string[];
}
/**
@@ -307,8 +317,10 @@ export interface ScopeReasoning {
step: string;
/** Kurzbeschreibung */
description: string;
/** Detaillierte Punkte */
details: string[];
/** Faktoren */
factors: string[];
/** Auswirkung */
impact: string;
}
// ============================================================================