{"action":"created","comment":{"url":"https://api.github.com/repos/rbrush/clara-rules/pulls/comments/83435834","pull_request_review_id":4281521,"id":83435834,"diff_hunk":"@@ -254,4 +254,24 @@\n             (check-fact expected-fact fact)))))))\n  \n (deftest test-durability-fressian-serde\n-  (durability-test :fressian))\n+  (testing \"SerDe of the rulebase along with working memory\"\n+    (durability-test :fressian))\n+\n+  (testing \"Repeated SerDe of rulebase\"\n+    (let [rb-serde (fn [s]\n+                     (with-open [baos (java.io.ByteArrayOutputStream.)]\n+                       (d/serialize-rulebase s (df/create-session-serializer baos))\n+                       (let [rb-data (.toByteArray baos)]\n+                         (with-open [bais (java.io.ByteArrayInputStream. rb-data)]\n+                           (d/deserialize-rulebase (df/create-session-serializer bais))))))\n+\n+          s (mk-session 'clara.durability-rules)\n+          rb (-> s eng/components :rulebase)\n+          deserialized1 (rb-serde s)\n+          ;; Need a session to do the 2nd round of SerDe.\n+          restored (d/assemble-restored-session deserialized1 {})\n+          deserialized2 (rb-serde restored)]\n+      \n+      (is (= (-> rb :id-to-node keys set)\n+             (-> deserialized1 :id-to-node keys set)\n+             (-> deserialized2 :id-to-node keys set))))))","path":"src/test/clojure/clara/test_durability.clj","position":25,"original_position":25,"commit_id":"c64b61234d1c203595ae2217b6c06fa8cba9a3b6","original_commit_id":"c64b61234d1c203595ae2217b6c06fa8cba9a3b6","user":{"login":"mrrodriguez","id":3483575,"avatar_url":"https://avatars.githubusercontent.com/u/3483575?v=3","gravatar_id":"","url":"https://api.github.com/users/mrrodriguez","html_url":"https://github.com/mrrodriguez","followers_url":"https://api.github.com/users/mrrodriguez/followers","following_url":"https://api.github.com/users/mrrodriguez/following{/other_user}","gists_url":"https://api.github.com/users/mrrodriguez/gists{/gist_id}","starred_url":"https://api.github.com/users/mrrodriguez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrrodriguez/subscriptions","organizations_url":"https://api.github.com/users/mrrodriguez/orgs","repos_url":"https://api.github.com/users/mrrodriguez/repos","events_url":"https://api.github.com/users/mrrodriguez/events{/privacy}","received_events_url":"https://api.github.com/users/mrrodriguez/received_events","type":"User","site_admin":false},"body":"Yeah I just did this to get a quick test.  It wasn't meant to be much more than asserting that something structurally coherent can serialize and deserialize.  I know the `:id-to-node` doesn't really prove much of anything in terms of the correctness of a rulebase.  \r\n\r\nPrior to these changes there were exceptions before even getting this far.  I can try to work in a test about inserting facts to these rulebases and showing they all have the same queried results. ","created_at":"2016-10-14T14:43:45Z","updated_at":"2016-10-14T14:43:45Z","html_url":"https://github.com/rbrush/clara-rules/pull/228#discussion_r83435834","pull_request_url":"https://api.github.com/repos/rbrush/clara-rules/pulls/228","_links":{"self":{"href":"https://api.github.com/repos/rbrush/clara-rules/pulls/comments/83435834"},"html":{"href":"https://github.com/rbrush/clara-rules/pull/228#discussion_r83435834"},"pull_request":{"href":"https://api.github.com/repos/rbrush/clara-rules/pulls/228"}}},"pull_request":{"url":"https://api.github.com/repos/rbrush/clara-rules/pulls/228","id":89265545,"html_url":"https://github.com/rbrush/clara-rules/pull/228","diff_url":"https://github.com/rbrush/clara-rules/pull/228.diff","patch_url":"https://github.com/rbrush/clara-rules/pull/228.patch","issue_url":"https://api.github.com/repos/rbrush/clara-rules/issues/228","number":228,"state":"open","locked":false,"title":"Sorted coll Fressian handler fixes","user":{"login":"mrrodriguez","id":3483575,"avatar_url":"https://avatars.githubusercontent.com/u/3483575?v=3","gravatar_id":"","url":"https://api.github.com/users/mrrodriguez","html_url":"https://github.com/mrrodriguez","followers_url":"https://api.github.com/users/mrrodriguez/followers","following_url":"https://api.github.com/users/mrrodriguez/following{/other_user}","gists_url":"https://api.github.com/users/mrrodriguez/gists{/gist_id}","starred_url":"https://api.github.com/users/mrrodriguez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrrodriguez/subscriptions","organizations_url":"https://api.github.com/users/mrrodriguez/orgs","repos_url":"https://api.github.com/users/mrrodriguez/repos","events_url":"https://api.github.com/users/mrrodriguez/events{/privacy}","received_events_url":"https://api.github.com/users/mrrodriguez/received_events","type":"User","site_admin":false},"body":"The sorted collections Fressian SerDe handlers didn't preserve metadata upon deserialization.  This means a deserialized sorted collection could potentially fail if it were re-serialized again afterwards.  This only applies to sorted collections that have a custom sort comparator fn, which must have its name specified in the metadata under the key `:clara.rules.durability/comparator-name`.\r\n\r\nI added the start of some explicit testing of the behavior of the Fressian handlers in `clara.test-fressian` to try to be sure to catch more issues like this in the future.\r\n\r\nI also added a test in `clara.test-durability` demonstrating the use-case that triggered this issue from the Serialize+Deserialize+Re-serialize a rulebase perspective.\r\n\r\n`clara.rules.durability/assemble-restored-session` had a 2-arity added as well.  This is only used in tests here, but we have experienced places where it'd be helpful for our use-cases as well.  If you deserialize a rulebase and want a brand new working memory, rather than having an existing one, it is convenient to have this assembly function that behaves sort of like `clara.rules/mk-session`, but with a rulebase given as an argument - along with the same sort of options.\r\n","created_at":"2016-10-13T19:23:41Z","updated_at":"2016-10-14T14:43:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8f99b542cb06ecb3d3b9c08549450046778e684b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/rbrush/clara-rules/pulls/228/commits","review_comments_url":"https://api.github.com/repos/rbrush/clara-rules/pulls/228/comments","review_comment_url":"https://api.github.com/repos/rbrush/clara-rules/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rbrush/clara-rules/issues/228/comments","statuses_url":"https://api.github.com/repos/rbrush/clara-rules/statuses/c64b61234d1c203595ae2217b6c06fa8cba9a3b6","head":{"label":"mrrodriguez:sorted-coll-durability-fix","ref":"sorted-coll-durability-fix","sha":"c64b61234d1c203595ae2217b6c06fa8cba9a3b6","user":{"login":"mrrodriguez","id":3483575,"avatar_url":"https://avatars.githubusercontent.com/u/3483575?v=3","gravatar_id":"","url":"https://api.github.com/users/mrrodriguez","html_url":"https://github.com/mrrodriguez","followers_url":"https://api.github.com/users/mrrodriguez/followers","following_url":"https://api.github.com/users/mrrodriguez/following{/other_user}","gists_url":"https://api.github.com/users/mrrodriguez/gists{/gist_id}","starred_url":"https://api.github.com/users/mrrodriguez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrrodriguez/subscriptions","organizations_url":"https://api.github.com/users/mrrodriguez/orgs","repos_url":"https://api.github.com/users/mrrodriguez/repos","events_url":"https://api.github.com/users/mrrodriguez/events{/privacy}","received_events_url":"https://api.github.com/users/mrrodriguez/received_events","type":"User","site_admin":false},"repo":{"id":15387814,"name":"clara-rules","full_name":"mrrodriguez/clara-rules","owner":{"login":"mrrodriguez","id":3483575,"avatar_url":"https://avatars.githubusercontent.com/u/3483575?v=3","gravatar_id":"","url":"https://api.github.com/users/mrrodriguez","html_url":"https://github.com/mrrodriguez","followers_url":"https://api.github.com/users/mrrodriguez/followers","following_url":"https://api.github.com/users/mrrodriguez/following{/other_user}","gists_url":"https://api.github.com/users/mrrodriguez/gists{/gist_id}","starred_url":"https://api.github.com/users/mrrodriguez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrrodriguez/subscriptions","organizations_url":"https://api.github.com/users/mrrodriguez/orgs","repos_url":"https://api.github.com/users/mrrodriguez/repos","events_url":"https://api.github.com/users/mrrodriguez/events{/privacy}","received_events_url":"https://api.github.com/users/mrrodriguez/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mrrodriguez/clara-rules","description":"Forward-chaining rules in Clojure","fork":true,"url":"https://api.github.com/repos/mrrodriguez/clara-rules","forks_url":"https://api.github.com/repos/mrrodriguez/clara-rules/forks","keys_url":"https://api.github.com/repos/mrrodriguez/clara-rules/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mrrodriguez/clara-rules/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mrrodriguez/clara-rules/teams","hooks_url":"https://api.github.com/repos/mrrodriguez/clara-rules/hooks","issue_events_url":"https://api.github.com/repos/mrrodriguez/clara-rules/issues/events{/number}","events_url":"https://api.github.com/repos/mrrodriguez/clara-rules/events","assignees_url":"https://api.github.com/repos/mrrodriguez/clara-rules/assignees{/user}","branches_url":"https://api.github.com/repos/mrrodriguez/clara-rules/branches{/branch}","tags_url":"https://api.github.com/repos/mrrodriguez/clara-rules/tags","blobs_url":"https://api.github.com/repos/mrrodriguez/clara-rules/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mrrodriguez/clara-rules/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mrrodriguez/clara-rules/git/refs{/sha}","trees_url":"https://api.github.com/repos/mrrodriguez/clara-rules/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mrrodriguez/clara-rules/statuses/{sha}","languages_url":"https://api.github.com/repos/mrrodriguez/clara-rules/languages","stargazers_url":"https://api.github.com/repos/mrrodriguez/clara-rules/stargazers","contributors_url":"https://api.github.com/repos/mrrodriguez/clara-rules/contributors","subscribers_url":"https://api.github.com/repos/mrrodriguez/clara-rules/subscribers","subscription_url":"https://api.github.com/repos/mrrodriguez/clara-rules/subscription","commits_url":"https://api.github.com/repos/mrrodriguez/clara-rules/commits{/sha}","git_commits_url":"https://api.github.com/repos/mrrodriguez/clara-rules/git/commits{/sha}","comments_url":"https://api.github.com/repos/mrrodriguez/clara-rules/comments{/number}","issue_comment_url":"https://api.github.com/repos/mrrodriguez/clara-rules/issues/comments{/number}","contents_url":"https://api.github.com/repos/mrrodriguez/clara-rules/contents/{+path}","compare_url":"https://api.github.com/repos/mrrodriguez/clara-rules/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mrrodriguez/clara-rules/merges","archive_url":"https://api.github.com/repos/mrrodriguez/clara-rules/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mrrodriguez/clara-rules/downloads","issues_url":"https://api.github.com/repos/mrrodriguez/clara-rules/issues{/number}","pulls_url":"https://api.github.com/repos/mrrodriguez/clara-rules/pulls{/number}","milestones_url":"https://api.github.com/repos/mrrodriguez/clara-rules/milestones{/number}","notifications_url":"https://api.github.com/repos/mrrodriguez/clara-rules/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mrrodriguez/clara-rules/labels{/name}","releases_url":"https://api.github.com/repos/mrrodriguez/clara-rules/releases{/id}","deployments_url":"https://api.github.com/repos/mrrodriguez/clara-rules/deployments","created_at":"2013-12-23T04:45:05Z","updated_at":"2015-04-28T21:51:41Z","pushed_at":"2016-10-13T20:22:00Z","git_url":"git://github.com/mrrodriguez/clara-rules.git","ssh_url":"git@github.com:mrrodriguez/clara-rules.git","clone_url":"https://github.com/mrrodriguez/clara-rules.git","svn_url":"https://github.com/mrrodriguez/clara-rules","homepage":"","size":1789,"stargazers_count":0,"watchers_count":0,"language":"Clojure","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rbrush:master","ref":"master","sha":"6d14dbf9379f3ede849c50dd82c47b1305a1d7c7","user":{"login":"rbrush","id":574824,"avatar_url":"https://avatars.githubusercontent.com/u/574824?v=3","gravatar_id":"","url":"https://api.github.com/users/rbrush","html_url":"https://github.com/rbrush","followers_url":"https://api.github.com/users/rbrush/followers","following_url":"https://api.github.com/users/rbrush/following{/other_user}","gists_url":"https://api.github.com/users/rbrush/gists{/gist_id}","starred_url":"https://api.github.com/users/rbrush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbrush/subscriptions","organizations_url":"https://api.github.com/users/rbrush/orgs","repos_url":"https://api.github.com/users/rbrush/repos","events_url":"https://api.github.com/users/rbrush/events{/privacy}","received_events_url":"https://api.github.com/users/rbrush/received_events","type":"User","site_admin":false},"repo":{"id":11697963,"name":"clara-rules","full_name":"rbrush/clara-rules","owner":{"login":"rbrush","id":574824,"avatar_url":"https://avatars.githubusercontent.com/u/574824?v=3","gravatar_id":"","url":"https://api.github.com/users/rbrush","html_url":"https://github.com/rbrush","followers_url":"https://api.github.com/users/rbrush/followers","following_url":"https://api.github.com/users/rbrush/following{/other_user}","gists_url":"https://api.github.com/users/rbrush/gists{/gist_id}","starred_url":"https://api.github.com/users/rbrush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbrush/subscriptions","organizations_url":"https://api.github.com/users/rbrush/orgs","repos_url":"https://api.github.com/users/rbrush/repos","events_url":"https://api.github.com/users/rbrush/events{/privacy}","received_events_url":"https://api.github.com/users/rbrush/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rbrush/clara-rules","description":"Forward-chaining rules in Clojure","fork":false,"url":"https://api.github.com/repos/rbrush/clara-rules","forks_url":"https://api.github.com/repos/rbrush/clara-rules/forks","keys_url":"https://api.github.com/repos/rbrush/clara-rules/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rbrush/clara-rules/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rbrush/clara-rules/teams","hooks_url":"https://api.github.com/repos/rbrush/clara-rules/hooks","issue_events_url":"https://api.github.com/repos/rbrush/clara-rules/issues/events{/number}","events_url":"https://api.github.com/repos/rbrush/clara-rules/events","assignees_url":"https://api.github.com/repos/rbrush/clara-rules/assignees{/user}","branches_url":"https://api.github.com/repos/rbrush/clara-rules/branches{/branch}","tags_url":"https://api.github.com/repos/rbrush/clara-rules/tags","blobs_url":"https://api.github.com/repos/rbrush/clara-rules/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rbrush/clara-rules/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rbrush/clara-rules/git/refs{/sha}","trees_url":"https://api.github.com/repos/rbrush/clara-rules/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rbrush/clara-rules/statuses/{sha}","languages_url":"https://api.github.com/repos/rbrush/clara-rules/languages","stargazers_url":"https://api.github.com/repos/rbrush/clara-rules/stargazers","contributors_url":"https://api.github.com/repos/rbrush/clara-rules/contributors","subscribers_url":"https://api.github.com/repos/rbrush/clara-rules/subscribers","subscription_url":"https://api.github.com/repos/rbrush/clara-rules/subscription","commits_url":"https://api.github.com/repos/rbrush/clara-rules/commits{/sha}","git_commits_url":"https://api.github.com/repos/rbrush/clara-rules/git/commits{/sha}","comments_url":"https://api.github.com/repos/rbrush/clara-rules/comments{/number}","issue_comment_url":"https://api.github.com/repos/rbrush/clara-rules/issues/comments{/number}","contents_url":"https://api.github.com/repos/rbrush/clara-rules/contents/{+path}","compare_url":"https://api.github.com/repos/rbrush/clara-rules/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rbrush/clara-rules/merges","archive_url":"https://api.github.com/repos/rbrush/clara-rules/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rbrush/clara-rules/downloads","issues_url":"https://api.github.com/repos/rbrush/clara-rules/issues{/number}","pulls_url":"https://api.github.com/repos/rbrush/clara-rules/pulls{/number}","milestones_url":"https://api.github.com/repos/rbrush/clara-rules/milestones{/number}","notifications_url":"https://api.github.com/repos/rbrush/clara-rules/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rbrush/clara-rules/labels{/name}","releases_url":"https://api.github.com/repos/rbrush/clara-rules/releases{/id}","deployments_url":"https://api.github.com/repos/rbrush/clara-rules/deployments","created_at":"2013-07-27T01:17:19Z","updated_at":"2016-10-12T21:33:40Z","pushed_at":"2016-10-13T20:22:00Z","git_url":"git://github.com/rbrush/clara-rules.git","ssh_url":"git@github.com:rbrush/clara-rules.git","clone_url":"https://github.com/rbrush/clara-rules.git","svn_url":"https://github.com/rbrush/clara-rules","homepage":"http://www.clara-rules.org","size":2035,"stargazers_count":500,"watchers_count":500,"language":"Clojure","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":49,"mirror_url":null,"open_issues_count":22,"forks":49,"open_issues":22,"watchers":500,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rbrush/clara-rules/pulls/228"},"html":{"href":"https://github.com/rbrush/clara-rules/pull/228"},"issue":{"href":"https://api.github.com/repos/rbrush/clara-rules/issues/228"},"comments":{"href":"https://api.github.com/repos/rbrush/clara-rules/issues/228/comments"},"review_comments":{"href":"https://api.github.com/repos/rbrush/clara-rules/pulls/228/comments"},"review_comment":{"href":"https://api.github.com/repos/rbrush/clara-rules/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rbrush/clara-rules/pulls/228/commits"},"statuses":{"href":"https://api.github.com/repos/rbrush/clara-rules/statuses/c64b61234d1c203595ae2217b6c06fa8cba9a3b6"}}}}
{"actor":{"display_login":"mrrodriguez"}}