6ca4dcde3e
CI / detect-changes (push) Successful in 8s
CI / branch-name (push) Has been skipped
CI / guardrail-integrity (push) Has been skipped
CI / secret-scan (push) Has been skipped
CI / dep-audit (push) Has been skipped
CI / sbom-scan (push) Has been skipped
CI / build-sha-integrity (push) Failing after 4s
CI / validate-canonical-controls (push) Successful in 12s
CI / loc-budget (push) Successful in 14s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / nodejs-build (push) Has been skipped
CI / test-go (push) Has been skipped
CI / iace-gt-coverage (push) Has been skipped
CI / test-python-backend (push) Successful in 31s
CI / test-python-document-crawler (push) Has been skipped
CI / test-python-dsms-gateway (push) Has been skipped
Use-Case-Zuordnung jetzt DETERMINISTISCH aus der Quell-Regulierung (statt LLM/scope-category): control_parent_links.source_regulation (79% der 13.588 MCs) -> Keyword-Mapper -> ~30 Domaenen-Use-Cases. 117/117 Regulierungen gemappt (dse 44 Leitlinien, code_security 10, network_security 9, ...). - use_case_registry.py: 37 Use Cases (Doku + Security + Produkt/Sektor: cra/ai_act/mica/mdr/maschinen/batterie/ehds/dsa/dma/psd2/aml/lksg/...) + use_case_for_regulation() Keyword-Mapper (117 Regulierungen abgedeckt). - migration 150: is_primary auf mc_use_case_mappings + neue mc_regulations (MC->source_regulation, n:m, is_primary) als feine Filter-Dimension. - classify_mc_use_cases.py: source_regulation-getriebener Seed; Primaerzweck = dominante Regulierung, Mehrfachzwecke = weitere. PYTHONPATH-Bootstrap. - 18 Registry-Tests gruen (Mapper-Abdeckung + Konsistenz-Invariante). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
41 lines
1.7 KiB
SQL
41 lines
1.7 KiB
SQL
-- Migration 150: Primaerzweck-Flag + MC <-> Quell-Regulierung (n:m)
|
|
-- Erweitert das Use-Case-Mapping um (a) is_primary (Primaerzweck pro MC)
|
|
-- und (b) mc_regulations (die feine Quell-Regulierungs-Filter-Dimension,
|
|
-- 117 Werte). Strikt add-only. [migration-approved]
|
|
|
|
SET search_path TO compliance, public;
|
|
|
|
DO $$
|
|
BEGIN
|
|
IF EXISTS (SELECT 1 FROM information_schema.tables
|
|
WHERE table_schema='compliance'
|
|
AND table_name='mc_use_case_mappings') THEN
|
|
ALTER TABLE mc_use_case_mappings
|
|
ADD COLUMN IF NOT EXISTS is_primary BOOLEAN NOT NULL DEFAULT FALSE;
|
|
CREATE INDEX IF NOT EXISTS idx_mcuc_primary
|
|
ON mc_use_case_mappings(use_case) WHERE is_primary;
|
|
END IF;
|
|
|
|
IF EXISTS (SELECT 1 FROM information_schema.tables
|
|
WHERE table_schema='compliance'
|
|
AND table_name='master_controls') THEN
|
|
CREATE TABLE IF NOT EXISTS mc_regulations (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
master_control_uuid UUID NOT NULL
|
|
REFERENCES master_controls(id) ON DELETE CASCADE,
|
|
master_control_id VARCHAR(60) NOT NULL,
|
|
source_regulation VARCHAR(160) NOT NULL,
|
|
is_primary BOOLEAN NOT NULL DEFAULT FALSE,
|
|
member_count INTEGER DEFAULT 0,
|
|
method VARCHAR(20) NOT NULL DEFAULT 'lineage'
|
|
CHECK (method IN ('lineage', 'manual')),
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
UNIQUE (master_control_uuid, source_regulation)
|
|
);
|
|
CREATE INDEX IF NOT EXISTS idx_mcreg_regulation
|
|
ON mc_regulations(source_regulation);
|
|
CREATE INDEX IF NOT EXISTS idx_mcreg_mc
|
|
ON mc_regulations(master_control_uuid);
|
|
END IF;
|
|
END $$;
|