{"action":"created","comment":{"url":"https://api.github.com/repos/taskcluster/slugid/pulls/comments/37783239","id":37783239,"diff_hunk":"@@ -9,7 +9,7 @@\n   },\n   \"repository\": {\n     \"type\":   \"git\",\n-    \"url\":    \"https://github.com/jonasfj/slugid.git\"\n+    \"url\":    \"https://github.com/taskcluster/slugid.git\"\n   },\n   \"dependencies\": {\n     \"uuid\":                             \"1.4.1\"","path":"package.json","position":16,"original_position":16,"commit_id":"0a6b80b8c65cb12363d7f4853457929cf794bfca","original_commit_id":"0a6b80b8c65cb12363d7f4853457929cf794bfca","user":{"login":"jonasfj","id":149732,"avatar_url":"https://avatars.githubusercontent.com/u/149732?v=3","gravatar_id":"","url":"https://api.github.com/users/jonasfj","html_url":"https://github.com/jonasfj","followers_url":"https://api.github.com/users/jonasfj/followers","following_url":"https://api.github.com/users/jonasfj/following{/other_user}","gists_url":"https://api.github.com/users/jonasfj/gists{/gist_id}","starred_url":"https://api.github.com/users/jonasfj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonasfj/subscriptions","organizations_url":"https://api.github.com/users/jonasfj/orgs","repos_url":"https://api.github.com/users/jonasfj/repos","events_url":"https://api.github.com/users/jonasfj/events{/privacy}","received_events_url":"https://api.github.com/users/jonasfj/received_events","type":"User","site_admin":false},"body":"Let's bump this and use a `^`...","created_at":"2015-08-24T18:15:55Z","updated_at":"2015-08-24T18:15:55Z","html_url":"https://github.com/taskcluster/slugid/pull/1#discussion_r37783239","pull_request_url":"https://api.github.com/repos/taskcluster/slugid/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/taskcluster/slugid/pulls/comments/37783239"},"html":{"href":"https://github.com/taskcluster/slugid/pull/1#discussion_r37783239"},"pull_request":{"href":"https://api.github.com/repos/taskcluster/slugid/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/taskcluster/slugid/pulls/1","id":42595414,"html_url":"https://github.com/taskcluster/slugid/pull/1","diff_url":"https://github.com/taskcluster/slugid/pull/1.diff","patch_url":"https://github.com/taskcluster/slugid/pull/1.patch","issue_url":"https://api.github.com/repos/taskcluster/slugid/issues/1","number":1,"state":"open","locked":false,"title":"Bug 1194767 - slugids starting with a '-' can cause problems","user":{"login":"petemoore","id":190790,"avatar_url":"https://avatars.githubusercontent.com/u/190790?v=3","gravatar_id":"","url":"https://api.github.com/users/petemoore","html_url":"https://github.com/petemoore","followers_url":"https://api.github.com/users/petemoore/followers","following_url":"https://api.github.com/users/petemoore/following{/other_user}","gists_url":"https://api.github.com/users/petemoore/gists{/gist_id}","starred_url":"https://api.github.com/users/petemoore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petemoore/subscriptions","organizations_url":"https://api.github.com/users/petemoore/orgs","repos_url":"https://api.github.com/users/petemoore/repos","events_url":"https://api.github.com/users/petemoore/events{/privacy}","received_events_url":"https://api.github.com/users/petemoore/received_events","type":"User","site_admin":false},"body":"The current method of generating a base64 encoding results in a 22 character string, giving a freedom of 22 * 6 = 132 bits. Since the uuid only carries 128 bits, the last character is zero padded with four trailing 0 bits.\r\n\r\nThe '-' character represents bits 0b111110 (value 62) in base64 and therefore since the last character of the slug is currently 0bxx0000 it means the last character can never be '-' (in reality, the last character must be one of 'A', 'Q', 'g', 'w').\r\n\r\nTherefore, I propose a trivial solution to guarantee that the slugId does not being with a '-' character, which is to base64 encode the uuid, and then reverse the sequence of characters in the resulting string. This means all new slugIds will begin with either 'A', 'Q', 'g', or 'w'. This also means there is no loss in randomness (122 bits) by introducing this change.\r\n\r\nI've also extended test coverage to be more comprehensive.","created_at":"2015-08-17T14:42:57Z","updated_at":"2015-08-24T18:15:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b4a78ab8c1e13f06a9cf620851c3d277a980bf12","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/taskcluster/slugid/pulls/1/commits","review_comments_url":"https://api.github.com/repos/taskcluster/slugid/pulls/1/comments","review_comment_url":"https://api.github.com/repos/taskcluster/slugid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/taskcluster/slugid/issues/1/comments","statuses_url":"https://api.github.com/repos/taskcluster/slugid/statuses/0a6b80b8c65cb12363d7f4853457929cf794bfca","head":{"label":"petemoore:bug1194767","ref":"bug1194767","sha":"0a6b80b8c65cb12363d7f4853457929cf794bfca","user":{"login":"petemoore","id":190790,"avatar_url":"https://avatars.githubusercontent.com/u/190790?v=3","gravatar_id":"","url":"https://api.github.com/users/petemoore","html_url":"https://github.com/petemoore","followers_url":"https://api.github.com/users/petemoore/followers","following_url":"https://api.github.com/users/petemoore/following{/other_user}","gists_url":"https://api.github.com/users/petemoore/gists{/gist_id}","starred_url":"https://api.github.com/users/petemoore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petemoore/subscriptions","organizations_url":"https://api.github.com/users/petemoore/orgs","repos_url":"https://api.github.com/users/petemoore/repos","events_url":"https://api.github.com/users/petemoore/events{/privacy}","received_events_url":"https://api.github.com/users/petemoore/received_events","type":"User","site_admin":false},"repo":{"id":40723800,"name":"slugid","full_name":"petemoore/slugid","owner":{"login":"petemoore","id":190790,"avatar_url":"https://avatars.githubusercontent.com/u/190790?v=3","gravatar_id":"","url":"https://api.github.com/users/petemoore","html_url":"https://github.com/petemoore","followers_url":"https://api.github.com/users/petemoore/followers","following_url":"https://api.github.com/users/petemoore/following{/other_user}","gists_url":"https://api.github.com/users/petemoore/gists{/gist_id}","starred_url":"https://api.github.com/users/petemoore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petemoore/subscriptions","organizations_url":"https://api.github.com/users/petemoore/orgs","repos_url":"https://api.github.com/users/petemoore/repos","events_url":"https://api.github.com/users/petemoore/events{/privacy}","received_events_url":"https://api.github.com/users/petemoore/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/petemoore/slugid","description":"URL-safe base64 UUID encoder for generating 22 character slugs","fork":true,"url":"https://api.github.com/repos/petemoore/slugid","forks_url":"https://api.github.com/repos/petemoore/slugid/forks","keys_url":"https://api.github.com/repos/petemoore/slugid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/petemoore/slugid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/petemoore/slugid/teams","hooks_url":"https://api.github.com/repos/petemoore/slugid/hooks","issue_events_url":"https://api.github.com/repos/petemoore/slugid/issues/events{/number}","events_url":"https://api.github.com/repos/petemoore/slugid/events","assignees_url":"https://api.github.com/repos/petemoore/slugid/assignees{/user}","branches_url":"https://api.github.com/repos/petemoore/slugid/branches{/branch}","tags_url":"https://api.github.com/repos/petemoore/slugid/tags","blobs_url":"https://api.github.com/repos/petemoore/slugid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/petemoore/slugid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/petemoore/slugid/git/refs{/sha}","trees_url":"https://api.github.com/repos/petemoore/slugid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/petemoore/slugid/statuses/{sha}","languages_url":"https://api.github.com/repos/petemoore/slugid/languages","stargazers_url":"https://api.github.com/repos/petemoore/slugid/stargazers","contributors_url":"https://api.github.com/repos/petemoore/slugid/contributors","subscribers_url":"https://api.github.com/repos/petemoore/slugid/subscribers","subscription_url":"https://api.github.com/repos/petemoore/slugid/subscription","commits_url":"https://api.github.com/repos/petemoore/slugid/commits{/sha}","git_commits_url":"https://api.github.com/repos/petemoore/slugid/git/commits{/sha}","comments_url":"https://api.github.com/repos/petemoore/slugid/comments{/number}","issue_comment_url":"https://api.github.com/repos/petemoore/slugid/issues/comments{/number}","contents_url":"https://api.github.com/repos/petemoore/slugid/contents/{+path}","compare_url":"https://api.github.com/repos/petemoore/slugid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/petemoore/slugid/merges","archive_url":"https://api.github.com/repos/petemoore/slugid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/petemoore/slugid/downloads","issues_url":"https://api.github.com/repos/petemoore/slugid/issues{/number}","pulls_url":"https://api.github.com/repos/petemoore/slugid/pulls{/number}","milestones_url":"https://api.github.com/repos/petemoore/slugid/milestones{/number}","notifications_url":"https://api.github.com/repos/petemoore/slugid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/petemoore/slugid/labels{/name}","releases_url":"https://api.github.com/repos/petemoore/slugid/releases{/id}","created_at":"2015-08-14T16:03:52Z","updated_at":"2015-08-14T16:03:52Z","pushed_at":"2015-08-24T16:17:31Z","git_url":"git://github.com/petemoore/slugid.git","ssh_url":"git@github.com:petemoore/slugid.git","clone_url":"https://github.com/petemoore/slugid.git","svn_url":"https://github.com/petemoore/slugid","homepage":null,"size":135,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"taskcluster:master","ref":"master","sha":"29be40074646b97e5ed02da257918467fac07c4a","user":{"login":"taskcluster","id":6257436,"avatar_url":"https://avatars.githubusercontent.com/u/6257436?v=3","gravatar_id":"","url":"https://api.github.com/users/taskcluster","html_url":"https://github.com/taskcluster","followers_url":"https://api.github.com/users/taskcluster/followers","following_url":"https://api.github.com/users/taskcluster/following{/other_user}","gists_url":"https://api.github.com/users/taskcluster/gists{/gist_id}","starred_url":"https://api.github.com/users/taskcluster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taskcluster/subscriptions","organizations_url":"https://api.github.com/users/taskcluster/orgs","repos_url":"https://api.github.com/users/taskcluster/repos","events_url":"https://api.github.com/users/taskcluster/events{/privacy}","received_events_url":"https://api.github.com/users/taskcluster/received_events","type":"Organization","site_admin":false},"repo":{"id":18197813,"name":"slugid","full_name":"taskcluster/slugid","owner":{"login":"taskcluster","id":6257436,"avatar_url":"https://avatars.githubusercontent.com/u/6257436?v=3","gravatar_id":"","url":"https://api.github.com/users/taskcluster","html_url":"https://github.com/taskcluster","followers_url":"https://api.github.com/users/taskcluster/followers","following_url":"https://api.github.com/users/taskcluster/following{/other_user}","gists_url":"https://api.github.com/users/taskcluster/gists{/gist_id}","starred_url":"https://api.github.com/users/taskcluster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taskcluster/subscriptions","organizations_url":"https://api.github.com/users/taskcluster/orgs","repos_url":"https://api.github.com/users/taskcluster/repos","events_url":"https://api.github.com/users/taskcluster/events{/privacy}","received_events_url":"https://api.github.com/users/taskcluster/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/taskcluster/slugid","description":"URL-safe base64 UUID encoder for generating 22 character slugs","fork":false,"url":"https://api.github.com/repos/taskcluster/slugid","forks_url":"https://api.github.com/repos/taskcluster/slugid/forks","keys_url":"https://api.github.com/repos/taskcluster/slugid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/taskcluster/slugid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/taskcluster/slugid/teams","hooks_url":"https://api.github.com/repos/taskcluster/slugid/hooks","issue_events_url":"https://api.github.com/repos/taskcluster/slugid/issues/events{/number}","events_url":"https://api.github.com/repos/taskcluster/slugid/events","assignees_url":"https://api.github.com/repos/taskcluster/slugid/assignees{/user}","branches_url":"https://api.github.com/repos/taskcluster/slugid/branches{/branch}","tags_url":"https://api.github.com/repos/taskcluster/slugid/tags","blobs_url":"https://api.github.com/repos/taskcluster/slugid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/taskcluster/slugid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/taskcluster/slugid/git/refs{/sha}","trees_url":"https://api.github.com/repos/taskcluster/slugid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/taskcluster/slugid/statuses/{sha}","languages_url":"https://api.github.com/repos/taskcluster/slugid/languages","stargazers_url":"https://api.github.com/repos/taskcluster/slugid/stargazers","contributors_url":"https://api.github.com/repos/taskcluster/slugid/contributors","subscribers_url":"https://api.github.com/repos/taskcluster/slugid/subscribers","subscription_url":"https://api.github.com/repos/taskcluster/slugid/subscription","commits_url":"https://api.github.com/repos/taskcluster/slugid/commits{/sha}","git_commits_url":"https://api.github.com/repos/taskcluster/slugid/git/commits{/sha}","comments_url":"https://api.github.com/repos/taskcluster/slugid/comments{/number}","issue_comment_url":"https://api.github.com/repos/taskcluster/slugid/issues/comments{/number}","contents_url":"https://api.github.com/repos/taskcluster/slugid/contents/{+path}","compare_url":"https://api.github.com/repos/taskcluster/slugid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/taskcluster/slugid/merges","archive_url":"https://api.github.com/repos/taskcluster/slugid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/taskcluster/slugid/downloads","issues_url":"https://api.github.com/repos/taskcluster/slugid/issues{/number}","pulls_url":"https://api.github.com/repos/taskcluster/slugid/pulls{/number}","milestones_url":"https://api.github.com/repos/taskcluster/slugid/milestones{/number}","notifications_url":"https://api.github.com/repos/taskcluster/slugid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/taskcluster/slugid/labels{/name}","releases_url":"https://api.github.com/repos/taskcluster/slugid/releases{/id}","created_at":"2014-03-28T01:45:13Z","updated_at":"2015-08-23T13:32:13Z","pushed_at":"2015-08-24T16:17:32Z","git_url":"git://github.com/taskcluster/slugid.git","ssh_url":"git@github.com:taskcluster/slugid.git","clone_url":"https://github.com/taskcluster/slugid.git","svn_url":"https://github.com/taskcluster/slugid","homepage":null,"size":421,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/taskcluster/slugid/pulls/1"},"html":{"href":"https://github.com/taskcluster/slugid/pull/1"},"issue":{"href":"https://api.github.com/repos/taskcluster/slugid/issues/1"},"comments":{"href":"https://api.github.com/repos/taskcluster/slugid/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/taskcluster/slugid/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/taskcluster/slugid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/taskcluster/slugid/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/taskcluster/slugid/statuses/0a6b80b8c65cb12363d7f4853457929cf794bfca"}}}}