Skip to content

Commit 39bd0e4

Browse files
committed
Removed newData.ref
1 parent 4874211 commit 39bd0e4

File tree

3 files changed

+19
-25
lines changed

3 files changed

+19
-25
lines changed

server/src/instant/db/cel.clj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,11 @@
425425
{:keys [data rule-params new-data linked-data linked-etype]}]
426426
(try
427427
(let [bindings (HashMap.)
428-
429428
_ (.put bindings "auth" (AuthCelMap. ctx (CelMap. (:current-user ctx))))
430429
_ (.put bindings "data" (DataCelMap. ctx etype (CelMap. data)))
431430
_ (.put bindings "ruleParams" (CelMap. rule-params))
432431
_ (when new-data
433-
(.put bindings "newData" (DataCelMap. ctx etype (CelMap. new-data))))
432+
(.put bindings "newData" (CelMap. new-data)))
434433
_ (when linked-data
435434
(.put bindings "linkedData" (DataCelMap. ctx linked-etype (CelMap. linked-data))))
436435
result (.eval ^CelRuntime$Program cel-program
@@ -480,7 +479,7 @@
480479
(CelMap. rule-params))
481480
"newData" (if new-data
482481
(Optional/of
483-
(DataCelMap. ctx etype (CelMap. new-data)))
482+
(CelMap. new-data))
484483
(Optional/empty))
485484
"linkedData" (if linked-data
486485
(Optional/of

server/src/instant/reactive/aggregator.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
ref-k (assoc! ref-k 1))
120120
(cms/add-batch sketch (persistent! triples))
121121
(cms/add-batch reverse-sketch (persistent! reverse-triples))
122-
(+ triples-pg-size (:pg-size triple)))
122+
(+ triples-pg-size (long (:pg-size triple))))
123123
(recur (rest s)
124124
app-id
125125
attr-id
@@ -128,7 +128,7 @@
128128
ref-k (assoc! ref-k (inc (get reverse-triples ref-k 0))))
129129
sketch
130130
reverse-sketch
131-
(+ triples-pg-size (:pg-size triple)))))
131+
(+ triples-pg-size (long (:pg-size triple))))))
132132
(let [forward-sketch (cms/add-batch sketch (persistent! triples))
133133
reverse-sketch (cms/add-batch reverse-sketch (persistent! reverse-triples))]
134134
(vswap! sketch-count inc)

server/test/instant/db/transaction_test.clj

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,26 +1693,21 @@
16931693
(map :handle)
16941694
set))))
16951695

1696-
(testing "ref works"
1697-
(test-util/test-matrix
1698-
[perm ["handle in data.ref('users.handle')"
1699-
"handle in newData.ref('users.handle')"]]
1700-
1701-
(rule-model/put!
1702-
(aurora/conn-pool :write)
1703-
{:app-id app-id :code {:bookshelves {:allow {:update perm}
1704-
:bind ["handle" "'alex'"]}}})
1705-
(permissioned-tx/transact!
1706-
(make-ctx)
1707-
[[:add-triple (resolvers/->uuid r "eid-short-stories") (resolvers/->uuid r :bookshelves/name) "Long Stories"]])
1708-
(is
1709-
(= #{"Long Stories" "Nonfiction"}
1710-
(->> (test-util/pretty-perm-q
1711-
{:app-id app-id :current-user nil}
1712-
{:bookshelves {:$ {:where {:users.handle "alex"}}}})
1713-
:bookshelves
1714-
(map :name)
1715-
set)))))
1696+
(rule-model/put!
1697+
(aurora/conn-pool :write)
1698+
{:app-id app-id :code {:bookshelves {:allow {:update "handle in data.ref('users.handle')"}
1699+
:bind ["handle" "'alex'"]}}})
1700+
(permissioned-tx/transact!
1701+
(make-ctx)
1702+
[[:add-triple (resolvers/->uuid r "eid-short-stories") (resolvers/->uuid r :bookshelves/name) "Long Stories"]])
1703+
(is
1704+
(= #{"Long Stories" "Nonfiction"}
1705+
(->> (test-util/pretty-perm-q
1706+
{:app-id app-id :current-user nil}
1707+
{:bookshelves {:$ {:where {:users.handle "alex"}}}})
1708+
:bookshelves
1709+
(map :name)
1710+
set)))
17161711

17171712
(testing "invalid ref blocks"
17181713
(rule-model/put!

0 commit comments

Comments
 (0)