diff --git a/CHANGELOG.md b/CHANGELOG.md index 974f49a8..0d9ac7d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ This is a history of changes to clara-rules. ### 0.19.0-SNAPSHOT * Remove a warning about `qualified-keyword?` being replaced when using Clojure 1.9. +* Fix RuleOrderedActivation Fressian Handler. See [issue 394](https://github.com/cerner/clara-rules/issues/394) ### 0.18.0 * Remove unnecessary memory operations from ProductionNode to optimize performance. Remove :rule-matches in session inspection that did not cause logical insertions and add a new optional feature to return all rule matches, regardless of what their RHS did or whether they were retracted. Add a new listener and tracing method fire-activation!. These changes are moderately non-passive with respect to listening, tracing, and session inspection but are otherwise passive. See [issue 386](https://github.com/cerner/clara-rules/issues/386) for details. diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 5a24c048..bda84c10 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -5,6 +5,7 @@ Cerner Corporation - William Parker [@WilliamParker] - Ethan Christian [@EthanEChristian] - Pushkar Kulkarni [@kulkarnipushkar] +- Matt Motter [@mmotter] Community diff --git a/src/main/clojure/clara/rules/durability/fressian.clj b/src/main/clojure/clara/rules/durability/fressian.clj index 27609175..5b3b3aa8 100644 --- a/src/main/clojure/clara/rules/durability/fressian.clj +++ b/src/main/clojure/clara/rules/durability/fressian.clj @@ -492,11 +492,13 @@ (.writeObject w (.-node-id ^RuleOrderedActivation c) true) (.writeObject w (.-token ^RuleOrderedActivation c)) (.writeObject w (.-activation ^RuleOrderedActivation c)) - (.writeInt w (.-rule-load-order ^RuleOrderedActivation c)))) + (.writeInt w (.-rule-load-order ^RuleOrderedActivation c)) + (.writeBoolean w (mem/use-token-identity? ^RuleOrderedActivation c)))) :readers {"clara/ruleorderactivation" (reify ReadHandler (read [_ rdr tag component-count] (mem/->RuleOrderedActivation (.readObject rdr) + (.readObject rdr) (.readObject rdr) (.readObject rdr) (.readObject rdr))))}} diff --git a/src/main/clojure/clara/rules/memory.cljc b/src/main/clojure/clara/rules/memory.cljc index dd72c998..74602fb5 100644 --- a/src/main/clojure/clara/rules/memory.cljc +++ b/src/main/clojure/clara/rules/memory.cljc @@ -320,7 +320,8 @@ #?(:clj (defprotocol IdentityComparable - (using-token-identity! [this bool]))) + (using-token-identity! [this bool]) + (use-token-identity? [this]))) #?(:clj (deftype RuleOrderedActivation [node-id @@ -340,6 +341,10 @@ (using-token-identity! [this bool] (set! use-token-identity? bool) this) + + (use-token-identity? [_] + use-token-identity?) + Object ;; Two RuleOrderedActivation instances should be equal if and only if their ;; activation is equal. Note that if the node of two activations is the same, diff --git a/src/test/clojure/clara/test_fressian.clj b/src/test/clojure/clara/test_fressian.clj index fd684117..a83299ba 100644 --- a/src/test/clojure/clara/test_fressian.clj +++ b/src/test/clojure/clara/test_fressian.clj @@ -3,6 +3,7 @@ [clara.rules.durability.fressian :as df] [clojure.data.fressian :as fres] [clara.rules.platform :as pform] + [clara.rules.memory :as mem] [clojure.test :refer :all]) (:import [org.fressian FressianWriter @@ -106,5 +107,9 @@ (test-serde-with-meta sm-custom sm-custom) (is (thrown? Exception (serde (with-meta sm-custom {}))) - "cannot serialized custom sort comparators without name given in metadata"))))) + "cannot serialized custom sort comparators without name given in metadata")))) + + (testing "RuleOrderActivation" + (let [act (mem/->RuleOrderedActivation 1 nil nil 1 false)] + (test-serde act act))))