datalog: dl-magic-rewrite worklist now drains across rule chains (239/239)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Real bug: the worklist used (set! queue (rest queue)) to pop the head, which left queue bound to a fresh empty list as soon as the last item was popped. Subsequent (append! queue ...) was a no-op on the empty list — so when the head's rewrite generated new (rel, adn) pairs to enqueue, they vanished. Multi-relation programs (e.g. shortest -> path -> edge, or chained derived relations) only had their head's rules rewritten; downstream rules silently dropped. Fix: use an index-based loop (idx 0 → len queue), with append! adding to the same list. Items added after the current pointer are picked up in subsequent iterations. 2 new regression tests: - 4-level chain (a → r1 → r2 → r3 → r4) under magic returns 2 - shortest-path demo via magic equals dl-query (1 result)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"lang": "datalog",
|
||||
"total_passed": 237,
|
||||
"total_passed": 239,
|
||||
"total_failed": 0,
|
||||
"total": 237,
|
||||
"total": 239,
|
||||
"suites": [
|
||||
{"name":"tokenize","passed":26,"failed":0,"total":26},
|
||||
{"name":"parse","passed":20,"failed":0,"total":20},
|
||||
@@ -13,8 +13,8 @@
|
||||
{"name":"negation","passed":10,"failed":0,"total":10},
|
||||
{"name":"aggregates","passed":20,"failed":0,"total":20},
|
||||
{"name":"api","passed":20,"failed":0,"total":20},
|
||||
{"name":"magic","passed":29,"failed":0,"total":29},
|
||||
{"name":"magic","passed":31,"failed":0,"total":31},
|
||||
{"name":"demo","passed":21,"failed":0,"total":21}
|
||||
],
|
||||
"generated": "2026-05-08T14:29:08+00:00"
|
||||
"generated": "2026-05-08T14:40:44+00:00"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user