fix(tree): from_dict 增加 ID 唯一性校验
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+3
-1
@@ -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 的唯一性。
|
||||
|
||||
Reference in New Issue
Block a user