All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 4s
- Updated the .env loading process to first check for an explicit path, improving reliability in different working directories. - Added logging for successful .env loading and fallback mechanisms. - Enhanced EdgeDTO creation with robust error handling, including fallbacks for unsupported provenance values and logging of errors for better traceability.
70 lines
2.5 KiB
Python
70 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Script zur Verifikation der EdgeDTO-Import-Version in Prod.
|
|
Prüft, ob die korrekte Version des EdgeDTO-Modells geladen wird.
|
|
"""
|
|
import sys
|
|
import os
|
|
|
|
# Stelle sicher, dass der Projekt-Pfad im Python-Path ist
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
try:
|
|
from app.models.dto import EdgeDTO
|
|
import inspect
|
|
|
|
# Extrahiere die Literal-Definition aus dem Source-Code
|
|
source = inspect.getsource(EdgeDTO)
|
|
|
|
# Prüfe, ob explicit:callout in der Literal-Liste ist
|
|
if "explicit:callout" in source:
|
|
print("✅ EdgeDTO unterstützt 'explicit:callout'")
|
|
print(f" -> Modul-Pfad: {EdgeDTO.__module__}")
|
|
print(f" -> Datei: {inspect.getfile(EdgeDTO)}")
|
|
|
|
# Zeige die Provenance-Definition
|
|
import re
|
|
match = re.search(r'provenance.*?Literal\[(.*?)\]', source, re.DOTALL)
|
|
if match:
|
|
literal_values = match.group(1)
|
|
if "explicit:callout" in literal_values:
|
|
print("✅ 'explicit:callout' ist in der Literal-Liste enthalten")
|
|
print(f"\n Literal-Werte (erste 200 Zeichen):\n {literal_values[:200]}...")
|
|
else:
|
|
print("❌ 'explicit:callout' ist NICHT in der Literal-Liste!")
|
|
print(f"\n Gefundene Literal-Werte:\n {literal_values}")
|
|
else:
|
|
print("⚠️ Konnte Literal-Definition nicht finden")
|
|
else:
|
|
print("❌ EdgeDTO unterstützt NICHT 'explicit:callout'")
|
|
print(f" -> Modul-Pfad: {EdgeDTO.__module__}")
|
|
print(f" -> Datei: {inspect.getfile(EdgeDTO)}")
|
|
print("\n Source-Code (erste 500 Zeichen):")
|
|
print(f" {source[:500]}...")
|
|
|
|
# Test: Versuche ein EdgeDTO mit explicit:callout zu erstellen
|
|
print("\n🧪 Test: Erstelle EdgeDTO mit provenance='explicit:callout'...")
|
|
try:
|
|
test_edge = EdgeDTO(
|
|
id="test",
|
|
kind="test",
|
|
source="test",
|
|
target="test",
|
|
weight=1.0,
|
|
provenance="explicit:callout"
|
|
)
|
|
print("✅ EdgeDTO mit 'explicit:callout' erfolgreich erstellt!")
|
|
print(f" -> Provenance: {test_edge.provenance}")
|
|
except Exception as e:
|
|
print(f"❌ Fehler beim Erstellen: {e}")
|
|
print(f" -> Typ: {type(e).__name__}")
|
|
|
|
except ImportError as e:
|
|
print(f"❌ Import-Fehler: {e}")
|
|
sys.exit(1)
|
|
except Exception as e:
|
|
print(f"❌ Unerwarteter Fehler: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
sys.exit(1)
|