{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/mentat/pulls/comments/115560648","pull_request_review_id":37109104,"id":115560648,"diff_hunk":"@@ -103,6 +103,14 @@ use types::{\n };\n use upsert_resolution::Generation;\n \n+struct PartRanges(Vec<(i64, i64)>);","path":"db/src/tx.rs","position":4,"original_position":4,"commit_id":"066f6d603ed3d05c7a83536f464e6447054fc9d0","original_commit_id":"066f6d603ed3d05c7a83536f464e6447054fc9d0","user":{"login":"ncalexan","id":1097182,"avatar_url":"https://avatars3.githubusercontent.com/u/1097182?v=3","gravatar_id":"","url":"https://api.github.com/users/ncalexan","html_url":"https://github.com/ncalexan","followers_url":"https://api.github.com/users/ncalexan/followers","following_url":"https://api.github.com/users/ncalexan/following{/other_user}","gists_url":"https://api.github.com/users/ncalexan/gists{/gist_id}","starred_url":"https://api.github.com/users/ncalexan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncalexan/subscriptions","organizations_url":"https://api.github.com/users/ncalexan/orgs","repos_url":"https://api.github.com/users/ncalexan/repos","events_url":"https://api.github.com/users/ncalexan/events{/privacy}","received_events_url":"https://api.github.com/users/ncalexan/received_events","type":"User","site_admin":false},"body":"You could profitably newtype `PartitionMap`, simplifying this slightly.  Either that or add it to the `PartitionMapping` trait that already exists.","created_at":"2017-05-09T18:08:56Z","updated_at":"2017-05-09T18:10:31Z","html_url":"https://github.com/mozilla/mentat/pull/447#discussion_r115560648","pull_request_url":"https://api.github.com/repos/mozilla/mentat/pulls/447","_links":{"self":{"href":"https://api.github.com/repos/mozilla/mentat/pulls/comments/115560648"},"html":{"href":"https://github.com/mozilla/mentat/pull/447#discussion_r115560648"},"pull_request":{"href":"https://api.github.com/repos/mozilla/mentat/pulls/447"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/mentat/pulls/447","id":119369486,"html_url":"https://github.com/mozilla/mentat/pull/447","diff_url":"https://github.com/mozilla/mentat/pull/447.diff","patch_url":"https://github.com/mozilla/mentat/pull/447.patch","issue_url":"https://api.github.com/repos/mozilla/mentat/issues/447","number":447,"state":"open","locked":false,"title":"[tx] Forbid insertion of unknown entity IDs","user":{"login":"rnewman","id":91722,"avatar_url":"https://avatars1.githubusercontent.com/u/91722?v=3","gravatar_id":"","url":"https://api.github.com/users/rnewman","html_url":"https://github.com/rnewman","followers_url":"https://api.github.com/users/rnewman/followers","following_url":"https://api.github.com/users/rnewman/following{/other_user}","gists_url":"https://api.github.com/users/rnewman/gists{/gist_id}","starred_url":"https://api.github.com/users/rnewman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rnewman/subscriptions","organizations_url":"https://api.github.com/users/rnewman/orgs","repos_url":"https://api.github.com/users/rnewman/repos","events_url":"https://api.github.com/users/rnewman/events{/privacy}","received_events_url":"https://api.github.com/users/rnewman/received_events","type":"User","site_admin":false},"body":"The Datomic docs state the following:\r\n\r\n>  There are three ways to sepcify an entity id:\r\n> - a temporary id for a new entity being added to the database\r\n> - an existing id for an entity that's already in the database\r\n> - an identifier for an entity that's already in the database\r\n\r\nNote that _not_ mentioned is \"by making up a new entity ID\".\r\n\r\nThe problem with simply making up a new entity ID is that it'll collide with tempid allocations, either within a transact itself, or with a later tempid allocation colliding with an existing entity.\r\n\r\nI've written a couple of failing tests for this. I believe the most straightforward and robust solution is for non-syncing code to simply be forbidden from transacting new raw entity IDs: it should use upserting or tempids to define new entities.\r\n\r\nA simple and cheap check is to ensure that every entid in transact input is within the used part ranges. A more thorough solution would be to maintain a set of every mentioned entity ID. We might be doing this anyway for syncing.","created_at":"2017-05-08T03:00:59Z","updated_at":"2017-05-09T18:10:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ebb866e981c8052a4d1a005ebbcaaeb82b513e49","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/mentat/pulls/447/commits","review_comments_url":"https://api.github.com/repos/mozilla/mentat/pulls/447/comments","review_comment_url":"https://api.github.com/repos/mozilla/mentat/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/mentat/issues/447/comments","statuses_url":"https://api.github.com/repos/mozilla/mentat/statuses/066f6d603ed3d05c7a83536f464e6447054fc9d0","head":{"label":"mozilla:rnewman/existing-entids","ref":"rnewman/existing-entids","sha":"066f6d603ed3d05c7a83536f464e6447054fc9d0","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars1.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":62660036,"name":"mentat","full_name":"mozilla/mentat","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars1.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/mentat","description":"A persistent, relational store inspired by Datomic and DataScript.","fork":false,"url":"https://api.github.com/repos/mozilla/mentat","forks_url":"https://api.github.com/repos/mozilla/mentat/forks","keys_url":"https://api.github.com/repos/mozilla/mentat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/mentat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/mentat/teams","hooks_url":"https://api.github.com/repos/mozilla/mentat/hooks","issue_events_url":"https://api.github.com/repos/mozilla/mentat/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/mentat/events","assignees_url":"https://api.github.com/repos/mozilla/mentat/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/mentat/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/mentat/tags","blobs_url":"https://api.github.com/repos/mozilla/mentat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/mentat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/mentat/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/mentat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/mentat/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/mentat/languages","stargazers_url":"https://api.github.com/repos/mozilla/mentat/stargazers","contributors_url":"https://api.github.com/repos/mozilla/mentat/contributors","subscribers_url":"https://api.github.com/repos/mozilla/mentat/subscribers","subscription_url":"https://api.github.com/repos/mozilla/mentat/subscription","commits_url":"https://api.github.com/repos/mozilla/mentat/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/mentat/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/mentat/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/mentat/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/mentat/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/mentat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/mentat/merges","archive_url":"https://api.github.com/repos/mozilla/mentat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/mentat/downloads","issues_url":"https://api.github.com/repos/mozilla/mentat/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/mentat/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/mentat/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/mentat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/mentat/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/mentat/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/mentat/deployments","created_at":"2016-07-05T18:29:34Z","updated_at":"2017-05-09T00:20:57Z","pushed_at":"2017-05-09T16:42:38Z","git_url":"git://github.com/mozilla/mentat.git","ssh_url":"git@github.com:mozilla/mentat.git","clone_url":"https://github.com/mozilla/mentat.git","svn_url":"https://github.com/mozilla/mentat","homepage":null,"size":1448,"stargazers_count":673,"watchers_count":673,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":147,"forks":21,"open_issues":147,"watchers":673,"default_branch":"rust"}},"base":{"label":"mozilla:rust","ref":"rust","sha":"1dc8a3eaa0cc078dbade42ff2555f83867aae4bb","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars1.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":62660036,"name":"mentat","full_name":"mozilla/mentat","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars1.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/mentat","description":"A persistent, relational store inspired by Datomic and DataScript.","fork":false,"url":"https://api.github.com/repos/mozilla/mentat","forks_url":"https://api.github.com/repos/mozilla/mentat/forks","keys_url":"https://api.github.com/repos/mozilla/mentat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/mentat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/mentat/teams","hooks_url":"https://api.github.com/repos/mozilla/mentat/hooks","issue_events_url":"https://api.github.com/repos/mozilla/mentat/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/mentat/events","assignees_url":"https://api.github.com/repos/mozilla/mentat/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/mentat/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/mentat/tags","blobs_url":"https://api.github.com/repos/mozilla/mentat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/mentat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/mentat/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/mentat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/mentat/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/mentat/languages","stargazers_url":"https://api.github.com/repos/mozilla/mentat/stargazers","contributors_url":"https://api.github.com/repos/mozilla/mentat/contributors","subscribers_url":"https://api.github.com/repos/mozilla/mentat/subscribers","subscription_url":"https://api.github.com/repos/mozilla/mentat/subscription","commits_url":"https://api.github.com/repos/mozilla/mentat/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/mentat/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/mentat/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/mentat/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/mentat/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/mentat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/mentat/merges","archive_url":"https://api.github.com/repos/mozilla/mentat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/mentat/downloads","issues_url":"https://api.github.com/repos/mozilla/mentat/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/mentat/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/mentat/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/mentat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/mentat/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/mentat/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/mentat/deployments","created_at":"2016-07-05T18:29:34Z","updated_at":"2017-05-09T00:20:57Z","pushed_at":"2017-05-09T16:42:38Z","git_url":"git://github.com/mozilla/mentat.git","ssh_url":"git@github.com:mozilla/mentat.git","clone_url":"https://github.com/mozilla/mentat.git","svn_url":"https://github.com/mozilla/mentat","homepage":null,"size":1448,"stargazers_count":673,"watchers_count":673,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":147,"forks":21,"open_issues":147,"watchers":673,"default_branch":"rust"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/mentat/pulls/447"},"html":{"href":"https://github.com/mozilla/mentat/pull/447"},"issue":{"href":"https://api.github.com/repos/mozilla/mentat/issues/447"},"comments":{"href":"https://api.github.com/repos/mozilla/mentat/issues/447/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/mentat/pulls/447/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/mentat/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/mentat/pulls/447/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/mentat/statuses/066f6d603ed3d05c7a83536f464e6447054fc9d0"}}}}
{"actor":{"display_login":"ncalexan"}}