feat: compile Light Arrival collective cognition
Final recovered Fifth Domain upgrade segment. Applies the Light Arrival collective cognition correction from local source commit 7390a35 without rewriting remote history.
This commit is contained in:
parent
c5be48e6a1
commit
9f89c69623
10 changed files with 734 additions and 7 deletions
|
|
@ -0,0 +1,49 @@
|
|||
import unittest
|
||||
|
||||
from compile_collective_cognition import (
|
||||
compile_graph,
|
||||
load_contributions,
|
||||
)
|
||||
|
||||
|
||||
class CollectiveCognitionCompilerTests(unittest.TestCase):
|
||||
def test_repository_contributions_compile_without_authority(self):
|
||||
result = compile_graph(load_contributions())
|
||||
self.assertGreaterEqual(result["contribution_count"], 1)
|
||||
self.assertGreater(result["node_count"], 1)
|
||||
self.assertFalse(result["execution_authority"])
|
||||
self.assertTrue(result["correction_edges"])
|
||||
|
||||
def test_unknown_parent_fails_closed(self):
|
||||
contribution = load_contributions()[0]
|
||||
broken = {
|
||||
**contribution,
|
||||
"nodes": [
|
||||
*contribution["nodes"],
|
||||
{
|
||||
"id": "BROKEN",
|
||||
"kind": "decision",
|
||||
"statement": "broken",
|
||||
"parents": ["MISSING"],
|
||||
"evidence": [],
|
||||
"state": "pending",
|
||||
},
|
||||
],
|
||||
}
|
||||
with self.assertRaises(ValueError):
|
||||
compile_graph([broken])
|
||||
|
||||
def test_cycles_fail_closed(self):
|
||||
contribution = load_contributions()[0]
|
||||
first = contribution["nodes"][0]["id"]
|
||||
last = contribution["nodes"][-1]["id"]
|
||||
cyclic_nodes = [
|
||||
{**node, "parents": [last]} if node["id"] == first else node
|
||||
for node in contribution["nodes"]
|
||||
]
|
||||
with self.assertRaises(ValueError):
|
||||
compile_graph([{**contribution, "nodes": cyclic_nodes}])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Loading…
Reference in a new issue