feat(spatial): 契约加 conflicts——两份来源打架时,只有两个世界都成立的答案才算答案

This commit is contained in:
liuhuajie committed 2026-12-04 01:15:31 +08:00
1 parent e799e02e22
commit a01ca7eab7
9 files changed
+206 -27

No files matched your search

+11
View File
@@ -123,10 +123,17 @@ class Observation:
# leaking the answer -- a BOM knows how many parts exist, a netlist knows
# how many conductors exist and on which layers, and neither of them knows
# which part ends up holding the load.
# Relations one source asserts and another denies. Not "missing" -- both
# sources are talking about the same pair and disagree, which is a different
# epistemic state from "nobody told me". Carries no vote and no priority:
# deciding which source wins is exactly the thing the system must not do on
# its own, so a disputed relation can only ever suspend an answer.
conflicts: list = field(default_factory=list)
scope: dict = field(default_factory=lambda: {
"parts": {}, "rendered": {},
"relations": {}, "rendered_relations": {},
"layers": [], "rendered_layers": [],
"conflicts": {},
})
def entity_ids(self) -> set:
@@ -142,6 +149,10 @@ class Observation:
"hidden_faces": sorted(self.hidden_faces),
"hidden": {k: dict(sorted(v.items())) for k, v in sorted(self.hidden.items())},
"dangling": [e.to_dict() for e in sorted(self.dangling, key=lambda x: x.eid)],
"conflicts": [dict(sorted(c.items())) for c in
sorted(self.conflicts, key=lambda c: (c.get("kind", ""),
c.get("a", ""),
c.get("b", "")))],
"scope": _canonical_scope(self.scope),
}