a4123ace71
This exposes the existing Smart Onboarding Advisor through a runtime endpoint; it does not add new
reasoning logic. Tightly scoped: adapter boundary + endpoint, no big frontend, no persistence, no
empirical learning, no new scanners, no LLM.
POST /onboarding/advisor-start : (company + certifications + target + scanner_findings[ProducedSignal])
-> Normalizer -> Silent Knowledge Pass -> Advisor -> { silent_intake_summary, inferred_assumptions,
rejected_assumptions, top_5_questions, capability_delta, top_measures, evidence_requests,
completeness_summary, auto_detected, headline }
GET /onboarding/targets : the supported target ids (CRA, TISAX, MDR, Environmental)
compliance/services/onboarding_service.py is the app-caller: it loads the curated knowledge (hypothesis
library, signal vocabulary + map, the target's required capabilities) once and calls the pure, tested
orchestration (normalize_signals -> silent_intake -> advisor_start). The scanner ADAPTER boundary is the
ProducedSignal format the request carries — existing scanners emit it, no new scanners. Thin handler
(<30 LOC), registered in the auto-load list. No DB. Additive to the OpenAPI contract (contract test is
additive-friendly; baseline regenerates on CI/py3.12). First deployable runtime feature -> dev deploy +
smoke. mypy --strict clean, 22 onboarding tests pass, check-loc 0.
94 lines
2.4 KiB
Python
94 lines
2.4 KiB
Python
"""API routes for Compliance module."""
|
|
|
|
import logging
|
|
|
|
from .routes import router
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
_failed_routers: dict[str, str] = {}
|
|
|
|
|
|
def _safe_import_router(module_name: str, attr: str = "router"):
|
|
"""Import a router module safely — log error but don't crash the whole app."""
|
|
try:
|
|
mod = __import__(f"compliance.api.{module_name}", fromlist=[attr])
|
|
return getattr(mod, attr)
|
|
except Exception as e:
|
|
logger.error("Failed to import %s: %s", module_name, e)
|
|
_failed_routers[module_name] = str(e)
|
|
return None
|
|
|
|
|
|
# Import all sub-routers (safe — failure of one doesn't block others)
|
|
_ROUTER_MODULES = [
|
|
"audit_routes",
|
|
"ai_routes",
|
|
"evidence_routes",
|
|
"risk_routes",
|
|
"dashboard_routes",
|
|
"scraper_routes",
|
|
"module_routes",
|
|
"isms_routes",
|
|
"vvt_routes",
|
|
"legal_document_routes",
|
|
"einwilligungen_routes",
|
|
"einwilligungen_export_routes",
|
|
"escalation_routes",
|
|
"consent_template_routes",
|
|
"notfallplan_routes",
|
|
"obligation_routes",
|
|
"security_backlog_routes",
|
|
"quality_routes",
|
|
"loeschfristen_routes",
|
|
"legal_template_routes",
|
|
"compliance_scope_routes",
|
|
"dsfa_routes",
|
|
"dsr_routes",
|
|
"email_template_routes",
|
|
"banner_routes",
|
|
"extraction_routes",
|
|
"tom_routes",
|
|
"vendor_compliance_routes",
|
|
"incident_routes",
|
|
"change_request_routes",
|
|
"generation_routes",
|
|
"project_routes",
|
|
"wiki_routes",
|
|
"canonical_control_routes",
|
|
"control_generator_routes",
|
|
"crosswalk_routes",
|
|
"use_case_controls_routes",
|
|
"control_suppression_routes",
|
|
"process_task_routes",
|
|
"evidence_check_routes",
|
|
"vvt_library_routes",
|
|
"tom_mapping_routes",
|
|
"llm_audit_routes",
|
|
"assertion_routes",
|
|
"org_role_routes",
|
|
"document_review_routes",
|
|
"banner_analytics_routes",
|
|
"banner_ab_routes",
|
|
"compliance_report_routes",
|
|
"whistleblower_routes",
|
|
"tcf_routes",
|
|
"founding_wizard_routes",
|
|
"licenses_routes",
|
|
"template_rule_routes",
|
|
"specialist_agent_routes",
|
|
"reasoning_routes",
|
|
"onboarding_routes",
|
|
]
|
|
|
|
_loaded_count = 0
|
|
for _mod_name in _ROUTER_MODULES:
|
|
_sub_router = _safe_import_router(_mod_name)
|
|
if _sub_router is not None:
|
|
router.include_router(_sub_router)
|
|
_loaded_count += 1
|
|
|
|
logger.info("Loaded %d/%d compliance sub-routers", _loaded_count, len(_ROUTER_MODULES))
|
|
|
|
__all__ = ["router"]
|