pfad Anpassung

This commit is contained in:
Lars 2025-12-23 18:11:05 +01:00
parent a5b4dfb31f
commit dcc3083455

View File

@ -1,8 +1,8 @@
""" """
FILE: app/services/edge_registry.py FILE: app/services/edge_registry.py
DESCRIPTION: Single Source of Truth für Kanten-Typen mit dynamischem Reload. DESCRIPTION: Single Source of Truth für Kanten-Typen mit dynamischem Reload.
WP-22: Transparente Status-Meldungen & Robuste Pfad-Auflösung. WP-22: Fix für absolute Pfade außerhalb des Vaults (Prod-Dictionary).
VERSION: 0.7.3 (Fix: Path Normalization & Env Priority) VERSION: 0.7.4 (Fix: Absolute Path Escaping & Quote Stripping)
""" """
import re import re
import os import os
@ -30,7 +30,8 @@ class EdgeRegistry:
return return
settings = get_settings() settings = get_settings()
# Hole ENV-Werte und entferne potenzielle Anführungszeichen
# 1. ENV-Werte laden und von Anführungszeichen bereinigen
env_vocab_path = os.getenv("MINDNET_VOCAB_PATH") env_vocab_path = os.getenv("MINDNET_VOCAB_PATH")
if env_vocab_path: if env_vocab_path:
env_vocab_path = env_vocab_path.strip('"').strip("'") env_vocab_path = env_vocab_path.strip('"').strip("'")
@ -39,10 +40,16 @@ class EdgeRegistry:
if env_vault_root: if env_vault_root:
env_vault_root = env_vault_root.strip('"').strip("'") env_vault_root = env_vault_root.strip('"').strip("'")
# Pfad-Priorität: 1. Direkter Pfad (ENV) -> 2. Vault-Struktur # 2. Pfad-Priorität: Wenn absolut (/), dann direkt nutzen!
if env_vocab_path: if env_vocab_path:
if env_vocab_path.startswith("/"):
# Absoluter Pfad (z.B. aus Produktion)
self.full_vocab_path = env_vocab_path
else:
# Relativer Pfad zum aktuellen Verzeichnis oder Vault
self.full_vocab_path = os.path.abspath(env_vocab_path) self.full_vocab_path = os.path.abspath(env_vocab_path)
else: else:
# Fallback: Suche im Vault-Verzeichnis
possible_paths = [ possible_paths = [
os.path.join(env_vault_root, "_system", "dictionary", "edge_vocabulary.md"), os.path.join(env_vault_root, "_system", "dictionary", "edge_vocabulary.md"),
os.path.join(env_vault_root, "01_User_Manual", "01_edge_vocabulary.md") os.path.join(env_vault_root, "01_User_Manual", "01_edge_vocabulary.md")
@ -77,7 +84,7 @@ class EdgeRegistry:
self._last_mtime = current_mtime self._last_mtime = current_mtime
def _load_vocabulary(self): def _load_vocabulary(self):
"""Parst das Wörterbuch[cite: 25].""" """Parst das Wörterbuch."""
self.canonical_map.clear() self.canonical_map.clear()
self.valid_types.clear() self.valid_types.clear()
@ -130,7 +137,7 @@ class EdgeRegistry:
return clean_type return clean_type
def _log_issue(self, edge_type: str, error_kind: str, ctx: dict): def _log_issue(self, edge_type: str, error_kind: str, ctx: dict):
"""JSONL-Logging[cite: 1].""" """Detailliertes JSONL-Logging für Debugging."""
try: try:
os.makedirs(os.path.dirname(self.unknown_log_path), exist_ok=True) os.makedirs(os.path.dirname(self.unknown_log_path), exist_ok=True)
entry = { entry = {