Hey Pranav,
Thanks for the example, I was able to get it running and replicate the behavior you mentioned(Insert/Retracts not behaving as intended).
I believe the root of the issue you are experiencing is a little "gotcha" with the implementation of durability, specifically when using
fact-type-fns.
In your
example your "pre-serde" session uses:
(mk-session name-space rules
:fact-type-fn FACT-TYPE)
However, on deserialization:
(d/deserialize-session-state (df/create-session-serializer is)
wm-serializer)
The
fact-type-fn is not being provided via the
opts param:
https://github.com/cerner/clara-rules/blob/e86dcd4f0224d966c1bd82043e79cf59c96136bf/src/main/clojure/clara/rules/durability.clj#L701 I believe that by updating the line mentioned above to something like:
(d/deserialize-session-state (df/create-session-serializer is)
wm-serializer
{
:fact-type-fn FACT-TYPE})
should sort out the undesired behavior. Please let me know, if it does or doesn't.
For context as to why this "gotcha" exists:
As clara supports arbitrary functions for fact-type-fn, during serde we are unable to persist the function across the serialization boundary and thus require users to provide it on the other side.
Hope this helps,
Ethan