fix(tree): from_dict 增加 ID 唯一性校验

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-07 01:40:46 -04:00
parent c136de076d
commit e0f7851975
+3 -1
View File
@@ -656,7 +656,9 @@ class TreeIndex:
for r in d["roots"]:
roots.append(L1Node.from_dict(r))
return cls(metadata=meta, roots=roots)
obj = cls(metadata=meta, roots=roots)
obj._validate_id_uniqueness()
return obj
def _validate_id_uniqueness(self) -> None:
"""校验树中所有节点 ID 的唯一性。