datalog: magic existence check (bb-adornment) regression test (228/228)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 54s

This commit is contained in:
2026-05-08 12:35:33 +00:00
parent 5f4defe99e
commit 8e508bc90f
3 changed files with 23 additions and 6 deletions

View File

@@ -1,8 +1,8 @@
{
"lang": "datalog",
"total_passed": 227,
"total_passed": 228,
"total_failed": 0,
"total": 227,
"total": 228,
"suites": [
{"name":"tokenize","passed":26,"failed":0,"total":26},
{"name":"parse","passed":18,"failed":0,"total":18},
@@ -13,8 +13,8 @@
{"name":"negation","passed":10,"failed":0,"total":10},
{"name":"aggregates","passed":19,"failed":0,"total":19},
{"name":"api","passed":20,"failed":0,"total":20},
{"name":"magic","passed":27,"failed":0,"total":27},
{"name":"magic","passed":28,"failed":0,"total":28},
{"name":"demo","passed":21,"failed":0,"total":21}
],
"generated": "2026-05-08T12:31:39+00:00"
"generated": "2026-05-08T12:35:21+00:00"
}

View File

@@ -1,6 +1,6 @@
# datalog scoreboard
**227 / 227 passing** (0 failure(s)).
**228 / 228 passing** (0 failure(s)).
| Suite | Passed | Total | Status |
|-------|--------|-------|--------|
@@ -13,5 +13,5 @@
| negation | 10 | 10 | ok |
| aggregates | 19 | 19 | ok |
| api | 20 | 20 | ok |
| magic | 27 | 27 | ok |
| magic | 28 | 28 | ok |
| demo | 21 | 21 | ok |

View File

@@ -211,6 +211,23 @@
(= (len semi) (len magic))))
true)
;; All-bound query (existence check) generates an "bb"
;; adornment chain. Verifies the rewriter walks multiple
;; (rel, adn) pairs through the worklist.
(dl-mt-test! "magic existence check via bb"
(let
((db (dl-program
"parent(a, b). parent(b, c). parent(c, d).
ancestor(X, Y) :- parent(X, Y).
ancestor(X, Z) :- parent(X, Y), ancestor(Y, Z).")))
(let
((found (dl-magic-query
db (list (quote ancestor) (quote a) (quote c))))
(missing (dl-magic-query
db (list (quote ancestor) (quote a) (quote z)))))
(and (= (len found) 1) (= (len missing) 0))))
true)
;; Magic over a rule whose body contains an aggregate.
;; The rewriter passes aggregate body lits through unchanged
;; (no propagation generated for them), so semi-naive's count