{"action":"created","comment":{"url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/comments/237056325","pull_request_review_id":179261773,"id":237056325,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNzA1NjMyNQ==","diff_hunk":"@@ -187,7 +187,18 @@ class DartdocBackend {\n       if (hasServing) {\n         completedList.removeWhere((entry) => !entry.isServing);\n       }\n-      completedList.sort((a, b) => -a.timestamp.compareTo(b.timestamp));\n+      completedList.sort((a, b) {\n+        // content goes first\n+        if (a.hasContent && !b.hasContent) return -1;\n+        if (!a.hasContent && b.hasContent) return 1;\n+        // next release goes to the back of the list\n+        final rva = a.runtimeVersion.compareTo(shared_versions.runtimeVersion);\n+        final rvb = b.runtimeVersion.compareTo(shared_versions.runtimeVersion);\n+        if (rva > 0 && rvb <= 0) return 1;\n+        if (rva <= 0 && rvb > 1) return -1;\n+        // otherwise compare by timestamp descending\n+        return -a.timestamp.compareTo(b.timestamp);\n+      });","path":"app/lib/dartdoc/backend.dart","position":16,"original_position":16,"commit_id":"92f03d6dd9094d4e863ee643b1cf7751aea4ad62","original_commit_id":"92f03d6dd9094d4e863ee643b1cf7751aea4ad62","user":{"login":"jonasfj","id":149732,"node_id":"MDQ6VXNlcjE0OTczMg==","avatar_url":"https://avatars2.githubusercontent.com/u/149732?v=4","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":"Can I block this PR on: https://github.com/dart-lang/pub-dartlang-dart/issues/1828\r\nI'm not quite sure what this attempts to do...\r\n\r\nAlso couldn't we do it simpler? Something along the lines of:\r\n```dart\r\nimport '../shared/versions.dart' show runtimeVersion, semanticRuntimeVersion;\r\n\r\n...\r\n\r\n    Future<DartdocEntry> loadVersion(String v) async {\r\n      final List<DartdocEntry> entries =\r\n          await _listEntries(storage_path.entryPrefix(package, v));\r\n      // utility to remove anything not matching pred, unless that is everything\r\n      void prefer(pred) => entries.any(pred) ? entries.retainWhere(pred) : null;\r\n      prefer((e) => e.isServing && e.hasContent);\r\n      prefer((e) => e.hasContent);\r\n      prefer((e) => e.runtimeVersion == runtimeVersion);\r\n      entries.sort((a, b) => -a.timestamp.compareTo(b.timestamp));\r\n      return entries.isEmpty ? null : entries.first;\r\n    }\r\n```\r\n\r\n","created_at":"2018-11-28T12:09:21Z","updated_at":"2018-11-28T12:11:07Z","html_url":"https://github.com/dart-lang/pub-dartlang-dart/pull/1827#discussion_r237056325","pull_request_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/1827","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/comments/237056325"},"html":{"href":"https://github.com/dart-lang/pub-dartlang-dart/pull/1827#discussion_r237056325"},"pull_request":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/1827"}}},"pull_request":{"url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/1827","id":234235985,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM0MjM1OTg1","html_url":"https://github.com/dart-lang/pub-dartlang-dart/pull/1827","diff_url":"https://github.com/dart-lang/pub-dartlang-dart/pull/1827.diff","patch_url":"https://github.com/dart-lang/pub-dartlang-dart/pull/1827.patch","issue_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/issues/1827","number":1827,"state":"open","locked":false,"title":"Prefer current runtime over future runtimes in dartdoc serving.","user":{"login":"isoos","id":4778111,"node_id":"MDQ6VXNlcjQ3NzgxMTE=","avatar_url":"https://avatars1.githubusercontent.com/u/4778111?v=4","gravatar_id":"","url":"https://api.github.com/users/isoos","html_url":"https://github.com/isoos","followers_url":"https://api.github.com/users/isoos/followers","following_url":"https://api.github.com/users/isoos/following{/other_user}","gists_url":"https://api.github.com/users/isoos/gists{/gist_id}","starred_url":"https://api.github.com/users/isoos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isoos/subscriptions","organizations_url":"https://api.github.com/users/isoos/orgs","repos_url":"https://api.github.com/users/isoos/repos","events_url":"https://api.github.com/users/isoos/events{/privacy}","received_events_url":"https://api.github.com/users/isoos/received_events","type":"User","site_admin":false},"body":"This is to address the consistency issue: when there is a new release and the dartdoc content is generated, we shouldn't immediately expose it (before the traffic was migrated). With this change we'll serve only if the new release generated content while the old one did not.","created_at":"2018-11-28T11:09:47Z","updated_at":"2018-11-28T12:11:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cb7937bfe781f9dee20c71823e6e33fe735e07bf","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":421017733,"node_id":"MDU6TGFiZWw0MjEwMTc3MzM=","url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/labels/cla:%20yes","name":"cla: yes","color":"ffffff","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/1827/commits","review_comments_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/1827/comments","review_comment_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/issues/1827/comments","statuses_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/statuses/92f03d6dd9094d4e863ee643b1cf7751aea4ad62","head":{"label":"isoos:dartdoc_newrelease","ref":"dartdoc_newrelease","sha":"92f03d6dd9094d4e863ee643b1cf7751aea4ad62","user":{"login":"isoos","id":4778111,"node_id":"MDQ6VXNlcjQ3NzgxMTE=","avatar_url":"https://avatars1.githubusercontent.com/u/4778111?v=4","gravatar_id":"","url":"https://api.github.com/users/isoos","html_url":"https://github.com/isoos","followers_url":"https://api.github.com/users/isoos/followers","following_url":"https://api.github.com/users/isoos/following{/other_user}","gists_url":"https://api.github.com/users/isoos/gists{/gist_id}","starred_url":"https://api.github.com/users/isoos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isoos/subscriptions","organizations_url":"https://api.github.com/users/isoos/orgs","repos_url":"https://api.github.com/users/isoos/repos","events_url":"https://api.github.com/users/isoos/events{/privacy}","received_events_url":"https://api.github.com/users/isoos/received_events","type":"User","site_admin":false},"repo":{"id":86555243,"node_id":"MDEwOlJlcG9zaXRvcnk4NjU1NTI0Mw==","name":"pub-dartlang-dart","full_name":"isoos/pub-dartlang-dart","private":false,"owner":{"login":"isoos","id":4778111,"node_id":"MDQ6VXNlcjQ3NzgxMTE=","avatar_url":"https://avatars1.githubusercontent.com/u/4778111?v=4","gravatar_id":"","url":"https://api.github.com/users/isoos","html_url":"https://github.com/isoos","followers_url":"https://api.github.com/users/isoos/followers","following_url":"https://api.github.com/users/isoos/following{/other_user}","gists_url":"https://api.github.com/users/isoos/gists{/gist_id}","starred_url":"https://api.github.com/users/isoos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isoos/subscriptions","organizations_url":"https://api.github.com/users/isoos/orgs","repos_url":"https://api.github.com/users/isoos/repos","events_url":"https://api.github.com/users/isoos/events{/privacy}","received_events_url":"https://api.github.com/users/isoos/received_events","type":"User","site_admin":false},"html_url":"https://github.com/isoos/pub-dartlang-dart","description":"The pub.dartlang.org site in Dart","fork":true,"url":"https://api.github.com/repos/isoos/pub-dartlang-dart","forks_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/forks","keys_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/teams","hooks_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/hooks","issue_events_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/issues/events{/number}","events_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/events","assignees_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/assignees{/user}","branches_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/branches{/branch}","tags_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/tags","blobs_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/git/refs{/sha}","trees_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/statuses/{sha}","languages_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/languages","stargazers_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/stargazers","contributors_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/contributors","subscribers_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/subscribers","subscription_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/subscription","commits_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/commits{/sha}","git_commits_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/git/commits{/sha}","comments_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/comments{/number}","issue_comment_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/issues/comments{/number}","contents_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/contents/{+path}","compare_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/merges","archive_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/downloads","issues_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/issues{/number}","pulls_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/pulls{/number}","milestones_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/milestones{/number}","notifications_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/labels{/name}","releases_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/releases{/id}","deployments_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/deployments","created_at":"2017-03-29T08:08:35Z","updated_at":"2018-11-28T08:28:29Z","pushed_at":"2018-11-28T11:08:22Z","git_url":"git://github.com/isoos/pub-dartlang-dart.git","ssh_url":"git@github.com:isoos/pub-dartlang-dart.git","clone_url":"https://github.com/isoos/pub-dartlang-dart.git","svn_url":"https://github.com/isoos/pub-dartlang-dart","homepage":"https://pub.dartlang.org/","size":6194,"stargazers_count":0,"watchers_count":0,"language":"Dart","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dart-lang:master","ref":"master","sha":"a315a7144db091aac9770bc7f997e06e3f6fc1cb","user":{"login":"dart-lang","id":1609975,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDk5NzU=","avatar_url":"https://avatars0.githubusercontent.com/u/1609975?v=4","gravatar_id":"","url":"https://api.github.com/users/dart-lang","html_url":"https://github.com/dart-lang","followers_url":"https://api.github.com/users/dart-lang/followers","following_url":"https://api.github.com/users/dart-lang/following{/other_user}","gists_url":"https://api.github.com/users/dart-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/dart-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dart-lang/subscriptions","organizations_url":"https://api.github.com/users/dart-lang/orgs","repos_url":"https://api.github.com/users/dart-lang/repos","events_url":"https://api.github.com/users/dart-lang/events{/privacy}","received_events_url":"https://api.github.com/users/dart-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":28035756,"node_id":"MDEwOlJlcG9zaXRvcnkyODAzNTc1Ng==","name":"pub-dartlang-dart","full_name":"dart-lang/pub-dartlang-dart","private":false,"owner":{"login":"dart-lang","id":1609975,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDk5NzU=","avatar_url":"https://avatars0.githubusercontent.com/u/1609975?v=4","gravatar_id":"","url":"https://api.github.com/users/dart-lang","html_url":"https://github.com/dart-lang","followers_url":"https://api.github.com/users/dart-lang/followers","following_url":"https://api.github.com/users/dart-lang/following{/other_user}","gists_url":"https://api.github.com/users/dart-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/dart-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dart-lang/subscriptions","organizations_url":"https://api.github.com/users/dart-lang/orgs","repos_url":"https://api.github.com/users/dart-lang/repos","events_url":"https://api.github.com/users/dart-lang/events{/privacy}","received_events_url":"https://api.github.com/users/dart-lang/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/dart-lang/pub-dartlang-dart","description":"The pub.dartlang.org site in Dart","fork":false,"url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart","forks_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/forks","keys_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/teams","hooks_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/hooks","issue_events_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/issues/events{/number}","events_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/events","assignees_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/assignees{/user}","branches_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/branches{/branch}","tags_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/tags","blobs_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/git/refs{/sha}","trees_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/statuses/{sha}","languages_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/languages","stargazers_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/stargazers","contributors_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/contributors","subscribers_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/subscribers","subscription_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/subscription","commits_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/commits{/sha}","git_commits_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/git/commits{/sha}","comments_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/comments{/number}","issue_comment_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/issues/comments{/number}","contents_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/contents/{+path}","compare_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/merges","archive_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/downloads","issues_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/issues{/number}","pulls_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls{/number}","milestones_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/milestones{/number}","notifications_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/labels{/name}","releases_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/releases{/id}","deployments_url":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/deployments","created_at":"2014-12-15T12:29:08Z","updated_at":"2018-11-28T10:37:56Z","pushed_at":"2018-11-28T11:09:48Z","git_url":"git://github.com/dart-lang/pub-dartlang-dart.git","ssh_url":"git@github.com:dart-lang/pub-dartlang-dart.git","clone_url":"https://github.com/dart-lang/pub-dartlang-dart.git","svn_url":"https://github.com/dart-lang/pub-dartlang-dart","homepage":"https://pub.dartlang.org/","size":18753,"stargazers_count":55,"watchers_count":55,"language":"Dart","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"archived":false,"open_issues_count":73,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":15,"open_issues":73,"watchers":55,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/1827"},"html":{"href":"https://github.com/dart-lang/pub-dartlang-dart/pull/1827"},"issue":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/issues/1827"},"comments":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/issues/1827/comments"},"review_comments":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/1827/comments"},"review_comment":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/pulls/1827/commits"},"statuses":{"href":"https://api.github.com/repos/dart-lang/pub-dartlang-dart/statuses/92f03d6dd9094d4e863ee643b1cf7751aea4ad62"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"jonasfj"}}