Files
breakpilot-compliance/ai-compliance-sdk/migrations/027_usecase_audits.sql
T
Benjamin Admin 06bfbd1dca
Build + Deploy / build-admin-compliance (push) Successful in 2m46s
Build + Deploy / build-backend-compliance (push) Successful in 26s
Build + Deploy / build-ai-sdk (push) Successful in 52s
Build + Deploy / build-developer-portal (push) Successful in 22s
Build + Deploy / build-tts (push) Successful in 16s
Build + Deploy / build-document-crawler (push) Successful in 12s
Build + Deploy / build-dsms-gateway (push) Successful in 20s
Build + Deploy / build-dsms-node (push) Successful in 16s
CI / branch-name (push) Has been skipped
CI / guardrail-integrity (push) Has been skipped
CI / loc-budget (push) Failing after 18s
CI / secret-scan (push) Has been skipped
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) Successful in 3m16s
CI / dep-audit (push) Has been skipped
CI / sbom-scan (push) Has been skipped
CI / test-go (push) Successful in 1m0s
CI / test-python-backend (push) Successful in 41s
CI / test-python-document-crawler (push) Successful in 29s
CI / test-python-dsms-gateway (push) Successful in 23s
CI / validate-canonical-controls (push) Successful in 16s
Build + Deploy / trigger-orca (push) Successful in 2m36s
feat(use-case-compiler): MC-based compliance questionnaires with scoring
Implements the Use-Case Compiler that turns Master Controls into
interactive compliance audits. 5 templates (Vendor Check, SAST/DAST,
DSGVO, NIS2, CRA), deterministic + LLM question generation, scoring
engine with regulation/severity breakdown, and gap detection.

- Backend: 9 API endpoints, 22 unit tests (all pass)
- Frontend: Template selector, questionnaire, result dashboard
- Migration 027: usecase_audits + usecase_answers tables

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-12 13:49:16 +02:00

40 lines
1.4 KiB
SQL

-- Use-Case Compiler: Audits + Answers
-- Turns Master Controls into interactive questionnaires
CREATE TABLE IF NOT EXISTS compliance.usecase_audits (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
tenant_id UUID NOT NULL,
template_id VARCHAR(100) NOT NULL,
name VARCHAR(200) NOT NULL,
target_name VARCHAR(200),
status VARCHAR(20) DEFAULT 'draft',
total_questions INT DEFAULT 0,
answered_questions INT DEFAULT 0,
compliance_score FLOAT DEFAULT 0,
questions JSONB DEFAULT '[]',
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW(),
completed_at TIMESTAMPTZ
);
CREATE INDEX IF NOT EXISTS idx_usecase_audits_tenant
ON compliance.usecase_audits (tenant_id);
CREATE INDEX IF NOT EXISTS idx_usecase_audits_template
ON compliance.usecase_audits (template_id);
CREATE TABLE IF NOT EXISTS compliance.usecase_answers (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
audit_id UUID NOT NULL REFERENCES compliance.usecase_audits(id) ON DELETE CASCADE,
question_id VARCHAR(50) NOT NULL,
mc_id VARCHAR(50),
answer JSONB NOT NULL,
evidence_ids JSONB DEFAULT '[]',
status VARCHAR(20) DEFAULT 'answered',
answered_at TIMESTAMPTZ DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_usecase_answers_audit
ON compliance.usecase_answers (audit_id);
CREATE UNIQUE INDEX IF NOT EXISTS idx_usecase_answers_unique
ON compliance.usecase_answers (audit_id, question_id);