diff --git a/harness/tht/config.py b/harness/tht/config.py index 877fe7c6..67adb207 100644 --- a/harness/tht/config.py +++ b/harness/tht/config.py @@ -663,7 +663,13 @@ def _validate_internal_vector_contract(raw: dict[str, Any], path: Path) -> None: engine = vector.get("engine") base_url = vector.get("base_url") collection = vector.get("collection") - allowed = {"engine", "base_url", "collection"} + lifecycle = vector.get("collection_lifecycle") + allowed = {"engine", "base_url", "collection", "collection_lifecycle"} + if lifecycle is not None and lifecycle not in ("self_heal", "require_existing"): + raise ConfigError( + f"Configurazione non valida in {path}:\n" + "resources.vector.collection_lifecycle deve essere 'self_heal' o 'require_existing'" + ) unexpected = sorted(set(vector) - allowed) if unexpected: raise ConfigError( diff --git a/harness/tht/config_compat.py b/harness/tht/config_compat.py index 639566fe..ac2d0664 100644 --- a/harness/tht/config_compat.py +++ b/harness/tht/config_compat.py @@ -36,11 +36,14 @@ def translate_legacy_config(raw: dict[str, Any]) -> tuple[dict[str, Any], bool]: if isinstance(resources, dict) and "vector" in resources and "vectors" not in translated: vector = _as_mapping(resources.get("vector")) if isinstance(vector, dict): - translated["vectors"] = { + translated_vectors: dict[str, Any] = { "type": "qdrant", "base_url": vector.get("base_url"), "collection": vector.get("collection"), } + if vector.get("collection_lifecycle") in ("self_heal", "require_existing"): + translated_vectors["collection_lifecycle"] = vector["collection_lifecycle"] + translated["vectors"] = translated_vectors legacy = any(key in raw for key in _LEGACY_RESOURCE_KEYS) if not legacy: return translated, False