Analysis task page is broken after r198479
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Mar 2016 22:27:34 +0000 (22:27 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Mar 2016 22:27:34 +0000 (22:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=155735

Rubber-stamped by Chris Dumez.

* public/api/measurement-set.php:
(AnalysisResultsFetcher::fetch_commits): We need to emit the commit ID as done for regular data.
* public/include/build-requests-fetcher.php:
(BuildRequestsFetcher::fetch_roots_for_set_if_needed): Ditto. Don't use a fake ID after r198479.
* public/v3/models/commit-log.js:
(CommitLog): Assert that all commit log IDs are integers to catch regressions like this in future.
* public/v3/models/root-set.js:
(RootSet): Don't resolve Repository here as doing so would modify the shared "root" entry in the JSON
we fetched, and subsequent construction of RootSet would fail since this line would blow up trying to
find the repository with "[object]" as the ID.
* public/v3/models/test-group.js:
(TestGroup._createModelsFromFetchedTestGroups): Resolve Repository here.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198503 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/public/api/measurement-set.php
Websites/perf.webkit.org/public/include/build-requests-fetcher.php
Websites/perf.webkit.org/public/v3/models/commit-log.js
Websites/perf.webkit.org/public/v3/models/root-set.js
Websites/perf.webkit.org/public/v3/models/test-group.js

index 46fc637..84956a1 100644 (file)
@@ -1,5 +1,25 @@
 2016-03-21  Ryosuke Niwa  <rniwa@webkit.org>
 
+        Analysis task page is broken after r198479
+        https://bugs.webkit.org/show_bug.cgi?id=155735
+
+        Rubber-stamped by Chris Dumez.
+
+        * public/api/measurement-set.php:
+        (AnalysisResultsFetcher::fetch_commits): We need to emit the commit ID as done for regular data.
+        * public/include/build-requests-fetcher.php:
+        (BuildRequestsFetcher::fetch_roots_for_set_if_needed): Ditto. Don't use a fake ID after r198479.
+        * public/v3/models/commit-log.js:
+        (CommitLog): Assert that all commit log IDs are integers to catch regressions like this in future.
+        * public/v3/models/root-set.js:
+        (RootSet): Don't resolve Repository here as doing so would modify the shared "root" entry in the JSON
+        we fetched, and subsequent construction of RootSet would fail since this line would blow up trying to
+        find the repository with "[object]" as the ID.
+        * public/v3/models/test-group.js:
+        (TestGroup._createModelsFromFetchedTestGroups): Resolve Repository here.
+
+2016-03-21  Ryosuke Niwa  <rniwa@webkit.org>
+
         v3 UI sometimes don't update the list of revisions on the commit log viewer
         https://bugs.webkit.org/show_bug.cgi?id=155729
 
index c1452c2..2dedbf3 100644 (file)
@@ -252,14 +252,14 @@ class AnalysisResultsFetcher {
 
     function fetch_commits()
     {
-        $query = $this->db->query('SELECT commit_build, commit_repository, commit_revision, commit_time
+        $query = $this->db->query('SELECT commit_id, commit_build, commit_repository, commit_revision, commit_time
             FROM commits, build_commits, build_requests, analysis_test_groups
             WHERE commit_id = build_commit AND commit_build = request_build
                 AND request_group = testgroup_id AND testgroup_task = $1', array($this->task_id));
         while ($row = $this->db->fetch_next_row($query)) {
             $commit_time = Database::to_js_time($row['commit_time']);
             array_push(array_ensure_item_has_array($this->build_to_commits, $row['commit_build']),
-                array($row['commit_repository'], $row['commit_revision'], $commit_time));
+                array($row['commit_id'], $row['commit_repository'], $row['commit_revision'], $commit_time));
         }
     }
 
index f724e8b..7eef3e5 100644 (file)
@@ -92,14 +92,12 @@ class BuildRequestsFetcher {
 
         $root_ids = array();
         foreach ($root_rows as $row) {
-            $repository = $row['repository_id'];
+            $repository_id = $row['commit_repository'];
             $revision = $row['commit_revision'];
             $commit_time = $row['commit_time'];
-            $root_id = $root_set_id . '-' . $repository;
-            array_push($root_ids, $root_id);
-            $repository_id = $resolve_ids ? $row['repository_name'] : $row['repository_id'];
+            array_push($root_ids, $row['commit_id']);
             array_push($this->roots, array(
-                'id' => $root_id,
+                'id' => $row['commit_id'],
                 'repository' => $repository_id,
                 'revision' => $revision,
                 'time' => Database::to_js_time($commit_time)));
index 45229ab..bc07712 100644 (file)
@@ -3,6 +3,7 @@
 class CommitLog extends DataModelObject {
     constructor(id, rawData)
     {
+        console.assert(parseInt(id) == id);
         super(id);
         this._repository = rawData.repository;
         console.assert(this._repository instanceof Repository);
index 30c89d1..d7e680d 100644 (file)
@@ -13,9 +13,7 @@ class RootSet extends DataModelObject {
             return;
 
         for (var row of object.roots) {
-            var repositoryId = row.repository;
-            row.repository = Repository.findById(repositoryId);
-
+            var repositoryId = row.repository.id();
             console.assert(!this._repositoryToCommitMap[repositoryId]);
             this._repositoryToCommitMap[repositoryId] = CommitLog.ensureSingleton(row.id, row);
             this._repositories.push(row.repository);
index 8c94c4e..a698b13 100644 (file)
@@ -222,8 +222,10 @@ class TestGroup extends LabeledObject {
         });
 
         var rootIdMap = {};
-        for (var root of data['roots'])
+        for (var root of data['roots']) {
             rootIdMap[root.id] = root;
+            root.repository = Repository.findById(root.repository);
+        }
 
         var rootSets = data['rootSets'].map(function (row) {
             row.roots = row.roots.map(function (rootId) { return rootIdMap[rootId]; });