relations: bulk lifecycle — relate-many! + unrelate-node! cascade cleanup + 12 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 54s

unrelate-node! retracts every local edge touching a node (all kinds, both
directions); leaves federated peer links alone. 147/147.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-07 13:27:12 +00:00
parent b66395886b
commit c0d02c229c
6 changed files with 202 additions and 6 deletions

View File

@@ -18,7 +18,7 @@ links. Reuses `lib/datalog/` — does not reimplement the engine.
## Status (rolling)
`bash lib/relations/conformance.sh`**135/135** (Phases 14 complete + extensions)
`bash lib/relations/conformance.sh`**147/147** (Phases 14 complete + extensions)
## Ground rules
@@ -110,9 +110,21 @@ lib/relations/federation.sx
computed in SX over `reach`/`ancestors`/`rnode`. `lib/relations/tests/tree.sx`.
- [x] **route enumeration**`all-paths` (all simple directed paths a→b, not just
the shortest; cycle-safe DFS) in explain.sx. `lib/relations/tests/routes.sx`.
- [x] **bulk lifecycle**`relate-many!` (batch assert) + `unrelate-node!` (cascade
cleanup: retract every local edge touching a node, all kinds, both directions —
for domain object deletion; leaves federated peer links alone). api.sx,
`lib/relations/tests/bulk.sx`.
## Progress log
- **Extension: bulk lifecycle** (147/147). `relations-relate-many!` (batch
`dl-assert!` over a list of (src dst kind) triples) and `relations-unrelate-node!`
(query `rel` for every edge with the node as src or dst, across all kinds, then
`dl-retract!` each — the cascade-cleanup a domain needs when it deletes the
object a node id names). Federated `peer_rel` links are a peer's assertion and
are deliberately left untouched. + `relations/relate-many!`/`unrelate-node!`
wrappers, `lib/relations/tests/bulk.sx` (12 tests: batch assert, cascade across
kinds/both directions, unrelated edges preserved, unknown-node no-op, api layer).
- **Extension: route enumeration** (135/135). `relations-all-paths(db,a,b,kind)`
in explain.sx — every simple (no repeated node) directed path a→b, not just the
shortest one `relations-path` returns; DFS that skips nodes already on the