2017-12-26 Dewei Zhu Test freshness page should use build time instead of commit time to determine the freshness of the data point. https://bugs.webkit.org/show_bug.cgi?id=181156 Reviewed by Alexey Proskuryakov. Build time is a better data point freshness indicator. Test freshness page is designed to highlight test failures. Using commit time will result in including the compiling and test running time which does not quite match the definition of data point fresshness. * public/v3/pages/test-freshness-page.js: (TestFreshnessPage.prototype._fetchTestResults): Use build time instead of commit time. 2017-12-21 Dewei Zhu Add UI for A/B testing on owned commits. https://bugs.webkit.org/show_bug.cgi?id=177993 Reviewed by Ryosuke Niwa. Customizable test group form should support specifying and A/B testing owned commits. Introduce 'IntermediateCommitSet' to achieve the goal of specifying owned commits for A/B test. In order to support configure A/B testing that may need to add/remove owned commits, CommitSet may be the closest thing we can get. However, it is a subclass of DataModelObject, which means CommitSet is a representation of 'commit_sets' table and can only be updated from server data. Thus, we want something like CustomCommitSet that is not a representation of database table, but unlike CustomCommitSet, it should store information about commits rather than a revision. As a result, IntermediateCommitSet is introduced. For a longer term, we may replace CustomCommitSet with IntermediateCommitSet as it carries more information and could potentially simplify some CustomCommitSet related APIs by using commit id instead of commit revision. Extend ButtonBase class so that we can enable/disable a button. * public/v3/components/button-base.js: (ButtonBase): (ButtonBase.prototype.setDisabled): Enable/disable a button. (ButtonBase.prototype.render): (ButtonBase.cssTemplate): Added css rule for disabled button. * public/v3/components/combo-box.js: Added. (ComboBox): (ComboBox.prototype.didConstructShadowTree): Setup text field. (ComboBox.prototype.render): (ComboBox.prototype._candidateNameForCurrentIndex): Returns candidate name based on current index. (ComboBox.prototype._candidateElementForCurrentIndex): Returns a list element based on current index. (ComboBox.prototype._autoCompleteIfOnlyOneMatchingItem): Supports auto completion. (ComboBox.prototype._moveCandidate): Supports arrow up/down. (ComboBox.prototype._updateCandidateList): Hide/unhide candidate list and high-light selected candidate. (ComboBox.prototype._renderCandidateList): Render candidate list base on value on text field. (ComboBox.htmlTemplate): (ComboBox.cssTemplate): * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm): (CustomizableTestGroupForm.prototype.didConstructShadowTree): Only fetch the full commits when we about to create a customized A/B tests. (CustomizableTestGroupForm.prototype._computeCommitSetMap): Compute the CustomCommitSet based on IntermediateCommitSet and other revision related information in some map. (CustomizableTestGroupForm.prototype.render): (CustomizableTestGroupForm.prototype._renderCustomRevisionTable): (CustomizableTestGroupForm.prototype._constructTableBodyList): This function builds table body for each highest level repository. It will also include the owned repository rows in the same table body if the commits for highest level repository owns other commits. (CustomizableTestGroupForm.prototype._constructTableRowForCommitsWithoutOwner): Build a table row for a highest level repository. (CustomizableTestGroupForm.prototype._constructTableRowForCommitsWithOwner): Build a table row for repository with owner. (CustomizableTestGroupForm.prototype._constructTableRowForIncompleteOwnedCommits): Build a table row for an unspecified repository. (CustomizableTestGroupForm.prototype._constructRevisionRadioButtons): Update the logic to support build radio buttons for the owned repository rows. (CustomizableTestGroupForm.cssTemplate): * public/v3/components/minus-button.js: Added. (MinusButton): (MinusButton.buttonContent): * public/v3/components/owned-commit-viewer.js: (OwnedCommitViewer.prototype._renderOwnedCommitTable): * public/v3/components/plus-button.js: Added. (PlusButton): (PlusButton.buttonContent): * public/v3/index.html: Added new components. * public/v3/models/commit-log.js: Added owner and owned commit information. (CommitLog): (CommitLog.prototype.ownedCommits): Returns a list of commits owned by current commit. (CommitLog.prototype.ownerCommit): Return owner commit of current commit. (CommitLog.prototype.setOwnerCommits): Set owner commit of current commit. (CommitLog.prototype.label): Remove unnecessary 'else'. (CommitLog.prototype.diff): Remove unused 'fromRevisionForURL' and tiny code cleanup. (CommitLog.prototype.ownedCommitForOwnedRepository): (CommitLog.prototype.fetchOwnedCommits): Sets the owner for those owned commits. The owner of a commit with multiple owner commits will be overwritten by each time this function is called. (CommitLog.ownedCommitDifferenceForOwnerCommits): A more generic version of diffOwnedCommits. diffOwnedCommits only accepts 2 commits, but ownedCommitDifferenceForOwnerCommits supports multiple commits. (CommitLog.diffOwnedCommits): Deleted and should use 'CommitLog.ownedCommitDifferenceForOwnerCommits' instead. * public/v3/models/commit-set.js: (CommitSet.prototype.topLevelRepositories): (CommitSet.prototype.commitForRepository): (IntermediateCommitSet): Take CommitSet as argument, note the commit from CommitSet doesn't contains full information of the commit. Always call 'fetchFullCommits' once before any further usages. (IntermediateCommitSet.prototype.fetchCommitLogs): Fetch all commits information in current commit set. (IntermediateCommitSet.prototype._fetchCommitLogAndOwnedCommits): Fetch commit log and owned commits if necessary. (IntermediateCommitSet.prototype.updateRevisionForOwnerRepository): Updates a commit for a repository by given a revision of the repository. (IntermediateCommitSet.prototype.setCommitForRepository): Sets a commit for a repository in commit set. (IntermediateCommitSet.prototype.removeCommitForRepository): Removes a commit for a repository in commit set. (IntermediateCommitSet.prototype.ownsCommitsForRepository): Returns whether the commit for repository owns commits. (IntermediateCommitSet.prototype.repositories): Returns all repositories in the commit set. (IntermediateCommitSet.prototype.highestLevelRepositories): Returns all repositories those don't have an owner. (IntermediateCommitSet.prototype.commitForRepository): Returns a commit for a given repository. (IntermediateCommitSet.prototype.ownedRepositoriesForOwnerRepository): Returns all repositories owned by a given repository in current commit set. (IntermediateCommitSet.prototype.ownerCommitForRepository): Returns owner commit for a given owned repository. * tools/js/v3-models.js: Added import for 'IntermediateCommitSet'. * unit-tests/commit-log-tests.js: Updated unittest which tests 'ownerCommit' function. * unit-tests/commit-set-tests.js: Added unit tests for IntermediateCommitSet. 2017-12-13 Dewei Zhu Add a test freshness page. https://bugs.webkit.org/show_bug.cgi?id=180126 Reviewed by Ryosuke Niwa. Added a page to show freshness of a test. The test freshness page reports on the same set of tests as the one shown in the summary page. Use a logistic function to evaluate the freshness of the data points. This function has the desired property which increase dramatically when it close to the center of the graph. 'acceptableLastDataPointDurationInHour' configs the center of the graph. * public/include/manifest-generator.php: * public/v3/components/freshness-indicator.js: Added. (FreshnessIndicator): A cell of the test freshness table, color will transit from green to red. (FreshnessIndicator.prototype.update): Update the the data point information and triggers the cell to re-render if anything changes. (FreshnessIndicator.prototype._renderIndicator): Re-render the indicator. (FreshnessIndicator.prototype.render): Render the box color base on a logistic function. (FreshnessIndicator.prototype._createIndicator): (FreshnessIndicator.htmlTemplate): (FreshnessIndicator.cssTemplate): * public/v3/index.html: * public/v3/main.js: Added test freshness page. (main): * public/v3/models/build-request.js: Refactored waitingTime function to make it reusable. (BuildRequest.formatTimeInterval): Format time interval in million seconds to more user friendly text. (BuildRequest.prototype.waitingTime): * public/v3/pages/test-freshness-page.js: Added. (TestFreshnessPage): (TestFreshnessPage.prototype.name): (TestFreshnessPage.prototype._loadConfig): Load config from summary page configurations. (TestFreshnessPage.prototype.open): (TestFreshnessPage.prototype._fetchTestResults): (TestFreshnessPage.prototype.render): (TestFreshnessPage.prototype._renderTable): (TestFreshnessPage.prototype._isValidPlatformMetricCombination): Return whether a platform and metric combination is valid. (TestFreshnessPage.prototype._constructTableCell): (TestFreshnessPage.cssTemplate): (TestFreshnessPage.prototype.routeName): * server-tests/api-manifest-tests.js: Added 'warningHourBaseline' so that we can config the parameter of logistic funciton. * unit-tests/build-request-tests.js: Added unit tests for formatTimeInterval. 2017-11-02 Dewei Zhu Add platform argument for syncing script. https://bugs.webkit.org/show_bug.cgi?id=179162 Reviewed by Ryosuke Niwa. Syncing script should pass platform name to buildbot if platform argument is specified in configuration. * server-tests/tools-sync-buildbot-integration-tests.js: (return.createTriggerable.configWithPlatformName.then): Added unit test for platform argument. * tools/js/buildbot-syncer.js: (BuildbotSyncer): Add '_platformPropertyName' property. (BuildbotSyncer.prototype.scheduleRequest): Add '_platformPropertyName' to build property if specified. (BuildbotSyncer._loadConfig): Read '_plaformPropertyName' from config. 2017-10-30 Dewei Zhu Limit the number of results to be submitted in one submission. https://bugs.webkit.org/show_bug.cgi?id=179045 Reviewed by Ryosuke Niwa. Submitting results for a large number of builds with owned commit information may exceed the size limit of php. Added a way to split the results into groups of certain sizes, and submit them one by one. * server-tests/tools-os-build-fetcher-tests.js: Updated the unit tests. * tools/js/os-build-fetcher.js: Added '_maxNumberOfResultsPerSubmit' which can be specified by a configuration but also use 20 as default value. (prototype.fetchAndReportNewBuilds): Instead of submitting all results once, split them into groups and submit them one by one. (prototype._fetchAvailableBuilds): 'label' is already quoted, should remove unnecessary quotes. (prototype._addOwnedCommitsForBuild): Added logging to log the size of owned commits. 2017-10-31 Dewei Zhu OwnedCommitViewer should include the preceding commit. https://bugs.webkit.org/show_bug.cgi?id=179047 Reviewed by Ryosuke Niwa. OwnedCommitViewer shows the difference between owned commits. To show changes made by first owned commit, we need to have the preceding commit information. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype._fetchCommitLogs): Fetch preceding commit if the commits fetched is not a single commit. (CommitLogViewer.prototype.render): (CommitLogViewer.prototype._renderCommitList): Conditionally rendering preceding commit in commit list. 2017-10-24 Dewei Zhu Fix a bug in syncing script that test/build syncer is never set. https://bugs.webkit.org/show_bug.cgi?id=178772 Reviewed by Ryosuke Niwa. Neither 'buildSyncer' nor 'testSyncer' is ever set. Added a unit test to cover this case. * server-tests/tools-sync-buildbot-integration-tests.js: (createTriggerable): Refactor it to allow customized name. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._pullBuildbotOnAllSyncers): Update syncer info accordingly. (BuildbotTriggerable._testGroupMapForBuildRequests): Initialize build and test syncer to null. 2017-10-24 Dewei Zhu Owner commit does not necessarily exist in the same commit set for an owned commit. https://bugs.webkit.org/show_bug.cgi?id=178763 Reviewed by Ryosuke Niwa. Remove the check based on previous incorrect assumption. Added unit tests to cover this change. * public/privileged-api/create-test-group.php: * server-tests/privileged-api-create-test-group-tests.js: (return.addTriggerableAndCreateTask.string_appeared_here.then.id.taskId.id.then): 2017-10-20 Dewei Zhu Update perf dashboard upload logic to support uploading binaries from owned commits. https://bugs.webkit.org/show_bug.cgi?id=178610 Reviewed by Ryosuke Niwa. Update build requests to 'completed' only when all commit set items are satisfied. Extend 'repositoryList' parameter to be able to specified own commit information. Items in 'repositoryList' can either be a string for top level repository, or a dictionary with two keys: 'ownerRepository' and 'ownedRepository'. * public/api/upload-root.php: Extend upload logic for support uploading binaries from owned commits. * server-tests/api-upload-root-tests.js: Added unit tests. * server-tests/tools-sync-buildbot-integration-tests.js: Added unit tests. 2017-10-05 Dewei Zhu Add try-bot button on perf analysis status page. https://bugs.webkit.org/show_bug.cgi?id=177995 Reviewed by Ryosuke Niwa. Add 'Create' button on analysis status top-left corner to create trybot analysis task. * public/v3/pages/analysis-category-toolbar.js: (AnalysisCategoryToolbar.cssTemplate): 2017-09-28 Dewei Zhu Update syncing script to be able to build binary for commit set with owned commits. https://bugs.webkit.org/show_bug.cgi?id=177225 Reviewed by Ryosuke Niwa. Added support for syncing script to be able to schedule builds to build binary for owned commits. Introduces 'ifRepositorySet' and 'ownedRevisions' in 'buildProperties'. 'ifRepositorySet' will conditionaly set a build property if at least one of the repositories it specified requires build. 'ownedRevisions' specifies owned commits revision informations. * public/v3/models/commit-set.js: (CommitSet): Added '_ownerRepositoryToOwnedRepositoriesMap'. (CommitSet.prototype.updateSingleton): Reset '_ownerRepositoryToOwnedRepositoriesMap'. (CommitSet.prototype._updateFromObject): Only update '_repositoryToCommitOwnerMap' and '_ownerRepositoryToOwnedRepositoriesMap' when 'commitOwner' exists. (CommitSet.prototype.ownerCommitForRepository): Returns a sorted list of top level repositories. (CommitSet.prototype.ownedRepositoriesForOwnerRepository): Returns owned repositories given a owner repository. (CustomCommitSet.prototype.ownerCommitForRepository): Returns a sorted list of top level repositories. * public/v3/models/triggerable.js: (prototype.accepts): It should only check against top-level repositories. Removed a deprecated 'FIXME'. * server-tests/tools-sync-buildbot-integration-tests.js: Added unit test for building owned commits binary. (createTriggerable): Added conditional 'ifRepositorySet' and 'ownedRevisions' in the repository groups. * tools/js/buildbot-syncer.js: (BuildbotSyncer.prototype._propertiesForBuildRequest): Added logic to conditionaly create build property for 'ifRepositorySet'. Added logic to create 'ownedRevisions' based on the owner repositories it specified. (BuildbotSyncer._parseRepositoryGroup): Build property template should be able to handle 'ifRepositorySet' and 'ownedRevisions'. * unit-tests/buildbot-syncer-tests.js: Added unit tests for 'ifRepositorySet' and 'ownedRevisions'. * unit-tests/commit-set-tests.js: Added unit tests for 'topLevelRepositoriesSortedByNamePreferringOnesWithURL'. * unit-tests/resources/mock-v3-models.js: Added a repository group contains 'ios', 'webkit' and 'ownerRepository'. 2017-09-19 Dewei Zhu Use 'owned commit' instead of 'sub commit' whenever refers to a commit owned by another commit. https://bugs.webkit.org/show_bug.cgi?id=177178 Reviewed by Ryosuke Niwa. We use both 'owned commit' and 'sub commit' to refer to a commit owned by an another commit. We should use one term instead of two. Renaming 'subCommit' to 'ownedCommit', 'ownsSubCommit' to 'ownsCommit' and 'sub-commit' to 'owned-commit'. * browser-tests/commit-log-viewer-tests.js: * public/api/commits.php: * public/api/report-commits.php: * public/include/commit-log-fetcher.php: * public/v3/components/commit-log-viewer.js: (CommitLogViewer.prototype._renderCommitList): * public/v3/components/owned-commit-viewer.js: Renamed from Websites/perf.webkit.org/public/v3/components/sub-commit-viewer.js. (OwnedCommitViewer): (OwnedCommitViewer.prototype.didConstructShadowTree): (OwnedCommitViewer.prototype._toggleVisibility): (OwnedCommitViewer.prototype.render): (OwnedCommitViewer.prototype._renderOwnedCommitTable): (OwnedCommitViewer.htmlTemplate): (OwnedCommitViewer.cssTemplate): * public/v3/index.html: * public/v3/models/commit-log.js: (CommitLog): (CommitLog.prototype.updateSingleton): (CommitLog.prototype.ownsCommits): (CommitLog.prototype.fetchOwnedCommits): (CommitLog.prototype._buildOwnedCommitMap): (CommitLog.diffOwnedCommits): (CommitLog.prototype.ownsSubCommits): Deleted. (CommitLog.prototype.fetchSubCommits): Deleted. (CommitLog.prototype._buildSubCommitMap): Deleted. (CommitLog.diffSubCommits): Deleted. * server-tests/api-commits-tests.js: * server-tests/api-report-commits-tests.js: * server-tests/tools-os-build-fetcher-tests.js: (return.waitForInvocationPromise.then): (string_appeared_here.return.waitForInvocationPromise.then): * tools/js/os-build-fetcher.js: (prototype._fetchAvailableBuilds): (prototype._addOwnedCommitsForBuild): (prototype._addSubCommitsForBuild): Deleted. * unit-tests/commit-log-tests.js: (return.commit.fetchOwnedCommits.then): (return.fetchingPromise.then): (return.commit.fetchSubCommits.then): Deleted. 2017-09-12 Dewei Zhu Performance Dashboard backend should support A/B testing for owned components. https://bugs.webkit.org/show_bug.cgi?id=175978 Reviewed by Ryosuke Niwa. Add backend change for Performance Dashboard to support A/B testing for owned components. Added 'commitset_commit_owner' and 'commitset_requires_build' columns to 'commit_set_items' table. 'commitset_commit_owner' referrs to determine a commit with owner. 'commitset_requires_build' indicates whether a root build is required. This will be set true whenever commit_set_item specifies a patch file, or commit_set_item is commit with owner commit, or any other commit from same repository and in same build-request group requires build. SQL for updating existing database: 'BEGIN; ALTER TABLE commit_set_items ADD COLUMN commitset_commit_owner integer REFERENCES commits DEFAULT NULL, ADD COLUMN commitset_requires_build boolean DEFAULT FALSE; UPDATE commit_set_items SET commitset_requires_build = TRUE WHERE commitset_patch_file IS NOT NULL; UPDATE commit_set_items SET commitset_requires_build = TRUE WHERE commitset_set IN (SELECT requests1.request_commit_set FROM build_requests as requests1 JOIN build_requests as requests2 ON requests1.request_group = requests2.request_group JOIN commit_set_items as item ON item.commitset_set = requests2.request_commit_set WHERE item.commitset_patch_file IS NOT NULL); ALTER TABLE commit_set_items ADD CONSTRAINT commitset_item_with_patch_must_requires_build CHECK (commitset_patch_file IS NULL OR commitset_requires_build = TRUE), ADD CONSTRAINT commitset_item_with_owned_commit_must_requires_build CHECK (commitset_commit_owner IS NULL OR commitset_requires_build = TRUE); END;' * init-database.sql: Updated 'commit_set_items' table. * public/admin/triggerables.php: Only top level repository should show on triggerables page. * public/include/build-requests-fetcher.php: Added 'commitOwner' and 'requireBuild' to 'revision_items'. Added 'commitOwner' field to a commit. * public/include/db.php: Should be able to insert boolean value to database without explicted convert to 't' or 'f'. * public/privileged-api/create-test-group.php: Added logic to process 'commitOwner' and 'requireBuild' in 'commit_set_items'. Removed a 'FIXME' that has been addressed before this commit. * public/v3/models/build-request.js: (BuildRequest.constructBuildRequestsFromData): Set 'commitOwner' field for a commit set item. * public/v3/models/commit-set.js: (CommitSet): Added maps for repository to commit owner and whether a repository requires builds. (CommitSet.prototype.updateSingleton): (CommitSet.prototype._updateFromObject): (CommitSet.prototype.ownerRevisionForRepository): Returns owner revision for a given repository in current commit set. (CommitSet.prototype.requiresBuildForRepository): Returns whether a repository need to build. (CommitSet.prototype.equals): Equality check should include 2 new maps. (CustomCommitSet): CustomCommitSet should be able to store commit with an owner commit. (CustomCommitSet.prototype.setRevisionForRepository): Added each revision list entry should have 'ownerRevision'(null by default). (CustomCommitSet.prototype.equals): Equality check should also check the equality of 'ownerRevision'. (CustomCommitSet.prototype.ownerRevisionForRepository): Returns a owner revision for a given repository. * public/v3/models/repository.js: (Repository.prototype.findOwnedRepositoryByName): Return an repository owned by current repository with a given name. * public/v3/models/test-group.js: Added 'ownerRevision' field in each entry of revisionSet. * server-tests/api-build-requests-tests.js: Added tests. * server-tests/privileged-api-create-test-group-tests.js: Added tests. * server-tests/privileged-api-upload-file-tests.js: Fix unit tests by setting'requires_build' field to be true when updating commit_set_item which has a patch.. * server-tests/resources/mock-data.js: Added mock build requests with commit sets contain owned commits. (MockData.jscRepositoryId): Returns id for JavaScriptsCore repository. (MockData.addMockConfiguration): Added mock JavaScriptCore and owned JavaScriptCore repositories and commits associated with them. (MockData.ownedJSCRepositoryId): Added a JavaScriptCore repository with WebKit as owner. (MockData.addMockConfiguration): Added mock data for test cases those require a commit with a owner commit. (MockData.addTestGroupWithOwnedCommits): Added mock data for analysis tasks, the build requires of which contains owned commits. (MockData.set addAnotherTriggerable): Added another triggerable which has mac, webkit and javascript core repositories as triggerable repository group. (MockData.set addAnotherMockTestGroup): Added another mock test group. * tools/js/v3-models.js: Import CustomCommitSet. * unit-tests/resources/mock-v3-models.js: Added an owned webkit repository. * unit-tests/commit-set-tests.js: Added unit tests CustomCommitSet. 2017-09-15 Dewei Zhu Should not mark a platform as missing in summary page if all expecting metrics are exlucded. https://bugs.webkit.org/show_bug.cgi?id=176970 Reviewed by Ryosuke Niwa. In summary page, if all metrics for a test are excluded in excludedConfigurations for a platform, this platform should not be marked as missing. * public/v3/pages/summary-page.js: (SummaryPageConfigurationGroup): 2017-09-11 Ryosuke Niwa Analysis task page shows an empty results for an irrelevant top-level test https://bugs.webkit.org/show_bug.cgi?id=175252 Reviewed by Antti Koivisto. The bug was caused by TestGroupResultsViewer always listing every top-level test which has a result for the entire analysis task. Since a custom analysis task (perf try bots) allows multiple tests to be tested in each group, we have to only list the tests which contains results in a particular test group. * public/v3/components/test-group-results-viewer.js: (TestGroupResultsViewer.prototype.render): Find the tests that have results for the current test group instead of for any test group in this analysis task. any test * public/v3/models/analysis-results.js: (AnalysisResults): (AnalysisResults.prototype.topLevelTestsForTestGroup): Renamed from highestTests. Now takes a test group as an argument. (AnalysisResults.prototype._computedTopLevelTests): Renamed from _computeHighestTests. Filters the results with the specified test group. 2017-09-06 Aakash Jain Add initSyncers method in BuildbotTriggerable https://bugs.webkit.org/show_bug.cgi?id=176125 Reviewed by Ryosuke Niwa. * tools/sync-buildbot.js: (syncLoop): Use initSyncers() which returns a promise. Modified to handle the promise. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable): Invokes initSyncers() appropriately. (BuildbotTriggerable.prototype.initSyncers): Returns a promise which initialize all the syncers. * server-tests/tools-buildbot-triggerable-tests.js: Updated tests to handle initSyncers(). * server-tests/tools-sync-buildbot-integration-tests.js: Ditto. 2017-09-05 Ryosuke Niwa Add a button to show two weeks of data to perf dashboard https://bugs.webkit.org/show_bug.cgi?id=176438 Reviewed by Saam Barati. Add "2W" button to show 14 days of data on dashboard pages. * public/v3/pages/dashboard-toolbar.js: (DashboardToolbar): 2017-08-29 Ryosuke Niwa Build fix. OS X "revision" can have a space. * public/include/commit-log-fetcher.php: 2017-08-29 Ryosuke Niwa Make it possible to specify A/B testing revision with a partial hash https://bugs.webkit.org/show_bug.cgi?id=176047 Rubber-stamped by Chris Dumez. Added the support for specifying a partial hash in A/B testing instead of the full hash. * public/include/commit-log-fetcher.php: (CommitLogFetcher::find_commit_id_by_revision): Extracted from associate-commit.php. * public/privileged-api/associate-commit.php: (main): * public/privileged-api/create-test-group.php: (main): Use find_commit_id_by_revision here to support scheduling an A/B testing with a partial hash. * server-tests/privileged-api-create-test-group-tests.js: (createAnalysisTask): Make it possible to customize revision string in some test cases. * server-tests/resources/test-server.js: (TestServer.prototype._stopApache): Fixed the bug that cleanup step always fails whenever the test file runs more than 8s. 2017-08-26 Ryosuke Niwa Build fix. Creating trying a test group no longer updates the page. * public/v3/models/test-group.js: (TestGroup.createWithCustomConfiguration): Added the missing ignoreCache=true. 2017-08-21 Dewei Zhu Performance Dashboard should be compatible with PHP 7. https://bugs.webkit.org/show_bug.cgi?id=175813 Reviewed by Ryosuke Niwa. Use `file_get_contents('php://input')` instead of '$HTTP_RAW_POST_DATA'. Update test harness script to load right php module in httpd. * ReadMe.md: JSON example format fix. * public/api/report-commits.php: Stop using '$HTTP_RAW_POST_DATA'. * public/api/report.php: Stop using '$HTTP_RAW_POST_DATA'. * public/api/update-triggerable.php: Stop using '$HTTP_RAW_POST_DATA'. * public/include/json-header.php: Stop using '$HTTP_RAW_POST_DATA'. * public/include/report-processor.php: Stop using '$HTTP_RAW_POST_DATA'. * server-tests/resources/test-server.conf: Load php5 or php7 module conditionally. * server-tests/resources/test-server.js: Pass PHP version info while launching httpd. (TestServer.prototype._startApache): * tools/remote-cache-server.py: Pass PHP version info while launching httpd. (start_httpd): * tools/remote-server-relay.conf: Load php5 or php7 module conditionally. * tools/sync-buildbot.js: (syncLoop.const.makeTriggerable): (syncLoop): 2017-08-17 Ryosuke Niwa Number each section in ReadMe.md and add more clarifications https://bugs.webkit.org/show_bug.cgi?id=175687 Rubber-stamped by Joseph Pecoraro. Numbered each section and added more clarifications per issues Aakash encountered. * ReadMe.md: 2017-08-17 Ryosuke Niwa Build fix. Make the test work with the latest versions of node modules. * server-tests/privileged-api-upload-file-tests.js: 2017-07-27 Ryosuke Niwa Build fix. Fixed a typo. task.id() isn't a thing in this function. * public/v3/models/test-group.js: (TestGroup.createWithCustomConfiguration): 2017-07-11 Ryosuke Niwa Another build fix. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): 2017-07-11 Ryosuke Niwa Build fix. It looks like the code here is racy. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): (ChartPaneBase.prototype.setOpenRepository): 2017-07-11 Ryosuke Niwa Show the roots built by perf try bots on results page https://bugs.webkit.org/show_bug.cgi?id=174305 Reviewed by Joseph Pecoraro. Show build products created by a perf try bots so that we can download them for local testing. * public/v3/components/test-group-revision-table.js: (TestGroupRevisionTable.prototype._renderTable): Find the set of repositories for which a patch is applied. Show build products for all commit sets for such a repository since when WebKit is built with a patch in one configuration, the other configuration also needs to be built for consistency. (TestGroupRevisionTable.prototype._buildCommitCell): Added the hyperlink for build products. (TestGroupRevisionTable.prototype._buildFileInfo): Takes a string to override the file's label. Since all build products made by bots tend to have the same filename, we show the label of "Build product" instead. (TestGroupRevisionTable.prototype._mergeCellsWithSameCommitsAcrossRows): Fixed a bug that any entry with a patch wasn't getting merged since it was comparing against the result commit set, which does not contain the patch (only requested commit set contains a patch). 2017-07-10 Ryosuke Niwa Address Antti's review comment. * public/v3/models/analysis-results.js: (AnalysisResults.prototype.containsTest): 2017-07-10 Ryosuke Niwa A/B testing results page show results for the top-level tests instead of the one being analyzed https://bugs.webkit.org/show_bug.cgi?id=174304 Reviewed by Antti Koivisto. When a specific subtest is analyzed (e.g. Images subtest of MotionMark), then TestGroupResultsViewer should expand and highlight that specific subtest instead of simply showing the top-level test's score. This is especially misleading since AnalysisResultsViewer (stacking bars for each test group) uses the score of the specific subtest being analyzed. Fixed the bug by passing in the metric associated with the analysis task from AnalysisTaskPage to TestGroupResultsViewer via AnalysisTaskTestGroupPane. Also made TestGroupResultsViewer.setAnalysisResults auto-expand the tests that are ancestors of the specified metric. Without that, the test won't be shown to the user until the ancestor tests are expanded by the user. Also fixed the bug that we were always listing sub-tests regardless of whether they have results or not. Since tests tend to change over time, we shouldn't show a test if it doesn't have any results associated. * public/v3/components/test-group-results-viewer.js: (TestGroupResultsViewer.prototype.setAnalysisResults): Expand the ancestor tests of the metric. (TestGroupResultsViewer.prototype._buildRowsForTest): Exit early if this test doesn't have any results. * public/v3/models/analysis-results.js: (AnalysisResults.prototype.containsTest): Added. * public/v3/pages/analysis-task-page.js: (AnalysisTaskTestGroupPane.prototype.setAnalysisResults): Takes a metric to pass it to the results viewer. (AnalysisTaskPage.prototype._assignTestResultsIfPossible): 2017-07-06 Ryosuke Niwa Safari 10.1 fails to upload a patch on perf try bots page https://bugs.webkit.org/show_bug.cgi?id=174214 Reviewed by Chris Dumez. Added the workaround to make the analysis task page work on Safari 10.1 * public/v3/components/instant-file-uploader.js: (InstantFileUploader.prototype._uploadFiles): Convert files to an array since for-of doesn't work otherwise on Safari 10.1. * public/v3/models/uploaded-file.js: (UploadedFile._computeSHA256Hash): Fallback to crypto.webkitSubtle since crypto.subtle isn't available on Safari 10.1 or 11. 2017-07-03 Ryosuke Niwa Fix a typo pointed out by Andreas Kling. * public/v3/components/instant-file-uploader.js: (InstantFileUploader.prototype._uploadFiles): * public/v3/models/uploaded-file.js: (UploadedFile.fetchUploadedFileWithIdenticalHash): Renamed from fetchUnloadedFileWithIdenticalHash. 2017-07-03 Ryosuke Niwa Add an admin page to manage uploaded files https://bugs.webkit.org/show_bug.cgi?id=174089 Reviewed by Andreas Kling. Add an admin page to see the disk usage per user as well as the total, and to prune any zombie files (ones marked as deleted but aren't actually deleted in the filesystem). * public/admin/files.php: Added. (format_size): Added. * public/include/admin-header.php: 2017-07-03 Ryosuke Niwa Roots uploaded by bots don't get author specified properly https://bugs.webkit.org/show_bug.cgi?id=174087 Reviewed by Andreas Kling. When a root file is uploaded from the bot, we manually specify the remote user to upload_file_in_transaction. However, this was getting ignored by create_uploaded_file_from_form_data since it was always calling remote_user_name to get the user name off of $_SERVER. Fixed the bug by passing in the user name from upload_file_in_transaction to create_uploaded_file_from_form_data. * public/include/uploaded-file-helpers.php: (create_uploaded_file_from_form_data): Take the remote user as an argument instead of calling remote_user_name. (upload_file_in_transaction): * server-tests/api-upload-root-tests.js: Updated an existing test cases to make sure root files' author is set. (createTestGroupWihPatch): Manually override the author of a test group for testing. 2017-07-03 Ryosuke Niwa Prune unused uploaded files when the file quota is reached https://bugs.webkit.org/show_bug.cgi?id=174086 Reviewed by Andreas Kling. Made /privileged-api/uploaded-file and /api/upload-root automatically delete old uploaded files when uploading a new file results in the file quota to be exceeded. Also added the notion of the total quota to avoid running out of a disk when there are hundreds of users each uploading near their quota. * config.json: Added a sample total disk quota of 100GB. * public/include/uploaded-file-helpers.php: (query_file_usage_for_user): Renamed from query_total_file_size. (query_total_file_usage): Added. (upload_file_in_transaction): (delete_file): Added. (prune_old_files): Added. * server-tests/privileged-api-upload-file-tests.js: Added tests for deleting old uploaded files as well as tests for the total quota. * server-tests/resources/test-server.js: (TestServer.prototype.testConfig): Added uploadTotalQuotaInMB to the test configuration. 2017-06-29 Ryosuke Niwa UploadedFile should include the file extension in its url https://bugs.webkit.org/show_bug.cgi?id=174009 Reviewed by Chris Dumez. Some command line tools such as darwinup use the file extension to determine the file type. Include the file extension in the URL of an uploaded file to make it work with these tools. * public/include/uploaded-file-helpers.php: (format_uploaded_file): Include the file extension. * public/v3/models/uploaded-file.js: (UploadedFile): (UploadedFile.prototype.url): Return the URL with hthe file extension specified. /api/uploaded-file already supports having the file extension specified. * server-tests/tools-sync-buildbot-integration-tests.js: Updated test cases. * unit-tests/buildbot-syncer-tests.js: Ditto. 2017-05-31 Ryosuke Niwa Don't shouldn't create a request to build a patch if there is no patch to build https://bugs.webkit.org/show_bug.cgi?id=172791 Reviewed by Chris Dumez. When a commit set doesn't have a patch specified, don't create a request to build. For example, when we're comparing WebKit in the system to WebKit with a patch, there is nothing to build for the first commit set. However, when conducting an A/B testing, it's advisible to compare WebKit built with and without a patch on a single machine with the same version of Xcode, etc... For this reason, we still create a request to build for a commit set if there is another commit set with a patch which uses the same repository group. * public/privileged-api/create-test-group.php: (main): Fixed the bug. Only create a build request to build if there is a matching repository group with a patch. * server-tests/privileged-api-create-test-group-tests.js: Added a test case. 2017-05-31 Ryosuke Niwa Allow sync-buildbot.js to set a buildbot property only when patches are built https://bugs.webkit.org/show_bug.cgi?id=172743 Rubber-stamped by Chris Dumez. Added the ability to specify a buildbot property only when there are build requests to build a patch. * tools/js/buildbot-syncer.js: (BuildbotSyncer.prototype.scheduleRequest): Pass in the list of build requests that belong to the same test group. (BuildbotSyncer.prototype.scheduleRequestInGroupIfAvailable): Ditto. (BuildbotSyncer.prototype._propertiesForBuildRequest): Added the support for specifying a conditional property. For the condition type of "built", we check if there was any other (BuildbotSyncer._parseRepositoryGroup): Added the support for "ifBuilt" conditional. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._scheduleRequestIfSlaveIsAvailable): Pass in the list of build requests that belong to the same test group. (BuildbotTriggerable.prototype._scheduleRequestWithLog): Ditto. * unit-tests/buildbot-syncer-tests.js: Added test case for newly added "ifBuilt" as well as specifying a patch. Updated the various test cases per the addition of new argument to scheduleRequest, _propertiesForBuildRequest, and scheduleRequestInGroupIfAvailable. (createSampleBuildRequestWithPatch): Added. * unit-tests/resources/mock-v3-models.js: (MockModels.inject): Made "ios-svn-webkit" accept a WebKit patch and roots to allow new testing. 2017-05-30 Ryosuke Niwa sync-builedbot.js fails to schedule the second request to test with a patch https://bugs.webkit.org/show_bug.cgi?id=172701 Reviewed by Antti Koivisto. The bug was caused by an assertion failure in BuildbotTriggerable's _pullBuildbotOnAllSyncers failing to take into account that for a test group with a patch could be associated with two syncers, one to build a patch and another to run tests. Fixed the bug by differentiating the two types of syncers by buildSyncer and testSyncer per test group. * server-tests/tools-sync-buildbot-integration-tests.js: Extended a test case so that it would hit the assertion without the fix. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype.syncOnce): Use the right kind of the syncer to schedule a build or a test. (BuildbotTriggerable.prototype._pullBuildbotOnAllSyncers): Associate a given syncer based on the kind of the build request it processed, and assert accordingly. 2017-05-29 Ryosuke Niwa Fix UI glitches with a custom analysis test group with a patch https://bugs.webkit.org/show_bug.cgi?id=172694 Reviewed by Sam Weinig. Fix the following UI glitches with perf try bots: - Retrying an A/B testing with a patch fails. - A patch specified in an test group does not get specified in the configurator. - Drag & dropping a patch doesn't work. - Results for custom analysis tasks don't get shown. * public/api/test-groups.php: (main): Fix a bug that test group's platform does not match that of the request'ed platform. Since each test group is associated with platform, just use that instead of querying test_configurations. This resulted in the configurator not being able to find a triggerable in some cases. * public/v3/components/custom-analysis-task-configurator.js: (CustomAnalysisTaskConfigurator): (CustomAnalysisTaskConfigurator.prototype.setCommitSets): Add patches in the commit set. (CustomAnalysisTaskConfigurator.prototype._setUploadedFilesToUploader): Now clears the exiting uploaded files Also renamed from _setUploadedFilesIfEmpty. (CustomAnalysisTaskConfigurator.prototype._setPatchFiles): Added. (CustomAnalysisTaskConfigurator.prototype.didConstructShadowTree): We no longer update the list of roots for the comparsion when a new root is added to the baseline. (CustomAnalysisTaskConfigurator.prototype._configureComparison): Copy over the list of patches and roots when starting to configure the comparsion. * public/v3/components/instant-file-uploader.js: (InstantFileUploader.prototype.clear): Added. (InstantFileUploader.prototype.didConstructShadowTree): Added event handlers for dragover & drop events to allow specifying a patch and root using drag & drop. Unfortunately, this still doesn't work in WebKit due to a bug in our shadow DOM implementation. (InstantFileUploader.prototype._didFileInputChange): (InstantFileUploader.prototype._uploadFiles): Extracted from _didFileInputChange. * public/v3/pages/analysis-task-page.js: (AnalysisTaskTestGroupPane.prototype.setAnalysisResults): No longer takes metric. (AnalysisTaskTestGroupPane.cssTemplate): Removed unused rules. Also disallow flexing on the list of test groups to avoid the name of a test froup from overflowing on top of the results pane. (AnalysisTaskPage.prototype._assignTestResultsIfPossible): Set setAnalysisResults even when metric is not set as is the case for a custom analysis task. (AnalysisTaskPage.prototype._retryCurrentTestGroup): Use createWithCustomConfiguration to allow retrying of an A/B testing with a patch in a custom analysis task. (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): 2017-05-26 Ryosuke Niwa Show patches applied in each A/B testing build requests https://bugs.webkit.org/show_bug.cgi?id=172636 Reviewed by Antti Koivisto. List patches applied along side revisions inn the list of revisions for an A/B tesing build requests if there are any patches applied. * public/v3/components/test-group-revision-table.js: (TestGroupRevisionTable.prototype._renderTable): Indicate which request is to build a patch and which one is to run tests. (TestGroupRevisionTable.prototype._buildCommitCell): Include the patch file's information when there is one. We need to use the requested commit set instead of the one reported by testers or builders since they don't include patch or root information. (TestGroupRevisionTable.prototype._buildCustomRootsCell): (TestGroupRevisionTable.prototype._buildFileInfo): Extracted from _buildCustomRootsCell. 2017-05-26 Ryosuke Niwa The queue page is broke when there is a custom analysis task https://bugs.webkit.org/show_bug.cgi?id=172631 Reviewed by Antti Koivisto. Fix the bug that we were always assuming each build request to have a test associated. * public/v3/models/test-group.js: (TestGroup.createAndRefetchTestGroups): Fixed the bug that we were referring to a non-existent variable task. * public/v3/pages/build-request-queue-page.js: (BuildRequestQueuePage.prototype._constructBuildRequestTable): Fixed the bug. Collect every request in the group and then find the first test request's test name. Make it clear that we're waiting for a build as needed. 2017-05-25 Ryosuke Niwa Syncing script shouldn't schedule a build request when there is a build from another test group in progress https://bugs.webkit.org/show_bug.cgi?id=172577 Reviewed by Chris Dumez. When a buildbot master gets restarted while there is an in-progress build and a pending build, the master will re-schedule the currently running build, and this can result in multiple build requests from different test groups being scheduled simultaneously. sync-buildbot.js was supposed to recover from this state by only processing build requests from one test group at a time and eventually come back to a state where only a single test group is running per buildbot slave. We had a test for this particular case but it wasn't testing what it claimed to test. Rewriten the test case and fixed the bug by explicitly checking this condition and treating it as if there is a pending build already scheduled in the builder in this case. * public/api/test-groups.php: (main): Fixed a regression from r217397. Return the platform ID of the first request when none of the requets have been processed yet or all of them had failed. * server-tests/tools-buildbot-triggerable-tests.js: Rewritten a test case intended to cover this bug. (.assertRequestAndResolve): Added. * tools/js/buildbot-syncer.js: (BuildbotSyncer.prototype.scheduleRequestInGroupIfAvailable): Fixed the bug. Avoid scheduling a new request on this syncer if there is a build in progress for a test group different from that of the new request. Reuse the code we had to deal with a pending build for this purpose. 2017-05-24 Ryosuke Niwa Opening an analysis task from the queue page is broken https://bugs.webkit.org/show_bug.cgi?id=172559 Rubber-stamped by Chris Dumez. Fix the bug that opening the analysis task page from the queue page results in multiple assertion failures as well as the list of test groups in the analysis task page not getting updated. * public/v3/models/build-request.js: (BuildRequest.prototype.updateSingleton): Because /api/build-requests/ do not include test groups, it's possible for testGroup to be dynamically updated upon loading an analysis task page. Update _testGroup in such instances instead of asserting that it doesn't happen. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Because various code to create model objects from the result of a JSON API modify the fetched content in irreversible manner, e.g. `object.platform = Platform.findById(object.platform)` we must return a fresh new content each time even if the result had been cached. * public/v3/models/test-group.js: (TestGroup.prototype.platform): Return this._platform as that's not available. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): (AnalysisTaskPage.prototype._resetVariables): Extracted from the constructor. (AnalysisTaskPage.prototype.updateFromSerializedState): Reset all instance variables when opening a new analysis task page. This would avoid showing the stale result even when fetching new test groups had failed. * unit-tests/test-groups-tests.js: Added a test case for fetching the same test group twice. This used to hit a problem in BuildRequest.constructBuildRequestsFromData which overrode platform property of each raw content with a Platform model object because in the case of a cached fetch, we end up trying to look up the platform again using the result of stringifying the Platform object instead of the platform ID included in the original fetched content. (sampleTestGroup): Added "platform" as included in the JSON API's response now. 2017-05-24 Ryosuke Niwa The commit log viewer can overlap the analysis results viewer https://bugs.webkit.org/show_bug.cgi?id=172534 Rubber-stamped by Chris Dumez. Allocate the padding on the right for the commit log viewer, and add a horizontal scrollbar to the analysis results viewer instead of letting it expand beneath the commit log viewer. * public/v3/pages/analysis-task-page.js: (AnalysisTaskResultsPane.htmlTemplate): (AnalysisTaskResultsPane.cssTemplate): 2017-05-24 Ryosuke Niwa Sycning script build fix after r217378. * tools/sync-buildbot.js: (syncLoop): 2017-05-23 Ryosuke Niwa Add the support for perf try bots to sync-buildbot.js https://bugs.webkit.org/show_bug.cgi?id=172529 Rubber-stamped by Chris Dumez. Make sync-buildbot.js schedule an A/B testing job with a patch or roots to buildbot. Change the buildbot property format in the syncing script's configuration again to use a dictionary with a single key of "revision", "patch", or "roots" to specify a revision, a patch, or a set of roots, and simplified the structure of the configuration by always having "types" and "builders", and make each entry in "configurations" refer to a list of types, platforms, and builders. Since now there are build requests to build patches and run tests, "configurations" has been renamed to "testConfigurations" and "buildConfigurations" have been added. Each entry in "buildConfigurations" specifies a list of platforms and builders. Similarly in repository group configurations, the buildbot properties for testing is now specified as "testProperties" and ones for building a patch is specified in newly introduced "buildProperties". * public/api/build-requests.php: (update_builds): When a build request to build a patch fails, mark all subsequent requests as failed since there is no way to run tests without a successful build. * public/api/update-triggerable.php: (main): Re-generate manifest.json after updating the triggerable. The lack of this re-generation was the reason we had to manually GET /api/manifest in api-update-triggerable-tests.js. * public/v3/models/build-request.js: (BuildRequest.prototype.hasCompleted): Added. * public/v3/models/manifest.js: (Manifest.reset): Added. Extracted from MockData.resetV3Models in unit-tests/mock-data.js and syncLoop in tools/sync-buildbot.js (Manifest.fetch): Reset V3 models before fetching the manifest. This eliminates the need to manually reset V3 models in syncLoop. * public/v3/models/uploaded-file.js: (UploadedFile.prototype.url): Use RemoteAPI.url to get the full URL instead of just a path. * public/v3/remote.js: (BrowserRemoteAPI.prototype.url): Added. Constructs the full URL. * server-tests/api-update-triggerable-tests.js: (.refetchManifest): Deleted. Now that /api/manifest re-generates manifest.json, we can simply call Manifest.fetch instead. * server-tests/resources/mock-data.js: (MockData.resetV3Models): Calls Manifest.reset(). (MockData.addMockConfiguration): Extracted from addMockData. (MockData.addMockData): Updated per the format change. (MockData.mockTestSyncConfigWithSingleBuilder): Ditto. (MockData.mockTestSyncConfigWithTwoBuilders): Ditto. (MockData.runningBuild): Make buildNumber specifiable. (MockData.finishedBuild): Ditto. * server-tests/tools-buildbot-triggerable-tests.js: Updated configurations per the format change. Now that now acceptsCustomRoots() for "system-and-webkit" must be true since we can't have a repository group that which accepts a patch and not take roots. * server-tests/tools-sync-buildbot-integration-tests.js: Added. (createTriggerable): Added. (createTestGroupWihPatch): Added. (uploadRoot): Added. (.assertAndResolveRequest): Added. (.assertTestBuildHasFailed): Added. * tools/js/buildbot-syncer.js: (BuildbotSyncer): Added. _type as an instance variable to identify whether this buildbot builder is a "builder" which builds a patch, builder, or a "tester" which runs a test. Also renamed _testConfigurations to _configurations. (BuildbotSyncer.prototype.addTestConfiguration): Assert that either the type of this syncer hasn't been set or it's a tester. (BuildbotSyncer.prototype.testConfigurations): Return [] when it's a builder. (BuildbotSyncer.prototype.addBuildConfiguration): Added. Adds a platform to a builder. (BuildbotSyncer.prototype.buildConfigurations): Added. Returns the list of configurations if this syncer is a builder. Otherwise returns []. (BuildbotSyncer.prototype.isTester): Added. (BuildbotSyncer.prototype.matchesConfiguration): (BuildbotSyncer.prototype._propertiesForBuildRequest): Updated to support the new format. (BuildbotSyncer._loadConfig): Ditto. Optionally parse buildConfigurations. (BuildbotSyncer._resolveBuildersWithPlatforms): Added. For each test or build configuration entry, creates the list of configurations per builder and platform. (BuildbotSyncer._parseRepositoryGroup): Added the support for parsing the new format with revision, roots, and patch option types with a lot of validations as we're seeing a bit of combinatorial explosion in the number of things that can go wrong. Also parse buildProperties optionally. (BuildbotSyncer._parseRepositoryGroupPropertyTemplate): Added. A helper function to parse a set of buildbot properties, validates its content, and invokes a callback if it's an dynamically resolved type such as "revision" and "patch". (BuildbotSyncer._validateAndMergeConfig): Updated per the format change. No longer allows "types", "type", "platforms", and "platform" as they're explicity resolved in _resolveBuildersWithPlatforms. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype.syncOnce): (BuildbotTriggerable.prototype._validateRequests): Handle the case when a build request is not associated with any test. (BuildbotTriggerable.prototype._nextRequestInGroup): Return null when there is a build request to build a patch which has not been completed (pending, scheduled, running, or failed). Since all requests to build a patch has a negative order, those requests should all show up at the beginning. (BuildbotTriggerable.prototype._scheduleRequestIfSlaveIsAvailable): Pick a new buildbot syncer when scheduling the first request to build a patch or the first request to run a test. The first request to run a test will always have order of 0, so it's a sufficient condition to find such a request. On the other hand, the first request to build a patch can have a negative order number so we must explicitly check if it's the first item in the ordered list of requests in the test group. * tools/remote-server-relay.log: Added. * tools/sync-buildbot.js: (syncLoop): Fixed a bug we were not re-fetching the triggerable after updating the triggerable so that Triggerable and related objects we have in the memory may not reflect what we just synced to the perf dashboard. Also, we don't reset V3 models manually any more since Manifest.fetch does that. * unit-tests/buildbot-syncer-tests.js: Added more test cases and updated existing test cases to test exception messages explicitly since allowing any exception was resulting in some tests passing a result of unrelated parsing error being thrown, etc... (sampleiOSConfig): Updated per the format change. (sampleiOSConfigWithExpansions): Ditto. (smallConfiguration): Ditto. 2017-05-22 Dewei Zhu Fix the bug that sometimes analysis task results pane is missing. https://bugs.webkit.org/show_bug.cgi?id=172404 Reviewed by Ryosuke Niwa. AnalysisTaskPage._didFetchTask and AnalaysisTaskPage._fetchRelatedInfoForTaskId should be called in order. The race between those two functions causes the analysis task results pane sometimes missing. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype.render): Fix the bug in r217173 that commitSet can be undefined. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype.updateFromSerializedState): Use arrow function to get rid of self variable. Use `const` instead of var for constant variable. And call _didFetchTask before calling _fetchRelatedInfoForTaskId. (AnalysisTaskPage.prototype._renderTaskNameAndStatus): (AnalysisTaskPage.cssTemplate): 2017-05-19 Ryosuke Niwa Add a commit log viewer next to the analysis results viewer https://bugs.webkit.org/show_bug.cgi?id=172399 Reviewed by Chris Dumez. Add a commit log viewer next to the analysis results viewer, which visualizes the A/B testing results. Also linkify the revisions in the table that shows the status of each A/B testing job, and allow the prefix of "r" when associating a Subversion revision. Finally, Fixed a bug that the list of commits associated with the analysis task were not re-rendered when the list was updated by the user. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer): Added _selectorRadioButtonList as an instance variable. It's a list of radio buttons to select a configuration (A/B) with a commit set. It's added to update the checked status of radio buttons upon changing the currently selected test group. (AnalysisResultsViewer.prototype.setTestGroups): Update the selected range to that of the currently selected group. (AnalysisResultsViewer.prototype.render): Fill _selectorRadioButtonList with radio buttons. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): Added _showRepositoryName as an instance variable. (CommitLogViewer.prototype.setShowRepositoryName): Added. (CommitLogViewer.prototype.render): Hide the repository name when _showRepositoryName is false. This is used in the newly added commit log viewer for the analysis results since we're showing a select element with all the names of repositories above this component. * public/v3/components/test-group-revision-table.js: (TestGroupRevisionTable.prototype._buildCommitCell): Linkify the revisions if possible. * public/v3/models/analysis-task.js: (AnalysisTask.prototype.associateCommit): Strip "r" at the beginning for a Subversion like r12345 since that's the format we use to show to the user. This makes copy & paste easier. * public/v3/pages/analysis-task-page.js: (AnalysisTaskResultsPane): Added a bunch of new instance variables to show and update the commit log viewer next to the analysis results viewer. (AnalysisTaskResultsPane.prototype.setPoints): Create the list of repositories to show details. (AnalysisTaskResultsPane.prototype.didConstructShadowTree): Re-render when the current selected test group changes since that may have updated the selected range for A/B testing. Also re-render when a new repository is selected to show details. (AnalysisTaskResultsPane.prototype.render): Update the list of repositories and the commit log viewer. (AnalysisTaskResultsPane.prototype._renderRepositoryList): Renders the list of repositories. (AnalysisTaskResultsPane.prototype._updateCommitViewer): Updates the commit log viewer given the range selected in the analysis results viewer. (AnalysisTaskResultsPane.htmlTemplate): Updated the template. (AnalysisTaskResultsPane.cssTemplate): Ditto. (AnalysisTaskTestGroupPane.cssTemplate): Add a little space between the list of results and the table of A/B testing jobs with revisions. (AnalysisTaskPage.prototype.render): Fixed the bug that the list of commits associated with the task is not updated when the list changes the task or the start point never changed when the list of commits associated with the task changed. Make the lazily evaluated function compare the actual list of commits so that it will invoke _renderCauseAndFixes when the list changes. (AnalysisTaskPage.prototype._renderCauseAndFixes): Now renders a specific list. 2017-05-16 Ryosuke Niwa Another build fix. Added a missing null check. * public/v3/components/custom-analysis-task-configurator.js: (CustomAnalysisTaskConfigurator.prototype._setUploadedFilesIfEmpty): 2017-05-14 Ryosuke Niwa Build fix. Added a missing null check. * public/v3/pages/analysis-task-page.js: (AnalysisTaskConfiguratorPane.prototype.setTestGroups): 2017-05-11 Ryosuke Niwa Remove the code for old syncing script configuration in BuildbotSyncer https://bugs.webkit.org/show_bug.cgi?id=171963 Reviewed by Chris Dumez. Removed the code for specifying {"root": ~}, {"rootOptions": [~]}, and {"rootsExcluding": [~]} in buildbot properties in the syncing script's configurations since they are no longer used after r215061. Also removed the support for using "arguments" as an alias to "properties", and updated the tests accordingly. * tools/js/buildbot-syncer.js: (BuildbotSyncer._parseRepositoryGroup): Removed the unused code. (BuildbotSyncer._validateAndMergeConfig): Just allow string values in properties. (BuildbotSyncer._validateAndMergeProperties): Deleted. * unit-tests/buildbot-syncer-tests.js: (sampleiOSConfig): Use "properties" instead of "arguments" to specify the buildbot properties. (sampleiOSConfigWithExpansions): Ditto. 2017-05-10 Ryosuke Niwa Another build fix after r215633 to make the bar graphs render even when the confidence intervals aren't available. * public/v3/components/bar-graph-group.js: (BarGraphGroup.prototype._computeRange): 2017-05-10 Ryosuke Niwa Build fix after r215633. * public/v3/models/test-group.js: (TestGroup.prototype._computeRequestedCommitSets): (TestGroup.prototype.requestsForCommitSet): 2017-05-10 Ryosuke Niwa Add API to upload a patched build for a custom A/B testing https://bugs.webkit.org/show_bug.cgi?id=171956 Reviewed by Chris Dumez. Added /api/upload-root to upload a root file, the build product of a patch associated with a commit set. Extracted more functions out of privileged-api/upload-file.php to uploaded-file-helpers.php to share code with /api/upload-root.php. * public/api/upload-root.php: Added. (main): (compute_commit_set_items_to_update): Find the list of commit set items to associate this root with. A root can be associated with multiple repositories and there fore commit set items; e.g. if a software is built from multiple repositories and there is a patch associated with one of them, the built product must be associated with all those repositories. * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::fetch_commits_for_set_if_needed): Include the root file is there is one. * public/include/json-header.php: (validate_arguments): Added the support for validating json string. (verify_slave): Return the slave ID found. * public/include/uploaded-file-helpers.php: (validate_uploaded_file): Extracted from /privileged-api/upload-file to be shared with /api/upload-root. (query_total_file_size): Ditto. (create_uploaded_file_from_form_data): Ditto. (upload_file_in_transaction): Ditto. Takes a lambda to do the extra work inside the transaction. * public/privileged-api/upload-file.php: (main): * public/v3/models/build-request.js: (BuildRequest.constructBuildRequestsFromData): Resolve the rootFIle of each commit set item. * public/v3/models/commit-set.js: (CommitSet): Added _repositoryToRootMap and _allRootFiles as instance variables. (CommitSet.prototype.updateSingleton): Added. Previously, each commit set's states never changed after its creation. After this patch, each item can be newly associated with a root so we must update its _repositoryToRootMap and _allRootFiles. For simplicity, we update all states. (CommitSet.prototype._updateFromObject): Extracted from the constructor. (CommitSet.prototype.allRootFiles): Added. Includes custom roots and roots created for patches. (CommitSet.prototype.rootForRepository): Added. (CommitSet.prototype.equals): Fixed the bug that we were comparing _repositoryToPatchMap to _repositoryToCommitMap, and added a check for _repositoryToRootMap. * public/v3/models/test-group.js: (TestGroup.prototype.task): Added. (TestGroup.createWithTask): (TestGroup.createWithCustomConfiguration): (TestGroup.createAndRefetchTestGroups): (TestGroup._fetchTestGroupsForTask): Deleted. Now fetchForTask takes a boolean argument: ignoreCache. (TestGroup.findAllByTask): Added. (TestGroup.fetchForTask): Renamed from fetchByTask. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype._fetchRelatedInfoForTaskId): * server-tests/api-build-requests-tests.js: * server-tests/api-upload-root-tests.js: Added. Added tests for /api/upload-root. (makeReport): Added. (addSlaveAndCreateRootFile): Added. (createTestGroupWihPatch): Added. * server-tests/privileged-api-create-test-group-tests.js: * server-tests/resources/mock-data.js: (MockData.sharedRepositoryId): Added. (MockData.addMockData): Added "Shared" repository along with commits. 2017-05-10 Ryosuke Niwa Rename server-tests/api-update-triggerable.js to server-tests/api-update-triggerable-tests.js https://bugs.webkit.org/show_bug.cgi?id=171905 Reviewed by Chris Dumez. * server-tests/api-update-triggerable-tests.js: Renamed from server-tests/api-update-triggerable.js. 2017-04-30 Ryosuke Niwa Add the support for scheduling a A/B testing with a patch. https://bugs.webkit.org/show_bug.cgi?id=171209 Reviewed by Chris Dumez. Added the support for creating a custom test group with a patch applied. First, each repository in a repository group has a boolean indicating whether a given repository can have a patch applied or not. When any configuration in a test group contains a patch, we create build requests without a test specified in order to "build" those patches. These build requests have negative order numbers to differentiate them from regular build requests. We can't simply build ones with patches since there could be differences in SDK, build options, etc... when patches are applied. The JSON format for commit sets returned by /api/build-requests have been changed from using an array of commit IDs to an array of dictionaries indicate commit and acceptsPatch boolean. /api/update-triggerable now uses a dictionary with two keys: repository and acceptsPatch to specify a set of repositories associated with a repository group, and /privileged-api-create-test-group uses a dictionary with two keys: revision and patch instead of a revision string to specify commit sets. Furthermore, the syncing script's configuration have been updated to use a dictionary of repository names to an options dictionary instead of an array of repositories names. For now, the only supported option is acceptsPatch but will be extended when we add the support for rolling back system components. e.g. {"WebKit": {acceptsPatch: true}, "macOS": {}} instead of ["WebKit", "macOS"] On the UI side, InstantFileUploader has been changed to accept only one file by default, and added a new method allowMultipleFiles() to allow multiple files to be selected for custom roots. Also replaced the input element with type=file by a button with a custom label to show labels such as "Apply a patch" or "Add a new root" instead of the generic label like "choose a file". * init-database.sql: Added trigrepo_accepts_patch to triggerable_repositories to indicate whether a given repository can have a patch applied or not. Made request_test optional in build_requests for when a build request is created to build patches. Such a build request have a negative request_order. Updated the related constraints accordingly. * public/admin/triggerables.php: Added the support for updating whether a given repository can have a patch applied in each repository group. Only show the repositories in the repository group for this purpose since there is no way to accept a patch on a repository without it being a part of the group. (generate_repository_form): Now takes the markup for checkboxes instead of generating one itself. (generate_repository_checkboxes): Now takes an array of repositories to generate checkboxes. The checkbox is shown when the repository ID exists as a key in this array, and is checked when its value is true. The new capability to skip repositories not in the array is used to hide repositories not associated with the group in the list of checkboxes to indicate a repository accepts a patch. * public/api/update-triggerable.php: (main): Now updates the description and acceptsRoots states of each repository group, and sets acceptsPatch boolean for each repository in the group if set in the update. (validate_repository_groups): Use a reference to $repository_groups in order to set repository_id_list, which contains an array of repository IDs to find the existing repository group that matches the set via RepositoryGroupFinder's find_by_repositories. Also added a various validations for acceptsRoots, a dictionary specifying repository and acceptsPatch. * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::fetch_commits_for_set_if_needed): Instead of returning an array of commit IDs as "commits", it now returns an array of dictionaries with "commit" and "patch" keys specifying the commit ID and the patch file's ID respectively as "revisionItems". (BuildRequestsFetcher::add_uploaded_file): Added. Extracted from fetch_commits_for_set_if_needed. Used to add either a patch file or a custom root file in the list of uploaded files in the result. * public/include/manifest-generator.php: (fetch_triggerables): Each element in repository group's "repositories" field is now an array of dictionaries with "repository" and "acceptsPatch" as keys. * public/include/repository-group-finder.php: (RepositoryGroupFinder::__construct): Added a map for boolean indicating whether a given repository group allows a patch on a repository. Used in /privileged-api/create-test-group. (RepositoryGroupFinder::accepts_patch): Added. (RepositoryGroupFinder::populate_map): Build up the map for acceptsPatch boolean per repository per group. * public/privileged-api/create-test-group.php: (main): Fixed a bug that we were not explicitly checking for a duplicate test group name (with a test). Create build requests to "build" patches if there is any patch file specified. (commit_sets_from_revision_sets): Updated to take a dictionary with "revision" and "patch" as keys to specify a revision and a patch if any instead of just a revision string for each repository. Also validate that each repository is allowed to have a patch once the repository group has been found for the set of repositories. (ensure_commit_sets): * public/v3/components/custom-analysis-task-configurator.js: (CustomAnalysisTaskConfigurator): Added _patchUploaders as an instance variable, which is a dictionary of configuration names to a map of InstantFileUploader's used to upload a patch. Also renamed _fileUploaders to _customRootUploaders for clarity. (CustomAnalysisTaskConfigurator.prototype.setCommitSets): (CustomAnalysisTaskConfigurator.prototype.didConstructShadowTree.createRootUploader): Added. (CustomAnalysisTaskConfigurator.prototype.didConstructShadowTree): (CustomAnalysisTaskConfigurator.prototype._ensurePatchUploader): Added. Creates an instant file uploader for patches. We only allow a single patch per repository. (CustomAnalysisTaskConfigurator.prototype._computeCommitSet): Include a patch in the commit set as needed. (CustomAnalysisTaskConfigurator.prototype._buildRevisionTable): Show the patch file uploader for repositories which can have patches in the current repository group. (CustomAnalysisTaskConfigurator.cssTemplate): Show borders between every rows instead of just between tbody's now that each row can have a patch file uploader. * public/v3/components/instant-file-uploader.js: (InstantFileUploader): Added _fileInput and _allowMultipleFiles as instance variables. We now show a button in the UI instead of an input with type=file. _fileInput is a hidden input with type=file used inside a click event of the button to let the user pick a file. (InstantFileUploader.prototype.allowMultipleFiles): Added. Allows this instance to accept multiple files. (InstantFileUploader.prototype.didConstructShadowTree): Synthetically click on the hidden input element when the newly added button element is clicked to open the browser's file picker. (InstantFileUploader.prototype.render): Hide the button to add a file if this instance can only select one file and there is already some file being uploaded in this instance. (InstantFileUploader.htmlTemplate): Replaced the input element with type=file with a button. Its label comes from the default slot content. * public/v3/models/build-request.js: (BuildRequest): Made the test optional. (BuildRequest.prototype.isBuild): Returns true if this is a build request for building a patch. (BuildRequest.prototype.isTest): Returns true if this is a build request for running tests. (BuildRequest.constructBuildRequestsFromData): Create each commit log here instead of relying on CommitSet's constructor to construct its commit logs. Also updated per the replacement of an array of commit IDs by an array of dictionaries with commit and patch properties. * public/v3/models/commit-set.js: (CommitSet): Made _repositoryToCommitMap a real Map object. Also added _repositoryToPatchMap. Also got rid of the code to instantiate commit logs since that's now done in BuildRequest.constructBuildRequestsFromData. (CommitSet.prototype.commitForRepository): (CommitSet.prototype.revisionForRepository): (CommitSet.prototype.patchForRepository): Added. (CommitSet.prototype.latestCommitTime): Modernized the code. (CommitSet.prototype.equals): Modernized the code. Also added the check for patches. (MeasurementCommitSet): Updated per the change to make _repositoryToCommitMap a real Map. (CustomCommitSet.prototype.setRevisionForRepository): (CustomCommitSet.prototype.equals): Added the check for patches. (CustomCommitSet.prototype.revisionForRepository): (CustomCommitSet.prototype.patchForRepository): Added. * public/v3/models/manifest.js: (Manifest._didFetchManifest): Updated per the replacement of an array of commit IDs by an array of dictionaries with commit and patch properties. * public/v3/models/repository.js: (Repository.prototype.ownerId): Renamed from owner for clarity. * public/v3/models/test-group.js: (TestGroup): Modernized the code by using LazilyEvaluatedFunction. Removed _requestsAreInOrder since it's not necessary anymore with LazilyEvaluatedFunction. (TestGroup.prototype.addBuildRequest): (TestGroup.prototype.test): Use the last build request's test since the first few requests could be requests to build patches. (TestGroup.prototype.platform): Ditto. (TestGroup.prototype._lastRequest): Added. (TestGroup.prototype._orderedBuildRequests): Added. (TestGroup.prototype.repetitionCount): Only count the build requests for testing (skipping any requests to build patches). (TestGroup.prototype.requestedCommitSets): Simply call _computeRequestedCommitSetsLazily. (TestGroup.prototype._computeRequestedCommitSets): Extracted from requestedCommitSets. (TestGroup.prototype.requestsForCommitSet): (TestGroup.prototype.labelForCommitSet): Rewritten. Just compute the label here instead of relying on _commitSetToLabel since requestedSets is always of the length two at the moment. (TestGroup._revisionSetsFromCommitSets): Specify both the revision and the patch in the revision set. * public/v3/models/triggerable.js: (TriggerableRepositoryGroup): Added _patchAcceptingSet as an instance variable. Use sortByNamePreferringOnesWithURL to sort repositories instead of simple sortByName. (TriggerableRepositoryGroup.prototype.accepts): Added checks for the custom roots and patches. (TriggerableRepositoryGroup.prototype.acceptsPatchForRepository): Added. * server-tests/api-build-requests-tests.js: Updated the test cases per the replacement of an array of commit IDs by an array of dictionaries with commit and patch properties. * server-tests/api-manifest-tests.js: Updated the test case per the name of Repository's owner to ownerId. * server-tests/api-update-triggerable.js: Updated the test case per the name of Repository's owner to ownerId, and added a test case for updating whether a given repository group allows custom roots as well as patches on repositories via /api/update-triggerable. (.updateWithOSXRepositoryGroup): Updated the sample syncing script configuration per the format change. (.refetchManifest): Added. * server-tests/privileged-api-create-test-group-tests.js: Updated per the syncing script configuration format change. Also added a test for creating a test group with a duplicate name, which is expected to fail with DuplicateTestGroupName, and creating a test group with a patch both when it's allowed and when it's not allowed in the matching repository group. (.addTriggerableAndCreateTask): Updated per the format change. * server-tests/resources/mock-data.js: (MockData.addEmptyTriggerable): Added a metric and its configuration to make it appear in the manifest file. The new test case in api-update-triggerable.js requires this. (MockData.mockTestSyncConfigWithSingleBuilder): Updated per the syncing script configuration format change. (MockData.mockTestSyncConfigWithTwoBuilders): Ditto. * server-tests/tools-buildbot-triggerable-tests.js: Removed the useless assertions about test configurations, and added assertions about custom roots and patches in the test case for updateTriggerables. * tools/js/buildbot-syncer.js: (BuildbotSyncer._parseRepositoryGroup): Made each assertion explicitly refer to the specific repository group to make it more user friendly. Now each repository group uses a dictionary of repository names to its options in the syncing script configurations. When parsed, we insert it as an array of dictionaries with repository ID and acceptsPatch boolean specified separately since this is the format /api/update-triggerable expects. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype.updateTriggerable): * unit-tests/build-request-tests.js: (sampleBuildRequestData): Updated per the commit sets format change in /api/build-requests. * unit-tests/buildbot-syncer-tests.js: Updated the existing tests per various format changes and added a couple of new test cases for the syncing script's configuration validation. (sampleiOSConfig): (smallConfiguration): (createSampleBuildRequest): * unit-tests/resources/mock-v3-models.js: (MockModels.inject): Updated per the repository group format change. * unit-tests/test-groups-tests.js: (sampleTestGroup): Updated per the commit sets format change in /api/build-requests. 2017-04-21 Ryosuke Niwa Rename commit_set_relationships to commit_set_items https://bugs.webkit.org/show_bug.cgi?id=171143 Reviewed by Joseph Pecoraro. Renamed commit_set_relationships to commit_set_items. Also added commitset_patch_file in the preparation to add the support for applying patches in custom test groups. To migrate an existing database, run: ```sql BEGIN; ALTER TABLE commit_set_relationships RENAME TO commit_set_items; ALTER TABLE commit_set_items ADD COLUMN commitset_patch_file integer REFERENCES uploaded_files; ALTER TABLE commit_set_items ADD CONSTRAINT commitset_with_patch_must_have_commit CHECK (commitset_patch_file IS NULL OR commitset_commit IS NOT NULL); END; ``` * init-database.sql: * public/include/build-requests-fetcher.php: * public/privileged-api/create-test-group.php: * server-tests/resources/mock-data.js: (MockData.addMockData): (MockData.addMockTestGroupWithGitWebKit): * tools/js/database.js: 2017-04-21 Ryosuke Niwa Add the support for creating a custom test group in the analysis task page Make it possible to create more custom test groups in the analysis task page https://bugs.webkit.org/show_bug.cgi?id=171138 Rubber-stamped by Chris Dumez. Extracted CustomConfigurationTestGroupForm out of CreateAnalysisTaskPage and added it to AnalysisTaskPage inside AnalysisTaskConfiguratorPane. This allows configuration of a new test group within a custom analysis task. * public/privileged-api/create-test-group.php: (main): Fixed the bug that the triggerable wasn't resolved when creating a test group in a custom analysis task. * public/v3/components/custom-analysis-task-configurator.js: (CustomAnalysisTaskConfigurator.prototype.selectTests): Added. Used by CustomConfigurationTestGroupForm's setConfigurations. (CustomAnalysisTaskConfigurator.prototype.selectPlatform): Ditto. (CustomAnalysisTaskConfigurator.prototype.setCommitSets): Ditto. (CustomAnalysisTaskConfigurator.prototype._setUploadedFilesIfEmpty): Added. (CustomAnalysisTaskConfigurator.prototype._revisionMapFromCommitSet): Added. (CustomAnalysisTaskConfigurator.prototype.render): Update the currently selected platforms and tests now that they can be set externally via selectTests and selectPlatform. (CustomAnalysisTaskConfigurator.prototype._renderTriggerableTests): Return the result of _renderRadioButtonList so that the caller can update the currently selected tests without having to reconstruct the list. (CustomAnalysisTaskConfigurator.prototype._renderTriggerablePlatforms): Ditto. (CustomAnalysisTaskConfigurator.prototype._renderRadioButtonList): Renamed from _buildCheckboxList. Now returns a function which updates the currently selected items. We still pretend that multiple items can be selected to make it future-proof. * public/v3/components/custom-configuration-test-group-form.js: Added. (CustomConfigurationTestGroupForm): Added. Inherits from TestGroupForm. Extracted from CreateAnalysisTaskPage. (CustomConfigurationTestGroupForm.prototype.setHasTask): Added. (CustomConfigurationTestGroupForm.prototype.hasCommitSets): Added. (CustomConfigurationTestGroupForm.prototype.setConfigurations): Added. Used by AnalysisTaskConfiguratorPane to set the default configuration to what the latest test group used. (CustomConfigurationTestGroupForm.prototype.startTesting): Added. Dispatches "startTesting" action with platform, test, taskName in addition to what CustomizedTestGroupForm emits. (CustomConfigurationTestGroupForm.prototype.didConstructShadowTree): Added. (CustomConfigurationTestGroupForm.prototype.render): Added. (CustomConfigurationTestGroupForm.prototype._updateTestGroupName): Added. (CustomConfigurationTestGroupForm.cssTemplate): Added. (CustomConfigurationTestGroupForm.htmlTemplate): Added. * public/v3/components/test-group-form.js: (TestGroupForm.cssTemplate): Make the form display: block. * public/v3/index.html: * public/v3/models/test-group.js: (TestGroup.prototype.test): Added. (TestGroup.prototype.platform): Added. (TestGroup.createWithCustomConfiguration): Added. Creates a custom test group with an existing analysis task. * public/v3/models/uploaded-file.js: (UploadedFile): Fixed a bug that _deletedAt was set to a Date object even when object.deletedAt is null. * public/v3/pages/analysis-task-page.js: (AnalysisTaskConfiguratorPane): Added. (AnalysisTaskConfiguratorPane.prototype.didConstructShadowTree): Added. Dispatch createCustomTestGroup action in turn when receiving startTesting from CustomConfigurationTestGroupForm. (AnalysisTaskConfiguratorPane.prototype.setTestGroups): Added. (AnalysisTaskConfiguratorPane.prototype.render): Added. (AnalysisTaskConfiguratorPane.htmlTemplate): Added. We override this instead of formContent to display the "Start" button at the end instead of at the beginnning. (AnalysisTaskConfiguratorPane.cssTemplate): Added. (AnalysisTaskPage.prototype.didConstructShadowTree): Listen to createCustomTestGroup. (AnalysisTaskPage.prototype.render): Hide AnalysisTaskConfiguratorPane when the analysis task is not custom. (AnalysisTaskPage.prototype._showTestGroup): Let AnalysisTaskConfiguratorPane know of the current test group so that it can update the default configuration if the user hasn't modified yet. (AnalysisTaskPage.prototype._createCustomTestGroup): Added. * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype.didConstructShadowTree): (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): (CreateAnalysisTaskPage.prototype.render): (CreateAnalysisTaskPage.prototype._renderMessage): (CreateAnalysisTaskPage.htmlTemplate): (CreateAnalysisTaskPage.cssTemplate): * server-tests/privileged-api-create-test-group-tests.js: Added a test case for creating a custom test group for an existing analysis task. * server-tests/resources/mock-data.js: (MockData.otherPlatformId): Added. (MockData.addMockData): Added a test configuration for otherPlatformId. 2017-04-21 Ryosuke Niwa Make it possible to view results for sub tests and metrics in A/B testing https://bugs.webkit.org/show_bug.cgi?id=170975 Reviewed by Chris Dumez. Replaced TestGroupResultsTable, which was a single table that presented the test results with a set of revisions each build request used, with TestGroupResultsViewer and TestGroupRevisionTable. TestGroupResultsViewer provides an UI to look the results of sub-tests and sub-metrics and TestGroupRevisionTable provides an UI to display the set of revisions each build request used. TestGroupRevisionTable can also show the list of custom roots now that we've added UI to schedule an analysis task with a custom test group. This patch extends BarGraphGroup to show multiple bars per SingleBarGraph using a canvas with bars indicating their mean and confidence interval. * browser-tests/index.html: (ChartTest.importChartScripts): Include lazily-evaluated-function.js now that Test model object uses LazilyEvaluatedFunction. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.TestGroupStackingBlock.prototype._valuesForCommitSet): (AnalysisResultsViewer.TestGroupStackingBlock.prototype._computeTestGroupStatus): * public/v3/components/bar-graph-group.js: (BarGraphGroup): No longer takes formatter. Added _computeRangeLazily and _showLabels as instance variables. (BarGraphGroup.prototype.addBar): Now takes a list of values, their labels, mean, confidence interval, and the colors of bar graphs shown for each value and the mean indicator. (BarGraphGroup.prototype.showLabels): Added. (BarGraphGroup.prototype.setShowLabels): Added. (BarGraphGroup.prototype.range): Added. (BarGraphGroup.prototype._computeRange): Renamed from updateGroupRendering. Now returns the range instead off setting it to each bar, and each SingleBarGraph's render function uses the value via BarGraphGroup's range. (BarGraph): Renamed from SingleBarGraph. Added various arguments introduced in addBar, and now stores various lazily evaluated functions used for rendering. (BarGraph.prototype.render): Rewritten to use canvas to draw bar graphs and show a label when group's showLabels() returns true. (BarGraph.prototype._resizeCanvas): Added. (BarGraph.prototype._renderCanvas): Added. (BarGraph.prototype._renderLabels): Added. We align the top of each label to the middle of each bar and shift it back up by half the height of the label (0.4rem) using margin-top in css. (BarGraph.htmlTemplate): Uses a canvas now. (BarGraph.cssTemplate): * public/v3/components/results-table.js: (ResultsTable.prototype.renderTable): Updated per code changes to BarGraphGroup. (ResultsTableRow.prototype.resultContent): Ditto. * public/v3/components/test-group-results-table.js: Removed. * public/v3/components/test-group-results-viewer.js: Added. (TestGroupResultsViewer): Added. Shows a list of test results with bar graphs with mean and confidence interval indicators. The results of sub tests and metrics can be expanded via "(Breakdown)" link shown below each test. (TestGroupResultsViewer.prototype.setTestGroup): Added. (TestGroupResultsViewer.prototype.setAnalysisResults): Added. (TestGroupResultsViewer.prototype.render): Added. (TestGroupResultsViewer.prototype._renderResultsTable): Compute the depth of the test tree we show, and construct the header rows. Each sub test is "indented" by a new column. (TestGroupResultsViewer.prototype._buildRowForTest): Added. Build rows for metrics of the given test. Expand the list of its child tests if it's in expandedTests. Otherwise add a link to "Breakdown" if it has any child tests. (TestGroupResultsViewer.prototype._buildRowForMetric): Added. Builds rows of table cells to show the results for the given metric for each configuration. (TestGroupResultsViewer.prototype._buildRowForMetric.createConfigurationRow): Added. A helper to build cells for a given configuration represented by a requested commit set. (TestGroupResultsViewer.prototype._buildValueMap): Added. Creates a mappting between a requested commit set, and the list of values, mean, etc... associated with the results for the commit set. (TestGroupResultsViewer.prototype._buildEmptyCells): Added. A helper to create empty cells to indent sub tests. (TestGroupResultsViewer.prototype._expandCurrentMetrics): Added. Highlights the current metrics and renders the label for each bar in the results. (TestGroupResultsViewer.htmlTemplate): Added. (TestGroupResultsViewer.cssTemplate): Added. * public/v3/components/test-group-revision-table.js: Added. (TestGroupRevisionTable): Added. Renders the list of revisions requested for each test configuration as well as ones used in actual testing, and additional repositories being reported (e.g. repositories for helper scripts). (TestGroupRevisionTable.prototype.setTestGroup): Added. (TestGroupRevisionTable.prototype.setAnalysisResults): Added. (TestGroupRevisionTable.prototype.render): Added. (TestGroupRevisionTable.prototype._renderTable): Added. The basic algorithm here is to first create a row entry object for each build request, merge cells that use the same revision of the same repository, and then render the entire table. (TestGroupRevisionTable.prototype._buildCommitCell): Added. (TestGroupRevisionTable.prototype._buildCustomRootsCell): Added. (TestGroupRevisionTable.prototype._mergeCellsWithSameCommitsAcrossRows): Added. Compute rowspan for each cell by traversing the rows that use the same revision per repository, and store it in rowCountByRepository while adding the repository to each succeeding row's repositoriesToSkip. (TestGroupRevisionTable.htmlTemplate): Added. (TestGroupRevisionTable.cssTemplate): Added. * public/v3/index.html: * public/v3/models/analysis-results.js: (AnalysisResults): Added _metricIds and _lazilyComputedHighestTests as instance variables. (AnalysisResults.prototype.findResult): Renamed from find. (AnalysisResults.prototype.highestTests): Added. (AnalysisResults.prototype._computeHighestTests): Added. Finds the root tests for this analysis result. (AnalysisResults.prototype.add): Update _metricIds. (AnalysisResults.prototype.commitSetForRequest): Added. Returns the reported commit set for the build request. This commit set contains the set of revisions reported to /api/report by A/B testers. (AnalysisResultsView.prototype.resultForRequest): Renamed from resultForBuildId. * public/v3/models/metric.js: (Metric.prototype.relativeName): Added. Computes the relative name given the test/metric path. This function is used to determine the label for each test/metric in TestGroupResultsViewer. (Metric.prototype.aggregatorLabel): Extracted from label. (Metric.prototype.label): (Metric.makeFormatter): Added the default value of false to alwaysShowSign. * public/v3/models/test-group.js: (TestGroup.prototype.compareTestResults): Now takes a metric instead of retrieving it from the analysis task since a custom analysis task may not have a metric associated with it. * public/v3/models/test.js: (Test): Added _computePathLazily as an instance variable. (Test.prototype.path): Lazily computes the path now that this function can be called on the same test for many times in TestGroupResultsViewer while computing relative names of tests and metrics. (Test.prototype._computePath): Extracted path. (Test.prototype.fullName): Modernized the code. (Test.prototype.relativeName): Added. * public/v3/models/uploaded-file.js: (UploadedFile): (UploadedFile.prototype.deletedAt): Added. (UploadedFile.prototype.label): Added. (UploadedFile.prototype.url): Added. * public/v3/pages/analysis-task-page.js: (AnalysisTaskTestGroupPane.prototype.setTestGroups): (AnalysisTaskTestGroupPane.prototype.setAnalysisResults): Replaced setAnalysisResultsView. Now takes an analysisResults instead of its view. (AnalysisTaskTestGroupPane.prototype.render): No longer enqueues the results table and the retry form to render since the results table no longer exists, and the retry form re-renders itself as needed. (AnalysisTaskTestGroupPane.htmlTemplate): Now uses test-group-results-viewer and test-group-revision-table instead of test-group-results-table, which has been removed. (AnalysisTaskTestGroupPane.cssTemplate): (AnalysisTaskPage.prototype._assignTestResultsIfPossible): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): Removed superflous console.log's. * tools/js/v3-models.js: Import LazilyEvaluatedFunction now that it's used in the Test model. * unit-tests/test-model-tests.js: Added. 2017-04-19 Ryosuke Niwa Another build fix after r215061. Clear TriggerableRepositoryGroup's static map in each iteration. * tools/sync-buildbot.js: (syncLoop): 2017-04-18 Ryosuke Niwa Build fix after r215061. There was a mismatch between the format updateTriggerable and /api/update-triggerable were using. Namely, each repository group was assumed to contain a name field in /api/update-triggerable but updateTriggerable was not including that at all. We didn't catch this because the test for updateTriggerable also used the wrong format :( * server-tests/tools-buildbot-triggerable-tests.js: * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype.updateTriggerable): 2017-04-14 Dewei Zhu Add sub-commit UI in commit log viewer. https://bugs.webkit.org/show_bug.cgi?id=170379 Reviewed by Ryosuke Niwa. Add an API to return sub-commits for a given commit. Add sub-commit difference viewer into commit log viewer to show changed sub-commits between two commits. Add 'ownsSubCommits' info in 'api/commits' return values. Extend 'api/manifest' to include whether a repositories owns other repositories. Only show this sub-commit difference viewer when a repository owns other repositories and both commits owns sub-commits. Add unit tests for those new features. * browser-tests/commit-log-viewer-tests.js: Updated test cases. * public/api/commits.php: Added 'sub-commits' to provide sub-commit for a given commit. * public/include/commit-log-fetcher.php: Added function to query sub-commit from database. Added 'repository' and 'ownsSubCommits' fields in returning commits. * public/v3/components/expand-collapse-button.js: Added. (ExpandCollapseButton): (ExpandCollapseButton.prototype.didConstructShadowTree): Changes state on click and dispatches 'toggle' event. (ExpandCollapseButton.sizeFactor): (ExpandCollapseButton.buttonContent): (ExpandCollapseButton.cssTemplate): * public/v3/components/commit-log-viewer.js: (CommitLogViewer.prototype._renderCommitList): Added sub-commit viewer if two adjacent commits both have sub-commits. (CommitLogViewer.cssTemplate): * public/v3/components/sub-commit-viewer.js: Added. (SubCommitViewer): Added 'SubCommitViewer' class to represent the sub-commit differences between two given commits.` (SubCommitViewer.prototype.didConstructShadowTree): Makes 'expand-collapse' button listen to 'toggle' event. (SubCommitViewer.prototype._toggleVisibility): Updates UI once 'expand-collapse' button is clicked. (SubCommitViewer.prototype.render): Render sub-commit view based on the state. (SubCommitViewer.prototype._renderSubcommitTable): Generates sub-commits difference table entries. (SubCommitViewer.htmlTemplate): (SubCommitViewer.cssTemplate): * public/v3/index.html: Added 'sub-commit-viewer.js' and 'expand-collapse-button.js'. * public/v3/models/commit-log.js: (CommitLog): Added '_subCommits'. (CommitLog.prototype.updateSingleton): Updates 'rawData.ownsSubCommits' as well. (CommitLog.prototype.ownsSubCommits): (CommitLog.prototype.subCommits): Added. Returns sub-commits. (CommitLog.prototype.fetchSubCommits): Added. Fetches sub-commits if haven't fetched them before. (CommitLog.prototype._buildSubCommitMap): Added. Creates a map which maps repositories to commits. (CommitLog.diffSubCommits): Added. Finds difference between two given commits. (CommitLog.fetchBetweenRevisions): Updated due to '_constructFromRawData' change. (CommitLog.fetchForSingleRevision): Updated due to '_constructFromRawData' change. (CommitLog._constructFromRawData): Removed first argument 'repository' as it can be determined by calling 'Repository.findById'. * public/v3/models/repository.js: (Repository): (Repository.prototype.owner): Returns the owner id. (Repository.prototype.ownedRepositories): Returns a list of repositories owned by this repository. * server-tests/api-commits-tests.js: Added tests for 'sub-commits' filter. * server-tests/api-manifest-tests.js: Added a test. * unit-tests/commit-log-tests.js: Added tests for 'fetchSubCommits' and 'diffSubCommits'. * unit-tests/resources/mock-v3-models.js: Added 'ownerRepository' and 'ownedRepository'. 2017-04-11 Ryosuke Niwa Retrying an A/B testing does not set the repetition count in some cases https://bugs.webkit.org/show_bug.cgi?id=170695 Reviewed by Joseph Pecoraro. When selecting an existing A/B test group, the analysis task page automatically sets the repetition count of its retry to be that of the original test group. However, this information wasn't being passed correctly to the code that actually created a test group. As a result, the retried test group's repetition count does not match that of the original group or the number shown to the user on UI. Fixed the bug by updating this._repetitionCount in setRepetitionCount. * browser-tests/index.html: * browser-tests/test-group-form-tests.js: Added. Added tests. (.createTestGroupFormWithContext): Added. * public/v3/components/test-group-form.js: (TestGroupForm.prototype.setRepetitionCount): (TestGroupForm.formContent): (TestGroupForm): 2017-04-10 Ryosuke Niwa Add the UI for scheduling a A/B testing with a custom root https://bugs.webkit.org/show_bug.cgi?id=170622 Reviewed by Anders Carlsson. This patch adds the support for creating a new analysis task with a custom darwinup roots. A follow up patch would update the syncing script to schedule such an A/B testing job to a buildbot instance. * ReadMe.md: Updated instructions for backing up and restoring the database so that it's easier to replace the file path for the backup. * init-database.sql: Make task_platform and task_metric optional in each analysis task. Also added a column to store the root file in commit_set_relationships. * public/api/build-requests.php: (main): Include the uploaded files. * public/api/commits.php: (main): Added the support for querying the latest commits for a given platform. This is used in a new page to create a custom analysis task to autofill the latest revisions for a given platform. * public/api/test-groups.php: (main): Include the uploaded files. * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::__construct): Added a list of uploaded_files and a map from its id. (BuildRequestsFetcher::uploaded_files): Added. (BuildRequestsFetcher::fetch_commits_for_set_if_needed): Added the support for including custom roots' id in each commit set, and inserting its meta data in the list of uplaoded files. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_latest_for_platform): Added. Finds the latest commit for a given platform. Ideally, we should be finding the latest commit for a given platform, but this is very slow so instead find the commit of the latest build for a given platform. * public/privileged-api/create-test-group.php: (main): Added the support for creating an analysis task along with a group. (commit_sets_from_revision_sets): Added the support for custom roots. Verify the specified uploaded file exists and include it in commit_set_relationships. Because commits and upload files are stored in a different column in commit_set_relationships, this function now stores the information for each row of commit_set_relationships except the commit set ID, which is unknown until the set is created, instead of a commit ID. (ensure_commit_sets): Made the each entry in a commit set a row instead of a commit ID as done. As this format is only by v2 UI and detect-changes.js, we don't add the support for specifying custom roots here. * public/privileged-api/upload-file.php: (main): Fixed a typo. Also added one more error check. * public/v3/components/custom-analysis-task-configurator.js: Added. The UI for selecting a test, a platform, and a set of revisions, as well as custom roots for a custom A/B testing job. The first set of revision with custom roots is referred as "baseline", and the second configuration is referred as "comparison" in this class. (CustomAnalysisTaskConfigurator): (CustomAnalysisTaskConfigurator.prototype.tests): Added. (CustomAnalysisTaskConfigurator.prototype.platform): Added. (CustomAnalysisTaskConfigurator.prototype.commitSets): Added. Returns a pair of baseline and comparsion if both have been configured by the user. (CustomAnalysisTaskConfigurator.prototype.didConstructShadowTree): Added. (CustomAnalysisTaskConfigurator.prototype._configureComparison): Added. Called when the user is to configu the "comparison" configuration. (CustomAnalysisTaskConfigurator.prototype.render): Added. (CustomAnalysisTaskConfigurator.prototype._renderTriggerableTests): Added. Renders the list of top-level tests that can be scheduled by a triggerable. (CustomAnalysisTaskConfigurator.prototype._renderTriggerablePlatforms): Added. Renders the list of platforms that can be schedule with the currently selected list of tests by a triggerable. Note that the current UI only lets the user select a single test but the intent is to allow multiple tests to be selected in the near future. (CustomAnalysisTaskConfigurator.prototype._buildCheckboxList): Added. Creates a list of radio boxes to select an item with a callback for each. It automatically sets "selected" class on the selected item. It's used to render both the list of tests and platforms. (CustomAnalysisTaskConfigurator.prototype._updateTriggerable): Added. Finds the triggerable for a given list of tests and platforms. Returns an error when some tests belong to another triggearalbe. (CustomAnalysisTaskConfigurator.prototype._updateRepositoryGroups): Added. Finds a repository group to use when the current triggerable has changed. We try to use the repository group of the same name if there is any, and defaults to the first repository group if there is none. This allows the set of repositories to be specified to more or less persist across different triggerables. For example, if iOS platforms and Mac platforms use two distinct triggerables , and both triggerables have two repository groups: one that only specify the OS and the other that specifies both teh OS and WebKit revision, then this code allows the choice the user had made to specify either just the OS or the OS and WebKit will be preserved when the user switches from an iOS platform to a Mac platform. (CustomAnalysisTaskConfigurator.prototype._updateCommitSetMap): Added. Create a commit set map, the format that TestGroup.createWithTask accepts given "baseline" and "comparison" commit sets. Pretend "comparison" is not set if two sets are identical since it makes no sense to schedule an A/B testing job when A and B are identical. (CustomAnalysisTaskConfigurator.prototype._computeCommitSet): Added. Creates a commit set using the revisions and the csutom roots the user had specified. (CustomAnalysisTaskConfigurator.prototype._renderRepositoryPanes): Added. Renders the pane to specify revisions and custom roots for "baseline" and "comparison". (CustomAnalysisTaskConfigurator.prototype._renderBaselineRevisionTable): Added. (CustomAnalysisTaskConfigurator.prototype._renderComparisonRevisionTable): Added. (CustomAnalysisTaskConfigurator.prototype._optionalRepositoryList): Added. (CustomAnalysisTaskConfigurator.prototype._buildRevisionTable): Added. Creates a table for specifying revisions and custom roots along with a list of repository groups to pick. The set of repositories and custom roots are shown at the all if all repository groups require them. Otherwise, they are grouped at the bottom as optional. (CustomAnalysisTaskConfigurator.prototype._buildRepositoryGroupList): Added. (CustomAnalysisTaskConfigurator.prototype._selectRepositoryGroup): Added. (CustomAnalysisTaskConfigurator.prototype._buildRevisionInput): Added. Creates an input element to specify a revision for a given repository. Autofills it with the latest commit for the currently selected platform if the user had not modified the field by the time the revisions are fetched. (CustomAnalysisTaskConfigurator.htmlTemplate): Added. (CustomAnalysisTaskConfigurator.cssTemplate): Added. * public/v3/components/instant-file-uploader.js: Added. A form to upload a custom darwinup root in "baseline" or "comparison" configurations of CustomAnalysisTaskConfigurator. It's "instant" because it auto-detects when a file to be uploaded had already been uploaded elsewhere by checking its SHA-256 hash. (InstantFileUploader): (InstantFileUploader.prototype.hasFileToUpload): Added. (InstantFileUploader.prototype.uploadedFiles): Added. (InstantFileUploader.prototype.addUploadedFile): Added. It's called on the uploader for "comparison" configuration when the uploader for "baseline" configuration dipsatches "uploadedFile" action to automatically mirror the newly uploaded custom root to "comparision" configuration. (InstantFileUploader.prototype.didConstructShadowTree): Added. (InstantFileUploader.prototype.render): Added. (InstantFileUploader.prototype._renderUploadedFiles): Added. Renders the list of the uploaded files. (InstantFileUploader.prototype._renderPreuploadFiles): Added. Renders the list of the files to be uploaded with a progress bar. (InstantFileUploader.prototype._updateUploadStatus): Added. Updates the progress bar for uploading the file. (InstantFileUploader.prototype._formatUploadError): Added. (InstantFileUploader.prototype._didFileInputChange): Added. Called when the user picks a file to uploaded on the input element. Fetch the meta data for the uploaded file with the same SHA-256 hash if there is any, and start uploading the file if there isn't one. (InstantFileUploader.prototype._removeUploadedFile): Added. (InstantFileUploader.prototype._didUploadFile): Added. Move a file from the list of files to be uploaded to the list of uploaded files. (InstantFileUploader.htmlTemplate): Added. (InstantFileUploader.cssTemplate): Added. * public/v3/index.html: * public/v3/models/analysis-task.js: (AnalysisTask): Made platform and metric optional as it is now. (AnalysisTask.findByPlatformAndMetric): Skip analysis tasks without a platform or a metric. (AnalysisTask.prototype.isCustom): Added. Returns true for a custom analysis task. (AnalysisTask.fetchRelatedTasks): Skip custom analysis tasks. (AnalysisTask._constructAnalysisTasksFromRawData): Construct analysis tasks even if they were missing a metric or a platform instead of silently skipping them. * public/v3/models/build-request.js: (BuildRequest.constructBuildRequestsFromData): Construct uploaded file objects returned by /api/build-requests. * public/v3/models/commit-log.js: (CommitLog.fetchLatestCommitForPlatform): Added. * public/v3/models/commit-set.js: (CommitSet): Added this._customRoots. (CommitSet.prototype.customRoots): Returns this._customRoots. (CommitSet.prototype.equals): Returns false when the set of custom roots are not equal. (CommitSet.areCustomRootsEqual): Added. (CustomCommitSet): (CustomCommitSet.prototype.equals): Added. (CustomCommitSet.prototype.customRoots): Added. (CustomCommitSet.prototype.addCustomRoot): Added. * public/v3/models/manifest.js: (Manifest._didFetchManifest): Store fileUploadSizeLimit in the manifest as UploadedFile.fileUploadSizeLimit. This allows a file size check in the client size instead of uploading it to the server and receiving an error. * public/v3/models/metric.js: (Metric.formatTime): Moved from ChartPaneStatusView to be also used by InstantFileUploader._renderUploadedFiles. * public/v3/models/test-group.js: (TestGroup.prototype.createWithTask): Added. (TestGroup.prototype.createAndRefetchTestGroups): (TestGroup.prototype._revisionSetsFromCommitSets): Added. Extracted from createAndRefetchTestGroups. (TestGroup.prototype._fetchTestGroupsForTask): Added. Extracted from createAndRefetchTestGroups. * public/v3/models/triggerable.js: (Triggerable.triggerablePlatformsForTests): Added. (Triggerable.sortByNamePreferringSmallerRepositories): Added. * public/v3/models/uploaded-file.js: (UploadedFile.prototype.createdAt): Added. (UploadedFile.prototype.filename): Added. (UploadedFile.prototype.author): Added. (UploadedFile.prototype.size): Added. (UploadedFile.uploadFile): Added a client-side check for the file size using UploadedFile.fileUploadSizeLimit. (UploadedFile.fetchUnloadedFileWithIdenticalHash): Ditto. Also fixed a bug that 404 was resulting in a rejected promise instead of a resolved promise with null. * public/v3/pages/analysis-category-page.js: (AnalysisCategoryPage.prototype._reconstructTaskList): Modernized the code. Added the support for platform and metric being null for some analysis tasks. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype._didFetchTask): Don't fetch the measurement set or create a chart for custom tasks. (AnalysisTaskPage.prototype.render): Don't display the charts or the stacking table for custom tasks. (AnalysisTaskPage.prototype._renderTaskNameAndStatus): Don't try to show the full test name for custom tasks since it's not associated with exactly one pair. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView.prototype._renderBuildRevisionTable): (ChartPaneStatusView.prototype._formatTime): Moved to Metric.formatTime. * public/v3/pages/chart-pane.js: (ChartPane.prototype._analyzeRange): Set inProgress to true to hide CustomAnalysisTaskConfigurator in CreateAnalysisTaskPage when creating a non-custom analysis task for a specific range. * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage): This page now shows CustomAnalysisTaskConfigurator by default, and lets a user create a custom analysis task by picking a test, a platform, and a set of revisions and custom darwinup roots. (CreateAnalysisTaskPage.prototype.updateFromSerializedState): Show a message when inProgress is set. This is the old behavior of this page. (CreateAnalysisTaskPage.prototype.didConstructShadowTree): Added. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): Added. (CreateAnalysisTaskPage.prototype.render): (CreateAnalysisTaskPage.prototype._renderMessage): Added. Hides CustomAnalysisTaskConfigurator and the select element to specify the numebr of iterations when a message is set. (CreateAnalysisTaskPage.htmlTemplate): (CreateAnalysisTaskPage.cssTemplate): * public/v3/pages/page-router.js: (PageRouter.prototype.route): Always enqueue the page to re-render when the route has changed. * server-tests/api-build-requests-tests.js: Updated test cases now that the response contains a list of uploaded files associated with build requests. * server-tests/privileged-api-create-test-group-tests.js: Added test cases for creating a custom analysis task and a test group with custom roots. * server-tests/resources/mock-data.js: (MockData.addMockData): Updated the mock data to satisfy new constraint on analysis-tasks table. * tools/js/remote.js: Include global.FormData from form-data.js. * unit-tests/build-request-tests.js: (sampleBuildRequestData): Updated the mock response. * unit-tests/buildbot-syncer-tests.js: (createSampleBuildRequest): Ditto. * unit-tests/test-groups-tests.js: (sampleTestGroup): Ditto. 2017-04-10 Commit Queue Unreviewed, rolling out r215202. https://bugs.webkit.org/show_bug.cgi?id=170694 Committed incorrectly (Requested by rniwa on #webkit). Reverted changeset: "Add the UI for scheduling a A/B testing with a custom root" https://bugs.webkit.org/show_bug.cgi?id=170622 http://trac.webkit.org/changeset/215202 2017-04-10 Ryosuke Niwa Add the UI for scheduling a A/B testing with a custom root https://bugs.webkit.org/show_bug.cgi?id=170622 Reviewed by Anders Carlsson. This patch adds the support for creating a new analysis task with a custom darwinup roots. A follow up patch would update the syncing script to schedule such an A/B testing job to a buildbot instance. * ReadMe.md: Updated instructions for backing up and restoring the database so that it's easier to replace the file path for the backup. * init-database.sql: Make task_platform and task_metric optional in each analysis task. Also added a column to store the root file in commit_set_relationships. * public/api/build-requests.php: (main): Include the uploaded files. * public/api/commits.php: (main): Added the support for querying the latest commits for a given platform. This is used in a new page to create a custom analysis task to autofill the latest revisions for a given platform. * public/api/test-groups.php: (main): Include the uploaded files. * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::__construct): Added a list of uploaded_files and a map from its id. (BuildRequestsFetcher::uploaded_files): Added. (BuildRequestsFetcher::fetch_commits_for_set_if_needed): Added the support for including custom roots' id in each commit set, and inserting its meta data in the list of uplaoded files. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_latest_for_platform): Added. Finds the latest commit for a given platform. Ideally, we should be finding the latest commit for a given platform, but this is very slow so instead find the commit of the latest build for a given platform. * public/privileged-api/create-test-group.php: (main): Added the support for creating an analysis task along with a group. (commit_sets_from_revision_sets): Added the support for custom roots. Verify the specified uploaded file exists and include it in commit_set_relationships. Because commits and upload files are stored in a different column in commit_set_relationships, this function now stores the information for each row of commit_set_relationships except the commit set ID, which is unknown until the set is created, instead of a commit ID. (ensure_commit_sets): Made the each entry in a commit set a row instead of a commit ID as done. As this format is only by v2 UI and detect-changes.js, we don't add the support for specifying custom roots here. * public/privileged-api/upload-file.php: (main): Fixed a typo. Also added one more error check. * public/v3/components/custom-analysis-task-configurator.js: Added. The UI for selecting a test, a platform, and a set of revisions, as well as custom roots for a custom A/B testing job. The first set of revision with custom roots is referred as "baseline", and the second configuration is referred as "comparison" in this class. (CustomAnalysisTaskConfigurator): (CustomAnalysisTaskConfigurator.prototype.tests): Added. (CustomAnalysisTaskConfigurator.prototype.platform): Added. (CustomAnalysisTaskConfigurator.prototype.commitSets): Added. Returns a pair of baseline and comparsion if both have been configured by the user. (CustomAnalysisTaskConfigurator.prototype.didConstructShadowTree): Added. (CustomAnalysisTaskConfigurator.prototype._configureComparison): Added. Called when the user is to configu the "comparison" configuration. (CustomAnalysisTaskConfigurator.prototype.render): Added. (CustomAnalysisTaskConfigurator.prototype._renderTriggerableTests): Added. Renders the list of top-level tests that can be scheduled by a triggerable. (CustomAnalysisTaskConfigurator.prototype._renderTriggerablePlatforms): Added. Renders the list of platforms that can be schedule with the currently selected list of tests by a triggerable. Note that the current UI only lets the user select a single test but the intent is to allow multiple tests to be selected in the near future. (CustomAnalysisTaskConfigurator.prototype._buildCheckboxList): Added. Creates a list of radio boxes to select an item with a callback for each. It automatically sets "selected" class on the selected item. It's used to render both the list of tests and platforms. (CustomAnalysisTaskConfigurator.prototype._updateTriggerable): Added. Finds the triggerable for a given list of tests and platforms. Returns an error when some tests belong to another triggearalbe. (CustomAnalysisTaskConfigurator.prototype._updateRepositoryGroups): Added. Finds a repository group to use when the current triggerable has changed. We try to use the repository group of the same name if there is any, and defaults to the first repository group if there is none. This allows the set of repositories to be specified to more or less persist across different triggerables. For example, if iOS platforms and Mac platforms use two distinct triggerables , and both triggerables have two repository groups: one that only specify the OS and the other that specifies both teh OS and WebKit revision, then this code allows the choice the user had made to specify either just the OS or the OS and WebKit will be preserved when the user switches from an iOS platform to a Mac platform. (CustomAnalysisTaskConfigurator.prototype._updateCommitSetMap): Added. Create a commit set map, the format that TestGroup.createWithTask accepts given "baseline" and "comparison" commit sets. Pretend "comparison" is not set if two sets are identical since it makes no sense to schedule an A/B testing job when A and B are identical. (CustomAnalysisTaskConfigurator.prototype._computeCommitSet): Added. Creates a commit set using the revisions and the csutom roots the user had specified. (CustomAnalysisTaskConfigurator.prototype._renderRepositoryPanes): Added. Renders the pane to specify revisions and custom roots for "baseline" and "comparison". (CustomAnalysisTaskConfigurator.prototype._renderBaselineRevisionTable): Added. (CustomAnalysisTaskConfigurator.prototype._renderComparisonRevisionTable): Added. (CustomAnalysisTaskConfigurator.prototype._optionalRepositoryList): Added. (CustomAnalysisTaskConfigurator.prototype._buildRevisionTable): Added. Creates a table for specifying revisions and custom roots along with a list of repository groups to pick. The set of repositories and custom roots are shown at the all if all repository groups require them. Otherwise, they are grouped at the bottom as optional. (CustomAnalysisTaskConfigurator.prototype._buildRepositoryGroupList): Added. (CustomAnalysisTaskConfigurator.prototype._selectRepositoryGroup): Added. (CustomAnalysisTaskConfigurator.prototype._buildRevisionInput): Added. Creates an input element to specify a revision for a given repository. Autofills it with the latest commit for the currently selected platform if the user had not modified the field by the time the revisions are fetched. (CustomAnalysisTaskConfigurator.htmlTemplate): Added. (CustomAnalysisTaskConfigurator.cssTemplate): Added. * public/v3/components/instant-file-uploader.js: Added. A form to upload a custom darwinup root in "baseline" or "comparison" configurations of CustomAnalysisTaskConfigurator. It's "instant" because it auto-detects when a file to be uploaded had already been uploaded elsewhere by checking its SHA-256 hash. (InstantFileUploader): (InstantFileUploader.prototype.hasFileToUpload): Added. (InstantFileUploader.prototype.uploadedFiles): Added. (InstantFileUploader.prototype.addUploadedFile): Added. It's called on the uploader for "comparison" configuration when the uploader for "baseline" configuration dipsatches "uploadedFile" action to automatically mirror the newly uploaded custom root to "comparision" configuration. (InstantFileUploader.prototype.didConstructShadowTree): Added. (InstantFileUploader.prototype.render): Added. (InstantFileUploader.prototype._renderUploadedFiles): Added. Renders the list of the uploaded files. (InstantFileUploader.prototype._renderPreuploadFiles): Added. Renders the list of the files to be uploaded with a progress bar. (InstantFileUploader.prototype._updateUploadStatus): Added. Updates the progress bar for uploading the file. (InstantFileUploader.prototype._formatUploadError): Added. (InstantFileUploader.prototype._didFileInputChange): Added. Called when the user picks a file to uploaded on the input element. Fetch the meta data for the uploaded file with the same SHA-256 hash if there is any, and start uploading the file if there isn't one. (InstantFileUploader.prototype._removeUploadedFile): Added. (InstantFileUploader.prototype._didUploadFile): Added. Move a file from the list of files to be uploaded to the list of uploaded files. (InstantFileUploader.htmlTemplate): Added. (InstantFileUploader.cssTemplate): Added. * public/v3/index.html: * public/v3/models/analysis-task.js: (AnalysisTask): Made platform and metric optional as it is now. (AnalysisTask.findByPlatformAndMetric): Skip analysis tasks without a platform or a metric. (AnalysisTask.prototype.isCustom): Added. Returns true for a custom analysis task. (AnalysisTask.fetchRelatedTasks): Skip custom analysis tasks. (AnalysisTask._constructAnalysisTasksFromRawData): Construct analysis tasks even if they were missing a metric or a platform instead of silently skipping them. * public/v3/models/build-request.js: (BuildRequest.constructBuildRequestsFromData): Construct uploaded file objects returned by /api/build-requests. * public/v3/models/commit-log.js: (CommitLog.fetchLatestCommitForPlatform): Added. * public/v3/models/commit-set.js: (CommitSet): Added this._customRoots. (CommitSet.prototype.customRoots): Returns this._customRoots. (CommitSet.prototype.equals): Returns false when the set of custom roots are not equal. (CommitSet.areCustomRootsEqual): Added. (CustomCommitSet): (CustomCommitSet.prototype.equals): Added. (CustomCommitSet.prototype.customRoots): Added. (CustomCommitSet.prototype.addCustomRoot): Added. * public/v3/models/manifest.js: (Manifest._didFetchManifest): Store fileUploadSizeLimit in the manifest as UploadedFile.fileUploadSizeLimit. This allows a file size check in the client size instead of uploading it to the server and receiving an error. * public/v3/models/metric.js: (Metric.formatTime): Moved from ChartPaneStatusView to be also used by InstantFileUploader._renderUploadedFiles. * public/v3/models/test-group.js: (TestGroup.prototype.createWithTask): Added. (TestGroup.prototype.createAndRefetchTestGroups): (TestGroup.prototype._revisionSetsFromCommitSets): Added. Extracted from createAndRefetchTestGroups. (TestGroup.prototype._fetchTestGroupsForTask): Added. Extracted from createAndRefetchTestGroups. * public/v3/models/triggerable.js: (Triggerable.triggerablePlatformsForTests): Added. (Triggerable.sortByNamePreferringSmallerRepositories): Added. * public/v3/models/uploaded-file.js: (UploadedFile.prototype.createdAt): Added. (UploadedFile.prototype.filename): Added. (UploadedFile.prototype.author): Added. (UploadedFile.prototype.size): Added. (UploadedFile.uploadFile): Added a client-side check for the file size using UploadedFile.fileUploadSizeLimit. (UploadedFile.fetchUnloadedFileWithIdenticalHash): Ditto. Also fixed a bug that 404 was resulting in a rejected promise instead of a resolved promise with null. * public/v3/pages/analysis-category-page.js: (AnalysisCategoryPage.prototype._reconstructTaskList): Modernized the code. Added the support for platform and metric being null for some analysis tasks. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype._didFetchTask): Don't fetch the measurement set or create a chart for custom tasks. (AnalysisTaskPage.prototype.render): Don't display the charts or the stacking table for custom tasks. (AnalysisTaskPage.prototype._renderTaskNameAndStatus): Don't try to show the full test name for custom tasks since it's not associated with exactly one pair. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView.prototype._renderBuildRevisionTable): (ChartPaneStatusView.prototype._formatTime): Moved to Metric.formatTime. * public/v3/pages/chart-pane.js: (ChartPane.prototype._analyzeRange): Set inProgress to true to hide CustomAnalysisTaskConfigurator in CreateAnalysisTaskPage when creating a non-custom analysis task for a specific range. * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage): This page now shows CustomAnalysisTaskConfigurator by default, and lets a user create a custom analysis task by picking a test, a platform, and a set of revisions and custom darwinup roots. (CreateAnalysisTaskPage.prototype.updateFromSerializedState): Show a message when inProgress is set. This is the old behavior of this page. (CreateAnalysisTaskPage.prototype.didConstructShadowTree): Added. (CreateAnalysisTaskPage.prototype._createAnalysisTaskWithGroup): Added. (CreateAnalysisTaskPage.prototype.render): (CreateAnalysisTaskPage.prototype._renderMessage): Added. Hides CustomAnalysisTaskConfigurator and the select element to specify the numebr of iterations when a message is set. (CreateAnalysisTaskPage.htmlTemplate): (CreateAnalysisTaskPage.cssTemplate): * public/v3/pages/page-router.js: (PageRouter.prototype.route): Always enqueue the page to re-render when the route has changed. * server-tests/api-build-requests-tests.js: Updated test cases now that the response contains a list of uploaded files associated with build requests. *server-tests/api-commits-tests.js: Added a test case for /api/commits//latest?platform=X. * server-tests/privileged-api-create-test-group-tests.js: Added test cases for creating a custom analysis task and a test group with custom roots. * server-tests/resources/mock-data.js: (MockData.addMockData): Updated the mock data to satisfy new constraint on analysis-tasks table. Also inserted more commits, builds, and build_commits rows for testing /api/commits//latest?platform=X. * tools/js/remote.js: Include global.FormData from form-data.js. * unit-tests/analysis-task-tests.js: Added a test for calling findByPlatformAndMetric when there is a custom analysis task. (sampleAnalysisTask): Removed the category since /api/analysis-tasks/ no longer generate this property. (sampleCustomAnalysisTask): Added. * unit-tests/build-request-tests.js: (sampleBuildRequestData): Updated the mock response. Added a test case for fetcing custom roots. * unit-tests/buildbot-syncer-tests.js: (createSampleBuildRequest): Ditto. * unit-tests/test-groups-tests.js: (sampleTestGroup): Ditto. 2017-04-07 Ryosuke Niwa Make cycler page scroll down when a dashboard is too tall for the current viewport size https://bugs.webkit.org/show_bug.cgi?id=170588 Rubber-stamped by Chris Dumez. Updated the cycler page to scroll down smoothly over 500ms and scroll up again before moving to the next page when a dashboard page is too tall to be shown at once. For now, we assume that each dashboard's height is no more than 2x the height of the viewport. * public/cycler.html: 2017-04-06 Ryosuke Niwa Each build request should be associated with a repository group https://bugs.webkit.org/show_bug.cgi?id=170528 Rubber-stamped by Chris Dumez. Make the buildbot syncing script use the concept of repository groups so that each repository group can post a different set of properties to buildbot. In order to do this, we associate each build request with a repository group to use. Each triggerable's repository groups is now updated by the syncing scripts via /api/update-triggerable just the same way the set of the supported platform, test pairs are updated. Each repository group specifies the list of repositories, a dictionary that maps the buildbot property name to either a string value or a repository name enclosed in < and >: ```js "repositoryGroups": { "webkit-svn": { "repositories": ["WebKit", "macOS"], "properties": {"os": "", "wk": ""} } } ``` With this, removed the support for specifying a repository to use in generic dictionary of properties via a dictionary with a single key of "root", "rootOptions", and "rootsExcluding". We now validate that the list of repositories in each repository group matches exactly the ones used in buildbot properties as well as ones in build requests. After this patch, sync-with-buildbot.js will no longer schedule a build request without a repository group. Run the appropriate database queries to set the repository group on each build request. Because of this change, this patch also makes BuildbotTriggerable.prototype.syncOnce more robust against invalid build requests. Instead of throwing an exception and exiting early, it simply skips all build requests that belong to the same test group if the next build request to be scheduled does not specify a repository group. * init-database.sql: Add request_repository_group column to build_requests table, and a unique constraint for repository and group pair in triggerable_repositories table. * public/api/update-triggerable.php: (main): Validate and insert repository groups. (validate_configurations): Extracted from main. (validate_repository_groups): Added. * public/v3/models/repository.js: (Repository.findTopLevelByName): Added. * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::results_internal): Include the repository group of each request in the JSON response. * public/include/repository-group-finder.php: Added. A helper class to find the repository group for a given triggerable for a list of repositories. (RepositoryGroupFinder): Added. (RepositoryGroupFinder::__construct): Added. (RepositoryGroupFinder::find_by_repositories): Added. (RepositoryGroupFinder::populate_map): Added. * public/privileged-api/create-test-group.php: (main): Each element in an array returned by ensure_commit_sets and commit_sets_from_revision_sets now contains "set", the list of commit IDs, and "repository_group", the repository group identified for each commit set. Use that to set the repository group in each new build request. (commit_sets_from_revision_sets): Use RepositoryGroupFinder to find the right repository group. (ensure_commit_sets): Ditto. There is no need to find a repository group for each commit set here since its argument is keyed by the repository name. e.g. {"WebKit": [123, 456], "macOS": ["16A323", "16A323"]} * public/v3/models/build-request.js: (BuildRequest): (BuildRequest.prototype.triggerable): Added. (BuildRequest.prototype.repositoryGroup): Added. (BuildRequest.constructBuildRequestsFromData): Resolve the triggerable and the repository group. * public/v3/models/triggerable.js: (Triggerable.prototype.name): Added. (Triggerable.prototype.acceptedRepositories): Deleted. (TriggerableRepositoryGroup): (TriggerableRepositoryGroup.prototype.accepts): Added. Retruns true if the repository group * server-tests/api-build-requests-tests.js: Added a test for getting the repository group of a build request. * server-tests/api-manifest-tests.js: Added assertions for the repository groups. * server-tests/api-report-tests.js: (.emptyReport): (.reportWithTwoLevelsOfAggregations): * server-tests/api-update-triggerable.js: Added test cases for updating the repository groups associated with a triggerable. (.updateWithOSXRepositoryGroup): (.mapRepositoriesByGroup): * server-tests/privileged-api-create-test-group-tests.js: (addTriggerableAndCreateTask): Add two repository groups for testing. Added assertions for repository groups in existing test cases, and added a test case for creating a test group with two different repository groups. * server-tests/resources/mock-data.js: (MockData.resetV3Models): Reset TriggerableRepositoryGroup's static maps. (MockData.emptyTriggeragbleId): Added. (MockData.macosRepositoryId): Added. (MockData.webkitRepositoryId): Added. (MockData.gitWebkitRepositoryId): Added. (MockData.addMockData): Create repository groups as needed. Renamed the "OS X" repository to "macOS" since some tests were using the latter, and now we need mock data to be consistent across tests due to stricter checks. (MockData.addEmptyTriggerable): Added. Used in api-update-triggerable.js. (MockData.addMockTestGroupWithGitWebKit): Added. Used in api-build-requests-tests.js. (MockData.addAnotherMockTestGroup): Cleanup. (MockData.mockTestSyncConfigWithSingleBuilder): Updated the mock configuration per code changes. (MockData.mockTestSyncConfigWithTwoBuilders): Ditto. * server-tests/tools-buildbot-triggerable-tests.js: Updated a test case testing /api/update-triggerable to test updating the set of repository groups in addition to the set of test, platform pairs. (.refetchManifest): Added. * tools/js/buildbot-syncer.js: (BuildbotSyncer): Now takes a set of configurations shared across syncers: repositoryGroups, slaveArgument, and buildRequestArgument as the third argument. (BuildbotSyncer.prototype.repositoryGroups): Added. (BuildbotSyncer.prototype._testGroupMapForBuildRequests): Cleaned up the code to use Array.prototype.find. Also added an assertion that the build request is associated with a repository group. (BuildbotSyncer.prototype._propertiesForBuildRequest): Removed the support for using an arbitary property to specify a revision in favor of explicity listing each property and repository name in a repository group. (BuildbotSyncer._loadConfig): Removed the support for "shared", which specified the set of buildbot properties shared across syncers, the name of properties which specifies the build slave name and build request ID. These values are not stored as top-level properties and superseded by the concept of repository groups. (BuildbotSyncer._parseRepositoryGroup): Parses and validates repository groups. (BuildbotSyncer._createTestConfiguration): We no longer expect each configuration to specify a dictionary of properties or buildRequestArgument (often inherited from shared). (BuildbotSyncer._validateAndMergeConfig): Removed "slaveArgument" and "buildRequestArgument" from the list of allowed proeprties in each configuration now that they're specified as top-level properties. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype.updateTriggerable): Update the associated repository groups. (BuildbotTriggerable.prototype.syncOnce): Skip test groups for which the next build request to be scheduled is not included in the list of valid build requests. (BuildbotTriggerable.prototype._validateRequests): Now returns the list of valid build requests, which excludes those that lack a repository group set. (BuildbotTriggerable.prototype._nextRequestInGroup): Extracted from _scheduleRequestIfSlaveIsAvailable. Finds the next build request to be scheduled for the test group. (BuildbotTriggerable.prototype._scheduleRequestIfSlaveIsAvailable): Renamed from _scheduleNextRequestInGroupIfSlaveIsAvailable. Now takes the syncer and the slave name as arguments instead of a test group information since syncOnce now calls _nextRequestInGroup to find the next build request. * tools/js/v3-models.js: * unit-tests/build-request-tests.js: Fixed the test name. * unit-tests/buildbot-syncer-tests.js: Removed tests for "rootOptions" and "rootsExcluding", and added tests for parsing repository groups. (sampleiOSConfig): Updated the mock configuration per code changes. (sampleiOSConfigWithExpansions): Ditto. (smallConfiguration): Ditto. Now returns the entire configuration instead of a single builder configuration. Various test cases have been updated to reflect this. (createSampleBuildRequest): Removed the git hash of WebKit to match the repository groups listed in the mock configurations. The git hash was there to test "rootOptions", which this patch removed. (samplePendingBuild): Removed "root_dict" from the list of properties. This was used to test "rootsExcluding" which, again, this patch removed. (sampleInProgressBuild): Ditto. (sampleFinishedBuild): Ditto. * unit-tests/resources/mock-v3-models.js: (MockModels.inject): Added ock repository groups so that existing tests will continue to function. 2017-04-05 Ryosuke Niwa Introduce the notion of repository groups to triggerables https://bugs.webkit.org/show_bug.cgi?id=170228 Reviewed by Chris Dumez. On some triggerable, it's desirable to specify multiple sets of repositories that are accepted. For example, if a repository X transitioned from Subversion to Git, and if a triggerable accepted X and some other repository Y, then it's desirable to two sets: (X-Subversion, Y) and (X-Git, Y) since neither (X-Subversion, X-Git) nor (X-Subversion, X-Git, Y) makes sense as a set. This patch introduces triggerable_repository_groups table to represent a set of repositories accepted by a triggerable. It has many to one relationship to build_triggerables and triggerable_repositories in turn now has many to one relationship to triggerable_repository_groups instead of build_triggerables. Also make it possible to disable a triggerable e.g. a set of tests and platforms are no longer supported. We don't want to delete the triggerable completely from the database since it would result in the associated A/B testing results being purged, which is not desirale. To migrate an existing database, run the following transaction: ```sql BEGIN; ALTER TABLE build_triggerables ADD COLUMN triggerable_disabled boolean NOT NULL DEFAULT FALSE; CREATE TABLE triggerable_repository_groups ( repositorygroup_id serial PRIMARY KEY, repositorygroup_triggerable integer REFERENCES build_triggerables NOT NULL, repositorygroup_name varchar(256) NOT NULL, repositorygroup_description varchar(256), repositorygroup_accepts_roots boolean NOT NULL DEFAULT FALSE, CONSTRAINT repository_group_name_must_be_unique_for_triggerable UNIQUE(repositorygroup_triggerable, repositorygroup_name)); INSERT INTO triggerable_repository_groups (repositorygroup_triggerable, repositorygroup_name) SELECT triggerable_id, 'default' FROM build_triggerables; ALTER TABLE triggerable_repositories ADD COLUMN trigrepo_group integer REFERENCES triggerable_repository_groups; UPDATE triggerable_repositories SET trigrepo_group = repositorygroup_id FROM triggerable_repository_groups WHERE trigrepo_triggerable = repositorygroup_triggerable; ALTER TABLE triggerable_repositories ALTER COLUMN trigrepo_group SET NOT NULL; ALTER TABLE triggerable_repositories DROP COLUMN trigrepo_triggerable; ALTER TABLE triggerable_repositories DROP COLUMN trigrepo_sub_roots; END; ``` * init-database.sql: * public/admin/triggerables.php: Use a custom column to make forms to add and configure repository groups. (insert_triggerable_repositories): Added. (generate_repository_list): Added. (generate_repository_form): Added. (generate_repository_checkboxes): Now generates checkboxes for a repository group instead of a triggerable. * public/include/manifest-generator.php: (fetch_triggerables): Fixed the bug that we were not filtering results with query in /api/triggerable. Rewrote it to include an array of repository groups, which in turn contains an array of repositories along with its name and a description, and a boolean indicating whether it accepts a custom root file or not. The boolean will be used when we're adding the support for perf try bots. We will keep acceptedRepositories since it's still used by detect-changes.js. * public/v3/models/manifest.js: (Manifest._didFetchManifest): Resolve repositoriy, test, and platform IDs to their respective objects. * public/v3/models/triggerable.js: (Triggerable): (Triggerable.prototype.isDisabled): Added. (Triggerable.prototype.repositoryGroups): Added. (Triggerable.prototype.acceptsTest): Added. (TriggerableRepositoryGroup): Added. (TriggerableRepositoryGroup.prototype.description): Added. (TriggerableRepositoryGroup.prototype.acceptsCustomRoots): Added. (TriggerableRepositoryGroup.prototype.repositories): Added. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype._didFetchTask): Don't use a disabled triggerable. * server-tests/api-manifest-tests.js: Updated a test case to test repository groups. * tools/js/database.js: (tableToPrefixMap): Added triggerable_repository_groups. * tools/js/v3-models.js: Imported TriggerableRepositoryGroup from triggerable.js. 2017-03-31 Ryosuke Niwa Build fix. For OS versions, we can end up with non-alphanumeric revision. Delete the code path only used by the v2 UI since nobody uses that now. * public/api/commits.php: (main): 2017-03-30 Ryosuke Niwa sync-buildbot.js can schedule more than one build per builder https://bugs.webkit.org/show_bug.cgi?id=170318 Reviewed by Saam Barati. The bug was caused by _scheduleNextRequestInGroupIfSlaveIsAvailable not returning a promise when scheduling the first build request of a test group. This resulted in _pullBuildbotOnAllSyncers to prematurely resolve before POST'ing new build had finished. That in turn could result in the next cycle of syncing to occur before POST'ing has actually taken place. More precisely, when the nextRequest was the first request or its associated syncer object could not be identified, we were supposed to find the first available syncer, schedule the request, and then return the promise returned by scheduleRequestInGroupIfAvailable. However, the for loop which called scheduleRequestInGroupIfAvailable on every syncer was declaring its own variable named "promise" thereby shadowing the outer variable, which is returned to the caller. Fixed the bug by not declaring a shadowing variable, and refactored the code. Namely, the only reason we had such a complicated logic with two local variables, promise and syncer, was so that we could log that we're scheduling a build. Extracted this code as _scheduleRequestWithLog. _scheduleNextRequestInGroupIfSlaveIsAvailable can now simply exit early with a call to _scheduleRequestWithLog when the syncer is readily identified. When looping over syncers, it can simply return the first non-null result of _scheduleNextRequestInGroupIfSlaveIsAvailable. * server-tests/tools-buildbot-triggerable-tests.js: Added a test case where we wait 10ms after receiving the request to POST a build. There should be no new network request until we resolve this request. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._scheduleNextRequestInGroupIfSlaveIsAvailable): Fixed the bug. (BuildbotTriggerable.prototype._scheduleRequestWithLog): Extracted. 2017-03-30 Ryosuke Niwa Modernize BuildbotSyncer and BuildbotTriggerable https://bugs.webkit.org/show_bug.cgi?id=170310 Reviewed by Chris Dumez. Modernized the code to use arrow functions and other modern idoms in ES2016. * ReadMe.md: Added instructions on how to run tests, and moved the steps to configure postgres above the steps to configure Apache since only the former is needed to run tests. * tools/js/buildbot-syncer.js: * tools/js/buildbot-triggerable.js: 2017-03-30 Ryosuke Niwa Yet another build fix after r214502. Workaround webkit.org/b/169907 for now. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.cssTemplate): 2017-03-30 Ryosuke Niwa Revert an erronously change in the previous commit. * public/v3/components/base.js: 2017-03-30 Ryosuke Niwa Build fix after r214280. Don't render components until its element is inserted into a document. * public/v3/components/base.js: (ComponentBase): 2017-03-29 Ryosuke Niwa Another build fix after r214502. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype.render): this._groupToCellMap.get may not contain the cell when startPoint or metric had not been fetched yet even if currentTestGroup is set. 2017-03-29 Ryosuke Niwa Build fix after r214502. Analysis tasks without any test groups are throwing exceptions. * public/v3/components/results-table.js: (ResultsTable.prototype.renderTable): Don't show the header row when there are no content to show. (ResultsTable.prototype._computeRepositoryList): Return a pair of arrays. The caller expects the repository list to be an array, not undefined. 2017-03-28 Ryosuke Niwa Modernize AnalysisTaskPage https://bugs.webkit.org/show_bug.cgi?id=170165 Reviewed by Antti Koivisto. Modernized AnalysisTaskPage and related components. The main refactoring happened in AnalysisTaskPage from which AnalysisTaskResultsPane and AnalysisTaskTestGroupPane have been extracted. Decoupled BuildRequest from its results. AnalysisResultsViewer and TestGroupResultsTable now stores a reference to AnalysisResultsView and Metric to find the results for each build request. This refactoring is necessary in order to view results of an arbitrary metric in the future. Also refactored ResultsTable and its subclasses extensively. Instead of making its render() to invoke subclass' methods such as buildRowGroups, heading, and additionalHeading, rely on each subclass call to invoke renderTable(), renamed from render(), with callbacks to add extra headers and columns. This patch also fixes a number of usability issues found by the user such as changing the test name resets the customized revisions by the virtue of the modern code being naturally more correct. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer): (AnalysisResultsViewer.prototype.setTestGroupCallback): Deleted. Replaced by "testGroupClick" action. (AnalysisResultsViewer.prototype.setRangeSelectorLabels): Moved here from ResultsTable since it's never used in ResultsTable or TestGroupResultsTable. (AnalysisResultsViewer.prototype.selectedRange): Ditto. (AnalysisResultsViewer.prototype.setPoints): Now takes metric as the third argument. (AnalysisResultsViewer.prototype.setTestGroups): Now takes the current test group. (AnalysisResultsViewer.prototype.didUpdateResults): Deleted. (AnalysisResultsViewer.prototype.setAnalysisResultsView): Added. (AnalysisResultsViewer.prototype.render): Invoke _renderTestGroups lazily. Also simplified the logic to find the selected list item. Since we always use a shadow DOM now, we can simply look for an element with ".seleted" instead of crafting a unique class name. (AnalysisResultsViewer.prototype.renderTestGroups): Renamed from buildRowGroups. Specify callbacks to insert headers for A/B radio buttons, which has been moved from ResultsTable.prototype.render, and the stacked blocks of testing results. (AnalysisResultsViewer.prototype._classForTestGroup): Deleted. (AnalysisResultsViewer.prototype._openStackingBlock): Deleted. (AnalysisResultsViewer.prototype._expandBetween): Create a new set for expandedPoints to make _renderTestGroupsLazily.evaluate do the work. (AnalysisResultsViewer._layoutBlocks): Moved from TestGroupStackingGrid.layout. (AnalysisResultsViewer._sortBlocksByRow): Moved from AnalysisResultsViewer.TestGroupStackingGrid. (AnalysisResultsViewer._insertAfterBlockWithSameRange): Ditto. (AnalysisResultsViewer._insertBlockInFirstAvailableColumn): Ditto. (AnalysisResultsViewer._createCellsForRow): Ditto. (AnalysisResultsViewer.TestGroupStackingBlock): (AnalysisResultsViewer.TestGroupStackingBlock.prototype.addRowIndex): (AnalysisResultsViewer.TestGroupStackingBlock.prototype.createStackingCell): No longer creates a unique class name here. See the inline comment for AnalysisResultsViewer.prototype.render. (AnalysisResultsViewer.TestGroupStackingBlock.prototype.isThin): Deleted. We used to collapse "failed" test groups as a thin vertical line, and we wanted to show them next to each other in _layoutBlock but we don't do that anymore. (AnalysisResultsViewer.TestGroupStackingBlock.prototype._valuesForCommitSet): Added. Uses this._analysisResultsView to extract the results for the current metrics. (AnalysisResultsViewer.TestGroupStackingBlock.prototype._computeTestGroupStatus): * public/v3/components/analysis-task-bug-list.js: Added. (AnalysisTaskBugList): Added. Extracted from AnalysisTaskChartPane. (AnalysisTaskBugList.prototype.setTask): Added. (AnalysisTaskBugList.prototype.didConstructShadowTree): Added. (AnalysisTaskBugList.prototype.render): Added. (AnalysisTaskBugList.prototype._associateBug): Added. (AnalysisTaskBugList.prototype._dissociateBug): Added. (AnalysisTaskBugList.htmlTemplate): Added. * public/v3/components/chart-pane-base.js: (ChartPaneBase.htmlTemplate): Added a hook to insert more content at the end in AnalysisTaskChartPane. (ChartPaneBase.paneFooterTemplate): Added. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm): (CustomizableTestGroupForm.prototype.setCommitSetMap): (CustomizableTestGroupForm.prototype.startTesting): Renamed from _submitted. Now dispatches an action by the name of "startTesting" instead of calling this._startCallback. (CustomizableTestGroupForm.prototype.didConstructShadowTree): Added. Moved the logic to attach event handlers here to avoid eagerly creating the shadow tree in the constructor. (CustomizableTestGroupForm.prototype._computeCommitSetMap): Use the newly added this._revisionEditorMap to find the relevant input element instead of running a querySelector. (CustomizableTestGroupForm.prototype.render): Lazily invoke _renderCustomRevisionTable. This avoids overriding the customized revisions when the user finally types in the test group name. (CustomizableTestGroupForm.prototype._renderCustomRevisionTable): Extracted from render. (CustomizableTestGroupForm.prototype._constructRevisionRadioButtons): Made this a non-static method since it needs to update this._revisionEditorMap now. Merged _constructRevisionRadioButtons. (CustomizableTestGroupForm.prototype._createRadioButton): Deleted. See above. (CustomizableTestGroupForm.cssTemplate): (CustomizableTestGroupForm.formContent): Use IDs instead of classes to make this.content(ID) work. * public/v3/components/mutable-list-view.js: (MutableListView.prototype.setList): (MutableListView.prototype.setKindList): (MutableListView.prototype.setAddCallback): Deleted. Replaced by "addItem" action. (MutableListView.prototype.render): (MutableListItem.prototype.content): * public/v3/components/results-table.js: (ResultsTable): Removed this._rangeSelectorLabels, this._rangeSelectorCallback, and this._selectedRange as they are only used by AnalysisResultsViewer. Also replaced this._valueFormatter by this._analysisResultsView which knows a metric. (ResultsTable.prototype.setValueFormatter): Deleted. (ResultsTable.prototype.setRangeSelectorLabels): Deleted. (ResultsTable.prototype.setRangeSelectorCallback): Deleted. (ResultsTable.prototype.selectedRange): Deleted. (ResultsTable.prototype._rangeSelectorClicked): Deleted. (ResultsTable.prototype.setAnalysisResultsView): Added. (ResultsTable.prototype.renderTable): Added. Removed the logic to add _rangeSelectorLabels since it has been moved to AnalysisResultsViewer.prototype.render inside buildColumns, which also inserts additional columns which used to be stored on each ResultsTableRow. Use the same technique to insert additional headers. Also take the name (thead tr th) of row header (tbody tr td) as an argument and automatically create a table cell of an appropriate colspan. (ResultsTable.prototype._createRevisionListCells): (ResultsTable.prototype.heading): Deleted. Superseded by buildHeaders callback. (ResultsTable.prototype.additionalHeading): Ditto. (ResultsTable.prototype.buildRowGroups): Deleted. It is now the responsibility of each subclass to call ResultsTable's renderTable() in the subclass' render() function. (ResultsTable.prototype._computeRepositoryList): No longer takes extraRepositories as an argument. Instead, this function now returns a pair of the repository list and the list of constant commits. (ResultsTable.htmlTemplate): (ResultsTable.cssTemplate): * public/v3/components/test-group-form.js: (TestGroupForm): Avoid eagerly creating the shadow tree. Also removed the removed the dead code. (TestGroupForm.prototype.setRepetitionCount): Simply override the value of the select element. (TestGroupForm.prototype.didConstructShadowTree): Added. Attach event handlers here to avoid eagerly creating the shadow tree in the constructor. (TestGroupForm.prototype.startTesting): Renamed from _submitted. Dispatch "startTesting" action instead of invoking _startCallback which has been removed. (TestGroupForm.htmlTemplate): (TestGroupForm.formContent): * public/v3/components/test-group-results-table.js: (TestGroupResultsTable): (TestGroupResultsTable.prototype.didUpdateResults): Deleted. No longer neeed per setAnalysisResultsView in ResultsTable. (TestGroupResultsTable.prototype.setTestGroup): (TestGroupResultsTable.prototype.heading): Deleted. (TestGroupResultsTable.prototype.render): (TestGroupResultsTable.prototype._renderTestGroup): Extracted from render. (TestGroupResultsTable.prototype._buildRowGroups): Renamed from buildRowGroups. (TestGroupResultsTable.prototype._buildRowGroupForCommitSet): Extracted from buildRowGroups. (TestGroupResultsTable.prototype._buildComparisonRow): Extracted from buildRowGroups.buildRowGroups * public/v3/index.html: Include analysis-task-bug-list.js. * public/v3/models/analysis-results.js: (AnalysisResults): Inverted the map so that we can easily create a view based on metric. (AnalysisResults.prototype.find): Ditto. (AnalysisResults.prototype.add): Ditto. (AnalysisResults.prototype.viewForMetric): Added. (AnalysisResults.fetch): (AnalysisResultsView): Added. (AnalysisResultsView.prototype.metric): Added. (AnalysisResultsView.prototype.resultForBuildId): Added. * public/v3/models/build-request.js: (BuildRequest.result): Deleted. (BuildRequest.setResult): Deleted. * public/v3/models/test-group.js: (TestGroup): Removed this._allCommitSets since it was never used. (TestGroup.prototype.didSetResult): Deleted since it was never used. (TestGroup.prototype.compareTestResults): Now takes an array of measurement set values. (TestGroup.prototype._valuesForCommitSet): Deleted. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane): This class now includes the form to cutomize the revisions. (AnalysisTaskChartPane.prototype.setShowForm): Added. (AnalysisTaskChartPane.prototype._mainSelectionDidChange): (AnalysisTaskChartPane.prototype.didConstructShadowTree): Added. Dispatches "newTestGroup" action when the user presses the button to start a new A/B testing from the chart. (AnalysisTaskChartPane.prototype.render): Added. (AnalysisTaskChartPane.prototype.paneFooterTemplate): Added. (AnalysisTaskChartPane.cssTemplate): (AnalysisTaskResultsPane): Added. Encapsulates AnalysisResultsViewer and CustomizableTestGroupForm. (AnalysisTaskResultsPane.prototype.setPoints): Added. (AnalysisTaskResultsPane.prototype.setTestGroups): Added. (AnalysisTaskResultsPane.prototype.setAnalysisResultsView): Added. (AnalysisTaskResultsPane.prototype.setShowForm): Added. (AnalysisTaskResultsPane.prototype.didConstructShadowTree): Added. Dispatches "newTestGroup" action when the user presses the button to start a new A/B testing from the chart. (AnalysisTaskResultsPane.prototype.render): Added. (AnalysisTaskResultsPane.htmlTemplate): Added. (AnalysisTaskResultsPane.cssTemplate): Added. (AnalysisTaskTestGroupPane): Added. Encapsulates TestGroupResultsTable and CustomizableTestGroupForm. (AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): Added. (AnalysisTaskTestGroupPane.prototype.setTestGroups): Added. (AnalysisTaskTestGroupPane.prototype.setAnalysisResultsView): Added. (AnalysisTaskTestGroupPane.prototype.render): Added. (AnalysisTaskTestGroupPane.prototype._renderTestGroups): Added. Updates the list of test groups. Hide the hidden groups unless showHiddenGroups is set. Updates this._testGroupMap so that the visibility of groups and their names can be updated without having to re-render the entire list. (AnalysisTaskTestGroupPane.prototype._renderTestGroupVisibility): Added. (AnalysisTaskTestGroupPane.prototype._renderTestGroupNames): Added. (AnalysisTaskTestGroupPane.prototype._renderCurrentTestGroup): Added. Update TestGroupResultsTable with the selected test group. Also highlight the list view, and update the hide-unhide toggle button's label as needed. (AnalysisTaskTestGroupPane.htmlTemplate): Added. (AnalysisTaskTestGroupPane.cssTemplate): Added. (AnalysisTaskPage): Deleted a massive number of instance variables. They are now manged by newly added AnalysisTaskChartPane, AnalysisTaskResultsPane, and AnalysisTaskTestGroupPane (AnalysisTaskPage.prototype.didConstructShadowTree): Added. Attach various event handlers here to avoid eagerly creating the shadow tree in the constructor. (AnalysisTaskPage.prototype._fetchRelatedInfoForTaskId): (AnalysisTaskPage.prototype._didFetchTask): No longer sets the value formatter to the results viewer and the results table as they now recieve AnalysisResultsView later in _assignTestResultsIfPossible. (AnalysisTaskPage.prototype._didFetchMeasurement): Set the metric to the results viewer. (AnalysisTaskPage.prototype._didUpdateTestGroupHiddenState): (AnalysisTaskPage.prototype._assignTestResultsIfPossible): Create AnalysisResultsView from the newly retrieved AnalysisResults and pass it to AnalysisTaskResultsPane and AnalysisTaskTestGroupPane. (AnalysisTaskPage.prototype.render): Dramatically simplified. (AnalysisTaskPage.prototype._renderTaskNameAndStatus): Extracted from render. (AnalysisTaskPage.prototype._renderRelatedTasks): Ditto. (AnalysisTaskPage.prototype._renderCauseAndFixes): Ditto. (AnalysisTaskPage.prototype._showTestGroup): (AnalysisTaskPage.prototype._updateTaskName): Now takes the new name as an argument. (AnalysisTaskPage.prototype._updateTestGroupName): Now takes the new name as the second argument. (AnalysisTaskPage.prototype._hideCurrentTestGroup): Now takes the test group to hide. (AnalysisTaskPage.prototype._associateCommit): Moved to AnalysisTaskBugList. (AnalysisTaskPage.prototype._dissociateCommit): Ditto. (AnalysisTaskPage.prototype._retryCurrentTestGroup): Now takes the test group as the first argument. (AnalysisTaskPage.prototype._chartSelectionDidChange): Deleted. (AnalysisTaskPage.prototype._createNewTestGroupFromChart): Deleted. (AnalysisTaskPage.prototype._selectedRowInAnalysisResultsViewer): Deleted. (AnalysisTaskPage.prototype._createNewTestGroupFromViewer): Deleted. (AnalysisTaskPage.htmlTemplate): (AnalysisTaskPage.cssTemplate): * unit-tests/test-groups-tests.js: Updated a test case which was expecting BuildReqeust's result, which has been removed, to exist. 2017-03-23 Ryosuke Niwa Share more code between ManifestGenerator and /api/triggerables https://bugs.webkit.org/show_bug.cgi?id=169993 Reviewed by Chris Dumez. Shared the code to fetch the list of triggerables from the database between ManifestGenerator and /api/triggerables. * public/api/triggerables.php: (main): * public/include/manifest-generator.php: (ManifestGenerator::fetch_triggerables): Extracted as a static function. Also include the ID in the triggerable data. 2017-03-23 Ryosuke Niwa create-test-group should allow a different set of repositories to be used in each configuration https://bugs.webkit.org/show_bug.cgi?id=169992 Rubber-stamped by Antti Koivisto. Added the support for new POST parameter, revisionSets, to /privileged-api/create-test-group. This new parameter now specifies an array of repository id to revision dictionaries, and allows different set of repositories' revisions to be specified in each dictionary. We keep the old API for v2 UI and detect-changes.js compatibility for now. * public/privileged-api/create-test-group.php: (main): (commit_sets_from_revision_sets): Added. (ensure_commit_sets): Only fetch the top-level repository per r213788 and r213976. * public/v3/models/test-group.js: (TestGroup.createAndRefetchTestGroups): Use the newly added revisionSets parameter instead of the now depreacted commitSets parameter. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): Simplified this code by simply verifying the consistency of commit sets now that createAndRefetchTestGroups takes an array of commit sets instead of a dictionary of repository name to a list of revisions. * server-tests/privileged-api-create-test-group-tests.js: Added test cases for new parameter. 2017-03-22 Ryosuke Niwa /api/uploaded-file should return createdAt as a POSIX timestamp https://bugs.webkit.org/show_bug.cgi?id=169980 Rubber-stamped by Antti Koivisto. Call Database::to_js_time on createdAt to return it as a POSIX timestamp. * public/include/uploaded-file-helpers.php: (format_uploaded_file): Fixed the bug. * server-tests/api-manifest-tests.js: Renamed from api-manifest.js. * server-tests/api-uploaded-file-tests.js: Renamed from api-uploaded-file.js. Added a test case. 2017-03-22 Ryosuke Niwa UploadedFile should support a callback for upload progress https://bugs.webkit.org/show_bug.cgi?id=169977 Reviewed by Andreas Kling. Added a new option dictionary to CommonRemoteAPI.sendHttpRequest with uploadProgressCallback Moved request headers and responseHandler callback in NodeRemoteAPI to this dictionary, and updated the tests which relied on this code. * public/shared/common-remote.js: (CommonRemoteAPI.prototype.postJSON): (CommonRemoteAPI.prototype.postJSONWithStatus): (CommonRemoteAPI.prototype.postFormData): (CommonRemoteAPI.prototype.postFormDataWithStatus): * public/v3/privileged-api.js: (PrivilegedAPI.prototype.sendRequest): * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): (BrowserRemoteAPI.prototype.sendHttpRequestWithFormData): (BrowserRemoteAPI): * server-tests/api-uploaded-file.js: * tools/js/remote.js: (NodeRemoteAPI.prototype.sendHttpRequest): (NodeRemoteAPI.prototype.sendHttpRequestWithFormData): (NodeRemoteAPI): 2017-03-22 Ryosuke Niwa ComponentBase should enqueue itself to render when it becomes connected https://bugs.webkit.org/show_bug.cgi?id=169905 Reviewed by Antti Koivisto. When a component becomes connected to a document, enqueue itself to render automatically. Also added the support for boolean attribute to ComponentBase.createElement. * ReadMe.md: Added an instruction to raise the upload limit per r214065. * browser-tests/component-base-tests.js: Added tests for the new behavior and createElement. Also moved the tests related to enqueueToRenderOnResize out of defineElement tests. * browser-tests/index.html: (BrowsingContext.prototype.constructor): Override requestAnimationFrame so that the callback would be involved immediately durign testing. * public/v3/components/base.js: (ComponentBase): Enqueue itself to render during construction if custom elements is not available. (ComponentBase.defineElement): (ComponentBase.defineElement.elementClass.prototype.connectedCallback): Enqueue itself to render when the component's element became connected. (ComponentBase.createElement): Use Array.isArray instead of instanceof to make it work with arrays made in other realms (global objects) during testing. Added the support for boolean attributes. Setting an attribute value to true would set the attribute, and setting it to false would not set the attribute. (ComponentBase.useNativeCustomElements): Added. True iff window.customElements is defined. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.render): No longer need to call enqueueToRender on the commit log viewer. * public/v3/components/commit-log-viewer.js: (CommitLogViewer.prototype.render): No longer need to call enqueueToRender on the spinner icon. * public/v3/models/time-series.js: (TimeSeries): Made this a proper class declaration now that we don't include data.js after r213300. * public/v3/pages/chart-pane.js: (ChartPane.prototype._renderActionToolbar): No longer need to call enqueueToRender on the close icon. * public/v3/pages/summary-page.js: (SummaryPage.prototype._renderCell): No longer need to call enqueueToRender on the spinner icon. 2017-03-20 Ryosuke Niwa Delete another function that was supposed to be removed in the previous commit. * public/v3/models/build-request.js: (BuildRequest.cachedRequestsForTriggerableID): Deleted. 2017-03-20 Ryosuke Niwa Modernize BuildRequestQueuePage https://bugs.webkit.org/show_bug.cgi?id=169903 Reviewed by Antti Koivisto. Modernized the code for /v3/#/analysis/queue. * public/v3/models/build-request.js: (BuildRequest.fetchTriggerables): Deleted since the manifest JSON now contains all the triggerables. * public/v3/pages/build-request-queue-page.js: (BuildRequestQueuePage): Deleted this._triggerables. Added this._buildRequestsByTriggerable. (BuildRequestQueuePage.prototype.open): Modernized the code. (BuildRequestQueuePage.prototype.render): Ditto. (BuildRequestQueuePage.prototype._constructBuildRequestTable): Ditto. 2017-03-19 Ryosuke Niwa Charts page show an inconsistent list of revisions for Git and Subversion https://bugs.webkit.org/show_bug.cgi?id=169888 Reviewed by Andreas Kling. With Git, CommitLogViewer was showing the list of revisions including the starting hash, which was the last data point's revision instead of all revisions after the last data point. Fixed the bug by always specifying the revision at the last data point in both Subversion and Git and then making /api/commits//?from=X&to=Y exclude the first revision. For clarity, "from" and "to" query parameters have been renamed to "precedingRevision" and "lastRevision" respectively. We also no longer adds 1 to the starting revision of Subversion-like starting revisions. e.g. when the last data point was at r1234, new data point is at r1250, the label is now "r1234-r1250" instead of "r1235-r1250". * browser-tests/chart-revision-range-tests.js: Fixed the tests since revisionList no longer specifies from/to revisions. * browser-tests/commit-log-viewer-tests.js: Added. Added tests for CommitLogViewer. * browser-tests/index.html: Include the new test. Also use a local copy of mocha.js/css. * public/api/commits.php: (main): Renamed "from" and "to" query parameters. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): Added a check that commit time should either be specified in both rows or not specified in either. Also reject when before_first_revision is identical or after last_revision instead of re-ordering them since it no longer makes sense to do so with new query parameter names. * public/v3/components/base.js: (ComponentBase._addContentToElement): Use Array.isArray instead of instanceof. It's resilient againt realm (global object) differences. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._updateCommitLogViewer): No longer calls enqueueToRender on this since CommitLogViewer does that on its own now. (ChartPaneBase.prototype.render): Juse use this._openRepository instead of relying on CommitLogViewer to remember which repository is current. This was the only use of currentRepository. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Deleted. (CommitLogViewer.prototype.view): (CommitLogViewer.prototype._fetchCommitLogs): Modernized and extracted from view to make it lazy. Call fetchForSingleRevision when precedingRevision is not specified or it's identical to lastRevision since the generic JSON API no longer supports being called with the identical revisions. (CommitLogViewer.prototype.render): Modernized & simplified the code. (CommitLogViewer.prototype._renderCommitList): Extracted from render to make it lazy. (CommitLogViewer.htmlTemplate): Add ID on caption & tbody so that they're more easily addressable. (CommitLogViewer.cssTemplate): * public/v3/models/commit-log.js: (CommitLog.prototype.diff): No longer includes from/to revisions in the result. Also avoid adding 1 to a Subversion-like starting revision for creating the label. See above. But we still do this for forming URLs due to the way tools like Trac work with Subversion revisions. (CommitLog.fetchBetweenRevisions): Rewritten using DataModel.prototype.cachedFetch with FIXME for what this function is supposed to be doing. (CommitLog._cachedCommitLogs): Deleted. (CommitLog.fetchForSingleRevision): Added. (CommitLog._constructFromRawData): Added. * public/v3/models/data-model.js: (DataModelObject.cachedFetch): Don't parse query values as an integer. Just URL-escape them. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequest): Fixed a typo. * server-tests/api-commits-tests.js: Renamed from api-commits.js. Updated the existing tests to use new query parameters and added more test cases. * unit-tests/commit-log-tests.js: Updated the test cases now that CommitLog.prototype.diff no longer includes from/to values. They're computed in ChartRevisionRange instead. 2017-03-20 Ryosuke Niwa Fix os-build-fetcher.js and subprocess.js to make them work https://bugs.webkit.org/show_bug.cgi?id=169844 Reviewed by Antti Koivisto. The script added in r213976 has a bug that it can execute commands to fetch subcommits in parallel. Some commands to poll the lsit of system components is not desirable to be ran in parallel. * server-tests/resources/mock-subprocess.js: (MockSubprocess): Use const declaration. (MockSubprocess.resetAndWaitForInvocation): Added. (MockSubprocess.waitForInvocation): Renamed from waitingForInvocation. A function name must be a verb. See https://webkit.org/code-style-guidelines/#names-verb (MockSubprocess.reset): Set invocations.length to 0 so that tests can store a reference to the array regardless of whether reset is called or when it's called. * server-tests/tools-os-build-fetcher-tests.js: Updated tests per the code change. Most of codes now expect each command to be ran seprately. e.g. if there were two commands to run, instead of expecting them to be both ran, and resolving invocation promises, we'd wait for one command to run, resolve, its subcommand to run, and then move onto the second top-level command. Also use a local reference to MockSubprocess.invocations instead of using the fully qualified name. * tools/js/os-build-fetcher.js: (mapInSerialPromiseChain): Added. Calling a closure that returns a promise on each item in an array in serial (not asynchronous) is a very common pattern in this class. (OSBuildFetcher.fetchAndReportAllInOrder): Added. (OSBuildFetcher.prototype.fetchAndReportNewBuilds): Log what the number of builds being submitted. (OSBuildFetcher.prototype._fetchAvailableBuilds): Fixed the main bug. Using Promise.all would result in each top-level command to be execued in parallel. Since each subcommand is executed as soon as its parent command is executed, this results in commands to be executed in parallel. Added a whole bunch of logging so that we can at least detect a bug like this in the future. (OSBuildFetcher.prototype._commitsForAvailableBuilds): Cleanup the coding style. (OSBuildFetcher.prototype._addSubCommitsForBuild): Use mapInSerialPromiseChain. Tightened the assertion about the content returned by a subcommand. * tools/js/subprocess.js: Fixed the bug that we were importing require('child_process').ChildProcess. execFile is defined on require('child_process') itself. (Subprocess.prototype.execute): Fixed a typo. this._childProcess doesn't exist. (Subprocess): * tools/sync-os-versions.js: Renamed from tools/pull-os-versions.js. (syncLoop): Cleaned up the coding style a little. Also added logging about how long we're about to sleep. 2017-03-16 Ryosuke Niwa Add the file uploading capability to the perf dashboard. https://bugs.webkit.org/show_bug.cgi?id=169737 Reviewed by Chris Dumez. Added /privileged-api/upload-file to upload a file, and /api/uploaded-file/ to download the file and retrieve its meta data based on its SHA256. We treat two files with the identical SHA256 as identical since anyone who can upload a file using this mechanism can execute arbitrary code in our bots anyway. This is important for avoiding uploading a large darwinup roots multiple times to the server, saving both user's time/bandwidth and server's disk space. * config.json: Added uploadDirectory, uploadFileLimitInMB, and uploadUserQuotaInMB as options. * init-database.sql: Added uploaded_files table. * public/api/uploaded-file.php: Added. (main): /api/uploaded-file/N would download uploaded_file with id=N. /api/uploaded-file/?sha256=X would return the meta data for uploaded_file with sha256=X. (stream_file_content): Streams the file content in 64KB chunks. We support Range & If-Range HTTP request headers so that browsers can pause and resume downloading of a large root file. (parse_range_header): Parses Range HTTP request header. * public/include/json-header.php: (remote_user_name): Use the default argument of NULL. * public/include/manifest-generator.php: (ManifestGenerator::generate): Include the maximum upload size in the manifest file to let the frontend code preemptively check the file size before attempting to submit a file. * public/include/uploaded-file-helpers.php: Added. (format_uploaded_file): (uploaded_file_path_for_row): * public/privileged-api/upload-file-form.html: Added. For debugging purposes. (fetchCSRFfToken): (upload): * public/privileged-api/upload-file.php: Added. (main): (query_total_file_size): (create_uploaded_file_from_form_data): * public/shared/common-remote.js: (CommonRemoteAPI.prototype.postFormData): Added. (CommonRemoteAPI.prototype.postFormDataWithStatus): Added. (CommonRemoteAPI.prototype.sendHttpRequestWithFormData): Added. (CommonRemoteAPI.prototype._asJSON): Throw an exception instead of calling a non-existent reject. * public/v3/models/uploaded-file.js: Added. (UploadedFile): Added. (UploadedFile.uploadFile): Added. (UploadedFile.fetchUnloadedFileWithIdenticalHash): Added. Finds the file with the same SHA256 in the server to avoid uploading a large custom root multiple times. (UploadedFile._computeSHA256Hash): Added. * public/v3/privileged-api.js: (PrivilegedAPI.prototype.sendRequest): Added the options dictionary as a third argument. For now, only support useFormData boolean. * public/v3/remote.js: (BrowserRemoteAPI.prototype.sendHttpRequestWithFormData): Added. * server-tests/api-manifest.js: Updated per the inclusion of fileUploadSizeLimit in the manifest. * server-tests/api-uploaded-file.js: Added. * server-tests/privileged-api-upload-file-tests.js: Added. * server-tests/resources/temporary-file.js: Added. (TemporaryFile): Added. A helper class for creating a temporary file to upload. (TemporaryFile.makeTemporaryFileOfSizeInMB): (TemporaryFile.makeTemporaryFile): (TemporaryFile.inject): * server-tests/resources/test-server.conf: Set upload_max_filesize and post_max_size for testing. * server-tests/resources/test-server.js: (TestServer.prototype.testConfig): Use uploadFileLimitInMB and uploadUserQuotaInMB of 2MB and 5MB. (TestServer.prototype._ensureDataDirectory): Create a directory to store uploaded files inside the data directory. In a production server, we can place it outside ServerRoot / DocumentRoot. (TestServer.prototype.cleanDataDirectory): Delete the aforementioned directory as needed. * tools/js/database.js: (tableToPrefixMap): Added uploaded_files. * tools/js/remote.js: (NodeRemoteAPI.prototype.sendHttpRequest): Added a dictionary to specify request headers and a callback to process the response as arguments. Fixed the bug that any 2xx code other than 200 was resulting in a rejected promise. Also include the response headers in the result for tests. Finally, when content is a function, call that instead of writing the content since FormData requires a custom logic. (NodeRemoteAPI.prototype.sendHttpRequestWithFormData): Added. * tools/js/v3-models.js: Include uploaded-file.js. * tools/run-tests.py: (main): Add form-data as a new dependency. 2017-03-15 Dewei Zhu Fix unit test and bug fix for 'pull-os-versions.js' script. https://bugs.webkit.org/show_bug.cgi?id=169701 Reviewed by Ryosuke Niwa. Fix unit tests warnings on node-6.10.0. Fix 'pull-os-versions.js' does not fetch new builds and report. * server-tests/tools-os-build-fetcher-tests.js: (then): (beforeEach): (afterEach): * tools/pull-os-versions.js: (syncLoop): 2017-03-15 Ryosuke Niwa In-browser and node.js implementations of RemoteAPI should share some code https://bugs.webkit.org/show_bug.cgi?id=169695 Rubber-stamped by Antti Koivisto. Extracted CommonRemoteAPI out of RemoteAPI implementations for node.js and browser. * public/shared/common-remote.js: Added. (CommonRemoteAPI): Added. (CommonRemoteAPI.prototype.postJSON): Extracted from RemoteAPI. (CommonRemoteAPI.prototype.postJSONWithStatus): Ditto. (CommonRemoteAPI.prototype.getJSON): Ditto. (CommonRemoteAPI.prototype.getJSONWithStatus): Ditto. (CommonRemoteAPI.prototype.sendHttpRequest): Added. Needs to implemented by a subclass. (CommonRemoteAPI.prototype._asJSON): Added. (CommonRemoteAPI.prototype._checkStatus): Added. * public/v3/index.html: Include common-remote.js. * public/v3/privileged-api.js: (PrivilegedAPI): Use class now that we don't include data.js. (PrivilegedAPI.sendRequest): Modernized the code. (PrivilegedAPI.requestCSRFToken): Ditto. * public/v3/remote.js: (BrowserRemoteAPI): Renamed from RemoteAPI. window.RemoteAPI is now an instance of this class. (BrowserRemoteAPI.prototype.sendHttpRequest): Moved from RemoteAPI.sendHttpRequest. (BrowserRemoteAPI.prototype.sendHttpRequest): * server-tests/privileged-api-create-analysis-task-tests.js: Updated tests since NodeJSRemoteAPI now throws the JSON status as an error to be consistent with BrowserRemoteAPI. * server-tests/privileged-api-create-test-group-tests.js: Ditto. * server-tests/privileged-api-upate-run-status.js: Ditto. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype.syncOnce): Just use postJSONWithStatus instead of manually checking the status. * tools/js/remote.js: (NodeRemoteAPI): Renamed from RemoteAPI. Still exported as RemoteAPI. (NodeRemoteAPI.prototype.constructor): (NodeRemoteAPI.prototype.sendHttpRequest): Modernized the code. 2017-03-15 Ryosuke Niwa Fix server tests after r213998 and r213969 https://bugs.webkit.org/show_bug.cgi?id=169690 Reviewed by Antti Koivisto. Fixed the existing server tests. * public/v3/models/analysis-task.js: (AnalysisTask.prototype._updateRemoteState): Use the relative path from the root so that it works inside tests. (AnalysisTask.prototype.associateBug): Ditto. (AnalysisTask.prototype.dissociateBug): Ditto. (AnalysisTask.prototype.associateCommit): Ditto. (AnalysisTask.prototype.dissociateCommit): Ditto. (AnalysisTask._fetchSubset): Ditto. (AnalysisTask.fetchAll): Ditto. * public/v3/models/test-group.js: (TestGroup.prototype.updateName): Ditto. (TestGroup.prototype.updateHiddenFlag): Ditto. (TestGroup.createAndRefetchTestGroups): Ditto. (TestGroup.cachedFetch): Ditto. * server-tests/api-manifest.js: Reverted an inadvertant change in r213969. * tools/js/database.js: (tableToPrefixMap): Added analysis_strategies. * unit-tests/analysis-task-tests.js: Updated expectations per changes to AnalysisTask. 2017-03-15 Ryosuke Niwa Add tests for privileged-api/create-analysis-task and privileged-api/create-test-group https://bugs.webkit.org/show_bug.cgi?id=169688 Rubber-stamped by Antti Koivisto. Added tests for privileged-api/create-analysis-task and privileged-api/create-test-group, and fixed newly found bugs. * public/privileged-api/create-analysis-task.php: (main): Fixed the bug that we were not explicitly checking whether start_run and end_run were integers or not. Also return InvalidTimeRange when start and end times are identical as that makes no sense for an analysis task. * public/privileged-api/create-test-group.php: (main): Fixed a bug that we were not explicitly checking task and repetitionCount to be an integer. (ensure_commit_sets): Fixed the bug that the number of commit sets weren't checked. * server-tests/privileged-api-create-analysis-task-tests.js: Added. * server-tests/privileged-api-create-test-group-tests.js: Added. * server-tests/resources/common-operations.js: (prepareServerTest): Increase the timeout from 1s to 5s. * server-tests/resources/mock-data.js: (MockData.addMockData): Use a higher database ID of 20 for a mock build_slave to avoid a conflict with auto-generated IDs. 2017-03-15 Ryosuke Niwa Make unit tests return a promise instead of manually calling done https://bugs.webkit.org/show_bug.cgi?id=169663 Reviewed by Antti Koivisto. Make the existing unit tests always reutrn a promise instead of manually calling "done" callback as done in r213969. The promise tests are a lot more stable and less error prone. Also use MockRemoteAPI.waitForRequest() instead of chaining two resolved promises where appropriate. * unit-tests/analysis-task-tests.js: * unit-tests/buildbot-syncer-tests.js: * unit-tests/checkconfig.js: * unit-tests/privileged-api-tests.js: 2017-03-15 Dewei Zhu Rewrite 'pull-os-versions' script in Javascript to add support for reporting os revisions with sub commits. https://bugs.webkit.org/show_bug.cgi?id=169542 Reviewed by Ryosuke Niwa. Extend '/api/commits//last-reported' to accept a range and return last reported commits in given range. Rewrite 'pull-os-versions' in JavaScript and add unit tests for it. Instead of writing query manually while searching criteria contains null columns, use the methods provided in 'db.php'. Add '.gitignore' file to ommit files generated by while running tests/instances locally. * .gitignore: Added. * public/api/commits.php: * public/api/report-commits.php: * public/include/commit-log-fetcher.php: * public/include/db.php: 'null_columns' of prepare_params should be a reference. * public/include/report-processor.php: * server-tests/api-commits.js: (then): * server-tests/api-report-commits-tests.js: * server-tests/resources/mock-logger.js: Added. (MockLogger): (MockLogger.prototype.log): (MockLogger.prototype.error): * server-tests/resources/mock-subprocess.js: Added. (MockSubprocess.call): (MockSubprocess.waitingForInvocation): (MockSubprocess.inject): (MockSubprocess.reset): * server-tests/tools-buildbot-triggerable-tests.js: (MockLogger): Deleted. (MockLogger.prototype.log): Deleted. (MockLogger.prototype.error): Deleted. * server-tests/tools-os-build-fetcher-tests.js: Added. (beforeEach): (return.waitingForInvocationPromise.then): (then): (string_appeared_here.return.waitingForInvocationPromise.then): (return.addSlaveForReport.emptyReport.then): * tools/js/os-build-fetcher.js: Added. (OSBuildFetcher): (OSBuildFetcher.prototype._fetchAvailableBuilds): (OSBuildFetcher.prototype._computeOrder): (OSBuildFetcher.prototype._commitsForAvailableBuilds.return.this._subprocess.call.then.): (OSBuildFetcher.prototype._commitsForAvailableBuilds): (OSBuildFetcher.prototype._addSubCommitsForBuild): (OSBuildFetcher.prototype._submitCommits): (OSBuildFetcher.prototype.fetchAndReportNewBuilds): * tools/js/subprocess.js: Added. (const.childProcess.require.string_appeared_here.Subprocess.prototype.call): (const.childProcess.require.string_appeared_here.Subprocess): * tools/pull-os-versions.js: Added. (main): (syncLoop): * tools/sync-commits.py: (Repository.fetch_commits_and_submit): 2017-03-14 Ryosuke Niwa Make server tests return a promise instead of manually calling done https://bugs.webkit.org/show_bug.cgi?id=169648 Rubber-stamped by Chris Dumez. Make the existing server tests always reutrn a promise instead of manually calling "done" callback. The promise tests are a lot more stable and less error prone. Also use arrow functions everywhere and use prepareServerTest, renamed from connectToDatabaseInEveryTest, in more tests instead of manually connecting to database in every test, and reset v3 models. * server-tests/admin-platforms-tests.js: * server-tests/admin-reprocess-report-tests.js: * server-tests/api-build-requests-tests.js: * server-tests/api-manifest.js: * server-tests/api-measurement-set-tests.js: (.postReports): Deleted. Not used in any test. * server-tests/api-report-commits-tests.js: * server-tests/api-report-tests.js: * server-tests/api-update-triggerable.js: * server-tests/privileged-api-upate-run-status.js: * server-tests/resources/common-operations.js: (prepareServerTest): Renamed from connectToDatabaseInEveryTest. Increase the timeout and reset v3 models. * server-tests/tools-buildbot-triggerable-tests.js: 2017-03-12 Ryosuke Niwa Rename RootSet to CommitSet https://bugs.webkit.org/show_bug.cgi?id=169580 Rubber-stamped by Chris Dumez. Renamed root_sets to commit_sets and roots to commit_set_relationships in the database schema, and renamed related classes in public/v3/ and tools accordingly. RootSet, MeasurementRootSet, and CustomRootSet are respectively renamed to CommitSet, MeasurementCommitSet, and CustomCommitSet. In order to migrate the database, run: ``` BEGIN; ALTER TABLE root_sets RENAME TO commit_sets; ALTER TABLE commit_sets RENAME COLUMN rootset_id TO commitset_id; ALTER TABLE roots RENAME TO commit_set_relationships; ALTER TABLE commit_set_relationships RENAME COLUMN root_set TO commitset_set; ALTER TABLE commit_set_relationships RENAME COLUMN root_commit TO commitset_commit; ALTER TABLE build_requests RENAME COLUMN request_root_set TO request_commit_set; END; ``` * browser-tests/index.html: * init-database.sql: * public/api/build-requests.php: (main): * public/api/test-groups.php: (main): (format_test_group): * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::__construct): (BuildRequestsFetcher::results_internal): (BuildRequestsFetcher::commit_sets): Renamed from root_sets. (BuildRequestsFetcher::commits): Renamed from roots. (BuildRequestsFetcher::fetch_commits_for_set_if_needed): Renamed from fetch_roots_for_set_if_needed. * public/privileged-api/create-test-group.php: (main): (ensure_commit_sets): Renamed from commit_sets_from_root_sets. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype.buildRowGroups): (AnalysisResultsViewer.prototype._collectCommitSetsInTestGroups): Renamed from _collectRootSetsInTestGroups. (AnalysisResultsViewer.prototype._buildRowsForPointsAndTestGroups): (AnalysisResultsViewer.prototype._buildRowsForPointsAndTestGroups): (AnalysisResultsViewer.CommitSetInTestGroup): Renamed from RootSetInTestGroup. (AnalysisResultsViewer.CommitSetInTestGroup.prototype.constructor): (AnalysisResultsViewer.CommitSetInTestGroup.prototype.commitSet): Renamed from rootSet. (AnalysisResultsViewer.CommitSetInTestGroup.prototype.succeedingCommitSet): Renamed from succeedingRootSet. (AnalysisResultsViewer.TestGroupStackingBlock.prototype.constructor): (AnalysisResultsViewer.TestGroupStackingBlock.prototype.addRowIndex): (AnalysisResultsViewer.TestGroupStackingBlock.prototype.isComplete): (AnalysisResultsViewer.TestGroupStackingBlock.prototype.startRowIndex): (AnalysisResultsViewer.TestGroupStackingBlock.prototype.endRowIndex): (AnalysisResultsViewer.TestGroupStackingBlock.prototype._computeTestGroupStatus): * public/v3/components/chart-revision-range.js: (ChartRevisionRange.prototype._revisionForPoint): (ChartRevisionRange.prototype._computeRevisionList): * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype.constructor): (CustomizableTestGroupForm.prototype.setCommitSetMap): Renamed from setRootSetMap. (CustomizableTestGroupForm.prototype._submitted): (CustomizableTestGroupForm.prototype._computeCommitSetMap): Renamed from _computeRootSetMap. (CustomizableTestGroupForm.prototype.render): Renamed from render. (CustomizableTestGroupForm.prototype._constructRevisionRadioButtons): * public/v3/components/results-table.js: (ResultsTable.prototype.render): (ResultsTable.prototype._createRevisionListCells): (ResultsTable.prototype._computeRepositoryList): (ResultsTableRow.prototype.constructor): (ResultsTableRow.prototype.commitSet): Renamed from rootSet. * public/v3/components/test-group-results-table.js: (TestGroupResultsTable.prototype.buildRowGroups): * public/v3/index.html: * public/v3/models/build-request.js: (BuildRequest.prototype.constructor): (BuildRequest.prototype.updateSingleton): (BuildRequest.prototype.commitSet): Renamed from rootSet. (BuildRequest.constructBuildRequestsFromData): * public/v3/models/commit-set.js: Renamed from public/v3/models/root-set.js. (CommitSet): Renamed from RootSet. (CommitSet.containsMultipleCommitsForRepository): (MeasurementCommitSet): Renamed from MeasurementRootSet. (MeasurementCommitSet.prototype.namedStaticMap): (MeasurementCommitSet.prototype.ensureNamedStaticMap): (MeasurementCommitSet.namedStaticMap): (MeasurementCommitSet.ensureNamedStaticMap): (MeasurementCommitSet.ensureSingleton): (CustomCommitSet): Renamed from CustomRootSet. * public/v3/models/measurement-adaptor.js: (MeasurementAdaptor.prototype.applyTo): * public/v3/models/test-group.js: (TestGroup.prototype.constructor): (TestGroup.prototype.addBuildRequest): (TestGroup.prototype.repetitionCount): (TestGroup.prototype.requestedCommitSets): Renamed from requestedRootSets. (TestGroup.prototype.requestsForCommitSet): Renamed from requestsForRootSet. (TestGroup.prototype.labelForCommitSet): Renamed from labelForRootSet. (TestGroup.prototype.didSetResult): (TestGroup.prototype.compareTestResults): (TestGroup.prototype._valuesForCommitSet): Renamed from _valuesForRootSet. (TestGroup.prototype.createAndRefetchTestGroups): * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype.render): (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype._createNewTestGroupFromChart): (AnalysisTaskPage.prototype._createNewTestGroupFromViewer): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingCommitSetList): * server-tests/api-build-requests-tests.js: * server-tests/resources/mock-data.js: (MockData.resetV3Models): (MockData.addMockData): (MockData.addAnotherMockTestGroup): * tools/detect-changes.js: (createAnalysisTaskAndNotify): * tools/js/buildbot-syncer.js: (BuildbotSyncer.prototype._propertiesForBuildRequest): (BuildbotSyncer.prototype._revisionSetFromCommitSetWithExclusionList): * tools/js/database.js: (tableToPrefixMap): * tools/js/v3-models.js: * tools/sync-buildbot.js: (syncLoop): * tools/sync-with-buildbot.py: Deleted. No longer used. * unit-tests/analysis-task-tests.js: * unit-tests/build-request-tests.js: (sampleBuildRequestData): * unit-tests/buildbot-syncer-tests.js: (sampleCommitSetData): * unit-tests/measurement-adaptor-tests.js: * unit-tests/measurement-set-tests.js: * unit-tests/resources/mock-v3-models.js: (MockModels.inject): * unit-tests/test-groups-tests.js: (sampleTestGroup): 2017-03-13 Ryosuke Niwa Database's query functions should support querying for a row with NULL value https://bugs.webkit.org/show_bug.cgi?id=169504 Reviewed by Antti Koivisto. Add the support for calling select_* with one of column values set to NULL. This feature is useful in webkit.org/b/146374 and webkit.org/b/168962. * public/include/db.php: (Database::prepare_params): Added $null_columns as an optional argument. (Database::select_conditions_with_null_columns): Added. Builds up a query string by appending AND x is NULL to match columns whose value must be NULL. (Database::_select_update_or_insert_row): (Database::select_rows): 2017-03-13 Dewei Zhu Add the ability to report a commit with sub-commits. https://bugs.webkit.org/show_bug.cgi?id=168962 Reviewed by Ryosuke Niwa. Introduce 'commit_ownerships' which records ownership between commits. On existing production server, run ``` CREATE TABLE commit_ownerships ( commit_owner integer NOT NULL REFERENCES commits ON DELETE CASCADE, commit_ownee integer NOT NULL REFERENCES commits ON DELETE CASCADE, PRIMARY KEY (commit_owner, commit_ownee) ); ALTER TABLE repositories RENAME repository_parent TO repository_owner; ALTER TABLE repositories DROP repository_name_must_be_unique; CREATE UNIQUE INDEX repository_name_owner_unique_index ON repositories (repository_owner, repository_name) WHERE repository_owner IS NOT NULL; CREATE UNIQUE INDEX repository_name_unique_index ON repositories (repository_name) WHERE repository_owner IS NULL; ``` to update database. Add unit-tests to cover this change. * init-database.sql: * public/api/report-commits.php: * public/include/commit-log-fetcher.php: * public/include/db.php: * public/include/manifest-generator.php: * public/include/report-processor.php: * public/v3/models/repository.js: (Repository): (Repository.prototype.owner): * server-tests/admin-reprocess-report-tests.js: (addBuilderForReport.simpleReportWithRevisions.0.then): (then): * server-tests/api-manifest.js: (then): * server-tests/api-report-commits-tests.js: (addSlaveForReport.sameRepositoryNameInSubCommitAndMajorCommit.then): (then): (addSlaveForReport.systemVersionCommitWithSubcommits.then): (addSlaveForReport.multipleSystemVersionCommitsWithSubcommits.then): (addSlaveForReport.systemVersionCommitWithEmptySubcommits.then): (addSlaveForReport.systemVersionCommitAndSubcommitWithTimestamp.then): * tools/js/database.js: 2017-03-07 Ryosuke Niwa Update ReadMe.md to use directory format for backing up & restoring the database https://bugs.webkit.org/show_bug.cgi?id=169263 Reviewed by Joseph Pecoraro. Update ReadMe.md's instruction to backup and restore the database to use directory format instead of piping it to gzip. The new command will backup and restore the database with multiple concurrent processes with a custom compression level. * ReadMe.md: 2017-03-02 Ryosuke Niwa Make baseline data points selectable https://bugs.webkit.org/show_bug.cgi?id=169069 Reviewed by Antti Koivisto. Add the capability to select data points other than "current" configuration type. This patch refactors the way the "chart status" is computed. Before this patch, ChartStatusView was responsible for determining two data points for which to compute the status, and computing the status between two data points. ChartPaneStatusView which inherits from ChartStatusView and used in the charts page relied upon ChartStatusView to compute these values, and computed the list of revision ranges for each relevant repository between the data points. ChartPane then had callbacks on ChartPaneStatusView to know whenever these values changed. Because of this entangled mess, ChartStatusView had to be aware of InteractiveTimeSeriesChart even though only ChartPaneStatusView could be used with it. This patch dramatically simplifies the situation by adding referencePoints() on TimeSeriesChart and InteractiveTimeSeriesChart which returns the current point, the previous point if there is any, and their time series view. It also extracts ChartStatusEvaluator which computes the current status values and ChartRevisionRange which computes a list of revision differences both based on the referencePoints. As a result, ChartPaneStatusView no longer inherits from ChartStatusView, and ChartStatusView has been renamed to DashboardChartStatusView to reflect its purpose. Furthermore, ChartPane which used to rely on ChartPaneStatusView's revisionCallback to update the commit log viewer simply uses another instance of ChartRevisionRange, eliminating the need for the callback. To implement these classes easily, this patch also introduces a new class, LazilyEvaluatedFunction to memoize the return value of a function when called with the same arguments. Delaying the computation of a value and avoiding the work when the values are the same is a very common pattern in the perf dashboard so I expect this class would be used in a lot more places in the future. * browser-tests/chart-revision-range-tests.js: Added. Tests for ChartRevisionRange. * browser-tests/chart-status-evaluator-tests.js: Added. Tests for ChartStatusEvaluator. * browser-tests/index.html: (BrowsingContext): (BrowsingContext.importScripts): Fixed the bug that calling importScripts twice results in MockRemoteAPI being loaded twice. (ChartTest.importChartScripts): Import more model objects. (ChartTest.sampleCluster): Made this a getter. (ChartTest.makeModelObjectsForSampleCluster): (ChartTest.makeSampleCluster): Added. Cutomizes the valus of baseline / target based on options. (ChartTest.respondWithSampleCluster): Now takes an options argument for makeSampleCluster. * public/v3/components/chart-pane-base.js: (ChartPaneBase): Added _openRepository to keep track of the currently open repository instead of relying on _mainChartStatus or _commitLogViewer to keep track of it. (ChartPaneBase.prototype.configure): The callback for when the user clicked on a repository name in ChartPaneStatusView has been replaced by "openRepository" action. (ChartPaneBase.prototype.setOpenRepository): Moved from ChartPane. (ChartPaneBase.prototype._mainSelectionDidChange): (ChartPaneBase.prototype._indicatorDidChange): (ChartPaneBase.prototype._didFetchData): (ChartPaneBase.prototype._updateCommitLogViewer): Renamed from _updateStatus. (ChartPaneBase.prototype.openNewRepository): Renamed from _requestOpeningCommitViewer. Fixed a bug that clicking on the repository name inside ChartPaneStatusView would not focus the pane, which resulted in arrow keys to be ignored instead of moving the main chart's indicator or the currently open repository. (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype._moveOpenRepository): Moved from ChartPaneStatusView's moveRepositoryWithNotification. Used when changing the open repository by up/down arrow keys. * public/v3/components/chart-revision-range.js: Added. Extracted from ChartPaneStatusView. (ChartRevisionRange): Added. (ChartRevisionRange.prototype.revisionList): Added. (ChartRevisionRange.prototype.rangeForRepository): Added. (ChartRevisionRange._revisionForPoint): Added. Extracted from ChartPaneStatusView's _updateRevisionListForNewCurrentRepository. (ChartRevisionRange._computeRevisionList): Ditto from computeChartStatusLabels. * public/v3/components/chart-status-evaluator.js: Added. (ChartStatusEvaluator): Added. (ChartStatusEvaluator.prototype.status): Added. (ChartStatusEvaluator.computeChartStatus): Added. Extracted from ChartStatusView's updateStatusIfNeeded. * public/v3/components/chart-status-view.js: Removed. (ChartStatusView): Deleted. Split into ChartStatusEvaluator and DashboardChartStatusView. * public/v3/components/chart-styles.js: (ChartStyles.baselineStyle): Make baseline data points interactive. This single line change is what enables the user to interact with the data points. The rest of changes in this patch mostly deals with the status text such as "5% worse than baseline" and the list of revisions shown in the commit log viewer which would have shown the wrong range without these changes. * public/v3/components/dashboard-chart-status-view.js: Added. Extracted from ChartStatusView. (DashboardChartStatusView): Added. (DashboardChartStatusView.prototype.render): Added. (DashboardChartStatusView.htmlTemplate): Added. (DashboardChartStatusView.cssTemplate): Added. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.referencePoints): Added. Return the first point and the last point as the reference points when there is a selection. Only report the previous point if they are distinct as showing a range of revisions from a data point to itself makes no sense. When there is a indicator simply return it and its previous point as reference points. Otherwise return null unlike TimeSeriesChart's referencePoints which always returns the latest point as the reference point. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.referencePoints): Added. Return the latest point as the reference point. It never returns the previous point even if there were more data points as there is no way for the user to specify which data points to compare. * public/v3/index.html: Include newly added files. * public/v3/lazily-evaluated-function.js: Added. (LazilyEvaluatedFunction): Added. (LazilyEvaluatedFunction.prototype.evaluate): Added. * public/v3/models/commit-log.js: (CommitLog.prototype.diff): Fixed a bug that computing the diff of two Subversion-like revisions results in "from" field to be unexpectedly an integer instead of a string. * public/v3/models/metric.js: (Metric): Moved the code to compute the unit from the metric name from v2's RunsData class. This makes writing tests easier since it eliminates the need to load v2's data.js. (Metric.prototype.unit): (Metric.prototype.isSmallerBetter): Ditto for determining whether the unit is smaller-is-better. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): Deleted the unused code. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): No longer inherits from ChartStatusView. Uses ChartStatusEvaluator and ChartRevisionRange to to compute the chart status and the list of revision changes. (ChartPaneStatusView.prototype.pointsRangeForAnalysis): Deleted. (ChartPaneStatusView.prototype.render): Split it into _renderStatus and _renderBuildRevisionTable using LazilyEvaluatedFunction. (ChartPaneStatusView.prototype._renderStatus): Added. (ChartPaneStatusView.prototype._renderBuildRevisionTable): Added. (ChartPaneStatusView.prototype.setCurrentRepository): _updateRevisionListForNewCurrentRepository has been moved into ChartRevisionRange. Just enqueue itself to re-render. (ChartPaneStatusView.prototype._setRevisionRange): Deleted. (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Deleted. (ChartPaneStatusView.prototype.updateRevisionList): Deleted. (ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Deleted. (ChartPaneStatusView.prototype.computeChartStatusLabels): Deleted. (ChartPaneStatusView.htmlTemplate): (ChartPaneStatusView.cssTemplate): * public/v3/pages/chart-pane.js: (ChartPane.prototype.openNewRepository): Overrides the one in ChartPaneBase, which has been renamed from _requestOpeningCommitViewer. (ChartPane.prototype._analyzeRange): (ChartPane.prototype._renderActionToolbar): Use the main chart's selection directly to determine whether an analysis task can be created for the currenty selected range. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): * unit-tests/lazily-evaluated-function-tests.js: Added. Tests for LazilyEvaluatedFunction. 2017-03-01 Ryosuke Niwa Build fix after r212853. Make creating an analysis task work again. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype.render): 2017-02-27 Ryosuke Niwa Fix tests after r213119 and r213120. * browser-tests/time-series-chart-tests.js: (return.ChartTest.importChartScripts.context.then): (string_appeared_here.then): Deleted. 2017-02-27 Ryosuke Niwa Removed the unused code that was supposed to be removed in the previous commit. * browser-tests/time-series-chart-tests.js: 2017-02-27 Ryosuke Niwa Split tests for InteractiveTimeSeriesChart into a separate test file. https://bugs.webkit.org/show_bug.cgi?id=168960 Reviewed by Joseph Pecoraro. Extracted the test cases for InteractiveTimeSeriesChart charts from time-series-chart-tests.js into interactive-time-series-chart-tests.js now that the former file has gotten really big over time. Also extracted a bunch of helper functions time-series-chart-tests.js as ChartTest in index.html. Any test which instantiates a time series chart can use this helper class. * browser-tests/index.html: (ChartTest.importChartScripts): Ditto. (ChartTest.posixTime): Moved from time-series-chart-tests.js. (ChartTest.sampleCluster): Ditto. (ChartTest.createChartWithSampleCluster): Ditto. (ChartTest.createInteractiveChartWithSampleCluster): Ditto. (ChartTest.respondWithSampleCluster): * browser-tests/interactive-time-series-chart-tests.js: Extracted from time-series-chart-tests.js. * browser-tests/time-series-chart-tests.js: (posixTime): Moved. (dayInMilliseconds): Moved. (sampleCluster): Moved. (createChartWithSampleCluster): Moved. (createInteractiveChartWithSampleCluster): Moved. (respondWithSampleCluster): Moved. * unit-tests/analysis-task-tests.js: Fixed a typo. s/adopter/adapter/. 2017-02-27 Ryosuke Niwa Calling build() on a baseline point results in an exception https://bugs.webkit.org/show_bug.cgi?id=168959 Reviewed by Joseph Pecoraro. Some baseline points may lack the build information. e.g. A custom data point made by an user. Only instantiate Build object in a point object returned by MeasurementAdaptor when the builder id is available so that we don't hit an assertion inside Build's constructor. * public/v3/models/measurement-adaptor.js: (MeasurementAdaptor.prototype.applyTo..build): Only instantiate Build when builderId is set. * unit-tests/measurement-adaptor-tests.js: Added a test case. 2017-02-27 Ryosuke Niwa Arrow key shouldn't move the indicator beyond the visible points https://bugs.webkit.org/show_bug.cgi?id=168956 Reviewed by Joseph Pecoraro. The bug was caused by moveLockedIndicatorWithNotification using the full sampled time series view instead of the one constrained by the domain. Since the time series chart expands the visible domain to include at least one point before the start time and one point after the end tiem to draw lines extending beyond the visible region (otherwise it looks as though the graph ends there), we need to use a view constrained by the start time and the end time before looking for a next/previous point. * browser-tests/time-series-chart-tests.js: Added test cases for moveLockedIndicatorWithNotification. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.moveLockedIndicatorWithNotification): Fixed the bug. Also enqueue itself to render instead of relying on a parent component to do it. 2017-02-27 Ryosuke Niwa A Locked indicator should be visually distinct from an unlocked indicator https://bugs.webkit.org/show_bug.cgi?id=168868 Reviewed by Antti Koivisto. Added the support for specifying options.lockedIndicator in addition to options.indicator to style an locked indicator differently from an unlocked one. * browser-tests/time-series-chart-tests.js: Added new test cases for indicators. (createChartWithSampleCluster): Renamed and swapped the order of arguments to better match TimeSeriesChart's constructor. Now the second argument is an array of source as is in the constructor. (createInteractiveChartWithSampleCluster): Added. * public/v3/components/chart-styles.js: (ChartStyles.overviewChartOptions): Changed the color of a selection to blue. (ChartStyles.mainChartOptions): Ditto. Also use a different style for a locked indicator. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype._layout): Removed the unused variable. (InteractiveTimeSeriesChart.prototype._renderChartContent): Use options.lockedIndicator when rendering a locked indicator. Also stroke the circle in addition to filling it so that we can use a blue circle with a white hole for a locked indicator to make it even more visually distinctive from an unlocked one. 2017-02-25 Dewei Zhu Commit should order by 'commit_order' as secondary key. https://bugs.webkit.org/show_bug.cgi?id=168866 Reviewed by Ryosuke Niwa. Currently, commits are sorted by 'commit_time' only. We should use 'commit_order' as secondary key when 'commit_time' is equal or null. * public/include/commit-log-fetcher.php: * public/include/db.php: * server-tests/api-commits.js: (return.addSlaveForReport.subversionCommits.then): (then): 2017-02-24 Ryosuke Niwa REGRESSION(r212853): Comparisons to baseline no longer shows up https://bugs.webkit.org/show_bug.cgi?id=168863 Reviewed by Joseph Pecoraro. The bug was caused by ChartStatusView's code not being updated to use TimeSeriesView's. Updated the code to use TimeSeriesView's methods to fix the bug. Also made InteractiveTimeSeriesChart's currentPoint to return a (TimeSeriesView, point, isLocked) tuple to consolidate it with lockedIndicator() to work towards making the baseline data points selectable. * browser-tests/time-series-chart-tests.js: Updated the test cases to use currentIndicator, and added test cases for newly added lastPointInTimeRange. * public/v3/components/chart-pane.js: (ChartPane.prototype.serializeState): Updated to use currentIndicator. (ChartPane.prototype._renderFilteringPopover): Ditto. * public/v3/components/chart-status-view.js: (ChartStatusView.prototype.updateStatusIfNeeded): Use currentIndicator for an interative time series. Fixed the non-interactive chart's code path for TimeSeriesView. (ChartStatusView.prototype._computeChartStatus): Modernized the code. (ChartStatusView.prototype._findLastPointPriorToTime): Deleted. Replaced by TimeSeriesView's lastPointInTimeRange. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.currentIndicator): (InteractiveTimeSeriesChart.prototype.moveLockedIndicatorWithNotification): (InteractiveTimeSeriesChart.prototype._renderChartContent): (InteractiveTimeSeriesChart): * public/v3/models/time-series.js: (TimeSeriesView.prototype.lastPointInTimeRange): Added. (TimeSeriesView.prototype._reverse): Added. Traverses the view in the reverse order. * unit-tests/time-series-tests.js: 2017-02-23 Dewei Zhu Rename 'commit_parent' in 'commits' table to 'commit_previous_commit'. https://bugs.webkit.org/show_bug.cgi?id=168816 Reviewed by Ryosuke Niwa. Rename 'commit_parent' to avoid ambiguity in the coming feature. For exisiting database, run "ALTER TABLE commits RENAME commit_parent TO commit_previous_commit;" to update the database. * init-database.sql: * public/api/report-commits.php: * public/include/commit-log-fetcher.php: * server-tests/api-commits.js: (then): * server-tests/api-report-commits-tests.js: (then): * tools/sync-commits.py: (main): (Repository.fetch_commits_and_submit): (GitRepository._revision_from_tokens): * unit-tests/analysis-task-tests.js: (sampleAnalysisTask): 2017-02-23 Ryosuke Niwa New sampling algorithm shows very few points when zoomed out https://bugs.webkit.org/show_bug.cgi?id=168813 Reviewed by Saam Barati. When a chart is zoomed out to a large time interval, the new sampling algorithm introduced in r212853 can hide most of the data points because the difference between the preceding point's time and the succeeding point's time of most points will be below the threshold we computed. Instead, rank each data point based on the aforementioned time interval difference, and pick the first M data points when M data points are to be shown. This makes the new algorithm behave like our old algorithm while keeping it stable still. Note that this algorithm still biases data points without a close neighboring point but this seems to work out in practice because such a point tends to be an important sample anyway, and we don't have a lot of space between data points since we aim to show about one point per pixel. * browser-tests/index.html: (CanvasTest.canvasContainsColor): Extracted from one of the test cases and generalized. Returns true when the specified region of the canvas contains a specified color (alpha is optional). * browser-tests/time-series-chart-tests.js: Added a test case for sampling. It checks that sampling happens and that we always show some data point even when zoomed out to a large time interval. (createChartWithSampleCluster): * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype._sampleTimeSeries): * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype._ensureSampledTimeSeries): M, the number of data points we pick must be computed based on the width of data points we're about to draw constrained by the canvas size. e.g. when the canvas is only half filled, we shouldn't be showing two points per pixel in the filled region. (TimeSeriesChart.prototype._sampleTimeSeries): Refined the algorithm. First, compute the time difference or the rank for each N data points. Sort those ranks in descending order (in the order we prefer), and include all data points above the M-th rank in the sample. (TimeSeriesChart.prototype.computeTimeGrid): Revert the inadvertent change in r212935. * public/v3/models/time-series.js: (TimeSeriesView.prototype.filter): Fixed a bug that the indices passed onto the callback were shifted by the starting index. * unit-tests/time-series-tests.js: Added a test case to ensure callbacks are called with correct data points and indices. 2017-02-23 Ryosuke Niwa REGRESSION(r212542): Make TimeSeriesChart.computeTimeGrid stops x-axis grid prematurely https://bugs.webkit.org/show_bug.cgi?id=168812 Reviewed by Joseph Pecoraro. Add time iterator of two months, three months, and four months with some tests. Also for one-month time iterator, round the day of month to 1 or 15 whichever is closer. * browser-tests/time-series-chart-tests.js: Added more tests. * public/v3/components/time-series-chart.js: (TimeSeriesChart._timeIterators.next): (TimeSeriesChart._timeIterators): 2017-02-22 Ryosuke Niwa Add tests for InteractiveTimeSeriesChart and adopt actions https://bugs.webkit.org/show_bug.cgi?id=168750 Reviewed by Chris Dumez. Added tests for InteractiveTimeSeriesChart. Also replaced selection.onchange, selection.onzoom, indicator.onchange, annotations.onclick callbacks by "selectionChange", "zoom", "indicatorChange", and "annotationClick" actions respectively. Also fixed various bugs and bad code I encountered while writing these tests. * browser-tests/index.html: (waitForComponentsToRender): Delay the call to enqueueToRender until the next run loop because there might be outstanding promises that just got resolved. e.g. for fetching measurement sets JSONs. Let all those promises get resolved first. Otherwise, some tests become racy. (canvasImageData): Extracted from time-series-chart-tests.js. (canvasRefTest): Ditto. (CanvasTest): Ditto. (CanvasTest.fillCanvasBeforeRedrawCheck): Ditto. (CanvasTest.hasCanvasBeenRedrawn): Ditto. (CanvasTest.canvasImageData): Ditto. (CanvasTest.expectCanvasesMatch): Ditto. (CanvasTest.expectCanvasesMismatch): Ditto. * browser-tests/time-series-chart-tests.js: Fixed some test cases where dpr multipler was not doing the right thing anymore in Safari under a high DPI screen. Also added a lot of test cases for interactive time series chart and one for rendering annotations. (scripts): Moved. (posixTime): Added. A helper function for sampleCluster. (dayInMilliseconds): Ditto. (sampleCluster): Moved here. Made the same cluster more artifical for an easier testing. (createChartWithSampleCluster): Moved out of one of the tests. (respondWithSampleCluster): Ditto. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): Adopted new actions in InteractiveTimeSeriesChart. * public/v3/components/chart-status-view.js: (ChartStatusView.prototype.updateStatusIfNeeded): Removed a superflous console.log. * public/v3/components/chart-styles.js: (ChartStyles.mainChartOptions): Set zoomButton to true. InteractiveTimeSeriesChart used to determine whether to show the zoom button or not based on the precense of the zoom callback. We made it explicit. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.setIndicator): Explicitly call _notifySelectionChanged with false instead of relying on undefined to be treated as falsey. (InteractiveTimeSeriesChart.prototype._createCanvas): Use id instead of selector to find elements. (InteractiveTimeSeriesChart.htmlTemplate): (InteractiveTimeSeriesChart.cssTemplate): (InteractiveTimeSeriesChart.prototype._mouseMove): Explicitly call _startOrContinueDragging with false instead of relying on undefined treated as falsey. Also added the missing call to enqueueToRender found by new tests. This was working fine on the dashboard due to other components invoking enqueueToRender but won't work in a standalone instance of InteractiveTimeSeriesChart. (InteractiveTimeSeriesChart.prototype._mouseLeave): Ditto, adding the missing call to enqueueToRender. (InteractiveTimeSeriesChart.prototype._click): Removed the assignment to _forceRender when calling _mouseMove in an early exist, which does set this flag and invokes enqueueToRender, and added the missing call to enqueueToRender in the other code path. (InteractiveTimeSeriesChart.prototype._startOrContinueDragging): Replaced annotations.onclick callback by the newly added "annotationClick" action, and added the missing call to enqueueToRender. (InteractiveTimeSeriesChart.prototype._endDragging): Use arrow function. (InteractiveTimeSeriesChart.prototype._notifyIndicatorChanged): Replaced indicator.onchange callback by the newly added "indicatorChange" action. (InteractiveTimeSeriesChart.prototype._notifySelectionChanged): Replaced selection.onchange callback by the newly added "selectionChange" action. (InteractiveTimeSeriesChart.prototype._renderChartContent): Show the zoom button when options.zoomButton is set instead of relying on the presence of selection.onzoom especially now that the callback has been replaced by the "zoom" action. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.setAnnotations): Added the missing call to enqueueToRender. * public/v3/main.js: 2017-02-21 Ryosuke Niwa Make sampling algorithm more stable and introduce an abstraction for sampled data https://bugs.webkit.org/show_bug.cgi?id=168693 Reviewed by Chris Dumez. Before this patch, TimeSeriesChart's resampling resulted in some points poping up and disappearing as the width of a chart is changed. e.g. when resizing the browser window. The bug was by caused by the sample for a given width not always including all points for a smaller width so as the width is expanded, some point may be dropped. Fixed this by using a much simpler algorithm of always picking a point when the time interval between the preceding point and the succeeding point is larger than the minimum space we allow for a given width. Also introduced a new abstraction around the sample data: TimeSeriesView. A TimeSeriesView provides a similar API to TimeSeries for a subset of the time series filtered by a time range a custom function. This paves a way to adding the ability to select baseline, etc... on the chart status view. TimeSeriesView can be in two modes: Mode 1. The view represents a contiguous subrange of TimeSeries - In this mode, this._data references the underlying TimeSeries's _data directly, and we use _startingIndex to adjust index given to find the relative index. Finding the next point or the previous point of a given point is done via looking up the point's seriesIndex and doing a simple arithmetic. In general, an index is converted to the absolute index in the underlying TimeSeries's _data array. Mode 2. The view represents a filtered non-contiguous subset of TimeSeries - In this mode, this._data is its own array. Finding the next point or the previous point of a given point requires finding a sibling point in the underlying TimeSeries which is in this view. Since this may result in O(n) traversal and a hash lookup, we lazily build a map of each point to its position in _data instead. * public/v3/components/chart-status-view.js: (ChartStatusView.prototype.updateStatusIfNeeded): Call selectedPoints instead of sampledDataBetween for clarity. This function now returns a TimeSeriesView instead of a raw array. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.currentPoint): Updated now that _sampledTimeSeriesData contains an array of TimeSeriesView's. Note that diff is either 0, -1, or 1. (InteractiveTimeSeriesChart.prototype.selectedPoints): Ditto. sampledDataBetween no longer exists since we can simply call viewTimeRange on TimeSeriesView returned by sampledDataBetween. (InteractiveTimeSeriesChart.prototype.firstSelectedPoint): Ditto. (InteractiveTimeSeriesChart.prototype._sampleTimeSeries): Use add since excludedPoints is now a Set. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.sampledDataBetween): Deleted. (TimeSeriesChart.prototype.firstSampledPointBetweenTime): Deleted. (TimeSeriesChart.prototype._ensureSampledTimeSeries): Modernized the code. Use the the time interval of the chart divided by the number of allowed points as the time interval used in the new sampling algorithm. (TimeSeriesChart.prototype._sampleTimeSeries): Rewritten. We also create TimeSeriesView here. (TimeSeriesChart.prototype._sampleTimeSeries.findMedian): Deleted. (TimeSeriesChart.prototype._updateCanvasSizeIfClientSizeChanged): Fixed a bug that the canvas size wasn't set to the correct value on Chrome when a high DPI screen is used. * public/v3/models/time-series.js: (TimeSeries.prototype.viewBetweenPoints): Renamed from dataBetweenPoints. Now returns a TimeSeriesView. (TimeSeriesView): Added. This constructor is to be called by viewBetweenPoints, viewTimeRange, and filter. (TimeSeriesView.prototype._buildPointIndexMap): Added. Used in mode (2). (TimeSeriesView.prototype.length): Added. (TimeSeriesView.prototype.firstPoint): Added. (TimeSeriesView.prototype.lastPoint): Added. (TimeSeriesView.prototype.nextPoint): Added. Note index is always a position in this._data. In mode (1), this is the position of the point in the underlying TimeSeries' _data. In mode (2), this is the position of the point in this._data which is dictinct from the underlying TimeSeries' _data. (TimeSeriesView.prototype.previousPoint): Ditto. (TimeSeriesView.prototype.findPointByIndex): Added. Finds the point using the positional index from the beginning of this view. findPointByIndex(0) on one view may not be same as findPointByIndex(0) of another. (TimeSeriesView.prototype.findById): Added. This is O(n). (TimeSeriesView.prototype.values): Added. Returns the value of each point in this view. (TimeSeriesView.prototype.filter): Added. Creates a new view with a subset of data points the predicate function returned true. (TimeSeriesView.prototype.viewTimeRange): Added. Creates a new view with a subset of data points for the given time ragne. When the resultant view would include all points of this view, it simply returns itself as an optimization. (TimeSeriesView.prototype.firstPointInTimeRange): Added. Returns the first point in the view which lies within the specified time range. (TimeSeriesView.prototype.Symbol.iterator): Added. Iterates over each point in the view. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype.selectedPoints): Use selectedPoints in lieu of getting selection and then calling sampledDataBetween with that range. * public/v3/pages/summary-page.js: (SummaryPageConfigurationGroup.set _medianForTimeRange): Modernized. * unit-tests/time-series-tests.js: Added tests for TimeSeries and TimeSeriesView. Already caught bugs! (addPointsToSeries): 2017-02-17 Ryosuke Niwa Add tests for the time series chart and fix bugs I found along the way https://bugs.webkit.org/show_bug.cgi?id=168499 Reviewed by Antti Koivisto. Add basic tests for the time series chart. Replaced the "ondata" callback set in the options by "dataChange" action now that ComponentBase provides a facility for defining event-like actions. Also fixed bugs I encountered while writing these tests see below for descriptions. * browser-tests/editable-text-tests.js: (waitToRender): Moved to index.html * browser-tests/index.html: (waitToRender): Moved from editable-text-tests.js. (wait): Added. * browser-tests/time-series-chart-tests.js: Added. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the code to set display and position inline properties. This is now done inside cssTemplate with :host pseudo class. (TimeSeriesChart.prototype._ensureCanvas): Don't strech the canvas to 100% of width and height. This was causing a flush of contents where the canvas is momentarily streched by the browser and the script later updates with the content with the correct aspect ratio. (TimeSeriesChart.cssTemplate): Added :host rule to set display: block and position: relative. (TimeSeriesChart._updateAllCharts): Deleted. (TimeSeriesChart.prototype.render): Only run the code for axis when options.axis is defined. Also, avoid setting the fill style because we never fill for axis drawing. (TimeSeriesChart.prototype._computeHorizontalRenderingMetrics): Ditto. Fallback to sensible values when options.axis is not defined. (TimeSeriesChart.prototype._renderYAxis): Now computeValueGrid generates a sequence of {time, label}. (TimeSeriesChart.prototype._renderTimeSeries): Don't draw the shades for confidence intervals unless its fill style is defined. Otherwise, we'd end up drawing black shade and mask the actual data points. (TimeSeriesChart.prototype._ensureSampledTimeSeries): Dispatch newly added "dataChange" action instead of calling "ondata" callback in options dictionary. (TimeSeriesChart.computeTimeGrid): Modernized to use const/let. Also fixed the bug that we were emitting the date even when the entire time range fit within a 24-hour interval. (TimeSeriesChart.computeValueGrid): Rewritten to make MB/GB use a nice round number instead of 0.98GB. We were using a power of 10 to round up the stepping value but the value formatter used a power of 1024 to divide byte measurements (e.g. for memory). Use formatter.divisor to find the right scaling factor for each kind. * public/v3/models/metric.js: (Metric.prototype.makeFormatter): (Metric.makeFormatter): Extracted from the one on the prototype so that tests don't need a metric object just to test TimeSeriesChart. Added the second argument which specifies the maximum absolute value of the range we're formatting. This is needed to use the same number of decimal points when the most significant digit of some value is smaller than that of the biggest one. For example, we were emitting 0.50GB instead of 0.5G along with 2.0GB. The "adjustment" reduces the number of significant figures in these cases. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): 2017-02-16 Ryosuke Niwa Use expect.js instead of expect in browser tests https://bugs.webkit.org/show_bug.cgi?id=168492 Reviewed by Joseph Pecoraro. Use expect.js (https://github.com/Automattic/expect.js) instead of expect (https://github.com/mjackson/expect). * browser-tests/close-button-tests.js: * browser-tests/component-base-tests.js: * browser-tests/editable-text-tests.js: * browser-tests/index.html: 2017-02-16 Ryosuke Niwa Modernize and fix measurement-set tests https://bugs.webkit.org/show_bug.cgi?id=168484 Reviewed by Joseph Pecoraro. Modernized and fixed the tests in measurement-set-tests.js. 1. Return a promise instead of manually calling done in then/catch hanlders. 2. Use arrow function everywhere. 3. Explicitly assert the number of calls to callbacks instead of asserting never reached. The test case labled "should return false when the range ends after the fetched cluster" was incorrectly asserting that hasFetchedRange returns false when the end time is after the primary cluster's end time. Test an interval before the primary cluster instead. Added a test case for hasFetchedRange returning true when the end time appears after the end of the primary cluster and fixed hasFetchedRange to that end. Since there are no data points after the primary cluster which is chronologically the last cluster, there is nothing to fetch beyond its end time. * public/v3/models/measurement-set.js: (MeasurementSet.prototype.hasFetchedRange): Fixed the bug that this function returned false when the end time was after the primary cluster's end by truncating the range by the end of the primary cluster. * unit-tests/measurement-set-tests.js: * unit-tests/resources/mock-remote-api.js: (assert.notReached.assert.notReached): Deleted. It's no longer used by any tests. 2017-02-15 Ryosuke Niwa Update ReadMe.md and merge it with Install.md https://bugs.webkit.org/show_bug.cgi?id=168405 Reviewed by Michael Catanzaro. Merged Install.md and ReadMe.md into one file. * Install.md: Removed. * ReadMe.md: Merged Install.md at the top and updated the rest of the content. 2017-01-24 Ryosuke Niwa Modernize editable-text component and add tests https://bugs.webkit.org/show_bug.cgi?id=167398 Reviewed by Yusuke Suzuki. Modernized EditableText component to use the action feature added in r210938. * browser-tests/editable-text-tests.js: Added. Added tests for EditableText component. (.waitToRender): * browser-tests/index.html: * public/v3/components/base.js: (ComponentBase.prototype.dispatchAction): Return the result from the callback. * public/v3/components/editable-text.js: (EditableText): Removed a bunch of instance variables that are no longer needed. (EditableText.prototype.didConstructShadowTree): Added. Add event listeners on the Edit/Save button and the host. (EditableText.prototype.editedText): Return the text field's value directly. (EditableText.prototype.text): Added. (EditableText.prototype.setText): Call enqueueToRender automatically instead of relying on the parent component to do so in _startedEditingCallback, which has been removed. (EditableText.prototype.render): Modernized the code. (EditableText.prototype._didClick): No longer prevents the default action manually since that's automatically done in createEventHandler. Handle the case where the update action is not handled. (EditableText.prototype._endEditingMode): Renamed from _didUpdate. (EditableText.htmlTemplate): Added ids on various elements in the shadow tree. (EditableText.cssTemplate): Updated the CSS selectors per above change. * public/v3/main.js: (main): Fixed a typo. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): Use the action listener instead of manually setting callbacks. (AnalysisTaskPage.prototype._createTestGroupListItem): Ditto. (AnalysisTaskPage.prototype._didStartEditingTaskName): Deleted. 2017-01-20 Ryosuke Niwa Build fix after r210783. Didn't mean to require custom elements API. * public/v3/main.js: (main): 2017-01-20 Ryosuke Niwa Make sync-commits.py robust against missing Subversion authors and missing parent Git commits https://bugs.webkit.org/show_bug.cgi?id=167231 Reviewed by Antti Koivisto. Fixed a bug that a subversion commit that's missing author name (anonymous commit) results in an out of bound exception, and a bug that syncing a git repository starts failing once there was a merge commit which pulled in a commit data earlier than that of the last reported commit. For the latter fix, added --max-ancestor-fetch-count to specify the number of maximum commits to look back. * tools/sync-commits.py: (main): Added --max-ancestor-fetch-count. (Repository.fetch_commits_and_submit): If submit_commits fails with FailedToFindParentCommit, fetch the parent commit's information until we've resolved them all. (Repository.fetch_next_commit): Renamed from fetch_commit. (SVNRepository.fetch_next_commit): Renamed from fetch_commit. Don't try to get the author name if it's missing due to an anonymous commit. It's important to never include the "author" field in the JSON submitted to a dashboard since it rejects when "author" field is not an array (e.g. null). (GitRepository.fetch_next_commit): Renamed from fetch_commit. (GitRepository.fetch_commit): Added. Fetches the commit information for a given git hash. Used to retrieve missing parent commits. (GitRepository._revision_from_tokens): Extracted from fetch_commit. * tools/util.py: (submit_commits): Optionally takes status_to_accept to avoid throwing in the case of FailedToFindParentCommit and returns the response JSON. 2017-01-20 Ryosuke Niwa REGRESSION(r198234): /api/commits/%revision% always fails https://bugs.webkit.org/show_bug.cgi?id=167235 Reviewed by Antti Koivisto. The bug was caused by a typo in CommitLogFetcher::fetch_revision, which was calling commit_for_revision on $this->db instead of $this. This had been monkey-patched in the internal dashboard so it was working there. Also fixed a bug that /latest wasn't doing what it claimed to do, and a bug that /oldest /latest, and /last-reported would return a commit with all values set to null instead of an empty list. Finally, added server API tests for /api/commits. * public/api/commits.php: (main): Add a comment for APIs that only exist for v2 UI. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_latest): Fixed the bug that this function was returning the oldest commit, not the the latest commit as desired. (CommitLogFetcher::fetch_revision): Fixed the bug that this function would always encounter an exception because commit_for_revision is defined on $this, not $this->db. (CommitLogFetcher::format_single_commit): Return an empty list instead of an array with a single commit with all values set to null. * server-tests/api-commits.js: Added. Added tests for the JSON API at /api/commits. (.assertCommitIsSameAsOneSubmitted): Added. A helper function to compare a commit returned by /api/commits to one sent to /api/report-commits. 2017-01-19 Ryosuke Niwa measurement-sets API can incorrectly order points with OS version without commit time https://bugs.webkit.org/show_bug.cgi?id=167227 Reviewed by Chris Dumez. Ignore revision_order for the purpose of ordering data points in /api/measurement-sets. These orderings are used in some UI (e.g A/B testing) to order OS build numbers which do not have a timestamp associated with each "revision". The baseline measurements made in our internal dashboard were using these ordering numbers before ordering results with build time. Because those data points don't have an associated Webkit revisions, all data points were ordered first by macOS's revision_order, then build time. Because v3 UI completely ignores revision_order for the purpose of plotting data points, this resulted in some data points being plotted in a wrong order with some lines going backwards in time. This patch addresses this discrepancy by stop ordering data points with revision_order in the JSON API. * public/api/measurement-set.php: (MeasurementSetFetcher::execute_query): Fixed the bug. * server-tests/api-measurement-set-tests.js: Added a test. 2017-01-19 Ryosuke Niwa Build fix after r210626. We need to clear Triggerable's static map in each iteration. * tools/sync-buildbot.js: (syncLoop): 2017-01-18 Ryosuke Niwa Add a mechanism to dispatch and listen to an action https://bugs.webkit.org/show_bug.cgi?id=167191 Reviewed by Antti Koivisto. Added the notion of an action to components. Like DOM events, it can be dispatched or listen to. Also added ComponentBase.prototype.part which finds a sub-component inside a component's shadow tree, and made ComponentBase.prototype.content take an id to find an element that matches it. * browser-tests/close-button-tests.js: Added. Tests for CloseButton. * browser-tests/component-base-tests.js: Added tests for ComponentBase's part(~), content(id), dispatchEvent. * browser-tests/index.html: * public/v3/components/base.js: (ComponentBase): Added this._actionCallbacks, which is a map of an action name to a callback to be invoked. (ComponentBase.prototype.content): Return an element of the given id if one is specified. (ComponentBase.prototype.part): Find a component whose element has the matching id. (ComponentBase.prototype.dispatchAction): Added. (ComponentBase.prototype.listenToAction): Added. (ComponentBase.prototype._ensureShadowTree): Call didConstructShadowTree. (ComponentBase.prototype.didConstructShadowTree): Added. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Copy attributes when instantiating an element for a component when the browser doesn't support custom elements API. (ComponentBase.createLink): (ComponentBase.prototype.createEventHandler): Added. (ComponentBase.createEventHandler): Renamed from createActionHandler. * public/v3/components/button-base.js: (ButtonBase.prototype.didConstructShadowTree): Added. Dispatch "activate" action when the button is clicked. (ButtonBase.prototype.setCallback): Deleted. (ButtonBase.htmlTemplate): Use id instead of class so that this.content() can find it. (ButtonBase.cssTemplate): Updated style rules. * public/v3/pages/chart-pane.js: (ChartPane): (ChartPane.prototype.didConstructShadowTree): Added. Listen to "activate" action on the close button. (ChartPane.prototype.render): Fixed a bug that we were never calling enqueueToRender on the close button. (ChartPane.htmlTemplate): Add the id on the close button. 2017-01-18 Dewei Zhu 'buildbot-syncer.js' should be able to determine force build argument from a list of possible repositories. https://bugs.webkit.org/show_bug.cgi?id=167152 Reviewed by Ryosuke Niwa. Add 'rootOptions' key which maps to a list of possible repositories. For a build request, only one of the repositories in the list is valid. * tools/js/buildbot-syncer.js: (BuildbotSyncer.prototype._propertiesForBuildRequest): (BuildbotSyncer._validateAndMergeProperties): (BuildbotSyncer): * unit-tests/buildbot-syncer-tests.js: (sampleiOSConfig): (sampleiOSConfigWithExpansions): (createSampleBuildRequest): (Promise.resolve.then): * unit-tests/resources/mock-v3-models.js: (MockModels.inject): 2017-01-17 Ryosuke Niwa Make calls to render() functions async https://bugs.webkit.org/show_bug.cgi?id=167151 Reviewed by Andreas Kling. Make calls to render() async by coalescing calls inside enqueueToRender(), which has been renamed from updateRendering(). We now queue up all the components and wait until the next animation frame to invoke render() on all those components. This reduces render() calls in the summary page of our internal dashboard by 15x from ~9400 to ~600 by eliminating pathological O(n^2) behavior between render() calls. Consolidated TimeSeriesChart's enqueueRender into this newly added feature of ComponentBase along with the support to call render() on a resize event. New implementation makes use of connectedCallback and disconnectedCallback to avoid the work when the component is not in a document tree. The rest of the patch concerns with renaming updateRendering to enqueueToRender and fixing a few minor bugs that I encountered while working on this patch. * browser-tests/component-base-tests.js: Added tests for ComponentBase.enqueueToRender(). * browser-tests/index.html: (BrowserContext.prototype.importScripts): Renamed from importScript; Now supports loading multiple scripts. (BrowserContext.prototype.importScript): Added. (BrowserContext): Removed the unused createWithScripts. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype._expandBetween): * public/v3/components/bar-graph-group.js: (BarGraphGroup.prototype.updateGroupRendering): * public/v3/components/base.js: (ComponentBase): When the browser doesn't support custom elements and (ComponentBase.prototype.enqueueToRender): Renamed from updateRendering. Queues up the component to call render() instead of immediately invoking it. (ComponentBase.renderingTimerDidFire): Call render(). Since render() function often calls enqueueToRender on child components, go ahead and invoke render() on any components enqueued during render() calls. (ComponentBase._connectedComponentToRenderOnResize): Added. (ComponentBase._disconnectedComponentToRenderOnResize): Added. (ComponentBase.defineElement.elementClass.prototype.connectedCallback): Added. This is an optimization to avoid the work when the component is not in the document; e.g. because the entire page component has been detached from the document. The old implementation in TimeSeriesChart was not doing this. (ComponentBase.defineElement.elementClass.prototype.disconnectedCallback): Added. (ComponentBase): Replaced unused static variables with _componentsToRender and _componentsToRenderOnResize. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.fetchAnalysisTasks): (ChartPaneBase.prototype.didUpdateAnnotations): Added. Addresses the bug that the annotation bars in the charts shown an an analysis task doesn't update its color when the state is updated in the UI. (ChartPaneBase.prototype._mainSelectionDidZoom): (ChartPaneBase.prototype._updateStatus): (ChartPaneBase.prototype._requestOpeningCommitViewer): (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype.render): * public/v3/components/commit-log-viewer.js: * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm): (CustomizableTestGroupForm.prototype._customize): * public/v3/components/editable-text.js: (EditableText.prototype._didUpdate): * public/v3/components/interactive-time-series-chart.js: * public/v3/components/pane-selector.js: (PaneSelector.prototype._selectedItem): * public/v3/components/time-series-chart.js: (TimeSeriesChart): Removed the logic to update upon resize. See _connectedComponentToRenderOnResize above. (TimeSeriesChart.prototype.get enqueueToRenderOnResize): Added. Returns true. (TimeSeriesChart.prototype.enqueueToRender): Deleted. (TimeSeriesChart._renderEnqueuedCharts): Deleted. (TimeSeriesChart): Call ComponentBase.defineElement to make this a proper component so that the logic in connectedCallback to update upon resize event would work. * public/v3/instrumentation.js: (Instrumentation.dumpStatistics): Sort results by the key names. * public/v3/models/time-series.js: (TimeSeries.prototype.values): Added. This method was never ported to v3 in r198462, and broke the feature to show moving averages, etc... on the charts page. * public/v3/pages/analysis-category-page.js: (AnalysisCategoryPage.prototype.open): (AnalysisCategoryPage.prototype.updateFromSerializedState): (AnalysisCategoryPage.prototype.filterDidChange): (AnalysisCategoryPage.prototype.render): * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): (AnalysisTaskPage.prototype.updateFromSerializedState): (AnalysisTaskPage.prototype._didFetchTask): (AnalysisTaskPage.prototype._didFetchRelatedAnalysisTasks): (AnalysisTaskPage.prototype._didFetchMeasurement): (AnalysisTaskPage.prototype._didFetchTestGroups): (AnalysisTaskPage.prototype._showAllTestGroups): (AnalysisTaskPage.prototype._didFetchAnalysisResults): (AnalysisTaskPage.prototype.render): (AnalysisTaskPage.prototype._renderTestGroupList.): (AnalysisTaskPage.prototype._renderTestGroupList): (AnalysisTaskPage.prototype._createTestGroupListItem): (AnalysisTaskPage.prototype._showTestGroup): (AnalysisTaskPage.prototype._didStartEditingTaskName): (AnalysisTaskPage.prototype._updateTaskName): (AnalysisTaskPage.prototype._updateTestGroupName): (AnalysisTaskPage.prototype._hideCurrentTestGroup): (AnalysisTaskPage.prototype._updateChangeType): Fixed the bug that we were never updating annotation bars in the main chart by calling didUpdateAnnotations. (AnalysisTaskPage.prototype._associateBug): (AnalysisTaskPage.prototype._dissociateBug): (AnalysisTaskPage.prototype._associateCommit): (AnalysisTaskPage.prototype._dissociateCommit): (AnalysisTaskPage.prototype._chartSelectionDidChange): (AnalysisTaskPage.prototype._selectedRowInAnalysisResultsViewer): * public/v3/pages/build-request-queue-page.js: (BuildRequestQueuePage.prototype.open.): (BuildRequestQueuePage.prototype.open): * public/v3/pages/chart-pane.js: (ChartPane.prototype.setOpenRepository): (ChartPane.prototype._renderTrendLinePopover): Fixed a race condition. Insert a select element as needed before trying to assign the current value on it. (ChartPane.prototype._trendLineTypeDidChange): (ChartPane.prototype._updateTrendLine): * public/v3/pages/charts-page.js: (ChartsPage.prototype.updateFromSerializedState): (ChartsPage.prototype._updateDomainsFromSerializedState): (ChartsPage.prototype.setNumberOfDaysFromToolbar): (ChartsPage.prototype._didMutatePaneList): (ChartsPage.prototype.render): * public/v3/pages/charts-toolbar.js: (ChartsToolbar.prototype.render): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype.updateFromSerializedState): * public/v3/pages/dashboard-page.js: (DashboardPage.prototype.updateFromSerializedState): (DashboardPage.prototype._fetchedData): * public/v3/pages/heading.js: (Heading.prototype.render): * public/v3/pages/page-with-heading.js: (PageWithHeading.prototype.render): * public/v3/pages/page.js: (Page.prototype.open): * public/v3/pages/summary-page.js: (SummaryPage.prototype.open): (SummaryPage.prototype.this._renderQueue.push): (SummaryPage): (SummaryPage.prototype._renderCell): 2017-01-15 Ryosuke Niwa Add the build fix for browsers that don't yet support custom elements SPI. It was supposedly to be a part of the previous commit. * public/v3/components/base.js: (ComponentBase.defineElement): 2017-01-12 Ryosuke Niwa Adopt custom elements API in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=167045 Reviewed by Darin Adler. Adopt custom elements API in ComponentBase, and create the shadow tree lazily in content() and render() instead of eagerly creating it inside the constructor. For now, create a separate element class for each component in ComponentBase.defineElement instead of making ComponentBase inherit from HTMLElement to preserve the semantics we have as well as to test the boundaries of what custom elements API allows for framework authors. In order to ensure one-to-one correspondence between elements and their components, we use a static map, ComponentBase._currentlyConstructedByInterface, to remember which element or component is being created and use that in custom element's constructor to update element.component() and this._element. Also dropped the support for not having attachShadow as we've shipped this feature in Safari 10. Finally, added tests to be ran inside a browser to test the front end code in browser-tests. * browser-tests/component-base-tests.js: Added. Basic tests for ComponentBase. * browser-tests/index.html: Added. * public/v3/components/base.js: (ComponentBase): Don't create the shadow tree. Use the currently constructed element as this._element if there is one (the custom element's constructor is getting called). Otherwise create a new element but store this component in the map to avoid creating a new component in the custom element's constructor. (ComponentBase.prototype.content): Lazily create the shadow tree now. (ComponentBase.prototype.render): Ditto. (ComponentBase.prototype._ensureShadowTree): Renamed from _constructShadowTree. Dropped the support for not having shadow DOM API. This is now required. Also use importNode instead of cloneNode in cloning the template content since the latter would not get upgraded. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Modernized the code. Don't re-create a component if its element had already been upgraded by its custom element constructor. (ComponentBase.defineElement): Add this component to the static maps. _componentByName is used by _recursivelyReplaceUnknownElementsByComponents to instantiate new components in the browsers that don't support custom elements API and _componentByClass is used by ComponentBase's constructor to lookup the element name. The latter should go away once all components fully adopt ComponentBase.defineElement. (ComponentBase.defineElement.elementClass): A class to define a custom element for the component. We need to reconfigure the property since class's name is not writable but configurable. * public/v3/components/button-base.js: (ButtonBase.htmlTemplate): Added. Extracted the common code from CloseButton and WarningIcon. (ButtonBase.buttonContent): Added. An abstract method overridden by CloseButton and WarningIcon. (ButtonBase.sizeFactor): Added. Overridden by WarningIcon. (ButtonBase.cssTemplate): Updated to use :host. * public/v3/components/close-button.js: (CloseButton.buttonContent): Renamed from htmlTemplate. * public/v3/components/spinner-icon.js: (SpinnerIcon.cssTemplate): Removed webkit prefixed properties, and updated it to animate stroke instead of opacity to reduce the power usage. (SpinnerIcon.htmlTemplate): Factored stroke, stroke-width, and stroke-linecap into cssTemplate. * public/v3/components/warning-icon.js: (WarningIcon.cssTemplate): Deleted. (WarningIcon.sizeFactor): Added. (WarningIcon.buttonContent): Renamed from htmlTemplate. * public/v3/pages/summary-page.js: (SummaryPage._constructRatioGraph): Fixed a bug that we were not never calling spinner.updateRendering(). (SummaryPage.prototype._renderCell): 2017-01-13 Ryosuke Niwa Instrument calls to render() https://bugs.webkit.org/show_bug.cgi?id=167037 Reviewed by Sam Weinig. Wrap every call to render() by newly added ComponentBase.updateRendering() to instrument it. Also, use arrow functions instead of this.render.bind or regular closures for simplicity. Currently, we're making 5100 calls to render() while opening the summary page, and that's way too high. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype._expandBetween): * public/v3/components/bar-graph-group.js: (BarGraphGroup.prototype.updateGroupRendering): Renamed form render() as BarGraphGroup is not a component. * public/v3/components/base.js: (ComponentBase.prototype.updateRendering): Added. Instruments render() call. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.fetchAnalysisTasks): (ChartPaneBase.prototype._mainSelectionDidZoom): (ChartPaneBase.prototype._updateStatus): (ChartPaneBase.prototype._requestOpeningCommitViewer): (ChartPaneBase.prototype._keyup): (ChartPaneBase.prototype.render): * public/v3/components/commit-log-viewer.js: * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm): (CustomizableTestGroupForm.prototype._customize): * public/v3/components/editable-text.js: (EditableText.prototype._didUpdate): * public/v3/components/pane-selector.js: (PaneSelector.prototype._selectedItem): * public/v3/components/results-table.js: (ResultsTable.prototype.render): * public/v3/components/time-series-chart.js: (TimeSeriesChart._renderEnqueuedCharts): * public/v3/pages/analysis-category-page.js: (AnalysisCategoryPage.prototype.open): (AnalysisCategoryPage.prototype.updateFromSerializedState): (AnalysisCategoryPage.prototype.filterDidChange): (AnalysisCategoryPage.prototype.render): * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): (AnalysisTaskPage.prototype.updateFromSerializedState): (AnalysisTaskPage.prototype._didFetchTask): (AnalysisTaskPage.prototype._didFetchRelatedAnalysisTasks): (AnalysisTaskPage.prototype._didFetchMeasurement): (AnalysisTaskPage.prototype._didFetchTestGroups): (AnalysisTaskPage.prototype._showAllTestGroups): (AnalysisTaskPage.prototype._didFetchAnalysisResults): (AnalysisTaskPage.prototype.render): (AnalysisTaskPage.prototype._renderTestGroupList.): (AnalysisTaskPage.prototype._renderTestGroupList): (AnalysisTaskPage.prototype._createTestGroupListItem): (AnalysisTaskPage.prototype._showTestGroup): (AnalysisTaskPage.prototype._didStartEditingTaskName): (AnalysisTaskPage.prototype._updateTaskName): (AnalysisTaskPage.prototype._updateTestGroupName): (AnalysisTaskPage.prototype._hideCurrentTestGroup): (AnalysisTaskPage.prototype._updateChangeType): (AnalysisTaskPage.prototype._associateBug): (AnalysisTaskPage.prototype._dissociateBug): (AnalysisTaskPage.prototype._associateCommit): (AnalysisTaskPage.prototype._dissociateCommit): (AnalysisTaskPage.prototype._chartSelectionDidChange): (AnalysisTaskPage.prototype._selectedRowInAnalysisResultsViewer): * public/v3/pages/build-request-queue-page.js: (BuildRequestQueuePage.prototype.open.): (BuildRequestQueuePage.prototype.open): * public/v3/pages/chart-pane.js: (ChartPane.prototype.setOpenRepository): (ChartPane.prototype._trendLineTypeDidChange): (ChartPane.prototype._updateTrendLine): * public/v3/pages/charts-page.js: (ChartsPage.prototype.updateFromSerializedState): (ChartsPage.prototype._updateDomainsFromSerializedState): (ChartsPage.prototype.setNumberOfDaysFromToolbar): (ChartsPage.prototype._didMutatePaneList): (ChartsPage.prototype.render): * public/v3/pages/charts-toolbar.js: (ChartsToolbar.prototype.render): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype.updateFromSerializedState): * public/v3/pages/dashboard-page.js: (DashboardPage.prototype.updateFromSerializedState): (DashboardPage.prototype._fetchedData): * public/v3/pages/heading.js: (Heading.prototype.render): * public/v3/pages/page-with-heading.js: (PageWithHeading.prototype.render): * public/v3/pages/page.js: (Page.prototype.open): * public/v3/pages/summary-page.js: (SummaryPage.prototype.open): (SummaryPage.prototype.this._renderQueue.push): (SummaryPage): (SummaryPage.prototype._renderCell): 2017-01-12 Ryosuke Niwa Outliers are not hidden in v3 UI https://bugs.webkit.org/show_bug.cgi?id=166966 Reviewed by Andreas Kling. Fixed the typo in addToSeries. An outlier has markedOutlier set to true, not isOutlier. Also fixed a bug unveiled by new tests in MeasurementRootSet.ensureSingleton. It was was creating a new MeasurementRootSet each time it was called instead of finding an existing instance. Fixed the bug by merging the static maps of MeasurementRootSet and RootSet. * public/v3/models/measurement-cluster.js: (MeasurementCluster.prototype.addToSeries): Fixed the bug. * public/v3/models/root-set.js: (MeasurementRootSet.prototype.namedStaticMap): Added. (MeasurementRootSet.prototype.ensureNamedStaticMap): Added. (MeasurementRootSet.namedStaticMap): Added. (MeasurementRootSet.ensureNamedStaticMap): Added. * unit-tests/measurement-set-tests.js: Added tests for adopting time series data from a cluster. 2017-01-12 Ryosuke Niwa Hide the UI to trigger an A/B testing when there are no triggerables https://bugs.webkit.org/show_bug.cgi?id=166964 Reviewed by Yusuke Suzuki. Hide the "Start A/B Testing" button on analysis task pages instead of showing it and failing later when the user tries to create one it with a TriggerableNotFound error. Added the list of triggerables to the manifest JSON so that we can determine this condition without having to fetch /api/triggerable for each analysis task as done in v2 UI. * public/admin/reprocess-report.php: * public/api/manifest.php: * public/api/report.php: * public/include/admin-header.php: * public/include/manifest-generator.php: Moved from public/include/manifest.php. (ManifestGenerator::generate): (ManifestGenerator::triggerables): Added. Include the list of repositories this triggerable accepts as well as the list of (test, platform) pairs on which this triggerable is available. Use [testId, platformId] instead of a dictionary to reduce the file size. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm): Removed this._disabled. This variable was used in TestGroupFrom to disable the "Start A/B Testing" button when no range is selected but this ended up racy. Compute the visibility of the button in render() function instead. (CustomizableTestGroupForm.prototype.setRootSetMap): (CustomizableTestGroupForm.prototype._submitted): (CustomizableTestGroupForm.prototype.render): Hide the customize link and the button as needed. The "Start A/B Testing" button must be hidden when either no range is selected or no title is typed. "Customize" button must be hidden when no range is selected. * public/v3/components/test-group-form.js: (TestGroupForm): Removed _disabled since it's no longer used. (TestGroupForm.prototype.setDisabled): Ditto. (TestGroupForm.prototype.render): Ditto. * public/v3/index.html: Include triggerable.js. * public/v3/models/manifest.js: (Manifest._didFetchManifest): Modernized. Create Triggerable objects from the manifest JSON. * public/v3/models/triggerable.js: Added. (Triggerable): Add this triggerable object to the static map of (test id, platform id) pair. (Triggerable.prototype.acceptedRepositories): Added. (Triggerable.findByTestConfiguration): Added. Finds a triggerable in the aforementioned static map. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._updateStatus): Added. Re-render the page since time series data points that were previously not available may have become available. The lack of this update was causing a race condition in which the "Start A/B Testing" button for the charts is disabled even after a group name had been specified because setRootSetMap was never called with a valid set. (AnalysisTaskPage): Added this._triggerable. (AnalysisTaskPage.prototype._didFetchTask): Find the triggerable now that we've fetched the task. (AnalysisTaskPage.prototype.render): Hide the group view (the table of A/B testing results) entirely when there are no groups to show. Also hide the forms to start A/B testing when there are no matching triggerable, which is the main feature of this patch. * server-tests/api-manifest.js: Added a test for including a list of triggerables in the manifest JSON. * server-tests/resources/mock-data.js: (MockData.resetV3Models): Reset Triggerable's static map. * server-tests/tools-buildbot-triggerable-tests.js: Assert that Triggerable objects are constructed with appropriate list of repositories and (test, platform) associations. * tools/js/database.js: (tableToPrefixMap): Added triggerable_repositories's prefix. * tools/js/remote.js: (RemoteAPI.prototype.getJSON): Log the entire response to stderr when JSON.parse fails to aid debugging. * tools/js/v3-models.js: Import triggerable.js. 2017-01-11 Ryosuke Niwa fetch-from-remote doesn’t work with some websites https://bugs.webkit.org/show_bug.cgi?id=166963 Reviewed by Yusuke Suzuki. Apparently file_get_contents is not compatible with some SSL/TLS connections. Use curl_* functions to access remote servers instead. * public/admin/fetch-from-remote.php: (fetch_remote): 2017-01-10 Ryosuke Niwa Another build fix. Always use UTC when expressing commit times in UNIX-epoch timestamps. * public/api/measurement-set.php: 2017-01-10 Ryosuke Niwa Fix a typo in the previous commit. * public/api/measurement-set.php: 2017-01-10 Ryosuke Niwa Build fixes for older versions of Postgres. Also redirect / and /# to /v3/ as intended in r200820. * public/api/measurement-set.php: * public/api/runs.php: * public/index.html: 2016-10-18 Dewei Zhu Update test cases for change r206465. https://bugs.webkit.org/show_bug.cgi?id=163618 Reviewed by Ryosuke Niwa. Update test case for change r206465 which added support for multiple summary pages. Use deepStrictEqual instead of deepEqual as deepEqual will not complain in the case like 'deepEqual([],{})'. Fix a test failure in tools-buildbot-triggerable-tests.js. Fix a bug in generating manifest. * config.json: * public/include/manifest.php: * server-tests/api-manifest.js: (TestServer.remoteAPI.getJSON.string_appeared_here.then): * server-tests/tools-buildbot-triggerable-tests.js: (then): 2016-09-27 Dewei Zhu Extend perf dashboard to support multiple summary pages. https://bugs.webkit.org/show_bug.cgi?id=162594 Reviewed by Ryosuke Niwa. Start support multiple summary pages instead of one. Specify 'summaryPages' as key that map to a list of summaries which follows current 'summary' format in 'config.json' but with 2 more properties: 'name': specifying the name shows on perf dashboard, 'route': specifying the path to this page. * public/include/manifest.php: * public/v3/main.js: (main): (main.): Deleted. * public/v3/models/manifest.js: (Manifest._didFetchManifest): (Manifest): * public/v3/pages/summary-page.js: (SummaryPage): (SummaryPage.prototype.routeName): 2016-08-09 Ryosuke Niwa Don't filter out the latest data point in chart data sampling https://bugs.webkit.org/show_bug.cgi?id=160714 Reviewed by Chris Dumez. Exclude the last data point from sampling so that it's always included in the "sampled" charts data. Without this, the last data point can change as we zoom out the time domain. Luckily, we already had a mechanism to exclude the user selected point from sampling. Extend this feature by supporting an array of point IDs instead of a single ID to exclude from filering. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype._sampleTimeSeries): Replaced exclusionPointID by excludedPoints. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype._ensureSampledTimeSeries): Put the last data point in excludedPoints. (TimeSeriesChart.prototype._sampleTimeSeries): Check point's id against the list of IDs. 2016-08-09 Ryosuke Niwa Build fix after r204187. interval has to be a getter, not a method. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype._renderTimeSeries): * public/v3/models/measurement-adaptor.js: (MeasurementAdaptor.prototype.applyTo): 2016-08-09 Ryosuke Niwa Fix a typo that was supposed to be fixed in r204296 before landing. * public/v3/pages/chart-pane.js: (ChartPane): (ChartPane.prototype.updateFromSerializedState): (ChartPane.prototype._analyzeRange): (ChartPane.prototype._renderTrendLinePopover): (ChartPane.prototype._trendLineTypeDidChange): 2016-08-08 Ryosuke Niwa Always show segmentation on v3 charts page https://bugs.webkit.org/show_bug.cgi?id=160576 Rubber-stamped by Chris Dumez. Added "Trend Lines" popover to select and customize a moving average or a segmentation to show on charts page and made Schwarz criterion segmentation the default trend line for all charts. Because computing the segmentation is expensive, we use WebWorker to parallelize the computation via AsyncTask. We also compute and cache the segmentation for each cluster separately to avoid processing the entire measurement set as that could take 10-20s total, which was a huge problem in v2 UI. v3 UI's approach is more incremental and even opens up an opportunity to cache the results in the server side. Also brought back "shading" for the confidence interval drawing as done in v1 and v2 UI. * public/shared/statistics.js: (Statistics.segmentTimeSeriesByMaximizingSchwarzCriterion): Added segmentCountWeight and gridSize as arguments to customize the algorithm. (Statistics.splitIntoSegmentsUntilGoodEnough): Takes segmentCountWeight as BirgeAndMassartC. * public/v3/async-task.js: Added. (AsyncTask): Added. This class represents a task such as computing segmentation to be executed in a worker. (AsyncTask.prototype.execute): Added. Returns a promise that gets resolved when the specified task completes. (AsyncTaskWorker.waitForAvailableWorker): Added. Calls the given callback with the first available worker. When all workers are processing some tasks, it waits until one becomes available by putting the callback into a queue. _didRecieveMessage pops an item out of this queue when a worker completes a task. We don't use a promise here because calling this function multiple times synchronously could result in all the returned promises getting resolved with the same worker as none of the callers get to lock away the first available worker until the end of the current micro-task. (AsyncTaskWorker._makeWorkerEventuallyAvailable): Added. A helper function for waitForAvailableWorker. Start a new worker if the number of workers we've started is less than the number of extra cores (e.g. 7 if there are 8 cores on the machine). Avoid starting a new worker if we've started a new worker within the last 50 ms since starting a new worker takes some time. (AsyncTaskWorker._findAvailableWorker): Added. Finds a worker that's available right now if there is any. (AsyncTaskWorker): Added. An instance of AsyncTaskWorker represents a Web worker. (AsyncTaskWorker.prototype.id): Added. (AsyncTaskWorker.prototype.sendTask): Added. Sends a task represented by AsyncTask to the worker. (AsyncTaskWorker.prototype._didRecieveMessage): Added. This function gets called when the current task completes in the worker. Pop the next callback if some caller of waitForAvailableWorker is still waiting. Otherwise stop the worker after one second of waiting to avoid worker churning. (AsyncTaskWorker.workerDidRecieveMessage): Added. Called by onmessage on the worker. Executes the specified task and sends back a message upon completion with the appropriate timing data. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): Uses _createSourceList. (ChartPaneBase.prototype._createSourceList): Added. Extracted from configure to customize the source list for the main chart and the overview chart. (ChartPaneBase.prototype._updateSourceList): Uses _createSourceList. * public/v3/components/chart-styles.js: (ChartStyles.createSourceList): Added a boolean showPoint as an extra argument. This specifies whether circles are drawn for each data point. (ChartStyles.baselineStyle): Added styles for foreground lines and background lines. They're used for trend lines and underlying raw data respectively when trend lines are shown. (ChartStyles.targetStyle): Ditto. (ChartStyles.currentStyle): Ditto. * public/v3/components/time-series-chart.js: (TimeSeriesChart): Added _trendLines, _renderedTrendLines, and _fetchedTimeSeries as instance variables. (TimeSeriesChart.prototype.setSourceList): Clear _fetchedTimeSeries before calling setSourceList for consistency. (TimeSeriesChart.prototype.sourceList): Added. (TimeSeriesChart.prototype.clearTrendLines): Added. (TimeSeriesChart.prototype.setTrendLine): Added. Preserves the existing trend lines for other sources. This is necessary because segmentation for "current" and "baseline" lines may become available at different times, and we don't want to clear one or the other when setting one. (TimeSeriesChart.prototype._layout): Added a call to _ensureTrendLines. (TimeSeriesChart.prototype._renderChartContent): Call _renderTimeSeries for trend lines. Trend lines are always foreground lines and "regular" raw data points are drawn as background if there are trend lines. (TimeSeriesChart.prototype._renderTimeSeries): Added layerName as an argument. It could be an empty string, "foreground", or "background". Draw a "shade" just like v1 and v2 UI instead of vertical lines for the confidence intervals. Pick "foreground", "background", or "regular" chart style based on layerName. Also avoid drawing data points when *PointRadius is set to zero to reduce the runtime of this function. (TimeSeriesChart.prototype._sourceOptionWithFallback): Added. (TimeSeriesChart.prototype._ensureSampledTimeSeries): When *PointRadius is 0, show as many points as there are x coordinates as a fallback instead of showing every point. (TimeSeriesChart.prototype._ensureTrendLines): Added. Returns true if the chart contents haven't been re-rendered since the last update to trend lines. This flag is unset by setTrendLine. * public/v3/index.html: * public/v3/models/measurement-cluster.js: (MeasurementCluster.prototype.addToSeries): Store the data points' index to idMap to help aid MeasurementSet's _cachedClusterSegmentation efficiently re-create the segmentation from the cache. * public/v3/models/measurement-set.js: (MeasurementSet): Added _segmentationCache as an instance variable. (MeasurementSet.prototype.fetchSegmentation): Added. Calls _cachedClusterSegmentation on each cluster, and constructs the time series representation of the segmentation from the results. (MeasurementSet.prototype._cachedClusterSegmentation): Computes and caches the segmentation for each cluster. The cache of segmentation stores ID of each measurement set at which segment changes instead of its index since the latter could change in any moment when a new test result is reported, or an existing test result is removed from the time series; e.g. when it's marked as an outlier. (MeasurementSet.prototype._validateSegmentationCache): Added. Checks whether the cached segmentation's name and its parameters match that of the requested one. (MeasurementSet.prototype._invokeSegmentationAlgorithm): Added. Invokes the segmentation algorithm either in the main thread or in a Web worker via AsyncTask API based on the size of the time series. While parallelizing the work is beneficial when the data set is large, the overhead can add up if we keep processing a very small data set in a worker. * public/v3/models/time-series.js: Made the file compatible with Node. (TimeSeries.prototype.length): Added. (TimeSeries.prototype.valuesBetweenRange): Added. * public/v3/pages/chart-pane.js: (createTrendLineExecutableFromAveragingFunction): Added. (ChartTrendLineTypes): Added. Similar to StatisticsStrategies (statistics-strategies.js) in v2 UI. (ChartPane): Added _trendLineType, _trendLineParameters, _trendLineVersion, and _renderedTrendLineOptions as instance variables. (ChartPane.prototype.serializeState): Serialize the trend line option. This format is compatible with v2 UI. (ChartPane.prototype.updateFromSerializedState): Ditto. Parsing is compatible with v2 UI except that we now have the default trend line set when the specified ID doesn't match an existing type ID. (ChartPane.prototype._renderActionToolbar): Added a call to _renderTrendLinePopover. This is the popover that specifies the type of a trend line to show as well as its parameters. (ChartPane.prototype._renderTrendLinePopover): Added. A popover for specifying and customizing a trend line. (ChartPane.prototype._trendLineTypeDidChange): Added. Called when a new trend line is selected. (ChartPane.prototype._defaultParametersForTrendLine): Added. (ChartPane.prototype._trendLineParameterDidChange): Added. Called when the trend lines' parameters are changed. (ChartPane.prototype._didFetchData): Added. Overrides the one in ChartPaneBase to trigger a trend line update. (ChartPane.prototype._updateTrendLine): Added. Update the trend line. Since segmentation can take an arbitrary long time, avoid updating trend lines if this function had been called again (possibly for a different trend line type or with different parameters) before the results become available; hence the versioning. (ChartPane.paneHeaderTemplate): Added the trend line popover. (ChartPane.cssTemplate): Added styles for the trend line popover. Also use a more opaque background color behind popovers when the -webkit-backdrop-filter property is not supported. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): Call createSourceList with showPoints set to true to preserve the existing behavior. * tools/js/v3-models.js: Include TimeSeries object. * unit-tests/measurement-set-tests.js: Added two test cases for MeasurementSet's fetchSegmentation. * unit-tests/resources/almost-equal.js: Added. (almostEqual): Extracted out of statistics-tests.js. * unit-tests/statistics-tests.js: 2016-08-05 Ryosuke Niwa segmentTimeSeriesByMaximizingSchwarzCriterion returns a bogus result on empty charts https://bugs.webkit.org/show_bug.cgi?id=160575 Rubber-stamped by Chris Dumez. The bug was caused by an early return in segmentTimeSeriesByMaximizingSchwarzCriterion. Removed this early return as the one in splitIntoSegmentsUntilGoodEnough was sufficient. Also factored out a few functions in findOptimalSegmentation so that they can be better optimized in JSC's DFG and FTL tiers, and removed unused debuggingTestingRangeNomination. * public/shared/statistics.js: (Statistics.segmentTimeSeriesByMaximizingSchwarzCriterion): Removed an early return. (Statistics.splitIntoSegmentsUntilGoodEnough): (.allocateCostUpperTriangularForSegmentation): Extracted from findOptimalSegmentation. (.allocatePreviousNodeForSegmentation): Ditto. (.findOptimalSegmentationInternal): Ditto. (.findOptimalSegmentation): * unit-tests/statistics-tests.js: Added a test case. 2016-08-05 Ryosuke Niwa Perf dashboard sometimes tries to fetch a non-existent measurement-set JSON https://bugs.webkit.org/show_bug.cgi?id=160577 Rubber-stamped by Chris Dumez. The bug was caused by findClusters computing the first cluster's endTime incorrectly. Namely, we were multiplying the number of clusters by clusterStart instead of clusterSize with an off-by-one error. * public/v3/models/measurement-set.js: (MeasurementSet.prototype.findClusters): Folded computeClusterStart into where clusterEnd is computed for clarity. Also fixed a bug that we were not computing the first cluster to fetch correctly when the fetched time range started before clusterStart (i.e. when startTime - clusterStart is negative). Finally, fixed the main bug by multiplying the number of clusters by clusterSize instead of clusterStart to compute the end time of the very first cluster in this measurement set. Because what we're computing here is the end time of the first cluster, not the start time, we also need to subtract one from the number of clusters. e.g. if there was exactly one cluster, then firstClusterEndTime is identically equal to lastClusterEndTime. (MeasurementSet.prototype.fetchedTimeSeries): Removed the unused argument to TimeSeries's constructor. * unit-tests/analysis-task-tests.js: Fixed the tests for the latest version of Mocha which complains if we returned a promise in unit tests when "done" function is used. * unit-tests/checkconfig.js: Ditto. * unit-tests/measurement-set-tests.js: Added a test case for findClusters and a test to make sure fetchBetween doesn't try to fetch a cluster before the first cluster in the set. Also fixed other test cases which were relying on the bug this patch fixed. 2016-08-04 Ryosuke Niwa MeasurementCluster's addToSeries is slow https://bugs.webkit.org/show_bug.cgi?id=160581 Rubber-stamped by Chris Dumez. The bulk of time was spent in MeasurementAdaptor.prototype.applyTo where we computed the interval. Since some of data points are filtered out by TimeSeriesChart component before intervals are used, we can significantly reduce the CPU time by lazily compute them. This patch reduces the runtime of applyTo from ~60ms to ~30ms on my machine. * public/v3/models/measurement-adaptor.js: (MeasurementAdaptor.prototype.applyTo): Lazily compute and cache the interval. Also cache the build object instead of always creating a new object. * public/v3/models/measurement-cluster.js: (MeasurementCluster.prototype.addToSeries): Call applyTo first before checking whether the point is an outlier or its id to avoid extracting those values twice since they show up in the profiler. Also use "of" instead "forEach" since "of" seems to be faster here. 2016-08-04 Ryosuke Niwa Syncing script's configuration duplicates a lot of boilerplate https://bugs.webkit.org/show_bug.cgi?id=160574 Rubber-stamped by Chris Dumez. This patch makes each configuration accept an array of platforms and types so that we can write: {"type": "speedometer", "builder": "mba", "platform": "Trunk El Capitan MacBookAir"}, {"type": "speedometer", "builder": "mbp", "platform": "Trunk El Capitan MacBookPro"}, {"type": "speedometer", "builder": "mba", "platform": "Trunk Sierra MacBookAir"}, {"type": "speedometer", "builder": "mbp", "platform": "Trunk Sierra MacBookPro"}, {"type": "jetstream", "builder": "mba", "platform": "Trunk El Capitan MacBookAir"}, {"type": "jetstream", "builder": "mbp", "platform": "Trunk El Capitan MacBookPro"}, {"type": "jetstream", "builder": "mba", "platform": "Trunk Sierra MacBookAir"}, {"type": "jetstream", "builder": "mbp", "platform": "Trunk Sierra MacBookPro"}, more concisely as: {"builder": "mba", "types": ["speedometer", "jetstream"], "platforms": ["Trunk El Capitan MacBookAir", "Trunk Sierra MacBookAir"]}, {"builder": "mbp", "types": ["speedometer", "jetstream"], "platforms": ["Trunk El Capitan MacBookPro", "Trunk Sierra MacBookPro"]}, * tools/js/buildbot-syncer.js: (BuildbotSyncer._loadConfig): (BuildbotSyncer._expandTypesAndPlatforms): Added. Clones a new configuration entry for each type and platform. (BuildbotSyncer._createTestConfiguration): Extracted from _loadConfig. (BuildbotSyncer._validateAndMergeConfig): Added a new argument that specifies a property that shouldn't be merged into the configuration. Also added the support for 'types' and 'platforms', and merged the code for verify an array of strings. Finally, allow the appearance of 'properties' since this function can now be called on a cloned configuration in which 'arguments' had already been renamed to 'properties'. * unit-tests/buildbot-syncer-tests.js: Added a test case to parse a consolidated configuration. (sampleiOSConfigWithExpansions): Added. * unit-tests/resources/mock-v3-models.js: (MockModels.inject): Added a few more mock models for the newly added test. 2016-07-26 Ryosuke Niwa REGRESSION: Tooltip for analysis tasks doesn't show up on charts https://bugs.webkit.org/show_bug.cgi?id=160221 Rubber-stamped by Chris Dumez. The bug was caused by ChartPaneBase resetting annotation bars every time the current point has moved. Avoid doing this in ChartPaneBase's _renderAnnotations(). * public/v3/components/chart-pane-base.js: (ChartPaneBase): (ChartPaneBase.prototype.fetchAnalysisTasks): (ChartPaneBase.prototype._renderAnnotations): 2016-07-26 Ryosuke Niwa REGRESSION: The arrow indicating the current page doesn't get updated https://bugs.webkit.org/show_bug.cgi?id=160185 Reviewed by Chris Dumez. The bug was caused by Heading's render() function not updating the DOM more than once. I don't understand how this has ever worked. Fixed the bug by rendering DOM whenever the current page has changed. * public/v3/pages/heading.js: (Heading): (Heading.prototype.render): 2016-07-25 Ryosuke Niwa Build fix for Safari 9. * public/v3/models/build-request.js: (BuildRequest.prototype.waitingTime): Don't use "const" in strict mode. 2016-07-23 Ryosuke Niwa Perf dashboard should show the list of a pending A/B testing jobs https://bugs.webkit.org/show_bug.cgi?id=160138 Rubber-stamped by Chris Dumez. Add a page to show the list of A/B testing build requests per triggerable. Ideally, we would like to see a queue per builder but that would require changes to database tables and syncing scripts. Because this page is most useful when the analysis task with which each build request is associated, JSON API at /api/build-requests/ has been modified to return the analysis task ID for each request. Also streamlined the page that shows the list of analysis tasks per Chris' feedback by consolidating "Bisecting" and "Identified" into "Investigated" and moving the toolbar from the upper left corner inside the heading to right beneath the heading above the table. Also made the category page serialize the filter an user had typed in so that reloading the page doesn't clear it. * public/api/analysis-tasks.php: (fetch_associated_data_for_tasks): Removed 'category' from the list of columns returned as the notion of 'category' is only relevant in UI, and it's better computed in the front-end. (format_task): Ditto. (determine_category): Deleted. * public/api/test-groups.php: (main): * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::fetch_for_task): Include the analysis task ID in the rows. (BuildRequestsFetcher::fetch_for_group): Ditto. Ditto. (BuildRequestsFetcher::fetch_incomplete_requests_for_triggerable): Ditto. (BuildRequestsFetcher::results_internal): Ditto. * public/v3/index.html: * public/v3/main.js: (main): Create a newly introduced BuildRequestQueuePage as a subpage of AnalysisCategoryPage. * public/v3/components/ratio-bar-graph.js: (RatioBarGraph.prototype.update): Fixed a bogus assertion here. ratio can be any number. The coercion into [-1, 1] is done inside RatioBarGraph's render() function. * public/v3/models/analysis-task.js: (AnalysisTask.prototype.category): Moved the code to compute the analysis task's category from determine_category in analysis-tasks.php. Also merged "bisecting" and "identified" into "investigated". (AnalysisTask.categories): Merged "bisecting" and "identified" into "investigated". * public/v3/models/build-request.js: (BuildRequest): Remember the triggerable and the analysis task associated with this request as well as the time at when this request was created. (BuildRequest.prototype.analysisTaskId): Added. (BuildRequest.prototype.statusLabel): Use a shorter label: "Waiting" for "pending" status. (BuildRequest.prototype.createdAt): Added. (BuildRequest.prototype.waitingTime): Added. Returns a human readable time duration since the creation of this build request such as "2 hours 21 minutes" against a reference time. (BuildRequest.fetchTriggerables): Added. (BuildRequest.cachedRequestsForTriggerableID): Added. Used when navigating back to * public/v3/pages/analysis-category-page.js: (AnalysisCategoryPage): Construct AnalysisCategoryToolbar and store it in this._categoryToolbar since it no longer inherits from Toolbar class, which PageWithHeading recognizes and stores. (AnalysisCategoryPage.prototype.title): (AnalysisCategoryPage.prototype.serializeState): Added. (AnalysisCategoryPage.prototype.stateForCategory): Added. Include the filter in the serialization. (AnalysisCategoryPage.prototype.updateFromSerializedState): Restore the filter from the URL state. (AnalysisCategoryPage.prototype.filterDidChange): Added. Called by AnalysisCategoryToolbar to update the URL state in addition to calling render() as done previously via setFilterCallback. (AnalysisCategoryPage.prototype.render): Always call _categoryToolbar.render() since the hyperlinks for the category pages now include the filter, which can be updated in each call. (AnalysisCategoryPage.cssTemplate): * public/v3/pages/analysis-category-toolbar.js: (AnalysisCategoryToolbar): Inherits from ComponentBase instead of Toolbar since AnalysisCategoryToolbar no longer works with Heading class unlike other subclasses of Toolbar class. (AnalysisCategoryToolbar.prototype.setCategoryPage): Added. (AnalysisCategoryToolbar.prototype.setFilterCallback): Deleted. (AnalysisCategoryToolbar.prototype.setFilter): Added. Used to restore from a serialized URL state. (AnalysisCategoryToolbar.prototype.render): Don't recreate the input element as it clears the value as well as the selection of the element. Also use AnalysisCategoryPage's stateForCategory to serialize the category name and the current filter for each hyperlink. (AnalysisCategoryToolbar.prototype._filterMayHaveChanged): Now takes an boolean argument specifying whether the URL state should be updated or not. We update the URL only when a change event is fired to avoid constantly updating it while an user is still typing. (AnalysisCategoryToolbar.cssTemplate): Added. (AnalysisCategoryToolbar.htmlTemplate): Added a button to open the newly added queue page. * public/v3/pages/build-request-queue-page.js: (BuildRequestQueuePage): Added. (BuildRequestQueuePage.prototype.routeName): Added. (BuildRequestQueuePage.prototype.pageTitle): Added. (BuildRequestQueuePage.prototype.open): Added. Fetch open build requests for every triggerables using the same API as the syncing scripts. (BuildRequestQueuePage.prototype.render): Added. (BuildRequestQueuePage.prototype._constructBuildRequestTable): Added. Construct a table for the list of pending, scheduled or running build requests in the order syncing scripts would see. Note that the list of build requests returned by /api/build-requests/* can contain completed, canceled, or failed requests since the JSON returns all build requests associated with each test group if one of the requests of the group have not finished. This helps syncing scripts picking the right builder for A/B testing when it had previously been unloaded or crashed in the middle of processing a test group. This characteristics of the API actually helps us here because we can reliably compute the total number of build requests in the group. The first half of this function does this counting as well as collapses all but the first unfinished build requests into a "contraction" row, which just shows the number of build requests that are remaining in the group. (BuildRequestQueuePage.cssTemplate): Added. (BuildRequestQueuePage.htmlTemplate): Added. * public/v3/pages/summary-page.js: (SummaryPage.prototype.open): Use one-day median instead of seven-day median to compute the status. (SummaryPageConfigurationGroup): Initialize _ratio to NaN. This was causing assertion failures in RatioBarGraph's update() while measurement sets are being fetched. * server-tests/api-build-requests-tests.js: Updated the tests per change in BuildRequest's statusLabel. * unit-tests/analysis-task-tests.js: Ditto. * unit-tests/test-groups-tests.js: Ditto. * unit-tests/build-request-tests.js: Added tests for BuildRequest's waitingTime. 2016-07-22 Ryosuke Niwa REGRESSION(r203035): Marking points as an outlier no longer updates charts https://bugs.webkit.org/show_bug.cgi?id=160106 Reviewed by Darin Adler. The bug was caused by MeasurementSet's fetchBetween clearing previously registered callbacks when noCache option is specified. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.setSourceList): Clear this._fetchedTimeSeries when changing chart options. e.g. need to start including or excluding outliers. (TimeSeriesChart.prototype.fetchMeasurementSets): Don't skip the fetching when noCache is true. * public/v3/models/measurement-set.js: (MeasurementSet): Added this._callbackMap as an instance variable to keep track of all callbacks on every cluster since we may need to call each callback multiple times per cluster when noCache option is used. (MeasurementSet.prototype.fetchBetween): Moved the code to add _primaryClusterPromise to _allFetches here so that now this function and _ensureClusterPromise are only functions that touch _allFetches. (MeasurementSet.prototype._ensureClusterPromise): Extracted out of fetchBetween. Queue up all callbacks for each cluster when creating a new promise. (MeasurementSet.prototype._fetchPrimaryCluster): Removed the code to add _primaryClusterPromise now that it's done in fetchBetween. * public/v3/remote.js: (RemoteAPI.postJSONWithStatus): Removed superfluous call to console.log. * unit-tests/measurement-set-tests.js: Updated the test case for noCache. The callback registered before fetchBetween is called with noCache=true is now invoked so callCount must be 3 instead of 2. 2016-07-19 Ryosuke Niwa Perf dashboard always re-generate measurement set JSON https://bugs.webkit.org/show_bug.cgi?id=159951 Reviewed by Chris Dumez. The bug was caused by manifest.json reporting the last modified date of a measurement set in floating point, and a measurement set JSON reporting it as an integer. Fixed the bug by always using an integer. * public/api/measurement-set.php: (main): Return 404 when the results is empty. (MeasurementSetFetcher::execute_query): Use "extract(epoch from commit_time)" like ManifestGenerator to improve the generation speed. This is ~10% runtime improvement. (MeasurementSetFetcher::format_map): Updated to reflect the above change. (MeasurementSetFetcher::parse_revisions_array): Ditto. * public/include/manifest.php: (ManifestGenerator::platforms): Fixed the bug by coercing lastModified to integer (instead of float). * server-tests/api-measurement-set-tests.js: Added a test case for returning empty results, and a test case for making sure lastModified dates in manifest.json and measurement sets match. * tools/js/remote.js: (RemoteAPI.prototype.sendHttpRequest): Reject the promise when HTTP status code is not 200. 2016-07-09 Ryosuke Niwa Perf dashboard can consume 50-70% of CPU on MacBook even if user is not interacting at all https://bugs.webkit.org/show_bug.cgi?id=159597 Reviewed by Chris Dumez. TimeSeriesChart and InteractiveTimeSeriesChart had been relying on continually polling on requestAnimationFrame to update itself in response to its canvas resizing. Even though there as an early exit in the case there was nothing to update, this is still causing a significant power drain when the user is not interacting at all. Let TimeSeriesChart use the regular top-down render path like other components with exceptions of listening to window's resize eventas well as when new JSONs are fetched from the server. The render() call to the latter case will be coerced into a single callback on requestAnimationFrame to avoid DOM-mutation-layout churn. * public/v3/components/base.js: (ComponentBase.isElementInViewport): Deleted. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.render): Enqueue charts to render. * public/v3/components/chart-styles.js: (ChartStyles.dashboardOptions): Removed updateOnRequestAnimationFrame which is no longer an available option. * public/v3/components/time-series-chart.js: (TimeSeriesChart): Replaced the code to register itself for rAF by the code to listen to resize events on window. (TimeSeriesChart._updateOnRAF): Deleted. (TimeSeriesChart._updateAllCharts): Added. (TimeSeriesChart.prototype._enqueueToRender): Added. (TimeSeriesChart._renderEnqueuedCharts): Added. (TimeSeriesChart.prototype.fetchMeasurementSets): Avoid calling fetchBetween when the range had been fetched. Without this change, we can incur a significant number of redundant calls to render() when adjusting the domain in charts page by the slider. When no new JSON is fetched, simply enqueue this chart to render on rAF. (TimeSeriesChart.prototype._didFetchMeasurementSet): Enqueue this chart to render on rAF. (TimeSeriesChart.prototype.render): Removed the check for isElementInViewport since we no longer get render() call when this chart moves into the viewport (as we no longer listen to every rAF or scroll event). * public/v3/models/measurement-set.js: (MeasurementSet.prototype.hasFetchedRange): Fixed various bugs revealed by the new use in fetchMeasurementSets. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Removed the dead code. It was probably copied from when this code was in InteractiveTimeSeries chart. There is no this._forceRender in this component. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype.render): Enqueue charts to render. * public/v3/pages/heading.js: (SummaryPage.prototype.open): Removed the call to isElementInViewport. This wasn't really doing anything useful in this component. * unit-tests/measurement-set-tests.js: Added tests for hasFetchedRange. (.waitForMeasurementSet): Moved to be used in a newly added test case. 2016-07-09 Ryosuke Niwa REGRESSION: manifest.json generation takes multiple seconds on perf dashboard https://bugs.webkit.org/show_bug.cgi?id=159596 Reviewed by Chris Dumez. The most of CPU time was spent looking for a duplicate entry in an array of metrics by array_search. This patch moves to postgres by using aggregate functions in the query. Also moved the code to convert datetime to UNIX epoch timestamp from PHP to within postgres query. These improvements reduce total runtime of Manifest::generate from ~4s to ~350ms on my machine. * public/include/manifest.php: (Manifest::generate): No longer fetches test_configurations table as this is done in Manifest::platforms now. Also moved calls to each method in the class to separate lines for easier instrumentation. (Manifest::platforms): Group test configurations (current, baseline, target) by platform and metric. Use the max of the last modified dates in UNIX epoch timestamps (ms to be compatible with JS's representation). A given platform, metric pair is considered to be in the v1 dashboard if any test configuration is in. 2016-07-08 Ryosuke Niwa bundle-v3-scripts.py should compress HTML/CSS templates https://bugs.webkit.org/show_bug.cgi?id=159582 Reviewed by Joseph Pecoraro. Strip leading and trailing whitespaces from HTML and CSS templates. This is a 8% progression on the file size. * Install.md: Updated the list of MIME types to apply deflate for newer versions of Apache. * tools/bundle-v3-scripts.py: (main): (compress_template): Added. 2016-06-13 Ryosuke Niwa Build fix. Strip out "use strict" everywhere so that the perf dashboard works on the shipping Safari. * tools/bundle-v3-scripts.py: (main): 2016-06-13 Ryosuke Niwa Invalid token error when trying to create an A/B analysis for a range https://bugs.webkit.org/show_bug.cgi?id=158679 Reviewed by Chris Dumez. The problem in this particular case was due to another website overriding cookies for our subdomain. Make PrivilegedAPI robust against its token becoming invalid in general to fix the bug since the cookie is only available under /privileged-api/ and the v3 UI can't access it for security reasons. This patch factors out PrivilegedAPI out of remote.js so that it can be tested separately in server tests as well as unit tests even though RemoteAPI itself is implemented differently in each case. * init-database.sql: Added a forgotten default value "false" to run_marked_outlier. * public/v3/index.html: * public/v3/privileged-api.js: Added. Extracted out of public/v3/remote.js. (PrivilegedAPI.sendRequest): Fixed the bug. When the initial request fails with "InvalidToken" error, re-generate the token and re-issue the request. (PrivilegedAPI.requestCSRFToken): * public/v3/remote.js: (RemoteAPI.postJSON): Added to match tools/js/remote.js. (RemoteAPI.postJSONWithStatus): Ditto. (PrivilegedAPI): Moved to privileged-api.js. * server-tests/api-measurement-set-tests.js: Removed the unused require for crypto. * server-tests/privileged-api-upate-run-status.js: Added tests for /privileged-api/update-run-status. * server-tests/resources/test-server.js: (TestServer.prototype.inject): Clear the cookies as well as tokens in PrivilegedAPI. * tools/js/remote.js: (RemoteAPI): Added the support for PrivilegedAPI by making cookie set by the server persist. (RemoteAPI.prototype.clearCookies): Added for tests. (RemoteAPI.prototype.postJSON): Make sure sendHttpRequest always sends a valid JSON. (RemoteAPI.prototype.postJSONWithStatus): Added since this API is used PrivilegedAPI. (RemoteAPI.prototype.sendHttpRequest): Retain the cookie set by the server and send it back in each request. * tools/js/v3-models.js: * unit-tests/privileged-api-tests.js: Added unit tests for PrivilegedAPI. * unit-tests/resources/mock-remote-api.js: (MockRemoteAPI.postJSON): Added for unit testing. (MockRemoteAPI.postJSONWithStatus): Ditto. 2016-06-13 Ryosuke Niwa /admin/tests is very slow https://bugs.webkit.org/show_bug.cgi?id=158682 Reviewed by Chris Dumez. The slowness came from TestNameResolver::__construct, which was fetching the entire table of test_configurations, which at this point contains more than 32,000 rows. Don't fetch the entire table in the constructor. Instead, fetch a subset of rows as needed in configurations_for_metric_and_platform. Even though this results in many SQL queries being issued, that's a lot more efficient in practice because we only fetch a few dozen rows in practice. Also removed a whole bunch of features from /admin/tests to simplify the page. In particular, the ability to update the list of triggerables has been removed now that sync-buildbot.js automatically updates that for us. This removed the last use of test_exists_on_platform, which was also dependent on fetching test_configurations upfront. * public/admin/tests.php: * public/include/test-name-resolver.php: (TestNameResolver::__construct): Don't fetch the entire table of test_configurations. (TestNameResolver::configurations_for_metric_and_platform): Just issue a SQL query for the specified platform and metric. (TestNameResolver::test_exists_on_platform): Removed. 2016-06-08 Ryosuke Niwa sync-buildbot.js should update the list of tests and platforms associated with a triggerable https://bugs.webkit.org/show_bug.cgi?id=158406 Reviewed by Chris Dumez. Add /api/update-triggerable and a test for it, which were supposed to be added in r201718 but for which I forgot to run svn add. * public/api/update-triggerable.php: Added. (main): * server-tests/api-update-triggerable.js: Added. 2016-06-07 Ryosuke Niwa Build fix after r201739. attachShadow was throwing an exception on this component. * public/v3/pages/analysis-category-toolbar.js: (AnalysisCategoryToolbar): 2016-06-06 Ryosuke Niwa sync-buildbot.js should update the list of tests and platforms associated with a triggerable https://bugs.webkit.org/show_bug.cgi?id=158406 Reviewed by Darin Adler. Added /api/update-triggerable to update the list of configurations (platform and test pairs) associated with a given triggerable, and make sync-buildbot.js use this JSON API before each syncing cycle so that the association gets updated automatically by simply updating the JSON. * server-tests/api-manifest.js: Use const for imported modules. * server-tests/api-report-commits-tests.js: Removed unnecessary importing of crypto. * server-tests/resources/mock-data.js: (MockData.someTestId): Added. (MockData.somePlatformId): Added. (MockData.addMockData): * server-tests/tools-buildbot-triggerable-tests.js: Use const for imported modules. Also added a test for BuildbotTriggerable's updateTriggerable. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype.updateTriggerable): Added. Find the list of all configurations associated with this triggeerable and post it to /api/update-triggerable. * tools/js/database.js: Added triggerable_configurations to the list of tables. * tools/js/remote.js: (RemoteAPI.prototype.postJSON): Print the whole response when JSON parsing fails for debugging. * tools/sync-buildbot.js: (syncLoop): Call BuildbotTriggerable's updateTriggerable before syncing. 2016-06-02 Ryosuke Niwa Build fix after r201564. * public/v3/pages/analysis-category-page.js: (AnalysisCategoryPage.prototype.updateFromSerializedState): * public/v3/pages/create-analysis-task-page.js: (CreateAnalysisTaskPage.prototype.updateFromSerializedState): (CreateAnalysisTaskPage.prototype.render): 2016-05-31 Ryosuke Niwa v3 UI should support marking and unmarking outliers as well as hiding them https://bugs.webkit.org/show_bug.cgi?id=158248 Rubber-stamped by Chris Dumez. Added the support for marking and unmarking a sequence of points as outliers. Unlike v2, we now support marking multiple points as outliers in a single click. Also fixed a bug that outliers are never explicitly hidden in v3 UI. This patch splits ChartStyles.createChartSourceList into two functions: resolveConfiguration and createSourceList to separate the work of resolving platform and metric IDs to their respective model objects, and creating a source list used by TimeSeriesChart to fetch measurement sets. createSourceList is called again when filtering options are changed. It also adds noCache option to TimeSeriesChart's fetchMeasurementSets, MeasurementSet's fetchBetween and _fetchPrimaryCluster to update the measurement sets after marking or unmarking points as outliers. In addition, it fixes a bug that the annotation bars for analysis tasks are not updated in charts page after creating an analysis task by adding noCache option to ChartPaneBase's fetchAnalysisTasks, AnalysisTask's fetchByPlatformAndMetric and _fetchSubset. Finally, this patch splits ChartPane._makeAnchorToOpenPane into _makePopoverActionItem, _makePopoverOpenOnHover and _setPopoverVisibility for clarity. * public/v3/components/chart-pane-base.js: (ChartPaneBase): Added _disableSampling and _showOutliers as instance variables. (ChartPaneBase.prototype.configure): (ChartPaneBase.prototype.isSamplingEnabled): Added. (ChartPaneBase.prototype.setSamplingEnabled): Added. When a filtering option is updated, recreate the source list so that TimeSeriesChart.setSourceList can re-fetch the measurement set JSONs. (ChartPaneBase.prototype.isShowingOutliers): Added. (ChartPaneBase.prototype.setShowOutliers): Added. Ditto for calling _updateSourceList. (ChartPaneBase.prototype._updateSourceList): Added. (ChartPaneBase.prototype.fetchAnalysisTasks): Renamed from _fetchAnalysisTasks. Now takes noCache as an argument instead of platform and metric IDs since they're on instance variables. * public/v3/components/chart-styles.js: (ChartStyles.resolveConfiguration): Renamed from createChartSourceList. Just resolves platform and metric IDs. (ChartStyles.createSourceList): Extracted from createChartSourceList since it needs to be called when a filtering option is changed as well as when ChartPaneBase.prototype.configure is called. (ChartStyles.baselineStyle): Now takes filtering options. (ChartStyles.targetStyle): Ditto. (ChartStyles.currentStyle): Ditto. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype.currentPoint): Find the point in _fetchedTimeSeries when _sampledTimeSeriesData hasn't been computed yet as a fallback (e.g. when the chart hasn't been rendered yet). (InteractiveTimeSeriesChart.prototype.selectedPoints): Added. (InteractiveTimeSeriesChart.prototype.firstSelectedPoint): Added. (InteractiveTimeSeriesChart.prototype.lockedIndicator): Added. Returns the current point if it's locked. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype.setDomain): (TimeSeriesChart.prototype.setSourceList): Added. Re-create _fetchedTimeSeries when filtering options have changed. Don't re-fetch measurement set JSONs here since showing outliers can be done entirely in the front end. (TimeSeriesChart.prototype.fetchMeasurementSets): Extracted out of setDomain. Now takes noCache as an argument. ChartPane._markAsOutlier (TimeSeriesChart.prototype.firstSampledPointBetweenTime): Added. * public/v3/models/analysis-task.js: (AnalysisTask.fetchByPlatformAndMetric): Added noCache as an argument. (AnalysisTask._fetchSubset): Ditto. * public/v3/models/measurement-adaptor.js: (MeasurementAdaptor.prototype.isOutlier): Added. (MeasurementAdaptor.prototype.applyToAnalysisResults): Add markedOutlier as a property on each point. * public/v3/models/measurement-cluster.js: (MeasurementCluster.prototype.addToSeries): Fixed the bug that filtering outliers was broken as _markedOutlierIndex is undefined here. Use MeasurementAdaptor's isOutlier instead. * public/v3/models/measurement-set.js: (MeasurementSet.prototype.fetchBetween): Added noCache as an argument. Reset _primaryClusterPromise and _allFetches when noCache is true since we need to re-fetch the primary cluster as well as all secondary clusters now. (MeasurementSet.prototype._fetchPrimaryCluster): Added noCache as an argument. Directly invoke the JSON API at /api/measurement-set to re-generate all clusters' JSON files instead of first fetching the cached version. (MeasurementSet.prototype._fetchSecondaryCluster): (MeasurementSet.prototype._didFetchJSON): Removed a bogus assertion since this function is called on secondary clusters as well as primary clusters. (MeasurementSet.prototype._addFetchedCluster): Reimplemented this function using an insertion sort. Also remove the existing entry if the fetch cluster should replace it. * public/v3/models/time-series.js: (TimeSeries.prototype.dataBetweenPoints): Removed the dead code to filter out outliers. This is done in addToSeries of MeasurementCluster instead. * public/v3/pages/chart-pane.js: (ChartPane): Renamed pane to popover since it was confusing to have a pane inside a pane class. As such, renamed _paneOpenedByClick to _lockedPopover. (ChartPane.prototype.serializeState): Added the code to serialize filtering options in the serialized state URL. (ChartPane.prototype.updateFromSerializedState): Ditto for parsing. (ChartPane.prototype._analyzeRange): Extracted out of render(). Also fixed a bug that the charts page don't show the newly created analysis task by invoking fetchAnalysisTasks with noCache set to true. (ChartPane.prototype._markAsOutlier): Added. (ChartPane.prototype._renderActionToolbar): A bunch of changes due to pane -> popover rename. Also added a popover for filtering options. (ChartPane.prototype._makePopoverActionItem): Extracted from _makeAnchorToOpenPane. (ChartPane.prototype._makePopoverOpenOnHover): Ditto. (ChartPane.prototype._setPopoverVisibility): Ditto. (ChartPane.prototype._renderFilteringPopover): Added. (ChartPane.htmlTemplate): Added a popover for specifying filtering options. Also added .popover on each popover. (ChartPane.cssTemplate): Updated the style to make use of .popover. * public/v3/pages/charts-page.js: (ChartsPage.prototype.graphOptionsDidChange): Added. Updates the URL state when a filtering option is modified. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype._createChartForCell): * public/v3/pages/page-router.js: (PageRouter.prototype._serializeHashQueryValue): Serialize a set of strings as | separated tokens. (PageRouter.prototype._deserializeHashQueryValue): Rewrote the function as the serialized URL can no longer be parsed as a JSON as | separated tokens can't be converted into a valid JSON construct with a simple regex. * unit-tests/measurement-set-tests.js: Added a test case for fetchBetween with noCache=true. 2016-05-24 Ryosuke Niwa Another build fix after r201307. * public/v3/pages/page-router.js: (PageRouter.prototype._deserializeHashQueryValue): (PageRouter.prototype._countOccurrences): Moved from _deserializeHashQueryValue. 2016-05-23 Ryosuke Niwa Build fix after r201307. * public/v3/pages/chart-pane.js: (ChartPane.prototype.serializeState): 2016-05-23 Ryosuke Niwa Some applications truncates the last closing parenthesis in perf dashboard URL https://bugs.webkit.org/show_bug.cgi?id=157976 Reviewed by Tim Horton. Unfortunately, different applications use different heuristics to determine the end of each URL. Two trailing parentheses, for example, is just fine in Radar as well as Apple Mail if the URL is short enough. Using other characters such as ] and } wouldn't work either because they would be %-escaped. At that point, we might as well as %-escape everything. Work around the bug by parsing the URL as if it had one extra ')' if the parsing had failed. Also shorten the charts page's URL by avoid emitting "-null" for each pane when the pane doesn't have a currently selected point or selection. This improves the odds of the entire URL being recognized by various applications. We could, in theory, implement some sort of a URL shorter but that can wait until when we support real user accounts. * public/v3/pages/chart-pane.js: (ChartPane.prototype.serializeState): Don't serialize the selection or the current point if nothing is selected. * public/v3/pages/page-router.js: (PageRouter.prototype._deserializeHashQueryValue): Try parsing the value again with one extra ] at the end if the JSON parsing had failed. 2016-05-18 Ryosuke Niwa Perf dashboard "Add pane" should list first by test, then by machine https://bugs.webkit.org/show_bug.cgi?id=157880 Reviewed by Stephanie Lewis. Reversed the order which tests and platforms are selected. Also split .pane-selector-container into #tests and #platform for the ease of DOM node manipulations. * public/v3/components/pane-selector.js: (PaneSelector): (PaneSelector.prototype._renderPlatformList): Renamed from _renderPlatformLists since there is a single list for platforms. This list now disappears while a non-metric item is selected in the collection of test lists. e.g. "Speedometer" instead of its "Score" metric. Remember the last metric we rendered to avoid churning. (PaneSelector.prototype._renderTestLists): Render the top level tests once. The index of lists have been decreased by one since test lists are now inside #tests instead of appearing after the platform list. (PaneSelector.prototype._buildTestList): Don't filter tests since platform is chosen after tests now. (PaneSelector.prototype._replaceList): (PaneSelector.prototype._selectedItem): Don't reset the test path (specifies which subtest or metric is picked) when a platform is selected since it happens after a test metric is chosen now. (PaneSelector.prototype._clickedItem): Add a pane when a platform is clicked, not when a metric is clicked. (PaneSelector.cssTemplate): 2016-05-18 Ryosuke Niwa Analysis task should look for a git commit based on abridged hashes https://bugs.webkit.org/show_bug.cgi?id=157877 Reviewed by Chris Dumez. Made /privileged-api/associate-commit look for commits using LIKE instead of an exact match. Associate the commit when there is exactly one match. * public/include/commit-log-fetcher.php: (CommitLogFetcher::fetch_between): * public/include/db.php: (Database::escape_for_like): Extracted from CommitLogFetcher::fetch_between. * public/privileged-api/associate-commit.php: (main): Look for the commits using LIKE. Reject whenever there are multiple commits. We limit the number of matches to two for performance when the user specifies something that almost thousands of commits: e.g. "1". * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype._associateCommit): Added human friendly error messages for mismatching commits. 2016-05-18 Ryosuke Niwa Unreviewed build fix. Use --date-order so that every child commit appears after its parent. Otherwise we'll hit a FailedToFindParentCommit error while submitting a commit that appears before its parent. * tools/sync-commits.py: (GitRepository._fetch_all_hashes): 2016-05-18 Ryosuke Niwa Removed the erroneously committed debug code. * tools/sync-commits.py: (GitRepository.fetch_commit): 2016-05-18 Ryosuke Niwa Perf dashboard should have a script to sync git commits https://bugs.webkit.org/show_bug.cgi?id=157867 Reviewed by Chris Dumez. Added the support to pull from a Git repo to pull-svn.py and renamed it to sync-commits.py. Added two classes SVNRepository and GitRepository which inherits from an abstract class, Repository. The code that fetches commit and format revision number / git hash is specialized in each. * Install.md: * tools/pull-svn.py: Removed. * tools/sync-commits.py: Renamed from Websites/perf.webkit.org/tools/pull-svn.py. (main): Renamed --svn-config-json to --repository-config-json. Also made it robust against exceptions inside fetch_commits_and_submit of each Repository class. (load_repository): A factory function for SVNRepository and GitRepository. (Repository): Added. (Repository.__init__): Added. (Repository.fetch_commits_and_submit): Extracted from standalone fetch_commits_and_submit. (Repository.fetch_commit): Added. Implemented by a subclass. (Repository.format_revision): Ditto. (Repository.determine_last_reported_revision): Extracted from alonealone determine_first_revision_to_fetch. The fallback to use "oldest" has been moved to SVNRepository's fetch_commit since it doesn't work in Git. (Repository.fetch_revision_from_dasbhoard): Extracted from fetch_revision_from_dasbhoard. (SVNRepository): Added. (SVNRepository.__init__): Added. (SVNRepository.fetch_commit): Extracted from standalone fetch_commit_and_resolve_author and fetch_commit. (SVNRepository._resolve_author_name): Renamed from resolve_author_name_from_account. (SVNRepository.format_revision): Added. (GitRepository): Added. (GitRepository.__init__): (GitRepository.fetch_commit): Added. Fetches the list of all git hashes if needed, and finds the next hash. (GitRepository._find_next_hash): Added. Finds the first commit that appears after the specified hash. (GitRepository._fetch_all_hashes): Added. Gets the list of all git hashs chronologically (old to new). (GitRepository._run_git_command): Added. (GitRepository.format_revision): Added. Use the first 8 characters of the hash. 2016-05-17 Ryosuke Niwa Add a subtitle under platform name in the summary page https://bugs.webkit.org/show_bug.cgi?id=157809 Reviewed by Chris Dumez. Add a description beneath the platform names. * public/v3/pages/summary-page.js: (SummaryPage.prototype._constructTable): Add a br and a span if subtitle is present. (SummaryPage.cssTemplate): Added CSS rules for .subtitle. 2016-05-13 Ryosuke Niwa v3 UI shows full git hash instead of the first 8 characters for a blame range https://bugs.webkit.org/show_bug.cgi?id=157691 Reviewed by Stephanie Lewis. Fixed the bug that v3 UI shows the full 40 character git hash instead of the first 8 character as done in v2 UI. * public/v3/models/commit-log.js: (CommitLog.prototype.diff): Fixed the bug. * tools/run-tests.py: (main): Add the support for running a subset of tests as mocha does. * unit-tests/commit-log-tests.js: Added. 2016-05-13 Ryosuke Niwa Unreviewed. Added the missing executable bits. * tools/bundle-v3-scripts.py: Added property svn:executable. * tools/detect-changes.js: Added property svn:executable. * tools/process-maintenance-backlog.py: Added property svn:executable. 2016-05-13 Ryosuke Niwa Summary page doesn't report some missing platforms https://bugs.webkit.org/show_bug.cgi?id=157670 Reviewed by Darin Adler. This patch improves the warning text for missing platforms and fixes the bug that platforms that don't have any data reported for a given test would not be reported as missing. * public/v3/pages/summary-page.js: (SummaryPage.prototype.render): Added instrumentations. (SummaryPage.prototype._constructRatioGraph): Always create both the ratio bar graph and the spinner icon. (SummaryPage.prototype._renderCell): Extracted from _constructRatioGraph. Toggle the displayed-ness of the spinner and the ratio bar graph in the cell by CSS for better performance. (SummaryPage.prototype._warningTextForGroup): Extracted from _constructRatioGraph. Rephrased warning text for clarity and adopted new API of SummaryPageConfigurationGroup. (SummaryPage.prototype._warningTextForGroup.mapAndSortByName): Added. (SummaryPage.prototype._warningTextForGroup.pluralizeIfNeeded): Added. (SummaryPage.cssTemplate): Added rules to toggle the visibility of spinner icons and bar graphs. (SummaryPageConfigurationGroup): Replaced this._warnings by more explicitly named this._missingPlatforms and this._platformsWithoutBaseline. Also add a platform to this._missingPlatforms if it didn't appear in any metrics. Note that adding a platform whenever it doesn't in any one metric would be incorrect since some tests uses a different test name on different platforms: e.g. PLT-Mac and PLT-iPhone. (SummaryPageConfigurationGroup.prototype.missingPlatforms): Added. (SummaryPageConfigurationGroup.prototype.platformsWithoutBaseline): Added. (SummaryPageConfigurationGroup.prototype._fetchAndComputeRatio): 2016-05-13 Ryosuke Niwa Always use v3 UI for dashboards and analysis task pages https://bugs.webkit.org/show_bug.cgi?id=157647 Reviewed by Darin Adler. Redirect dashboard pages from v1 and v2 to v3's summary page. Also redirect v1 UI's charts page and v2 UI's analysis task pages to the corresponding v3 pages. Keep v2's charts page accessible since some features such as segmentation is still only available on v2 UI. * public/index.html: (init.showCharts): Redirect to v3 UI once the chart list has been parsed. (init.redirectChartsToV3): Added. * public/v2/index.html: 2016-05-13 Ryosuke Niwa Show a spinner while fetching data on summary page https://bugs.webkit.org/show_bug.cgi?id=157658 Reviewed by Darin Adler. Show a spinner while fetching JSON files on the summary page. * public/v3/components/base.js: (ComponentBase.prototype.renderReplace): Added a new implementation that simply calls the static version. (ComponentBase.renderReplace): Made this static. * public/v3/pages/summary-page.js: (SummaryPage.prototype._constructRatioGraph): Show a spinner icon when SummaryPageConfigurationGroup's isFetching returns true. (SummaryPage.cssTemplate): Force the height of each cell to be 2.5rem so that the height of cell doesn't change when a spinner is replaced by a ratio bar graph. (SummaryPageConfigurationGroup): Added this._isFetching as an instance variable. (SummaryPageConfigurationGroup.prototype.isFetching): Added. (SummaryPageConfigurationGroup.prototype.fetchAndComputeSummary): Set this._isFetching while waiting for the promises to resolve after 50ms. We don't immediately set this._isFetching to avoid FOC when all JSON files have been cached. 2016-05-07 Ryosuke Niwa Add horizontal between categories of tests https://bugs.webkit.org/show_bug.cgi?id=157386 Reviewed by Darin Adler. Wrap tests in each category by tbody and add a horizontal bar between each category. * public/v3/pages/summary-page.js: (SummaryPage.prototype._constructTable): (SummaryPage.cssTemplate): 2016-05-04 Dewei Zhu Summary page should show warnings when current or baseline data is missing. https://bugs.webkit.org/show_bug.cgi?id=157339 Reviewed by Ryosuke Niwa. Set summary page to be the default page of v3 UI. Show warning icon when either baseline or current data is missing. Make fetchBetween returns a promise. Update unit tests for MeasurementSet.fetchBetween since it returns a promise now. Add a workaround to skip some platform and metric configurations. * public/v3/components/ratio-bar-graph.js: (RatioBarGraph): (RatioBarGraph.prototype.update): Add showWarningIcon flag to indicate whether we should show warning icon. (RatioBarGraph.prototype.render): Show warning icon when showWarningIcon is true. (RatioBarGraph.cssTemplate): Add style for warning icon. * public/v3/components/warning-icon.js: Add warning icon. (WarningIcon): (WarningIcon.cssTemplate): * public/v3/index.html: * public/v3/main.js: (main): Set summary page to be the default page of v3 UI. * public/v3/models/measurement-set.js: (MeasurementSet): (MeasurementSet.prototype.fetchBetween): Returns a promise. Fix the bug in previous implementation that we miss some callbacks sometimes. Basically, we will fetch primary cluster first, then secondary clusters. For each secondary cluster fetch, we will always invoke callback even when it fails. (MeasurementSet.prototype._fetchSecondaryClusters): Deleted. (MeasurementSet.prototype._fetch.else.url.api.measurement.set platform): Deleted. * public/v3/pages/summary-page.js: (SummaryPage): Add a variable for excluded configurations. (SummaryPage.prototype._createConfigurationGroup): Pass excluded configurations while building config groups. (SummaryPage.prototype._constructTable): Remove the logic for unified header since it breaks consistency of the table appearance. (SummaryPage.prototype.this._renderQueue.push): Show warning message when baseline/current data is missing. (SummaryPageConfigurationGroup): Add a variable to keep track of the warnings while computing summary. (SummaryPageConfigurationGroup.prototype.warnings): A getter for warnings. (SummaryPageConfigurationGroup._computeSummary): Fix a bug in calculating ratios. We should always use current/baseline for ratio and present the difference between ratio and 1 in the summary page. (SummaryPageConfigurationGroup.set then): Deleted. (SummaryPageConfigurationGroup.set var): Deleted. * unit-tests/measurement-set-tests.js: Add a helper function to wait for fetchBetween. Update unit tests since fetchBetween returns a promise now. (promise.set fetchBetween): (set MeasurementSet): (set fetchBetween): Deleted. 2016-04-26 Ryosuke Niwa Chart status should always be computed against prior values https://bugs.webkit.org/show_bug.cgi?id=157014 Reviewed by Darin Adler. Compare the current value against the last baseline or target value that appear before the current value in time so that the comparison stay the same even when new baseline and target values are reported. Also include the compared baseline or target value in the label for clarity. * public/v3/components/chart-status-view.js: (ChartStatusView.prototype._computeChartStatus): (ChartStatusView.prototype._computeChartStatus.labelForDiff): (ChartStatusView.prototype._findLastPointPriorToTime): Extracted from _relativeDifferenceToLaterPointInTimeSeries. Now finds the last point before the current point's time if there is any, or the last point in baseline / target. (ChartStatusView.prototype._relativeDifferenceToLaterPointInTimeSeries): Deleted. * public/v3/models/metric.js: (Metric.prototype.makeFormatter): Don't use SI units for unit-less metrics. 2016-04-13 Ryosuke Niwa REGRESSION(r199444): Perf dashboard always fetches all measurement sets https://bugs.webkit.org/show_bug.cgi?id=156534 Reviewed by Darin Adler. The bug was cased by SummaryPage's constructor fetching all measurement sets. Since each page is always constructed in main(), this resulted in all measurement sets being fetched on all pages. * public/v3/pages/summary-page.js: (SummaryPage): (SummaryPage.prototype.open): Fetch measurement set JSONs here. (SummaryPage.prototype._createConfigurationGroup): Renamed from _createConfigurationGroupAndStartFetchingData. 2016-04-12 Ryosuke Niwa Add a summary page to v3 UI https://bugs.webkit.org/show_bug.cgi?id=156531 Reviewed by Stephanie Lewis. Add new "Summary" page, which shows the average difference (better or worse) from the baseline across multiple platforms and tests by a single number. * public/include/manifest.php: (ManifestGenerator::generate): Include "summary" in manifest.json. * public/shared/statistics.js: (Statistics.mean): Added. (Statistics.median): Added. * public/v3/components/ratio-bar-graph.js: Added. (RatioBarGraph): Shows a horizontal bar graph that visualizes the relative difference (e.g. 3% better). (RatioBarGraph.prototype.update): (RatioBarGraph.prototype.render): (RatioBarGraph.cssTemplate): (RatioBarGraph.htmlTemplate): * public/v3/index.html: * public/v3/main.js: (main): Instantiate SummaryPage and add it to the navigation bar and the router. * public/v3/models/manifest.js: (Manifest._didFetchManifest): Let "summary" pass through from manifest.json to main(). * public/v3/models/measurement-set.js: (MeasurementSet.prototype._failedToFetchJSON): Invoke the callback with an error or true in order for the callback can detect a failure. (MeasurementSet.prototype._invokeCallbacks): Ditto. * public/v3/pages/charts-page.js: (ChartsPage.createStateForConfigurationList): Added to add a hyperlink from summary page to charts page. * public/v3/pages/summary-page.js: Added. (SummaryPage): Added. (SummaryPage.prototype.routeName): Added. (SummaryPage.prototype.open): Added. (SummaryPage.prototype.render): Added. (SummaryPage.prototype._createConfigurationGroupAndStartFetchingData): Added. (SummaryPage.prototype._constructTable): Added. (SummaryPage.prototype._constructRatioGraph): Added. (SummaryPage.htmlTemplate): Added. (SummaryPage.cssTemplate): Added. (SummaryPageConfigurationGroup): Added. Represents a set of platforms and tests shown in a single cell. (SummaryPageConfigurationGroup.prototype.ratio): Added. (SummaryPageConfigurationGroup.prototype.label): Added. (SummaryPageConfigurationGroup.prototype.changeType): Added. (SummaryPageConfigurationGroup.prototype.configurationList): Added. (SummaryPageConfigurationGroup.prototype.fetchAndComputeSummary): Added. (SummaryPageConfigurationGroup.prototype._computeSummary): Added. (SummaryPageConfigurationGroup.prototype._fetchAndComputeRatio): Added. Invoked for each time series in the set, and stores the computed ratio of the current values to the baseline in this._setToRatio. The results are aggregated by _computeSummary as a single number later. (SummaryPageConfigurationGroup._medianForTimeRange): Added. (SummaryPageConfigurationGroup._fetchData): A thin wrapper to make MeasurementSet.fetchBetween promise friendly since MeasurementSet doesn't support Promise at the moment (but it should!). * server-tests/api-manifest.js: Updated a test case. 2016-04-12 Ryosuke Niwa Make sync-buildbot.js fault safe https://bugs.webkit.org/show_bug.cgi?id=156498 Reviewed by Chris Dumez. Fixed a bug that sync-buildbot.js will continue to schedule build requests from multiple test groups if multiple test groups are simultaneously in-progress on the same builder. Also fixed a bug that if a build request had failed without leaving a trace (i.e. no entry on any of the builders we know of), sync-buildbot.js throws an exception. * server-tests/tools-buildbot-triggerable-tests.js: Added test cases. * tools/js/buildbot-syncer.js: (BuildbotSyncer.prototype.scheduleRequestInGroupIfAvailable): Renamed. Optionally takes the slave name. When this parameter is specified, schedule the request only if the specified slave is available. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._scheduleNextRequestInGroupIfSlaveIsAvailable): Always use scheduleRequestInGroupIfAvailable to schedule a new build request. Using scheduleRequest for non-first build requests was problematic when there were multiple test groups with pending requests because then we would schedule those pending requests without checking whether there is already a pending job or if we have previously scheduled a job. Also fallback to use any syncer / builder when groupInfo.syncer is not set even if the next request was not the first one in the test group since we can't determine on which builder preceding requests are processed in such cases. * unit-tests/buildbot-syncer-tests.js: 2016-04-11 Ryosuke Niwa Replace script runner to use mocha.js tests https://bugs.webkit.org/show_bug.cgi?id=156490 Reviewed by Chris Dumez. Replaced run-tests.js, which was a whole test harness for running legacy tests by tools/run-tests.py which is a thin wrapper around mocha.js. * run-tests.js: Removed. * tests: Removed. * tools/run-tests.py: Added. (main): 2016-04-11 Ryosuke Niwa New syncing script sometimes schedules a build request on a wrong builder https://bugs.webkit.org/show_bug.cgi?id=156489 Reviewed by Stephanie Lewis. The bug was caused by _scheduleNextRequestInGroupIfSlaveIsAvailable scheduling the next build request on any available syncer regardless of whether the request is the first one in the test group or not because BuildRequest.order was returning a string instead of a number. Also fixed a bug that BuildbotTriggerable.syncOnce was re-ordering test groups by their id's instead of respecting the order in which the perf dashboard returned. * public/v3/models/build-request.js: (BuildRequest.prototype.order): Force the order to be a number. * server-tests/api-build-requests-tests.js: Assert the order as numbers. * server-tests/resources/mock-data.js: (MockData.addAnotherMockTestGroup): Changed the test group id to 601, which is after the first mock data. The old number was masking a bug in BuildbotTriggerable that it was re-ordering test groups by their id's instead of using the order set forth by the perf dashboard. (MockData.mockTestSyncConfigWithSingleBuilder): * server-tests/tools-buildbot-triggerable-tests.js: Added a test case for scheduling two build requests in a single call to syncOnce. Each build request should be scheduled on the same builder as the previous build requests in the same test group. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype.syncOnce): Order test groups by groupOrder, which is the index at which first build request in the group appeared. (BuildbotTriggerable.prototype._scheduleNextRequestInGroupIfSlaveIsAvailable): Don't re-order build requests as they're already sorted on the server side. (BuildbotTriggerable._testGroupMapForBuildRequests): Added groupOrder to test group info 2016-04-09 Ryosuke Niwa Build fix. Don't treat a build number 0 as a pending build. * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.prototype.isPending): 2016-04-08 Ryosuke Niwa Escape builder names in url* and pathFor* methods of BuildbotSyncer https://bugs.webkit.org/show_bug.cgi?id=156427 Reviewed by Darin Adler. The build fix in r199251 breaks other usage of RemoteAPI. Fix it properly by escaping builder names in various methods of BuildbotSyncer. Also fixed a typo in the logging and a bug that the new syncing script never updated "scheduled" to "running". * server-tests/resources/mock-data.js: (MockData.mockTestSyncConfigWithTwoBuilders): Renamed "some-builder-2" to "some builder 2" to test the new escaping behavior in tools-buildbot-triggerable-tests.js and buildbot-syncer-tests.js. * server-tests/tools-buildbot-triggerable-tests.js: Added tests for status url, and added a new test case for updating "scheduled" to "running". * tools/js/buildbot-syncer.js: (BuildbotBuildEntry.buildRequestStatusIfUpdateIsNeeded): Update the status to "running" when the request's status is "scheduled" and the buildbot's build is currently in progress. (BuildbotSyncer.prototype.pathForPendingBuildsJSON): Escape the builder name. (BuildbotSyncer.prototype.pathForBuildJSON): Ditto. (BuildbotSyncer.prototype.pathForForceBuild): Ditto. (BuildbotSyncer.prototype.url): Ditto. (BuildbotSyncer.prototype.urlForBuildNumber): Ditto. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._pullBuildbotOnAllSyncers): (BuildbotTriggerable.prototype._scheduleNextRequestInGroupIfSlaveIsAvailable): Fixed a typo. We are scheduling new build requests, not syncing them. * tools/js/remote.js: (RemoteAPI.sendHttpRequest): Reverted r199251. * unit-tests/buildbot-syncer-tests.js: 2016-04-08 Ryosuke Niwa Build fix. We need to escape the path or http.request would fail. * tools/js/remote.js: 2016-04-08 Ryosuke Niwa Fix various bugs in the new syncing script https://bugs.webkit.org/show_bug.cgi?id=156393 Reviewed by Darin Adler. * server-tests/resources/common-operations.js: Added. This file was supposed to be added in r199191. (addBuilderForReport): (addSlaveForReport): (connectToDatabaseInEveryTest): (submitReport): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._pullBuildbotOnAllSyncers): Don't log every time we pull from buildbot builder as this dramatically increases the amount of log we generate. * tools/js/parse-arguments.js: (parseArguments): Fixed a typo. This should be parseArgument*s*, not parseArgument. * tools/js/remote.js: (RemoteAPI.prototype.url): Fixed a bug that portSuffix wasn't being expanded in the template literal. (RemoteAPI.prototype.configure): Added more validations with nice error messages. (RemoteAPI.prototype.sendHttpRequest): Falling back to port 80 isn't right when scheme is https. Compute the right port in configure instead based on the scheme. * tools/sync-buildbot.js: (syncLoop): Fixed the bug that syncing multiple times fail because Manifest.fetch() create new Platform and Test objects. This results in various references in BuildRequest objects to get outdated. Fixing this properly in Manifest.fetch() because we do need to "forget" about some tests and platforms in some cases. For now, delete all v3 model objects and start over in each syncing cycle. * unit-tests/tools-js-remote-tests.js: Added. Unit tests for the aforementioned changes to RemoteAPI. 2016-04-07 Ryosuke Niwa sync-buildbot.js doesn't mark disappeared builds as failed https://bugs.webkit.org/show_bug.cgi?id=156386 Reviewed by Chris Dumez. Fix a bug that new syncing script doesn't mark builds that it scheduled but doesn't appear when queried by buildbot's JSON API. These are builds that got canceled by humans (e.g. buildbot was restarted, data loss, pending build was canceled, etc...) * server-tests/tools-buildbot-triggerable-tests.js: Added a test case. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._pullBuildbotOnAllSyncers): Added a set of build requests we've matched against BuildbotBuildEntry's. Mark build requests that didn't have any entry but supposed to be in either 'scheduled' or 'running' status as failed. 2016-04-07 Ryosuke Niwa A/B testing bots should prioritize user created test groups https://bugs.webkit.org/show_bug.cgi?id=156375 Reviewed by Chris Dumez. Order build requests preferring user created ones over ones automatically created by detect-changes.js. Also fixed a bug in BuildbotSyncer.scheduleFirstRequestInGroupIfAvailable that it was scheduling a new build request on a builder/slave even when we had previously scheduled another build request. * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::fetch_incomplete_requests_for_triggerable): Order build requested based on author_order which is 0 when it's created by an user and 1 when it's created by detect-changes.js. Since we're using ascending order, this would put user created test groups first. * server-tests/api-build-requests-tests.js: Updated an existing test case and added a new test case for testing that build requests for an user created test group shows up first. * server-tests/resources/mock-data.js: (MockData.addAnotherMockTestGroup): Takes an extra argument to specify the author name. * server-tests/tools-buildbot-triggerable-tests.js: Added a test case for testing that build requests for an user created test group shows up first. * tools/js/buildbot-syncer.js: (BuildbotSyncer): Added _slavesWithNewRequests to keep track of build slaves on which we have already scheduled new build requests. Don't schedule more requests on these slaves. (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer.prototype.scheduleFirstRequestInGroupIfAvailable): Add the specified slave name (or null when slaveList is not specified) to _slavesWithNewRequests. (BuildbotSyncer.prototype.pullBuildbot): Clear the set after pulling buildbot since any build request we have previously scheduled should be included in one of the entires now. * unit-tests/buildbot-syncer-tests.js: Added test cases for the aforementioned bug. (sampleiOSConfig): Added a second slave for new test cases. 2016-04-07 Ryosuke Niwa Migrate legacy perf dashboard tests to mocha.js based tests https://bugs.webkit.org/show_bug.cgi?id=156335 Reviewed by Chris Dumez. Migrated all legacy run-tests.js tests to mocha.js based tests. Since the new harness uses Promise for most of asynchronous operations, refactored the tests to use Promises as well, and added more assertions where appropriate. Also consolidated common helper functions into server-tests/resources/common-operations.js. Unfortunately there were multiple inconsistent implementations of addBuilder/addSlave. Some were taking an array of reports while others were taking a single report. New shared implementation in common-operations.js now takes a single report. Also decreased the timeout in most tests from 10s to 1s so that tests fail early when they timeout. Most of tests are passing under 100ms on my computer so 1s should be plenty still. * run-tests.js: Removed. * server-tests/admin-platforms-tests.js: Moved from tests/admin-platforms.js. (reportsForDifferentPlatforms): * server-tests/admin-reprocess-report-tests.js: Moved from tests/admin-reprocess-report.js. (.addBuilder): Moved to common-operations.js. * server-tests/api-build-requests-tests.js: * server-tests/api-manifest.js: Use MockData.resetV3Models() instead of manually clearing maps. * server-tests/api-measurement-set-tests.js: Moved from tests/api-measurement-set.js. (.queryPlatformAndMetric): (.format): * server-tests/api-report-commits-tests.js: Moved from tests/api-report-commits.js. * server-tests/api-report-tests.js: Moved from tests/api-report.js. (.emptyReport): (.emptySlaveReport): (.reportWithSameSubtestName): * server-tests/resources/common-operations.js: Added. (addBuilderForReport): Extracted from tests. (addSlaveForReport): Ditto. (connectToDatabaseInEveryTest): Added. (submitReport): Extracted from admin-platforms-tests.js. * server-tests/resources/test-server.js: (TestServer): Make TestServer a singleton since it doesn't make any sense for each module to start its own Apache instance (that would certainly will fail). * server-tests/tools-buildbot-triggerable-tests.js: * tests: Removed. * tools/js/database.js: (Database.prototype.selectAll): Added. (Database.prototype.selectFirstRow): Added. (Database.prototype.selectRows): Added. Dynamically construct a query string based on arguments. 2016-04-05 Ryosuke Niwa New buildbot syncing scripts that supports multiple builders and slaves https://bugs.webkit.org/show_bug.cgi?id=156269 Reviewed by Chris Dumez. Add sync-buildbot.js that supports scheduling A/B testing jobs on multiple builders and slaves. The old python script (sync-with-buildbot.py) could only support a single builder and slave for each platform, test pair. The main logic is implemented in BuildbotTriggerable.syncOnce. Various helper methods are added throughout the codebase and tests have been refactored. BuildbotSyncer has been updated to support multiple platform, test pairs. It's now responsible for syncing everything on each builder (on a buildbot). Added more unit tests for BuildbotSyncer and server tests for BuildbotTriggerable, and refactored test helpers and mocks as needed. * public/v3/models/build-request.js: (BuildRequest.prototype.status): Added. (BuildRequest.prototype.isScheduled): Added. * public/v3/models/metric.js: (Metric.prototype.fullName): Added. * public/v3/models/platform.js: (Platform): Added the map based on platform name. (Platform.findByName): Added. * public/v3/models/test.js: (Test.topLevelTests): (Test.findByPath): Added. Finds a test based on an array of test names; e.g. ['A', 'B'] would find the test whose name is "B" which has a parent test named "A". (Test.prototype.fullName): Added. * server-tests/api-build-requests-tests.js: (addMockData): Moved to resources/mock-data.js. (addAnotherMockTestGroup): Ditto. * server-tests/resources/mock-data.js: Added. (MockData.resetV3Models): Added. (MockData.addMockData): Moved from api-build-requests-tests.js. (MockData.addAnotherMockTestGroup): Ditto. (MockData.mockTestSyncConfigWithSingleBuilder): Added. (MockData.mockTestSyncConfigWithTwoBuilders): Added. (MockData.pendingBuild): Added. (MockData.runningBuild): Added. (MockData.finishedBuild): Added. * server-tests/resources/test-server.js: (TestServer): (TestServer.prototype.remoteAPI): (TestServer.prototype._ensureTestDatabase): Don't fail even if the test database doesn't exit. (TestServer.prototype._startApache): Create a RemoteAPI instance to access the test sever. (TestServer.prototype._waitForPid): Increase the timeout. (TestServer.prototype.inject): Replace global.RemoteAPI during the test and restore it afterwards. * server-tests/tools-buildbot-triggerable-tests.js: Added. Tests BuildbotTriggerable.syncOnce. (MockLogger): Added. (MockLogger.prototype.log): Added. (MockLogger.prototype.error): Added. * tools/detect-changes.js: (parseArgument): Moved to js/parse-arguments.js. * tools/js/buildbot-syncer.js: (BuildbotBuildEntry): (BuildbotBuildEntry.prototype.syncer): Added. (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): Added. Returns a new status for a build request (of the matching build request ID) if it needs to be updated in the server. (BuildbotSyncer): This class (BuildbotSyncer.prototype.addTestConfiguration): Added. (BuildbotSyncer.prototype.testConfigurations): Returns the list of test configurations. (BuildbotSyncer.prototype.matchesConfiguration): Returns true iff the request can be scheduled on this builder. (BuildbotSyncer.prototype.scheduleRequest): Added. Schedules a new job on buildbot for a request. (BuildbotSyncer.prototype.scheduleFirstRequestInGroupIfAvailable): Added. Schedules a new job for the specified build request on the first slave that's available. (BuildbotSyncer.prototype.pullBuildbot): Return a list of BuildbotBuildEntry instead of an object. Also store it on an instance variable so that scheduleFirstRequestInGroupIfAvailable could use it. (BuildbotSyncer.prototype._pullRecentBuilds): (BuildbotSyncer.prototype.pathForPendingBuildsJSON): Renamed from urlForPendingBuildsJSON and now only returns the path instead of the full URL since RemoteAPI takes a path, not full URL. (BuildbotSyncer.prototype.pathForBuildJSON): Ditto from pathForBuildJSON. (BuildbotSyncer.prototype.pathForForceBuild): Added. (BuildbotSyncer.prototype.url): Use RemoteAPI's url method instead of manually constructing URL. (BuildbotSyncer.prototype.urlForBuildNumber): Ditto. (BuildbotSyncer.prototype._propertiesForBuildRequest): Now that each syncer can have multiple test configurations associated with it, find the one matching for this request. (BuildbotSyncer._loadConfig): Create a syncer per builder and add all test configurations to it. (BuildbotSyncer._validateAndMergeConfig): Added the support for 'SlaveList', which is a list of slave names present on this builder. * tools/js/buildbot-triggerable.js: Added. (BuildbotTriggerable): Added. (BuildbotTriggerable.prototype.name): Added. (BuildbotTriggerable.prototype.syncOnce): Added. The main logic for the syncing script. It pulls existing build requests from the perf dashboard, pulls buildbot for pending and running/completed builds on each builder (represented by each syncer), schedules build requests on buildbot if there is any builder/slave available, and updates the status of build requests in the database. (BuildbotTriggerable.prototype._validateRequests): Added. (BuildbotTriggerable.prototype._pullBuildbotOnAllSyncers): Added. (BuildbotTriggerable.prototype._scheduleNextRequestInGroupIfSlaveIsAvailable): Added. (BuildbotTriggerable._testGroupMapForBuildRequests): Added. * tools/js/database.js: * tools/js/parse-arguments.js: Added. Extracted out of tools/detect-changes.js. (parseArguments): * tools/js/remote.js: (RemoteAPI): Now optionally takes the server configuration. (RemoteAPI.prototype.url): Added. (RemoteAPI.prototype.getJSON): Removed the code for specifying request content. (RemoteAPI.prototype.getJSONWithStatus): Ditto. (RemoteAPI.prototype.postJSON): Added. (RemoteAPI.prototype.postFormUrlencodedData): Added. (RemoteAPI.prototype.sendHttpRequest): Fixed the code to specify auth. * tools/js/v3-models.js: Don't include RemoteAPI here as they require a configuration for each host. * tools/sync-buildbot.js: Added. (main): Added. Parse the arguments and start the loop. (syncLoop): Added. * unit-tests/buildbot-syncer-tests.js: Added tests for pullBuildbot, scheduleRequest, as well as scheduleFirstRequestInGroupIfAvailable. Refactored helper functions as needed. (sampleiOSConfig): (smallConfiguration): Added. (smallPendingBuild): Added. (smallInProgressBuild): Added. (smallFinishedBuild): Added. (createSampleBuildRequest): Create a unique build request for each platform. (samplePendingBuild): Optionally specify build time and slave name. (sampleInProgressBuild): Optionally specify slave name. (sampleFinishedBuild): Ditto. * unit-tests/resources/mock-remote-api.js: (assert.notReached.assert.notReached): (MockRemoteAPI.url): Added. (MockRemoteAPI.postFormUrlencodedData): Added. (MockRemoteAPI._addRequest): Extracted from getJSONWithStatus. (MockRemoteAPI.waitForRequest): Extracted from inject. For tools-buildbot-triggerable-tests.js, we need to instantiate a RemoteAPI for buildbot without replacing global.RemoteAPI. (MockRemoteAPI.inject): (MockRemoteAPI.reset): Added. 2016-03-30 Ryosuke Niwa Simplify API of Test model by removing Test.setParentTest https://bugs.webkit.org/show_bug.cgi?id=156055 Reviewed by Joseph Pecoraro. Removed Test.setParentTest. Keep track of the child-parent relationship using the static map instead. Now each test only stores parent's id and uses the ID static map in Test.parentTest(). * public/v3/models/manifest.js: (Manifest._didFetchManifest.buildObjectsFromIdMap): Removed the code to create the map of child-parent relationship and call setParentTest. * public/v3/models/test.js: (Test): Updated a static map by the name of "childTestMap" to store itself. We should probably sort child tests using some fixed criteria in the future instead of relying on the creation order but preserve the old code's ordering for now. (Test.prototype.parentTest): Look up the static map by the parent test's id. (Test.prototype.onlyContainsSingleMetric): (Test.prototype.setParentTest): Deleted. (Test.prototype.childTests): Look up the child test map. 2016-03-30 Ryosuke Niwa BuildRequest should have associated platform and test https://bugs.webkit.org/show_bug.cgi?id=156054 Reviewed by Joseph Pecoraro. Added methods to retrieve the platform and the test associated with a build request with tests. * public/v3/models/build-request.js: (BuildRequest): (BuildRequest.prototype.platform): Added. (BuildRequest.prototype.test): Added. * server-tests/api-build-requests-tests.js: * server-tests/api-manifest.js: Fixed a typo. This tests /api/manifest, not /api/build-requests. * unit-tests/buildbot-syncer-tests.js: (.createSampleBuildRequest): Now takes Platform and Test objects to avoid hitting assertions in BuildRequest's constructor. 2016-03-30 Ryosuke Niwa BuildRequest should have a method to fetch all in-progress and pending requests for a triggerable https://bugs.webkit.org/show_bug.cgi?id=156008 Reviewed by Darin Adler. Add a method to BuildRequest that fetches all pending and in-progress requests for a triggerable. Now, new syncing scripts must be able to figure out the build slave the first build requests in a given test group had used in order to schedule subsequent build requests in the test group. For this purpose, /api/build-requests has been modified to return all build requests whose test group had not finished yet. A test group is finished if all build requests in the test group had finished (completed, failed, or canceled). * public/include/build-requests-fetcher.php: (BuildRequestFetcher::fetch_incomplete_requests_for_triggerable): Return all build requests in test groups that have not been finished. * public/v3/models/build-request.js: (BuildRequest): (BuildRequest.prototype.testGroupId): Added. (BuildRequest.prototype.isPending): Renamed from hasPending to fix a bad grammar. (BuildRequest.fetchForTriggerable): Added. (BuildRequest.constructBuildRequestsFromData): Extracted from _createModelsFromFetchedTestGroups in TestGroup. * public/v3/models/manifest.js: (Manifest.fetch): Use the full path from root so that it works in server tests. * public/v3/models/test-group.js: (TestGroup.hasPending): (TestGroup._createModelsFromFetchedTestGroups): * server-tests/api-build-requests-tests.js: Added tests to ensure all build requests for a test group is present in the response returned by /api/build-requests iff any build request in the group had not finished yet. (.addMockData): (.addAnotherMockTestGroup): Added. * unit-tests/test-groups-tests.js: 2016-03-29 Ryosuke Niwa Make dependency injection in unit tests more explicit https://bugs.webkit.org/show_bug.cgi?id=156006 Reviewed by Joseph Pecoraro. Make the dependency injection of model objects in unit tests explicit so that server tests that create "real" model objects won't create these mock objects. Now each test that uses mock model objects would call MockModels.inject() to inject before / beforeEach and access each object using a property on MockModels instead of them being implicitly defined on the global object. Similarly, MockRemoteAPI now only replaces global.RemoteAPI during each test so that server tests can use real RemoteAPI to access the test Apache server. * unit-tests/analysis-task-tests.js: * unit-tests/buildbot-syncer-tests.js: (createSampleBuildRequest): * unit-tests/measurement-adaptor-tests.js: * unit-tests/measurement-set-tests.js: * unit-tests/resources/mock-remote-api.js: (MockRemoteAPI.getJSONWithStatus): (MockRemoteAPI.inject): Added. Override RemoteAPI on the global object during each test. * unit-tests/resources/mock-v3-models.js: (MockModels.inject): Added. Create mock model objects before each test, and clear all static maps of various v3 model classes (to remove all singleton objects for those model classes). * unit-tests/test-groups-tests.js: 2016-03-29 Ryosuke Niwa BuildbotSyncer should be able to fetch JSON from buildbot https://bugs.webkit.org/show_bug.cgi?id=155921 Reviewed by Joseph Pecoraro. Added BuildbotSyncer.pullBuildbot which fetches pending, in-progress, and finished builds from buildbot with lots of unit tests as this has historically been a source of subtle bugs in the old script. New implementation fixes a subtle bug in the old pythons script which overlooked the possibility that the state of some builds may change between each HTTP request. In the old script, we fetched the list of the pending builds, and requested -1, -2, etc... builds for N times. But between each request, a pending build may start running or an in-progress build finish and shift the offset by one. The new script avoids this problem by first requesting all pending builds, then all in-progress and finished builds in a single HTTP request. The results are then merged so that entries for in-progress and finished builds would override the entries for pending builds if they overlap. Also renamed RemoteAPI.fetchJSON to RemoteAPI.getJSON to match v3 UI's RemoteAPI. This change makes the class interchangeable between frontend (public/v3/remote.js) and backend (tools/js/remote.js). * server-tests/api-build-requests-tests.js: * server-tests/api-manifest.js: * tools/js/buildbot-syncer.js: (BuildbotBuildEntry): Removed the unused argument "type". Store the syncer as an instance variable as we'd need to query for the buildbot URL. Also fixed a bug that _isInProgress was true for finished builds as 'currentStep' is always defined but null in those builds. (BuildbotBuildEntry.prototype.buildNumber): Added. (BuildbotBuildEntry.prototype.isPending): Added. (BuildbotBuildEntry.prototype.hasFinished): Added. (BuildbotSyncer.prototype.pullBuildbot): Added. Fetches pending builds first and then finished builds. (BuildbotSyncer.prototype._pullRecentBuilds): Added. Fetches in-progress and finished builds. (BuildbotSyncer.prototype.urlForPendingBuildsJSON): Added. (BuildbotSyncer.prototype.urlForBuildJSON): Added. (BuildbotSyncer.prototype.url): Added. (BuildbotSyncer.prototype.urlForBuildNumber): Added. * tools/js/remote.js: (RemoteAPI.prototype.getJSON): Renamed from fetchJSON. (RemoteAPI.prototype.getJSONWithStatus): Renamed from fetchJSONWithStatus. * tools/js/v3-models.js: Load tools/js/remote.js instead of public/v3/remote.js inside node. * unit-tests/buildbot-syncer-tests.js: Added a lot of unit tests for BuildbotSyncer.pullBuildbot (samplePendingBuild): (sampleInProgressBuild): Added. (sampleFinishedBuild): Added. * unit-tests/resources/mock-remote-api.js: (global.RemoteAPI.getJSON): Use the same mock as getJSONWithStatus. 2016-03-24 Ryosuke Niwa Migrate admin-regenerate-manifest.js to mocha.js and test v3 UI code https://bugs.webkit.org/show_bug.cgi?id=155863 Reviewed by Joseph Pecoraro. Replaced admin-regenerate-manifest.js by a new mocha.js tests using the new server testing capability added in r198642 and tested v3 UI code (parsing manifest.json and creating models). Also removed /admin/regenerate-manifest since it has been superseded by /api/manifest. This patch also extracts manifest.js out of main.js so that it could be used and tested without the DOM support in node. * public/admin/regenerate-manifest.php: Deleted. * public/include/db.php: Fixed a regression from r198642 since CONFIG_DIR now doesn't end with a trailing backslash. * public/include/manifest.php: (ManifestGenerator::bug_trackers): Avoid a warning message when there are no repositories. * public/v3/index.html: * public/v3/main.js: (main): * public/v3/models/bug-tracker.js: (BugTracker.prototype.newBugUrl): Added. (BugTracker.prototype.repositories): Added. * public/v3/models/manifest.js: Added. Extracted from main.js. (Manifest.fetch): Moved from main.js' fetchManifest. (Manifest._didFetchManifest): Moved from main.js' didFetchManifest. * public/v3/models/platform.js: (Platform.prototype.hasTest): Fixed the bug that "test" here was shadowing the function parameter of the same name. This is tested by the newly added test cases. * server-tests/api-build-requests-tests.js: * server-tests/api-manifest.js: Added. Migrated test cases from tests/admin-regenerate-manifest.js with additional assertions for v3 UI model objects. * server-tests/resources/test-server.js: (TestServer.prototype.start): (TestServer.prototype.testConfig): Renamed from _constructTestConfig now that this is a public API. Also no longer takes dataDirectory as an argument since it's always the same. (TestServer.prototype._ensureDataDirectory): Fixed a bug that we weren't making public/data. (TestServer.prototype.cleanDataDirectory): Added. Remove all files inside public/data between tests. (TestServer.prototype.inject): Added. Calls before, etc... because always calling before had an unintended side effect of slowing down unit tests even through they don't need Postgres or Apache. * tests/admin-regenerate-manifest.js: Removed. * tools/js/database.js: * tools/js/v3-models.js: 2016-03-23 Ryosuke Niwa Add mocha server tests for /api/build-requests https://bugs.webkit.org/show_bug.cgi?id=155831 Reviewed by Chris Dumez. Added the new mocha.js based server-tests for /api/build-requests. The new harness automatically: - starts a new Apache instance - switches the database during testing via setting an environmental variable - backups and restores public/data directory during testing As a result, developer no longer has to manually setup Apache, edit config.json manually to use a testing database, or run /api/manifest.php to re-generate the manifest file after testing. This patch also makes ID resolution optional on /api/build-requests so that v3 model based syncing scripts can re-use the same code as the v3 UI to process the JSON. tools/sync-with-buildbot.py has been modified to use this option (useLegacyIdResolution). * config.json: Added configurations for the test httpd server. * init-database.sql: Don't error when tables and types don't exist (when database is empty). * public/api/build-requests.php: (main): Made the ID resolution optional with useLegacyIdResolution. Also removed "updates" from the results JSON since it's never used. * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::__construct): (BuildRequestsFetcher::fetch_roots_for_set_if_needed): Fixed the bug that we would include the same commit multiple times for each root set. * public/include/db.php: (config): If present, use ORG_WEBKIT_PERF_CONFIG_PATH instead of Websites/perf.webkit.org/config.json. * server-tests: Added. * server-tests/api-build-requests-tests.js: Added. Tests for /api/build-requests. (.addMockData): * server-tests/resources: Added. * server-tests/resources/test-server.conf: Added. Apache configuration file for testing. * server-tests/resources/test-server.js: Added. (TestSever): Added. (TestSever.prototype.start): Added. (TestSever.prototype.stop): Added. (TestSever.prototype.remoteAPI): Added. Configures RemoteAPI to be used with the test sever. (TestSever.prototype.database): Added. Returns Database configured to use the test database. (TestSever.prototype._constructTestConfig): Creates config.json for testing. The file is generated by _start and db.php's config() reads it from the environmental variable: ORG_WEBKIT_PERF_CONFIG_PATH. (TestSever.prototype._ensureDataDirectory): Renames public/data to public/original-data if exists, and creates a new empty public/data. (TestSever.prototype._restoreDataDirectory): Deletes public/data and renames public/original-data back to public/data. (TestSever.prototype._ensureTestDatabase): Drops the test database if exists and creates a new one. (TestSever.prototype.initDatabase): Run init-database.sql to start each test with a consistent state. (TestSever.prototype._executePgsqlCommand): Executes a postgres command line tool such as psql. (TestSever.prototype._determinePgsqlDirectory): Finds the directory that contains psql. (TestSever.prototype._startApache): Starts an Apache instance for testing. (TestSever.prototype._stopApache): Stops the Apache instance for testing. (TestSever.prototype._waitForPid): Waits for the Apache pid file to appear or disappear. (before): Start the test server at the beginning. (beforeEach): Re-initialize all tables before each test. (after): Stop the test server at the end. * tools/js/config.js: (Config.prototype.path): (Config.prototype.serverRoot): Added. The path to Websites/perf.webkit.org/public/. (Config.prototype.pathFromRoot): Added. Resolves a path from Websites/perf.webkit.org. * tools/js/database.js: (Database): Now optionally takes the database name to use a different database during testing. (Database.prototype.connect): (Database.prototype.query): Added. (Database.prototype.insert): Added. (tableToPrefixMap): Maps table name to its prefix. Used by Database.insert. * tools/js/remote.js: Added. (RemoteAPI): Added. This is node.js equivalent of RemoteAPI in public/v3/remote.js. (RemoteAPI.prototype.configure): Added. (RemoteAPI.prototype.fetchJSON): Added. (RemoteAPI.prototype.fetchJSONWithStatus): Added. (RemoteAPI.prototype.sendHttpRequest): Added. * tools/sync-with-buildbot.py: (main): Use useLegacyIdResolution as this script relies on the legacy behavior. * unit-tests/checkconfig.js: pg was never directly used in this test. 2016-03-23 Ryosuke Niwa Delete a file that was supposed to be removed in r198614 for real. * unit-tests/resources/v3-models.js: Removed. 2016-03-23 Ryosuke Niwa Add a model for parsing buildbot JSON with unit tests https://bugs.webkit.org/show_bug.cgi?id=155814 Reviewed by Joseph Pecoraro. Added BuildbotSyncer and BuildbotBuildEntry classes to parse buildbot JSON files with unit tests. They will be used in the new syncing scripts to improve A/B testing. * public/v3/models/build-request.js: (BuildRequest): * tools/js/buildbot-syncer.js: Added. (BuildbotBuildEntry): Added. (BuildbotBuildEntry.prototype.slaveName): Added. (BuildbotBuildEntry.prototype.buildRequestId): Added. (BuildbotBuildEntry.prototype.isInProgress): Added. (BuildbotSyncer): Added. (BuildbotSyncer.prototype.testPath): Added. (BuildbotSyncer.prototype.builderName): Added. (BuildbotSyncer.prototype.platformName): Added. (BuildbotSyncer.prototype.fetchPendingRequests): Added. (BuildbotSyncer.prototype._propertiesForBuildRequest): Added. (BuildbotSyncer.prototype._revisionSetFromRootSetWithExclusionList): Added. (BuildbotSyncer._loadConfig): Added. (BuildbotSyncer._validateAndMergeConfig): Added. (BuildbotSyncer._validateAndMergeProperties): Added. * tools/js/v3-models.js: Copied from unit-tests/resources/v3-models.js. (beforeEach): Deleted since this only defined inside mocha. * unit-tests/analysis-task-tests.js: * unit-tests/buildbot-syncer-tests.js: Added. (sampleiOSConfig): (createSampleBuildRequest): (.smallConfiguration): * unit-tests/measurement-adaptor-tests.js: * unit-tests/measurement-set-tests.js: * unit-tests/resources/mock-v3-models.js: Renamed from unit-tests/resources/v3-models.js. (beforeEach): * unit-tests/test-groups-tests.js: (sampleTestGroup): 2016-03-22 Ryosuke Niwa Add unit tests for test-group.js https://bugs.webkit.org/show_bug.cgi?id=155781 Reviewed by Joseph Pecoraro. Added unit tests for test-group.js that would have caught regressions fixed in r198503. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._renderAnnotations): Added a forgotten break statement. * public/v3/models/build-request.js: (BuildRequest.prototype.setResult): (BuildRequest): * public/v3/models/test-group.js: * unit-tests/measurement-set-tests.js: Use ./resources/v3-models.js to reduce the code duplication. * unit-tests/resources/v3-models.js: Import more stuff from v3 models. (beforeEach): * unit-tests/test-groups-tests.js: Added. Added some unit tests for TestGroup. (sampleTestGroup): (.testGroupWithStatusList): 2016-03-22 Ryosuke Niwa Fix a typo. * config.json: 2016-03-21 Ryosuke Niwa Commit log viewer repaints too frequently after r198499 https://bugs.webkit.org/show_bug.cgi?id=155732 Reviewed by Joseph Pecoraro. The bug was caused by InteractiveTimeSeriesChart invoking onchange callback whenever mouse moved even if the current point didn't change. Fixed the bug by avoiding the work if the indicator hadn't changed and avoiding work in the commit log viewer when the requested repository and the revision range were the same as those of the last request. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Exit early when repository and the revision range are identical to the one we already have to avoid repaints and issuing multiple network requests. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype._mouseMove): Don't invoke _notifyIndicatorChanged if the current indicator hadn't changed. * public/v3/pages/chart-pane.js: (ChartPane.prototype._indicatorDidChange): Fixed the bug that unlocking the indicator wouldn't update the URL. We need to check whether the lock state had changed. The old condition was also redundant since _mainChartIndicatorWasLocked is always identically equal to isLocked per the prior assignment. 2016-03-21 Ryosuke Niwa Fix A/B testing after r198503. * public/include/build-requests-fetcher.php: 2016-03-21 Ryosuke Niwa 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 v3 UI sometimes don't update the list of revisions on the commit log viewer https://bugs.webkit.org/show_bug.cgi?id=155729 Rubber-stamped by Chris Dumez. Fixed multiple bugs that were affecting the list of blame range and commit logs for the range weren't updated in some cases on v3 UI. Also, the commit log viewer state is now a part of the URL state so opening and closing the commit log viewer will persist across page loads. Also fixed a regression from r198479 that Test object can't be created for a top level test. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): (ChartPaneBase.prototype._mainSelectionDidChange): Fixed the bug that the list of blame range nor the commit log viewer don't get updated when the selected range changes. (ChartPaneBase.prototype._indicatorDidChange): (ChartPaneBase.prototype._didFetchData): (ChartPaneBase.prototype._updateStatus): Extracted from _indicatorDidChange and _didFetchData. (ChartPaneBase.prototype._requestOpeningCommitViewer): Renamed from _openCommitViewer. * public/v3/components/chart-status-view.js: (ChartStatusView.prototype.updateStatusIfNeeded): Fixed the bug that the blame range doesn't get set on the initial page load when the selection range is set but the chart data hadn't been fetched yet. * public/v3/components/commit-log-viewer.js: (CommitLogViewer.prototype.view): Fixed the bug that we don't clear out the old list of commits while loading the next set of commits to show as it looked as if the list was never updated. (CommitLogViewer.prototype.render): Fixed the bug that the view always show the last repository name even if there were nothing being fetched or commits to show. * public/v3/components/pane-selector.js: (PaneSelector.prototype.focus): Removed superfluous call to console.log. * public/v3/models/data-model.js: (DataModelObject.listForStaticMap): Generalized the code for all to fix the bug in Test. (DataModelObject.all): * public/v3/models/test.js: (Test): Fixed the bug that this code was relying on the static map to be an array. (Test.topLevelTests): Use newly added listForStaticMap to convert the dictionary to an array. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): Always initialize _usedRevisionRange as a triple to simplify code elsewhere. (ChartPaneStatusView.prototype.render): Invoke _revisionCallback when user clicks on a repository expansion mark (>>). Also fixed click handler from the row since this made selecting revision range on the view cumbersome. Now user has to explicitly click on the expansion mark (>>). (ChartPaneStatusView.prototype._setRevisionRange): Now takes shouldNotify, from, and to as arguments as this function must not invoke_revisionCallback inside _updateRevisionListForNewCurrentRepository. (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Use newly added setCurrentRepository instead of manually invoking setCurrentRepository and updateRevisionListWithNotification. (ChartPaneStatusView.prototype.setCurrentRepository): Fixed the bug that we weren't updating the blame list here. (ChartPaneStatusView.prototype.updateRevisionList): Renamed from updateRevisionListWithNotification since we no longer call _revisionCallback. In general, callbacks are only meant to communicate user initiated actions, and not program induced updates like this API so this was a bad pattern anyway. ChartPane now explicitly updates the commit log viewer instead of relying on this function calling _requestOpeningCommitViewer implicitly. (ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Extracted from updateRevisionListWithNotification so that setCurrentRepository can also call this function. * public/v3/pages/chart-pane.js: (ChartPane.prototype._requestOpeningCommitViewer): Overrides ChartPaneBase's method. Open the same repository in other panes via ChartsPage.setOpenRepository. (ChartPane.prototype.setOpenRepository): This method is called when the user selected a repository in another pane. Open the same repository in this pane if it wasn't already open. * public/v3/pages/charts-page.js: (ChartsPage): Added this._currentRepositoryId. (ChartsPage.prototype.serializeState): Serialize _currentRepositoryId. (ChartsPage.prototype.updateFromSerializedState): Set the commit log viewer's (ChartsPage.prototype.setOpenRepository): Added. * tests/api-measurement-set.js: Fixed a test after r198479. 2016-03-21 Ryosuke Niwa V3 Perf Dashboard should automatically select initial range when creating a new task https://bugs.webkit.org/show_bug.cgi?id=155677 Reviewed by Joseph Pecoraro. Select the entire range of points for which the analysis task is created by default so that creating a test group to confirm the regression / progression is easy. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): Added a boolean flag which indicates the user had modified main chart's selection. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype.render): Set the main chart's selection to the entire range of points in the analysis task if the user had never modified selection. (AnalysisTaskPage.prototype._chartSelectionDidChange): This callback is invoked only when the user had modified the selection so set _selectionWasModifiedByUser true here unconditionally. 2016-03-19 Ryosuke Niwa Associated commits don't immediately show up on an analysis task page https://bugs.webkit.org/show_bug.cgi?id=155692 Reviewed by Darin Adler. The bug was caused by resolveCommits in AnalysisTask._constructAnalysisTasksFromRawData not being able to find the matching commit log if the commit log had been created by the charts which don't set the remote identifiers on each CommitLog objects. Fixed the bug by modifying /api/measurement-set to include the commit ID, and making CommitLog use the real database ID as its ID instead of a fake ID we create from repository and revision. Also added a bunch of Mocha unit tests for AnalysisTask.fetchAll. * public/api/measurement-set.php: (MeasurementSetFetcher::execute_query): Fetch commit_id. (MeasurementSetFetcher::format_run): Use pass-by-reference to avoid making a copy of the row. (MeasurementSetFetcher::parse_revisions_array): Include commit_id as the first item in the result. * public/v3/instrumentation.js: * public/v3/models/analysis-task.js: (AnalysisTask): Fixed a bug that _buildRequestCount and _finishedBuildRequestCount could be kept as strings and hasPendingRequests() could return a wrong result because it would perform string inequality instead of numerical inequality. (AnalysisTask.prototype.updateSingleton): Ditto. (AnalysisTask.prototype.dissociateCommit): (AnalysisTask._constructAnalysisTasksFromRawData): (AnalysisTask._constructAnalysisTasksFromRawData.resolveCommits): Use findById now that CommitLog objects all use the same id as the database id. * public/v3/models/commit-log.js: (CommitLog): (CommitLog.prototype.remoteId): Deleted since we no longer create a fake id for commit logs for measurement sets. (CommitLog.findByRemoteId): Deleted. (CommitLog.ensureSingleton): Deleted. (CommitLog.fetchBetweenRevisions): * public/v3/models/data-model.js: (DataModelObject.clearStaticMap): Added to aid unit testing. (DataModelObject.ensureNamedStaticMap): Fixed a typo. Each map is a dictionary, not an array. * public/v3/models/metric.js: * public/v3/models/platform.js: * public/v3/models/root-set.js: (RootSet): Updated per the interface change in CommitLog.ensureSingleton. (MeasurementRootSet): Updated per /api/measurement-set change. Use the first value as the id. * public/v3/models/test.js: * unit-tests/analysis-task-tests.js: Added. (sampleAnalysisTask): (measurementCluster): * unit-tests/checkconfig.js: Added some assertion message to help aid diagnosing the failure. * unit-tests/measurement-adaptor-tests.js: Updated the sample data per the API change in /api/measurement-set and also added assertions for commit log ids. * unit-tests/measurement-set-tests.js: (beforeEach): * unit-tests/resources: Added. * unit-tests/resources/mock-remote-api.js: Added. Extracted from measurement-set-tests.js to be used in analysis-task-tests.js. (assert.notReached.assert.notReached): (global.RemoteAPI.getJSON): (global.RemoteAPI.getJSONWithStatus): (beforeEach): * unit-tests/resources/v3-models.js: Added. Extracted from measurement-set-tests.js to be used in analysis-task-tests.js and added more imports as needed. (importFromV3): (beforeEach): 2016-03-18 Ryosuke Niwa Build fix after r198464. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype._buildRowsForPointsAndTestGroups): 2016-03-18 Ryosuke Niwa Build fix after r198234. * public/api/commits.php: (main): Typo: fetch_latest_reported -> fetch_last_reported. * public/include/commit-log-fetcher.php: (CommitLogFetcher::format_single_commit): commits should be an array. 2016-03-18 Ryosuke Niwa Perf Dashboard v3 confuses better and worse on A/B task page https://bugs.webkit.org/show_bug.cgi?id=155675 Reviewed by Joseph Pecoraro. The analysis results viewer on v3 UI sometimes treats regressions as progressions and vice versa when the first set (i.e. set A) of the revisions used in an A/B testing never appears in the original graph, and its latest commit time matches that of the second set, which appears in the original graph. Because the analysis results viewer compares results in the increasing row number, this results in B to be compared to A instead of A to be compared to B. Fixed the bug by preventing the wrong ordering to occur in _buildRowsForPointsAndTestGroups by always inserting a root set A before B when B appears and A doesn't appear in the original graph. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype._collectRootSetsInTestGroups): Remember the succeeding root set B when creating an entry for root set A. (AnalysisResultsViewer.prototype._buildRowsForPointsAndTestGroups): Fixed the bug. Also un-duplicated the code to create a new row. (AnalysisResultsViewer.RootSetInTestGroup): Now takes a succeeding root set. e.g. it's B for A and undefined for B in A/B testing. (AnalysisResultsViewer.RootSetInTestGroup.prototype.succeedingRootSet): Added. * public/v3/components/time-series-chart.js: (TimeSeriesChart.computeTimeGrid): Fixed the bug that we would end up showing 0 AM instead of dates when both dates and months change. 2016-03-18 Ryosuke Niwa Add unit tests for measurement-set.js and measurement-adapter.js https://bugs.webkit.org/show_bug.cgi?id=155673 Reviewed by Daniel Bates. Add tests which were supposed to be added in r198462. * unit-tests/measurement-adaptor-tests.js: Added. * unit-tests/measurement-set-tests.js: Added. (assert.notReached): Added. (global.RemoteAPI.getJSON): Added. (global.RemoteAPI.getJSONWithStatus): Added. A mock. 2016-03-18 Ryosuke Niwa Add unit tests for measurement-set.js and measurement-adapter.js https://bugs.webkit.org/show_bug.cgi?id=155673 Reviewed by Darin Adler. Added mocha unit tests for MeasurementSet and MeasurementAdapter classes along with the necessary refactoring to run these tests in node. getJSON and getJSONStatus are now under RemoteAPI so that unit tests can mock them. Removed the dependency on v2 UI's TimeSeries and Measurement class by adding a new implementation of TimeSeries in v3 and removing the dependency on Measurement in chart-pane-status-view.js with new helper methods on Build and CommitLog. Many js files now use 'use strict' (node doesn't support class syntax in non-strict mode) and module.exports to export symbols in node's require function. * public/v3/index.html: * public/v3/main.js: * public/v3/models/analysis-results.js: (AnalysisResults.fetch): * public/v3/models/analysis-task.js: (AnalysisTask.fetchAll): * public/v3/models/builder.js: (Build): (Build.prototype.builder): Added. Used by ChartPaneStatusView. (Build.prototype.buildNumber): Ditto. (Build.prototype.buildTime): Ditto. * public/v3/models/commit-log.js: (CommitLog.prototype.diff): Ditto. (CommitLog.fetchBetweenRevisions): * public/v3/models/data-model.js: (DataModelObject.cachedFetch): * public/v3/models/measurement-adaptor.js: (MeasurementAdaptor.prototype.applyToAnalysisResults): Renamed from adoptToAnalysisResults. (MeasurementAdaptor.prototype.applyTo): Renamed from adoptToSeries. Now shares a lot more code with applyToAnalysisResults. The code to set 'series' and 'seriesIndex' has been moved to TimeSeries.append. 'measurement' is no longer needed as this patch removes its only use in ChartPaneStatusView. * public/v3/models/measurement-cluster.js: (MeasurementCluster.prototype.addToSeries): Use TimeSeries.append instead of directly mutating series._series. * public/v3/models/measurement-set.js: (Array.prototype.includes): Added a polyfill for node. (MeasurementSet.prototype._fetchSecondaryClusters): Removed a bogus assertion. When fetchBetween is called with a mixture of clusters that have been fetched and not fetched, this assertion fails. (MeasurementSet.prototype._fetch): (TimeSeries.prototype.findById): Moved to time-series.js. (TimeSeries.prototype.dataBetweenPoints): Ditto. (TimeSeries.prototype.firstPoint): Ditto. (TimeSeries.prototype.fetchedTimeSeries): Moved the code to extend the last point to TimeSeries' extendToFuture. * public/v3/models/repository.js: * public/v3/models/root-set.js: (MeasurementRootSet): Ignore repositories that had not been defined (e.g. it could be added after manifest.json had been downloaded but before a given root set is created for an A/B testing). * public/v3/models/time-series.js: (TimeSeries): Added. (TimeSeries.prototype.append): Added. (TimeSeries.prototype.extendToFuture): Added. (TimeSeries.prototype.firstPoint): Moved from measurement-set.js. (TimeSeries.prototype.lastPoint): Added. (TimeSeries.prototype.previousPoint): Added. (TimeSeries.prototype.nextPoint): Added. (TimeSeries.prototype.findPointByIndex): Added. (TimeSeries.prototype.findById): Moved from measurement-set.js. (TimeSeries.prototype.findPointAfterTime): Added. (TimeSeries.prototype.dataBetweenPoints): Moved from measurement-set.js. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView.prototype.render): Use newly added helper functions on Build. (ChartPaneStatusView.prototype._formatTime): Added. (ChartPaneStatusView.prototype.setCurrentRepository): (ChartPaneStatusView.prototype.computeChartStatusLabels): Rewrote the code using RootSet object on currentPoint and previousPoint instead of Measurement class from v2 UI. Also sort the results using sortByNamePreferringOnesWithURL. * public/v3/remote.js: (RemoteAPI.getJSON): Moved under RemoteAPI. (RemoteAPI.getJSONWithStatus): Ditto. (PrivilegedAPI): (PrivilegedAPI.requestCSRFToken): 2016-03-17 Ryosuke Niwa Add unit tests for config.json and statistics.js https://bugs.webkit.org/show_bug.cgi?id=155626 Reviewed by Darin Adler. Added mocha unit tests for statistics.js and validating config.json. For segmentations, I've extracted real data from our internal perf dashboard. Also fixed some bugs covered by these new tests. * public/shared/statistics.js: (Statistics.movingAverage): Fixed a bug that forwardWindowSize was never used. (Statistics.exponentialMovingAverage): Fixed the bug that the moving average starts at 0. It should start at the first value instead. (.splitIntoSegmentsUntilGoodEnough): Fixed the bug that we may try to segment a time series into more parts than there are data points. Clearly, that doesn't make any sense. (.findOptimalSegmentation): Renamed local variables so that they're more descriptive, and rewrote the debugging code was the old code was emitting some useless data. Also fixed the bug that the length of "segmentation" was off by one (we need segmentCount + 1 elements in the array sine we always include the start of the first segment = 0 and the end of the last segment = values.length). (.SampleVarianceUpperTriangularMatrix): (Statistics): Modernized the export code. * tools/js: Added. * tools/js/config.js: Added. (Config): Added. (Config.prototype.configFilePath): Added. (Config.prototype.value): Added. (Config.prototype.path): Added. * tools/js/database.js: Added. (Database): Added. (Database.prototype.connect): Added. (Database.prototype.disconnect): Added. * unit-tests: Added. * unit-tests/checkconfig.js: Added. Validates config.json. This is useful while setting up a local instance of the perf dashboard. * unit-tests/statistics-tests.js: Added. (assert.almostEqual): Added. Asserts that two floating values are within a given significant digits. (.stdev): (.delta): (.computeWelchsT): 2016-03-17 Ryosuke Niwa Fix a typo which was supposed to be fixed in r198351. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype.render): 2016-03-17 Ryosuke Niwa An analysis task should be closed if a progression cause is identified https://bugs.webkit.org/show_bug.cgi?id=155549 Reviewed by Chris Dumez. Since a progression is desirable, we should close an analysis task once its cause is identified. Also fix some typos. * init-database.sql: Fixed a typo. * public/api/analysis-tasks.php: * public/v3/models/analysis-task.js: (AnalysisTask.prototype.dissociateBug): Renamed from dissociateBug. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype.render): (AnalysisTaskPage.prototype._dissociateBug): Renamed from _dissociateBug. (AnalysisTaskPage.prototype._dissociateCommit): Fixed the typo in the alert. 2016-03-16 Ryosuke Niwa Analysis task page should allow specifying commits that caused or fixed a regression or a progression https://bugs.webkit.org/show_bug.cgi?id=155529 Reviewed by Chris Dumez. Added the capability to associate revisions that caused or fixed a progression or a regression for which an analysis task was created. Added task_commits that stores this relationship and added the backend support to retrieve this table in /api/analysis-tasks and an privileged API to update this table at /privileged-api/associate-commit. Also extracted a new component, MutableListView, out of AnalysisTaskPage to render and manipulate a list of mutable items, and used it to render the list of associated bugs and commits. The view takes a list of kinds (e.g. repositories or bug trackers), and accepts a pair of a kind and arbitrary text as a new item value. * init-database.sql: Added task_commits table. * public/api/analysis-tasks.php: (main): (fetch_associated_data_for_tasks): Renamed from fetch_and_push_bugs_to_tasks now that it also fetches the list of commits associated with each analysis task by calling CommitLogFetcher::fetch_for_tasks. Also fixe the bug that we were not taking (format_task): No longer sets 'category' since the computation of category now depends on the list of commits associated with this analysis task which aren't available until fetch_associated_data_for_tasks. (determine_category): Added. Categorize any analysis tasks with "fixes" commits as "closed" and "causes" commits as "identified". * public/include/commit-log-fetcher.php: (CommitLogFetcher::__construct): Remove the unused instance variable. (CommitLogFetcher::fetch_for_tasks): Added. Fetches all commits associated with a list of analysis tasks. Assumes the caller (fetch_associated_data_for_tasks) had setup "fixes" and "causes" fields on each task. * public/privileged-api/associate-commit.php: Added. Updates task_commits table to associate or disassociate a commit with an analysis task. When the specified analysis task and the specified commit are already associated, we simply update the table instead of adding a duplicating entry or error. For dissociation, the front-end specifies the commit ID. (main): Added. * public/v3/index.html: * public/v3/components/mutable-list-view.js: Added. Used by the list associated bugs and commits. (MutableListView): Added. (MutableListView.prototype.setList): Added. (MutableListView.prototype.setKindList): Added. (MutableListView.prototype.setAddCallback): Added. This callback is invoked when the user tries to add a new item to the list. (MutableListView.prototype.render): Added. (MutableListView.prototype._submitted): Added. (MutableListView.cssTemplate): (MutableListView.htmlTemplate): (MutableListItem): Added. RemovalLink could be a hyperlink or a callback and gets involved when the user tries to delete this item. (MutableListItem.prototype.content): * public/v3/models/analysis-task.js: (AnalysisTask): Added the support of the list of commits that fixed and caused changes. (AnalysisTask.prototype.updateSingleton): Ditto. (AnalysisTask.prototype.causes): Added. (AnalysisTask.prototype.fixes): Added. (AnalysisTask.prototype.associateCommit): Added. Use the API added at /privileged-api/associate-commit to associate a new commit with this analysis task. Each commit has either caused or fixed the change. (AnalysisTask.prototype.dissociateCommit): Added. Use the same API to disassociate each commit. (AnalysisTask._constructAnalysisTasksFromRawData): Find all commits associated with each analysis task. Because commit log objects use a fake ID fdue to /api/measurement-set not providing commit IDs, we must use CommitLog.findByRemoteId to find each commit instead of usual CommitLog.findById. (AnalysisTask._constructAnalysisTasksFromRawData.resolveCommits): Added. * public/v3/models/build-request.js: (BuildRequest.prototype.hasFinished): Renamed from hasCompleted since it was confusing for this._status being "completed" wasn't a necessary condition for this function to return true. * public/v3/models/commit-log.js: (CommitLog): Added the static map for actual commit ID instead of a fake ID created in ensureSingleton. (CommitLog.prototype.remoteId): Added. Returns the real commit ID. (CommitLog.findByRemoteId): Added. Finds an CommitLog object using the real ID. * public/v3/models/test-group.js: (TestGroup.prototype.hasFinished): Renamed from hasCompleted to match the rename in BuildRequest. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): Added lists for the commits that fixed and caused the change using MutableListView. Also adopted MutableListView for the list of associated bugs. (AnalysisTaskPage.prototype.render): Added the code to populate the newly added lists. (AnalysisTaskPage.prototype._makeCommitListItem): Added. (AnalysisTaskPage.prototype._associateBug): Now this is a callback from MutableListView. (AnalysisTaskPage.prototype._associateCommit): Added. (AnalysisTaskPage.prototype._dissociateCommit): Added. (AnalysisTaskPage.htmlTemplate): (AnalysisTaskPage.cssTemplate): * public/v3/remote.js: (getJSON): Spit out the entire responseText when JSON failed to parse to make debugging easier. 2016-03-15 Ryosuke Niwa Extract the code to format commit logs into its own PHP file https://bugs.webkit.org/show_bug.cgi?id=155514 Rubber-stamped by Chris Dumez. Extracted CommitLogFetcher out of /api/commits so that it could be used in analysis-tasks.php in the future to support associating cause/fix for each analysis task. * public/api/commits.php: * public/include/commit-log-fetcher.php: Added. (CommitLogFetcher) (CommitLogFetcher::__construct): Added. (CommitLogFetcher::repository_id_from_name): Added. (CommitLogFetcher::fetch_between): Added. (CommitLogFetcher::fetch_oldest): Added. (CommitLogFetcher::fetch_latest): Added. (CommitLogFetcher::fetch_last_reported): Added. (CommitLogFetcher::fetch_revision): Added. (CommitLogFetcher::commit_for_revision): Added. (CommitLogFetcher::format_single_commit): Added. (CommitLogFetcher::format_commit): Added. 2016-03-09 Ryosuke Niwa Build fix after r196870. * public/include/report-processor.php: 2016-03-09 Ryosuke Niwa Add Size metric to perf dashboard https://bugs.webkit.org/show_bug.cgi?id=155266 Reviewed by Chris Dumez. Added the "Size" metric and use bytes as its unit. * public/js/helper-classes.js: (PerfTestRuns): * public/v2/data.js: (RunsData.unitFromMetricName): 2016-02-20 Ryosuke Niwa Add the support for universal slave password https://bugs.webkit.org/show_bug.cgi?id=154476 Reviewed by David Kilzer. Added the support for universalSlavePassword. * config.json: * public/include/report-processor.php: (ReportProcessor::process): (ReportProcessor::authenticate_and_construct_build_data): Extracted from process(). 2016-02-19 Ryosuke Niwa Analysis tasks page complains about missing repository but with a wrong name https://bugs.webkit.org/show_bug.cgi?id=154468 Reviewed by Chris Dumez. Fixed the bug by using the right variable in the template literal. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype._computeRootSetMap): Use querySelector here since Chrome doesn't have getElementsByClassName on ShadowRoot. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingRootSetList): Use name which is the name of repository here. 2016-02-18 Ryosuke Niwa Revert an unintended change made in the previous commit. * init-database.sql: 2016-02-18 Ryosuke Niwa Perf dashboard should let user cancel pending A/B testing and hide failed ones https://bugs.webkit.org/show_bug.cgi?id=154433 Reviewed by Chris Dumez. Added a button to hide a test group in the details view (the bottom table) in the analysis task page, and "Show hidden tests" link to show the hidden test groups on demand. When a test group is hidden, all pending requests in the group will also be canceled since a common scenario of using this feature is that the user had triggered an useless A/B testing; e.g. all builds will fail, wrong, etc... We can revisit and add the capability to just cancel the pending requests and leaving the group visible later if necessary. Run `ALTER TYPE build_request_status_type ADD VALUE 'canceled';` to add the new type. * init-database.sql: Added testgroup_hidden column to analysis_test_groups table and added 'canceled' as a value to build_request_status_type table. * public/api/test-groups.php: (format_test_group): Added 'hidden' field in the JSON result. * public/privileged-api/update-test-group.php: (main): Added the support for updating testgroup_hidden column. When this column is set to true, also cancel all pending build requests (by setting its request_status to 'canceled' which will be ignore by the syncing script). * public/v3/components/test-group-results-table.js: (TestGroupResultsTable.prototype.setTestGroup): Reset _renderedTestGroup here so that the next call to render() will update the table; e.g. when build requests' status change from 'Pending' to 'Canceled'. * public/v3/models/build-request.js: (BuildRequest.prototype.hasCompleted): A build request is considered complete/finished if it's canceled. (BuildRequest.prototype.hasPending): Added. (BuildRequest.prototype.statusLabel): Handle 'canceled' status. * public/v3/models/test-group.js: (TestGroup): (TestGroup.prototype.updateSingleton): Added to update 'hidden' field. (TestGroup.prototype.isHidden): Added. (TestGroup.prototype.hasPending): Added. (TestGroup.prototype.hasPending): Added. (TestGroup.prototype.updateHiddenFlag): Added. Uses the privileged API to update testgroup_hidden column. The JSON API also updates the status of the 'pending' build requests in the group to 'canceled'. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): Added _showHiddenTestGroups and _filteredTestGroups as instance variables. (AnalysisTaskPage.prototype._didFetchTestGroups): (AnalysisTaskPage.prototype._showAllTestGroups): Added. (AnalysisTaskPage.prototype._didUpdateTestGroupHiddenState): Extracted from _didFetchTestGroups. (AnalysisTaskPage.prototype._renderTestGroupList): Use the filtered list of test groups to show the list of test groups. When all test groups are shown, we would first show the hidden ones after the regular ones. (AnalysisTaskPage.prototype._createTestGroupListItem): Extracted from _renderTestGroupList. (AnalysisTaskPage.prototype._renderTestGroupDetails): Update the text inside the button to hide the test group. Also show a warning text that the pending requests will be canceled if there are any. (AnalysisTaskPage.prototype._hideCurrentTestGroup): Added. (AnalysisTaskPage.cssTemplate): Updated the style. 2016-02-18 Ryosuke Niwa The rows in the analysis results table should be expandable https://bugs.webkit.org/show_bug.cgi?id=154427 Reviewed by Chris Dumez. Added "(Expand)" link between rows that have hidden points. Upon click it inserts the hidden rows. We insert around five rows at a time when there are hundreds of hidden points but we also avoid leaving behind expandable rows of less than two rows. Also fixed a bug in CustomizableTestGroupForm that getElementsById would throw in the shipping Safari because getElementsById doesn't exist on Element.prototype by using class name instead. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer): (AnalysisResultsViewer.prototype.setCurrentTestGroup): Removed superfluous call to render(). (AnalysisResultsViewer.prototype.setPoints): Always show the start and the end points. (AnalysisResultsViewer.prototype.buildRowGroups): (AnalysisResultsViewer.prototype._buildRowsForPointsAndTestGroups): Add an instance of ExpandableRow which shows a "(Expand)" link to show hidden rows here. (AnalysisResultsViewer.prototype._expandBetween): Added. Expands rows between two points. (AnalysisResultsViewer.cssTemplate): Added rules for "(Expand)" links. (AnalysisResultsViewer.ExpandableRow): Added. (AnalysisResultsViewer.ExpandableRow.prototype.resultContent): Added. Overrides what's in the results column. (AnalysisResultsViewer.ExpandableRow.prototype.heading): Added. Generates "(Expand)" link. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype._computeRootSetMap): Use getElementsByClassName instead of getElementById. (CustomizableTestGroupForm.prototype._classForLabelAndRepository): Renamed from _idForLabelAndRepository. (CustomizableTestGroupForm._constructRevisionRadioButtons): Set class name instead of id. * public/v3/components/results-table.js: (ResultsTable.prototype.render): Don't generate radio buttons to select a row when root set is missing; e.g. for rows that show "(Expand)" links. 2016-02-18 Ryosuke Niwa Statistically significant A/B testing results should be color coded in details view https://bugs.webkit.org/show_bug.cgi?id=154414 Reviewed by Chris Dumez. Color code the statistically significant comparisions in TestGroupResultsTable as done in the analysis results viewer. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.cssTemplate): Build fix after r196768. * public/v3/components/test-group-results-table.js: (TestGroupResultsTable.prototype.buildRowGroups): Add the status as a class name. (TestGroupResultsTable.cssTemplate): Added styles to color-code statistically significant results. 2016-02-17 Ryosuke Niwa v3 UI should allow custom revisions for A/B testing https://bugs.webkit.org/show_bug.cgi?id=154379 Reviewed by Chris Dumez. Added the capability to customize revisions selected in the overview chart and the results viewer. Newly added CustomizableTestGroupForm is responsible for allowing users to modify the set of revisions in a new A/B testing group. Unlike TestGroupForm which doesn't know anything about which revisions are selected for each project/repository, CustomizableTestGroupForm is aware of the list of revisions used in each set. The list of revisions used in each set is represented by RootSet if users had not customized them, and CustomRootSet otherwise; the latter was added since regular RootSet object requires CommitLog and other DataModelObjects which are hard to create without corresponding database entries. * public/v3/components/customizable-test-group-form.js: Added. (CustomizableTestGroupForm): Added. (CustomizableTestGroupForm.prototype.setRootSetMap): Added. (CustomizableTestGroupForm.prototype._submitted): Overrides the superclass' method. (CustomizableTestGroupForm.prototype._customize): Ditto. Unlike TestGroupForm's callback, this class' callback passes in a root set map as the third argument. (CustomizableTestGroupForm.prototype._computeRootSetMap): Added. Returns this._rootSetMap, which is set by AnalysisTaskPage if user had not customized the root sets. Otherwise return a new map with CustomRootSet's. (CustomizableTestGroupForm.prototype.render): Added. Creates a table to allow customization of root sets. (CustomizableTestGroupForm._constructRevisionRadioButtons): Added. (CustomizableTestGroupForm._createRadioButton): Added. (CustomizableTestGroupForm.cssTemplate): Added. (CustomizableTestGroupForm.formContent): Added. This method is called by TestGroupForm.htmlTemplate. * public/v3/components/test-group-form.js: (TestGroupForm): Updated the various methods to not directly mutate DOM. Store the state in instance variables and update DOM in render() as done elsewhere. (TestGroupForm.prototype.setNeedsName): Deleted. We no longer need this flag since TestGroupForm which is used for retries never needs a name and CustomizableTestGroupForm which is used to create a new test group always requires a name. (TestGroupForm.prototype.setDisabled): (TestGroupForm.prototype.setLabel): (TestGroupForm.prototype.setRepetitionCount): (TestGroupForm.prototype.render): Added. (TestGroupForm.prototype._submitted): Moved the code to prevent the default action has been moved to the constructor since this method is overridden by CustomizableTestGroupForm. (TestGroupForm.cssTemplate): Added. (TestGroupForm.htmlTemplate): (TestGroupForm.formContent): Extracted from htmlTemplate. * public/v3/index.html: * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): Added. * public/v3/models/root-set.js: (RootSet.prototype.revisionForRepository): Added so that _createTestGroupAfterVerifyingRootSetList can retrieve the revision information from CustomRootSet without going through CommitLog objects since CustomRootSet doesn't have associated CommitLog objects. (CustomRootSet): Added. Used by CustomizableTestGroupForm to create a custom root map since regular RootSet requires CommitLog and other related objects which are hard to create without database entries. (CustomRootSet.prototype.setRevisionForRepository): Added. (CustomRootSet.prototype.repositories): Added. (CustomRootSet.prototype.revisionForRepository): Added. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): (AnalysisTaskPage.prototype.render): Removed the reference to v2 UI since v3 UI is now strictly more powerful than v2 UI. Also update the root set maps in each form here. (AnalysisTaskPage.prototype._retryCurrentTestGroup): No longer takes unused name argument as it got removed from TestGroupForm. (AnalysisTaskPage.prototype._chartSelectionDidChange): No longer updates the disabled-ness here since it's now done in render() via setRootSetMap(). (AnalysisTaskPage.prototype._createNewTestGroupFromChart): Now takes rootSetMap as an argument. (AnalysisTaskPage.prototype._selectedRowInAnalysisResultsViewer): No longer updates the disabled-ness here since it's now done in render() via setRootSetMap(). (AnalysisTaskPage.prototype._createNewTestGroupFromViewer): Now takes rootSetMap as an argument. (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingRootSetList): Take a dictionary of root set labels such as A and B, which maps to a RootSet or a newly-added CustomRootSet. (AnalysisTaskPage.htmlTemplate): Use customizable-test-group-form for creating a new A/B testing group. Retry form will continue to use TestGroupForm since customizing revisions is non-sensical in retries. (AnalysisTaskPage.cssTemplate): Updated the style. 2016-02-16 Ryosuke Niwa v3 UI has the capability to schedule an A/B testing in a specific range https://bugs.webkit.org/show_bug.cgi?id=154329 Reviewed by Chris Dumez. Extended AnalysisTaskChartPane and ResultsTable so that users can select a range of points in either the overview chart pane and the results viewer table. Extracted TestGroupForm out of the analysis task page and used right below those two components in the analysis task page. * public/v3/components/results-table.js: (ResultsTable): (ResultsTable.prototype.setRangeSelectorLabels): Added. (ResultsTable.prototype.setRangeSelectorCallback): Added. (ResultsTable.prototype.selectedRange): Added. (ResultsTable.prototype._rangeSelectorClicked): Added. (ResultsTable.prototype.render): Generate radio boxes to select a range. * public/v3/components/test-group-form.js: (TestGroupForm): (TestGroupForm.prototype.setStartCallback): Added. (TestGroupForm.prototype.setNeedsName): Added. (TestGroupForm.prototype.setDisabled): Added. (TestGroupForm.prototype.setLabel): Added. (TestGroupForm.prototype.setRepetitionCount): Added. (TestGroupForm.prototype._submitted): Added. (TestGroupForm.htmlTemplate): Extracted from AnalysisTaskPage.htmlTemplate. * public/v3/index.html: * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._mainSelectionDidChange): Added. Delegates the work to AnalysisTaskPage. (AnalysisTaskChartPane.prototype.selectedPoints): Added. (AnalysisTaskPage): (AnalysisTaskPage.prototype.title): (AnalysisTaskPage.prototype.render): (AnalysisTaskPage.prototype._renderTestGroupDetails): Use TestGroupForm's methods instead of mutating DOM. (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype._chartSelectionDidChange): Added. (AnalysisTaskPage.prototype._createNewTestGroupFromChart): Added. (AnalysisTaskPage.prototype._selectedRowInAnalysisResultsViewer): Added. (AnalysisTaskPage.prototype._createNewTestGroupFromViewer): Added. (AnalysisTaskPage.prototype._createRetryNameForTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingRootSetList): Extracted from _retryCurrentTestGroup so that we can call it in _createNewTestGroupFromChart and _createNewTestGroupFromViewer. (AnalysisTaskPage.htmlTemplate): 2016-02-15 Ryosuke Niwa Extract the code specific to v2 UI out of shared statistics.js https://bugs.webkit.org/show_bug.cgi?id=154277 Reviewed by Chris Dumez. Extracted statistics-strategies.js out of statistics.js for v2 UI and detect-changes.js. The intent is to deprecate this file once we implement refined statistics tools in v3 UI and adopt it in detect-changes.js. * public/shared/statistics.js: (Statistics.movingAverage): Extracted from the "Simple Moving Average" strategy. (Statistics.cumultaiveMovingAverage): Extracted from the "Cumulative Moving Average" strategy. (Statistics.exponentialMovingAverage): Extracted from the "Exponential Moving Average" strategy. Use a temporary "movingAverage" to keep the last moving average instead of relying on the previous entry in "averages" array to avoid special casing an array of length 1 and starting the loop at i = 1. (Statistics.segmentTimeSeriesGreedyWithStudentsTTest): Extracted from "Segmentation: Recursive t-test" strategy. Don't create the list of averages to match segmentTimeSeriesByMaximizingSchwarzCriterion here. It's done in newly added averagesFromSegments. (Statistics.segmentTimeSeriesByMaximizingSchwarzCriterion): Extracted from "Segmentation: Schwarz criterion" strategy. (.recursivelySplitIntoTwoSegmentsAtMaxTIfSignificantlyDifferent): Just store the start index to match * public/v2/app.js: (App.Pane.updateStatisticsTools): (App.Pane._computeMovingAverageAndOutliers): * public/v2/data.js: * public/v2/index.html: * public/v2/statistics-strategies.js: Added. (StatisticsStrategies.MovingAverageStrategies): Added. (averagesFromSegments): Extracted from "Segmentation: Schwarz criterion" strategy. Now used by both "Segmentation: Recursive t-test" and "Segmentation: Schwarz criterion" strategies. (StatisticsStrategies.EnvelopingStrategies): Moved from Statistics.EnvelopingStrategies. (StatisticsStrategies.TestRangeSelectionStrategies): Moved from Statistics.TestRangeSelectionStrategies. (createWesternElectricRule): Moved from statistics.js. (countValuesOnSameSide): Ditto. (StatisticsStrategies.executeStrategy): Moved from Statistics.executeStrategy. * tools/detect-changes.js: (computeRangesForTesting): 2016-02-15 Ryosuke Niwa v1 UI and v2 UI should share statistics.js https://bugs.webkit.org/show_bug.cgi?id=154262 Reviewed by Chris Dumez. Share statistics.js between v1 and v2 UI. * public/index.html: * public/js/shared.js: Deleted. * public/js/statistics.js: Removed. * public/shared: Added. * public/shared/statistics.js: Moved from Websites/perf.webkit.org/public/v2/js/statistics.js. * public/v2/index.html: * public/v2/js/statistics.js: Removed. * public/v3/index.html: * tools/detect-changes.js: 2016-02-13 Ryosuke Niwa v3 UI sometimes shows same dates twice on the x-axis of time series charts https://bugs.webkit.org/show_bug.cgi?id=154210 Reviewed by Chris Dumez. The bug was caused by the label generation code in TimeSeriesChart.computeTimeGrid never emitting hours. Use hours instead of dates as labels when the current time's date is same as the previous label's date. Always include dates before entering this mode to avoid just having hours as labels on the entire x-axis. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype._renderXAxis): Slightly increase the "average" width of x-axis label. (TimeSeriesChart.computeTimeGrid): See above. Also assert that the number of labels we generate never exceeds maxLabels as a sanity check. (TimeSeriesChart._timeIterators): Added an iterator that increments by two hours for zoomed graphs. 2016-02-13 Ryosuke Niwa v3 UI should show status and associated bugs on analysis task pages https://bugs.webkit.org/show_bug.cgi?id=154212 Reviewed by Chris Dumez. Added the capability to see and modify the status and the list of associated of bugs on analysis task pages. Also added the list of related tasks, which are analysis tasks associated with the same bug or have overlapping time ranges with the same test metric but on a potentially different platform. In addition, categorize analysis tasks with the status of "no change" or "inconclusive" as "closed" as no further action can be taken (users can bring them back to non-closed state without any restrictions). * public/api/analysis-tasks.php: (format_task): Categorize 'unchanged' and 'inconclusive' analysis tasks as closed. * public/privileged-api/associate-bug.php: (main): Added shouldDelete as a new mechanism to disassociate a bug since v3 UI shares a single Bug object between multiple analysis tasks (as it should have been in the first place). * public/v3/components/chart-pane-base.js: (ChartPaneBase): (ChartPaneBase.prototype._fetchAnalysisTasks): Since each analysis task's change type (status/result) could change, we need to create annotation objects during each render() call. (ChartPaneBase.prototype.render): (ChartPaneBase.prototype._renderAnnotations): Extracted from ChartPaneBase.prototype._fetchAnalysisTasks to do that. I was afraid of the perf impact of this but it doesn't seem to be an issue in my testing. (ChartPaneBase.cssTemplate): Removed superfluous margins (moved to ChartPane.cssTemplate) around the charts since they are only useful in the charts page. * public/v3/models/analysis-task.js: (AnalysisTask): (AnalysisTask.prototype.updateSingleton): Added a comment as to why object.result cannot be renamed to object.changeType in the JSON API. (AnalysisTask.prototype.updateName): Added. (AnalysisTask.prototype.updateChangeType): Added. (AnalysisTask.prototype._updateRemoteState): Added. (AnalysisTask.prototype.associateBug): Added. (AnalysisTask.prototype.disassociateBug): Added. (AnalysisTask.fetchRelatedTasks): Added. See above for the criteria of related-ness. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): (AnalysisTaskPage.prototype.updateFromSerializedState): (AnalysisTaskPage.prototype._fetchRelatedInfoForTaskId): Extracted from updateFromSerializedState. (AnalysisTaskPage.prototype._didFetchRelatedAnalysisTasks): Added. (AnalysisTaskPage.prototype.render): Render the list of associated bugs, the list of bug trackers (so that users can use it to associate with a new bug), and the list of related analysis tasks. (AnalysisTaskPage.prototype._renderTestGroupList): Extracted from render since it was getting too long. (AnalysisTaskPage.prototype._renderTestGroupDetails): Ditto. (AnalysisTaskPage.prototype._updateChangeType): Added. (AnalysisTaskPage.prototype._associateBug): Added. (AnalysisTaskPage.prototype._disassociateBug): Added. (AnalysisTaskPage.htmlTemplate): Added various elements to show and modify the status, associate bugs, and a list of related analysis tasks. (AnalysisTaskPage.cssTemplate): Added various styles for those form controls. * public/v3/pages/chart-pane.js: (ChartPane.cssTemplate): Moved the margins from ChartPaneBase.cssTemplate. 2016-02-12 Ryosuke Niwa Perf dashboard should allow renaming analysis tasks and test groups https://bugs.webkit.org/show_bug.cgi?id=154200 Reviewed by Chris Dumez. Allow editing names of analysis tasks and A/B testing groups in the v3 UI. Added the support for updating the name to the privileged API at /privileged-api/update-analysis-task and added a new prevailed API to update A/B testing groups at /privileged-api/update-test-group. * public/privileged-api/update-analysis-task.php: Added the support for renaming the analysis task. (main): * public/privileged-api/update-test-group.php: Added. Supports updating the test group's name. (main): * public/v3/components/editable-text.js: Added. (EditableText): Added. A new editable text label control. It looks like a text node with "(Edit)" link at the end which allow users to go into the "editing mode", which reveals an input element. The user can exit the editing mode by either moving the focus away from the control or clicking on "(Save)" at the end. It calls _updateCallback in the latter case. (EditableText.prototype.editedText): Returns the current value of the input element user. (EditableText.prototype.setText): Sets the label. This does not live-update the input element until the user exists the current editing mode and re-enters it. (EditableText.prototype.setStartedEditingCallback): Sets a callback which gets called when the user requested to enter the editing mode. Since EditableText relies on AnalysisTaskPage to render, this callback only exits to call EditableText.render() in AnalysisTask._didStartEditingTaskName. (EditableText.prototype.setUpdateCallback): Sets a callback which gets called when the user exits the editing mode by activating the "(Save)" link. This callback MUST return a promise upon resolution of which the control gets out of the editing mode. While the promise is in flight, the input element becomes readonly. (EditableText.prototype.render): Updates various states of the elements. When _updatingPromise is not falsy, we make the input element readonly and show '(...)' on the link. Don't show the action link if the label is empty (e.g. analysis task or test group is still being fetched). (EditableText.prototype._didClick): Called when the user clicked on the action link. Enter the editing mode or save the edited label via _updateCallback. (EditableText.prototype._didBlur): Exit the editing mode without saving if the input element is not focused, there is no inflight promise returned by _updateCallback, and the action link "(Save)" does not have the focus. (EditableText.prototype._didUpdate): Called when exiting the editing mode. (EditableText.htmlTemplate): (EditableText.cssTemplate): * public/v3/index.html: Include newly added editable-text.js. * public/v3/models/analysis-task.js: (AnalysisTask.prototype.updateSingleton): Added. (AnalysisTask.prototype.updateName): Added. Uses PrivilegedAPI to update the name and re-fetches the analysis task from the sever. (AnalysisTask._constructAnalysisTasksFromRawData): Use ensureSingleton instead of manually calling findById since we need to update the name of the singleton object we found (via updateSingleton). * public/v3/models/bug.js: (Bug.ensureSingleton): Moved the code to compute the synthetic id from AnalysisTask's _constructAnalysisTasksFromRawData. (Bug.prototype.updateSingleton): Added. Just assert that nothing changes. * public/v3/models/build-request.js: (BuildRequest.prototype.updateSingleton): Added. Assert that the intrinsic values of a build request doesn't change and update status text, status url, and build id as they could change. * public/v3/models/commit-log.js: (CommitLog): Made the constructor argument conform to the convention of id, object pair so that we can use DataModelObject.ensureSingleton. (CommitLog.ensureSingleton): (CommitLog.prototype.updateSingleton): Extracted from CommitLog.ensureSingleton. * public/v3/models/data-model.js: (DataModelObject.ensureSingleton): Call newly added updateSingleton. (DataModelObject.prototype.updateSingleton): (LabeledObject): Removed the name map since it's never used (findByName is never called anywhere). (LabeledObject.prototype.updateSingleton): Added. Updates _name. (LabeledObject.findByName): Deleted. * public/v3/models/test-group.js: (TestGroup.prototype.updateName): Added. Uses PrivilegedAPI to update the name and re-fetches the test group from the sever. (TestGroup._createModelsFromFetchedTestGroups): Removed bogus code. A root set doesn't have a test group associated with it since multiple test groups can share a single root set (this property doesn't even exist). * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): Removed useless _taskId and added this._testGroupLabelMap and this._taskNameLabel. (AnalysisTaskPage.prototype.updateFromSerializedState): Cleanup. (AnalysisTaskPage.prototype._didFetchTask): Assert that this function is called exactly once. (AnalysisTaskPage.prototype.render): Use this._task.id() to show the v2 link. Use EditableText to show the names of the analysis task and the associated test groups. Hide the overview chart and the list of test groups (along with the retry/confirm button) when the analysis task failed to fetch. We always update the names of the analysis task and the associated test groups since they could be updated by the server. (AnalysisTaskPage.prototype._didStartEditingTaskName): Added. (AnalysisTaskPage.prototype._updateTaskName): Added. (AnalysisTaskPage.prototype._updateTestGroupName): Added. (AnalysisTaskPage.htmlTemplate): Updated the style. 2016-02-11 Ryosuke Niwa Land the change that was supposed to be the part of r196463. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype._didFetchTestGroups): Select the latest test group by default. 2016-02-11 Ryosuke Niwa Refine v3 UI's analysis task page https://bugs.webkit.org/show_bug.cgi?id=154152 Reviewed by Chris Dumez. This patch makes the following refinements to the analysis task page: - Always show the relative different of in-progress A/B testing. - Make the annotations (colored bars) in the chart open other analysis tasks. - Order the A/B testing groups in the reverse chronological order. - Select the time range corresponding to the current test group. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.cssTemplate): Fixed the bug that pending and running testing groups are no longer colored after r196440. Use a slightly more opaque color for currently running groups compared to pending ones. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.setMainSelection): Added. (ChartPaneBase.prototype._openAnalysisTask): Moved the code from ChartPane._openAnalysisTask so that it can be reused in both AnalysisTaskChartPane and ChartPane (in charts page). (ChartPaneBase.prototype.router): Added. Overridden by each subclass. * public/v3/components/test-group-results-table.js: (TestGroupResultsTable.prototype.buildRowGroups): Always show the summary (relative difference of A to B) as long as there are some results in each set. * public/v3/models/test-group.js: (TestGroup.prototype.compareTestResults): Always set .label and .fullLabel with the relative change as long as there are some values. Keep using "pending" and "running" in .status since that would determine the color of stacking blocks representing those A/B testing groups. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane): (AnalysisTaskChartPane.prototype.setPage): Added. (AnalysisTaskChartPane.prototype.router): Added. (AnalysisTaskPage): (AnalysisTaskPage.prototype.render): Show the list of A/B testing groups in the reverse chronological order. Also set the main chart's selection to the time range of the current test group. * public/v3/pages/chart-pane.js: (ChartPane.prototype.router): Added. (ChartPane.prototype._openAnalysisTask): Moved to ChartPaneBase.prototype._openAnalysisTask. 2016-02-11 Ryosuke Niwa Add a script to process backlogs created while perf dashboard was in the maintenance mode https://bugs.webkit.org/show_bug.cgi?id=154140 Reviewed by Chris Dumez. Added a script to process the backlog JSONs created while the perf dashboard was put in the maintenance mode. It re-submits each JSON file to the perf dashboard using the same server config file used by syncing scripts. * public/include/report-processor.php: (TestRunsGenerator::test_value_list_to_values_by_iterations): Fixed a bug in the error message code. It was referencing an undeclared variable. * tools/process-maintenance-backlog.py: Added. 2016-02-11 Ryosuke Niwa AnalysisResultsViewer never uses this._smallerIsBetter https://bugs.webkit.org/show_bug.cgi?id=154134 Reviewed by Chris Dumez. Removed the unused instance variable _smallerIsBetter from AnalysisResultsViewer and TestGroupStackingBlock. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer): Removed the unused _smallerIsBetter. (AnalysisResultsViewer.prototype.setSmallerIsBetter): Deleted. (AnalysisResultsViewer.prototype.buildRowGroups): (AnalysisResultsViewer.TestGroupStackingBlock): Removed the unused _smallerIsBetter. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype._didFetchTask): 2016-02-11 Ryosuke Niwa Build fix after r196440. * public/v3/models/test-group.js: (TestGroup.prototype.addBuildRequest): Clear the map instead of setting the property to null. 2016-02-10 Ryosuke Niwa Perf dashboard should have UI to retry A/B testing https://bugs.webkit.org/show_bug.cgi?id=154090 Reviewed by Chris Dumez. Added a button to re-try an existing A/B testing group with a custom repetition count. The same button functions as a way of confirming the progression/regression when there have been no A/B testing scheduled in the task. Also fixed the bug that A/B testing groups that have been waiting for other test groups will be shown as "running". * public/v3/components/results-table.js: (ResultsTable.cssTemplate): Don't pad the list of extra repositories when it's empty. * public/v3/components/test-group-results-table.js: (TestGroupResultsTable.prototype.buildRowGroups): Use TestGroup.labelForRootSet instead of manually computing the letter for each configuration set. * public/v3/models/build-request.js: (BuildRequest.prototype.hasStarted): Added. * public/v3/models/data-model.js: (DataModelObject.ensureSingleton): Added. (DataModelObject.cachedFetch): Added noCache option. This is used when re-fetching the test groups after creating one. * public/v3/models/measurement-cluster.js: (MeasurementCluster.prototype.startTime): Added. * public/v3/models/measurement-set.js: (MeasurementSet.prototype.hasFetchedRange): Added. Returns true only if there are no "holes" (cluster yet to be fetched) between the specified time range. This was added to fix a bug in AnalysisTaskPage's _didFetchMeasurement. * public/v3/models/test-group.js: (TestGroup): Added this._rootSetToLabel. (TestGroup.prototype.addBuildRequest): Reset this._rootSetToLabel along with this._requestedRootSets. (TestGroup.prototype.repetitionCount): Added. Returns the number of iterations executed per set. We assume that every root set in the test group shares a single repetition count. (TestGroup.prototype.requestedRootSets): Now populates this._rootSetToLabel for labelForRootSet. (TestGroup.prototype.labelForRootSet): Added. (TestGroup.prototype.hasStarted): Added. (TestGroup.prototype.compareTestResults): Use 'running' and 'pending' to differentiate test groups that are waiting for other groups to finish running from the ones that are actually running ('incomplete' before this patch). (TestGroup.fetchByTask): (TestGroup.createAndRefetchTestGroups): Added. Creates a new test group using the privileged-api/create-test-group and fetches the list of test groups for the specified analysis task. (TestGroup._createModelsFromFetchedTestGroups): Extracted from TestGroup.fetchByTask. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): Initialize _renderedCurrentTestGroup to undefined so that we'd always can differentiate the initial call to AnalysisTaskPage.render and subsequent calls in which it's identical to _currentTestGroup. (AnalysisTaskPage.prototype._didFetchMeasurement): Fixed a bug that we don't exit early even when some clusters in between startPoint and endPoint are still being fetched via newly added hasFetchedRange. (AnalysisTaskPage.prototype.render): Update the default repetition count based on the current test group. Also update the label of the button to "Confirm the change" if there is no A/B testing in this task. (AnalysisTaskPage.prototype._retryCurrentTestGroup): Added. Re-triggers an existing A/B testing group or creates the A/B testing for the entire range of the analysis task. (AnalysisTaskPage.prototype._hasDuplicateTestGroupName): Added. (AnalysisTaskPage.prototype._createRetryNameForTestGroup): Added. (AnalysisTaskPage.htmlTemplate): Added form controls to re-trigger A/B testing. (AnalysisTaskPage.cssTemplate): Updated the style. 2016-02-10 Ryosuke Niwa Removed the duplicated definition of ChartPaneBase. * public/v3/components/chart-pane-base.js: 2016-02-09 Ryosuke Niwa Analysis task page on v3 UI should show charts https://bugs.webkit.org/show_bug.cgi?id=154057 Reviewed by Chris Dumez. Extracted ChartPaneBase out of ChartPane and added an instance of its new subclass, AnalysisTaskChartPane, to the analysis task page. The main difference is that ChartPaneBase doesn't depend on the presence of this._chartsPage unlike ChartPane. It also doesn't have the header with toolbar (to show breakdown, etc...). * public/v3/components/base.js: (ComponentBase.prototype._constructShadowTree): Call htmlTemplate() and cssTemplate() with the right "this". * public/v3/components/chart-pane-base.js: Added. (ChartPaneBase): Extracted from ChartPane. (ChartPaneBase.prototype.configure): Extracted from the constructor. Separating this function allows the component to be instantiated inside a HTML template. (ChartPaneBase.prototype._fetchAnalysisTasks): Moved from ChartPane._fetchAnalysisTasks. (ChartPaneBase.prototype.platformId): Ditto. (ChartPaneBase.prototype.metricId): Ditto. (ChartPaneBase.prototype.setOverviewDomain): Ditto. (ChartPaneBase.prototype.setMainDomain): Ditto. (ChartPaneBase.prototype._overviewSelectionDidChange): Extracted from the constructor. This is overridden in ChartPane and unused in AnalysisTaskChartPane. (ChartPaneBase.prototype._mainSelectionDidChange): Extracted from ChartPane._mainSelectionDidChange. (ChartPaneBase.prototype._mainSelectionDidZoom): Extracted from ChartPane._mainSelectionDidZoom. (ChartPaneBase.prototype._indicatorDidChange): Extracted from ChartPane._indicatorDidChange. (ChartPaneBase.prototype._didFetchData): Moved from ChartPane._fetchAnalysisTasks. (ChartPaneBase.prototype._openAnalysisTask): Ditto. (ChartPaneBase.prototype._openCommitViewer): Ditto. Also fixed a bug that we don't show the spinner while waiting for the data to be fetched by calling this.render() here. (ChartPaneBase.prototype._keyup): Moved from ChartPane._keyup. Also fixed the bug that the revisions list doesn't update by calling this.render() here. (ChartPaneBase.prototype.render): Extracted from ChartPane.render. (ChartPaneBase.htmlTemplate): Extracted from ChartPane.htmlTemplate. (ChartPaneBase.paneHeaderTemplate): Added. This is overridden in ChartPane and unused in AnalysisTaskChartPane. (ChartPaneBase.cssTemplate): Extracted from ChartPane.htmlTemplate. * public/v3/components/chart-styles.js: Renamed from public/v3/pages/page-with-charts.js. (PageWithCharts): Renamed from PageWithCharts since it no longer extends PageWithHeading. (ChartStyles.createChartSourceList): * public/v3/components/commit-log-viewer.js: (CommitLogViewer.prototype.view): Set this._repository right away instead of waiting for the fetched data so that spinner will be shown while the data is being fetched. * public/v3/index.html: * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane): Added extends ChartPaneBase. (AnalysisTaskPage): Added. this._chartPane. (AnalysisTaskPage.prototype._didFetchTask): Initialize this._chartPane with a domain. (AnalysisTaskPage.prototype.render): Render this._chartPane. (AnalysisTaskPage.htmlTemplate): * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): Removed the unused router from the argument list. (ChartPaneStatusView.prototype.pointsRangeForAnalysis): Renamed from analyzeData() since it was ambiguous. (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Fixed the bug that we don't update the list of the revisions here. (ChartPaneStatusView.prototype.computeChartStatusLabels): * public/v3/pages/chart-pane.js: (ChartPane): Now extends ChartPaneBase. (ChartPane.prototype._overviewSelectionDidChange): Extracted from the constructor. (ChartPane.prototype._mainSelectionDidChange): (ChartPane.prototype._mainSelectionDidZoom): (ChartPane.prototype._indicatorDidChange): (ChartPane.prototype.render): (ChartPane.prototype._renderActionToolbar): (ChartPane.paneHeaderTemplate): Extracted from htmlTemplate. (ChartPane.cssTemplate): (ChartPane.overviewOptions.selection.onchange): Deleted. (ChartPane.prototype._fetchAnalysisTasks): Deleted. (ChartPane.prototype.platformId): Deleted. (ChartPane.prototype.metricId): Deleted. (ChartPane.prototype.setOverviewDomain): Deleted. (ChartPane.prototype.setMainDomain): Deleted. (ChartPane.prototype._openCommitViewer): Deleted. (ChartPane.prototype._didFetchData): Deleted. (ChartPane.prototype._keyup): Deleted. * public/v3/pages/charts-page.js: (ChartsPage): (ChartsPage.createDomainForAnalysisTask): Extracted by createDomainForAnalysisTask; used to set the domain of the charts in the analysis task page. (ChartsPage.createStateForAnalysisTask): * public/v3/pages/dashboard-page.js: (DashboardPage): (DashboardPage.prototype._createChartForCell): 2016-02-10 Ryosuke Niwa Add the support for maintenance mode https://bugs.webkit.org/show_bug.cgi?id=154072 Reviewed by Chris Dumez. Added the crude support for maintenance mode whereby which the reports are stored in the filesystem instead of the database. * config.json: Added maintenanceMode and maintenanceDirectory as well as forgotten siteTitle and remoteServer.httpdMutexDir. * public/api/report.php: (main): Don't connect to the database or modify database when maintenanceMode is set. * public/include/json-header.php: (ensure_privileged_api_data): Exit with InMaintenanceMode when maintenanceMode is set. This prevents privileged API such as creating analysis tasks and new A/B testing groups from modifying the database. 2016-02-09 Ryosuke Niwa Analysis task page on v3 show progression as regressions https://bugs.webkit.org/show_bug.cgi?id=154045 Reviewed by Chris Dumez. The bug was caused by TestGroup.compareTestResults referring to undefined _smallerIsBetter. Retrieve it from the associated metric object via the owner analysis task. * public/v3/models/test-group.js: 2016-02-05 Ryosuke Niwa Testing with remote server cache is unusably slow https://bugs.webkit.org/show_bug.cgi?id=153928 Reviewed by Chris Dumez. Don't use the single process mode of httpd as it's way too slow even for testing. Also we'll hit a null pointer crash (http://svn.apache.org/viewvc?view=revision&revision=1711479) Since httpd exits immediately when launched in multi-process mode, remote-cache-server.py (renamed from run-with-remote-server.py) now has "start" and "stop" commands to start/stop the Apache. Also added "reset" command to reset the cache for convenience. * Install.md: Updated the instruction. * config.json: Fixed a typo: httpdErro*r*Log. * tools/remote-cache-server.py: Copied from Websites/perf.webkit.org/tools/run-with-remote-server.py. Now takes one of the following commands: "start", "stop", and "reset". (main): (start_httpd): Extracted from main. (stop_httpd): Added. * tools/remote-server-relay.conf: Removed redundant (duplicate) LoadModule's. * tools/run-with-remote-server.py: Removed. 2016-02-04 Ryosuke Niwa Perf dashboard should have a script to setup database https://bugs.webkit.org/show_bug.cgi?id=153906 Reviewed by Chris Dumez. Added tools/setup-database.py to setup the database. It retrieves the database name, username, password and initializes a database at the specified location. * Install.md: Updated instruction to setup postgres to use setup-database.py. * tools/setup-database.py: Added. (main): (load_database_config): (determine_psql_dir): (start_or_stop_database): (execute_psql_command): 2016-01-12 Ryosuke Niwa buildbot syncing scripts sometimes schedule more than one requests per builder https://bugs.webkit.org/show_bug.cgi?id=153047 Reviewed by Chris Dumez. The bug was caused by the check for singularity of scheduledRequests being conducted per configuration instead of per builder. So if there were multiple test configurations (e.g. Speedometer and Octane) that both used the same builder, then we may end up scheduling both at once. Fixed the bug by sharing a single set to keep track of the scheduled requests for all configurations per builder. * tools/sync-with-buildbot.py: (load_config): Share a set amongst test configurations for each builder. (find_request_updates): Instead of creating a new set for each configuration, reuse the existing sets to share a single set agmonst test configurations for each builder. 2016-01-12 Ryosuke Niwa Analysis results viewer sometimes doesn't show the correct relative difference https://bugs.webkit.org/show_bug.cgi?id=152930 Reviewed by Chris Dumez. The bug was caused by single A/B testing result associated with multiple rows when there are multiple data points with the same root set which matches that of an A/B testing. Fixed the bug by detecting such a case, and only associating each A/B testing result with the row created for the first matching point. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype._buildRowsForPointsAndTestGroups): 2016-01-08 Ryosuke Niwa Make v3 UI analysis task page is hard to understand https://bugs.webkit.org/show_bug.cgi?id=152917 Reviewed by Antti Koivisto. Add a dark gray border around the selected block in the analysis results viewer instead of using darker shades since that looks as if they were bigger regression/progression. Explicitly show "Failed" as the label instead of omitting with "-" when all build requests in an A/B testing group fails. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.cssTemplate): Tweaked the style to underline text in the hovered blocks and the selected blocks and show a dark gray border around the selected blocks. (AnalysisResultsViewer.TestGroupStackingBlock): (AnalysisResultsViewer.TestGroupStackingBlock.prototype.createStackingCell): Use this._title for title. (AnalysisResultsViewer.TestGroupStackingBlock.prototype._computeTestGroupStatus): (AnalysisResultsViewer.TestGroupStackingBlock.prototype._valuesForRootSet): Deleted. * public/v3/components/results-table.js: (ResultsTable.prototype.render): (ResultsTable.prototype._createRevisionListCells): Extracted from ResultsTable.prototype.render. (ResultsTable.cssTemplate): Tweaked the style. (ResultsTableRow): (ResultsTableRow.prototype.constructor): Added _labelForWholeRow to store the label for the entire row. This is used to show the comparison result of two root sets (e.g. A vs B). (ResultsTableRow.prototype.setLabelForWholeRow): Added. (ResultsTableRow.prototype.labelForWholeRow): Added. (ResultsTableRow.prototype.resultContent): Extracted from buildHeading. Creates a hyperlinked bar graph used for each A/B testing result. (ResultsTableRow.prototype.buildHeading): Deleted since we need to set colspan on the second table cell when we're creating a row with _labelForWholeRow. * public/v3/components/test-group-results-table.js: (TestGroupResultsTable.prototype.buildRowGroups): Added rows to show relative differences and statistical significance between root sets (e.g. A vs B). * public/v3/models/build-request.js: (BuildRequest.prototype.hasCompleted): Added. * public/v3/models/test-group.js: (TestGroup.prototype.compareTestResults): Extracted from AnalysisResultsViewer.TestGroupStackingBlock's _computeTestGroupStatus and generalized to be reused in TestGroupResultsTable. (TestGroup.prototype._valuesForRootSet): Moved from AnalysisResultsViewer.TestGroupStackingBlock. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.cssTemplate): Tweaked the style. 2016-01-07 Ryosuke Niwa Perf dashboard should automatically add aggregators https://bugs.webkit.org/show_bug.cgi?id=152818 Reviewed by Chris Dumez. When an aggregator entry is missing in aggregators table, automatically insert it in /api/report. In a very early version of the perf dashboard, we had the ability to define a custom aggregator in an admin page. In practice, nobody used or needed this feature so we got rid of it even before the dashboard was landed into WebKit repository. This patch cleans up that mess. * run-tests.js: (main): Added the filtering capability. (TestEnvironment): Expose the config JSON in the test environment. * public/include/report-processor.php: (ReportProcessor): Renamed name_to_aggregator now that it only contains ID. (ReportProcessor::__construct): No longer fetches the aggregator table. An equivalent work is done in newly added ensure_aggregators. (ReportProcessor::process): Calls ensure_aggregators which populates name_to_aggregator_id. (ReportProcessor::ensure_aggregators): Added. Add the builtin aggregators: Arithmetic, Geometric, Harmonic, and Total. (TestRunsGenerator): Renamed name_to_aggregator now that it only contains ID. (TestRunsGenerator::__construct): (TestRunsGenerator::add_aggregated_metric): Don't include aggregator_definition here since it's never used now that all the aggregations are done natively in PHP. (TestRunsGenerator::$aggregators): Added. We don't include SquareSum since it's only used for computing run_square_sum_cache in test_runs table and it's useless elsewhere. (TestRunsGenerator::aggregate_values): Add a comment about that. * tests/api-report.js: Updated a test case to reflect the change. 2016-01-06 Ryosuke Niwa Perf dashboard JSON API should fail gracefully when postgres is down https://bugs.webkit.org/show_bug.cgi?id=152812 Reviewed by Chris Dumez. Even though all JSON APIs returned DatabaseConnectionFailure as the status when Database::connect returned a falsy value, PHP was spitting out warnings and producing HTTP responses that cannot be parsed as a JSON when pg_connect failed. Fixed the bug by suppressing warning messages in pg_connect. * public/include/db.php: (Database::connect): Use '@' prefix to suppress warning messages. 2016-01-06 Ryosuke Niwa Perf dashboard should auto-generate manifest file when one is missing https://bugs.webkit.org/show_bug.cgi?id=152813 Reviewed by Chris Dumez. When /data/manifest.json is missing, fall back to newly added /api/manifest instead of silently failing to show the UI. This will make the initial setup easier. * public/api/manifest.php: Added. (main): * public/include/manifest.php: (Manifest::manifest): Added. * public/v3/main.js: (fetchManifest): (didFetchManifest): Extracted from fetchManifest. 2016-01-06 Ryosuke Niwa Commit another forgotten change, this time, for r194653. * public/v3/models/measurement-set.js: 2016-01-06 Ryosuke Niwa The sampling of time series on v3 UI is too aggressive https://bugs.webkit.org/show_bug.cgi?id=152804 Reviewed by Chris Dumez. Fixed a bug that we were always halving the number of data points in _sampleTimeSeries and increased the number of data points allowed to make the sampling less aggressive. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype._ensureSampledTimeSeries): Increase the number of maximum points to 2x the number of pixels divided by the radius of each point. (TimeSeriesChart.prototype._sampleTimeSeries.findMedian): Changed the semantics of endIndex to mean the index after the last point and renamed it to indexAfterEnd. (TimeSeriesChart.prototype._sampleTimeSeries): Fixed a bug that this code always coerced two data points into one sampled data point despite of the fact i and j are sufficiently apart since data[j].time - data[i].time > timePerSample by definition. 2016-01-06 Ryosuke Niwa Commit the forgotten change for r194651. * public/v3/pages/domain-control-toolbar.js: (DomainControlToolbar.prototype.setStartTime): 2016-01-05 Ryosuke Niwa The right hand side of main chart appears to be cut off as you zoom out on v3 UI https://bugs.webkit.org/show_bug.cgi?id=152778 Reviewed by Antti Koivisto. Add a padding on x-axis after the end time to make the main chart more easily interactive. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype._computeHorizontalRenderingMetrics): * public/v3/pages/page-with-charts.js: (PageWithCharts.mainChartOptions): Add a padding of 5px at the end of x-axis. 2016-01-06 Ryosuke Niwa v3 UI should use four sig-figs to label y-axis of the main charts https://bugs.webkit.org/show_bug.cgi?id=152779 Reviewed by Antti Koivisto. Increase the number of significant figures used in the main charts to four as done in v2 UI. * public/v3/pages/chart-pane.js: (ChartPane.constructor): Create a formatter with four significant figures. * public/v3/pages/page-with-charts.js: (PageWithCharts.mainChartOptions): Increase the width of y-axis labels. 2016-01-05 Ryosuke Niwa v3 UI's time range slider is harder to use than that of v2 UI https://bugs.webkit.org/show_bug.cgi?id=152780 Reviewed by Antti Koivisto. Improved the time range slider by using a cubic mapping to time range and providing a text field to directly edit the number of days to show. Now an user can enter the text mode to directly edit the number of days to show by clicking on the number of days (text field is always there with opacity=0). * public/v3/pages/charts-toolbar.js: (ChartsToolbar): Store the minimum and maximum number of days allowed. Also rename _inputElement to _slider and added a new type=number text field as _editor. (ChartsToolbar.prototype.render): (ChartsToolbar.prototype.setStartTime): Exit the text mode when the number of days is changed by an URL state transition (i.e. back/forward navigation). (ChartsToolbar.prototype._setInputElementValue): Added. Updates the values of _slider and _editor. (ChartsToolbar.prototype._enterTextMode): Added. Hide the elements used by the slider mode and show the text field. (ChartsToolbar.prototype._exitTextMode): Added. Does the opposite. (ChartsToolbar.prototype._sliderValueMayHaveChanged): Renamed from _inputValueMayHaveChanged. (ChartsToolbar.prototype._editorValueMayHaveChanged): Added. Similar to _sliderValueMayHaveChanged but also corrects the value of _editor if needed. (ChartsToolbar.prototype._callNumberOfDaysCallback): Extracted from _inputValueMayHaveChanged. Also fixed a bug that we didn't update the URL state when the change event was fired without modifying the effective number of days. (ChartsToolbar.cssTemplate): Tweaked the style to support the new mode. Also set a fixed width on the span showing the number of days in the slider mode. 2016-01-06 Ryosuke Niwa Zooming button is broken on v3 UI https://bugs.webkit.org/show_bug.cgi?id=152777 Reviewed by Chris Dumez. Bring up the zoom button in z-index so that users can click it. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.cssTemplate): 2016-01-06 Ryosuke Niwa v3 UI doesn't preserve the time range when charts page is opened from a dashboard https://bugs.webkit.org/show_bug.cgi?id=152776 Reviewed by Chris Dumez. Fixed the bug by moving the construction of charts URL from DashboardPage.prototype.open to DashboardPage.prototype.render and re-rendering the entire page upon an URL state transition. * public/v3/pages/charts-page.js: (ChartsPage.createStateForDashboardItem): Takes the start time for the charts page. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype.updateFromSerializedState): Merged _numberOfDaysDidChange and _updateChartsDomainFromToolbar into this function since they're not used elsewhere. Also re-render the entire page when transition between different number of days to show. (DashboardPage.prototype._numberOfDaysDidChange): Deleted. (DashboardPage.prototype._updateChartsDomainFromToolbar): Deleted. (DashboardPage.prototype.render): Construct URL for each charts here. (DashboardPage.prototype._createChartForCell): Don't construct URL here since this function is called once when the dashboard page is opened, and not when the time range is changed. 2016-01-05 Ryosuke Niwa Build fix for an old version of PHP after r194618. * public/api/measurement-set.php: 2016-01-05 Ryosuke Niwa A/B testing results should be visualized intuitively on v3 UI https://bugs.webkit.org/show_bug.cgi?id=152496 Rubber-stamped by Chris Dumez. Add the "stacking block" view of A/B testing results to the analysis task page on v3 UI. The patch enhances JSON APIs at /api/analysis-task /api/measurement-set/ to reduce the number of HTTP requests, and adds two UI components: TestGroupResultsTable and AnalysisResultsViewer both of which inherits from an abstract superclass: ResultsTable. ResultsTable provides a tabular presentation of measured values in regular measurement sets and A/B testing results using groups of bar graphs created by BarGraphGroup. TestGroupResultsTable inherits from this class to display A/B testing configurations and the averaged results for each configuration, and AnalysisResultsViewer inherits from it to provide an intuitive visualization of the outcomes of all A/B testing results associated with a given analysis task. * public/api/analysis-tasks.php: (main): Add the capability to find the analysis task based on its build request. This allows /v3/#/analysis/task/?buildRequest= to be hyperlinked on buildbot page. * public/api/measurement-set.php: (main): Removed the unused startTime and endTime, and added "analysisTask" to query parameters. (AnalysisResultsFetcher): Added. Used to fetch measured data associated with every build request on an analysis task. (AnalysisResultsFetcher::__construct): (AnalysisResultsFetcher::fetch): Unlike MeasurementSetFetcher, we fetch the list of commits and list of measurements separately since there will be a lot less builds and commits than measured data (since we're fetching measured values for all tests and their metrics). (AnalysisResultsFetcher::fetch_commits): Fetches commits. (AnalysisResultsFetcher::format_measurement): Like MeasurementSetFetcher::format_measurement but with config_type and config_metric since we're returning measured data for all metrics and test configurations. (AnalysisResultsFetcher::format_map): Similar to MeasurementSetFetcher::format_map. * public/v3/components/analysis-results-viewer.js: Added. (AnalysisResultsViewer): Added. (AnalysisResultsViewer.prototype.didUpdateResults): This callback is called by AnalysisTaskPage when A/B testing results become available. (AnalysisResultsViewer.prototype.render): Overrides ResultsTable's render to highlight the block representing the currently selected test group. (AnalysisResultsViewer.prototype.buildRowGroups): Creates a list of rows with "stacking blocks" that visualizes A/B testing results. The algorithm works as follows: 1. Create all table rows. 2. Find which row is associated with each set in each test group. 3. Layout "blocks". (AnalysisResultsViewer.prototype._collectRootSetsInTestGroups): Collects root sets from all data in the measurement set as well as A/B testing **requests** (results may contain more repositories than requested but they aren't interesting for the purpose of visualizing results for the entire analysis task). (AnalysisResultsViewer.prototype._buildRowsForPointsAndTestGroups): Create table rows. First, create table rows for measurement set points that have a matching test group (i.e. either set A or set B of an A/B testing uses the same root set as a point). Second, insert a new row for each root set in each test group which didn't find a matching measurement set point. There is a little subtlety that some A/B testing may specify revisions for a subset of repositories and/or some A/B testing results may appear as if it goes back in time with respect to other A/B testing results. For example, consider creating two A/B test groups for WebKit changes and OS changes separately. There could be no coherent linearization of those two A/B testing in which both WebKit and OS versions move forward. (AnalysisResultsViewer.RootSetInTestGroup): Added. Represents a pair (test group, root set) since a root set could be shared by multiple test groups. (AnalysisResultsViewer.TestGroupStackingBlock): Added. A stacked block representing a test group. (AnalysisResultsViewer.TestGroupStackingBlock.prototype.addRowIndex): Associates a row number with either set A or set B. (AnalysisResultsViewer.TestGroupStackingBlock.prototype.createStackingCell): Creates a table cell for this block. (AnalysisResultsViewer.TestGroupStackingBlock.prototype.isThin): Returns true if this test group has failed and this block should look "thin" without any label. (AnalysisResultsViewer.TestGroupStackingBlock.prototype._computeTestGroupStatus): Computes the status for this test group. (AnalysisResultsViewer.TestGroupStackingGrid): Added. AnalysisResultsViewer uses this class to layout blocks representing test groups. (AnalysisResultsViewer.TestGroupStackingGrid.prototype.insertBlockToColumn): Inserts a new block to layout. We keep all test groups doing the same A/B test next to each other. (AnalysisResultsViewer.TestGroupStackingGrid.prototype.layout): Layouts each block / test group in the order they are created. (AnalysisResultsViewer.TestGroupStackingGrid.prototype._layoutBlock): Places the block in the left-most column that can accommodate it while avoiding columns of a different thin-ness. A column is thin if its A/B testing has failed, and not thin otherwise. (AnalysisResultsViewer.TestGroupStackingGrid.prototype.createCellsForRow): Creates table cells for a given row. For each column, generate a table cell if we're in the first row and the first block starts in a later row, a block starts in the current row, or the last block ended in the previous row and the next block or the last row appears later. * public/v3/components/bar-graph-group.js: Added. A component for showing a group of bar graphs. (BarGraphGroup): Added. Creates a group of bar graphs with the same value range. It's used by AnalysisResultsViewer and ResultsTable to show bar graphs to compare values. (SingleBarGraph): A component created and collectively controlled by BarGraphGroup. * public/v3/components/results-table.js: Added. (ResultsTable): An abstract superclass for TestGroupResultsTable and AnalysisResultsViewer. (ResultsTable.prototype.render): Renders the table. 1. Call "buildRowGroups()" implemented by a subclass to obtain the list of rows. 2. Compute the list of repositories to show. 3. For each cell in the table, compute the number of rows to show the same value (for rowspan). 4. Render the table with an extra list of repositories if exists. (ResultsTable.prototype._computeRepositoryList): Compute the list of repositories to list revisions in the table. Omit repositories not present in any row or for which all rows have the same revision. In the latter case, include it in the extra repositories listed below the table. This minimizes the amount of redundant information presented to the user. (ResultsTableRow): Added. Represents a single row in the table. ResultsTable constructs necessary table cells to tabulate the associated root sets, and shows the associated result using a grouped bar graph. Additional columns are used by AnalysisResultsViewer to show stacked blocks for A/B testing groups. * public/v3/components/test-group-results-table.js: Added. (TestGroupResultsTable): (TestGroupResultsTable.prototype.didUpdateResults): (TestGroupResultsTable.prototype.setTestGroup): (TestGroupResultsTable.prototype.heading): (TestGroupResultsTable.prototype.render): (TestGroupResultsTable.prototype.buildRowGroups): * public/v3/index.html: * public/v3/models/analysis-results.js: Added. (AnalysisResults): Added. Like MeasurementSet, this class represents a set of measured values associated with a given analysis task. (AnalysisResults.prototype.find): Returns a measured valued for a given build and metric. (AnalysisResults.prototype.add): Adds a new measured value. Used by AnalysisResults.fetch. (AnalysisResults.fetch): Fetches data and creates AnalysisResults for a given analysis task. * public/v3/models/analysis-task.js: (AnalysisTask.prototype.startMeasurementId): Added. (AnalysisTask.prototype.endMeasurementId): Added. (AnalysisTask.fetchByBuildRequestId): Added. (AnalysisTask._fetchSubset): Uses DataModelObject.cachedFetch. * public/v3/models/build-request.js: Added. (BuildRequest): Added. Represents a single A/B testing request associated with a test group. * public/v3/models/builder.js: (Build): Added. Represents a build associated with a given A/B testing result. * public/v3/models/commit-log.js: (CommitLog): Made this class inherit from DataModelObject. (CommitLog.ensureSingleton): Added. Finds the singleton object created for a given revision in the specified repository. This helps RootSet and other classes compare commits fast. (CommitLog.prototype.repository): Added. (CommitLog.fetchBetweenRevisions): Uses CommitLog.ensureSingleton. * public/v3/models/data-model.js: (DataModelObject): (DataModelObject.namedStaticMap): Added. (DataModelObject.ensureNamedStaticMap): Renamed from namedStaticMap instead of implicitly assuming that the non-static version always creates the map. (DataModelObject.prototype.namedStaticMap): Added. (DataModelObject.cachedFetch): Extracted from AnalysisTask._fetchSubset so that TestGroup's fetchByTask could also use it. (LabeledObject): * public/v3/models/measurement-adaptor.js: Added. (MeasurementAdaptor): Extracted from MeasurementCluster. This class is responsible for re-formatting the data received via /api/measurement-set JSON API inside the v3 UI. (MeasurementAdaptor.prototype.extractId): Added. (MeasurementAdaptor.prototype.adoptToAnalysisResults): Added. Used by AnalysisResults. (MeasurementAdaptor.aggregateAnalysisResults): Added. Used by TestGroupResultsTable to aggregate results for each test configuration; e.g. computing the average for set A. (MeasurementAdaptor.prototype.adoptToSeries): Extracted from MeasurementCluster.addToSeries. Added rootSet() to each point. This allows AnalysisResultsViewer to compare them against root sets associated with A/B testing results. (MeasurementAdaptor.computeConfidenceInterval): Moved from MeasurementCluster. * public/v3/models/measurement-cluster.js: (MeasurementCluster): (MeasurementCluster.prototype.addToSeries): * public/v3/models/repository.js: (Repository.prototype.hasUrlForRevision): Added. * public/v3/models/root-set.js: Added. (RootSet): Added. Represents a set of commits in measured results. (MeasurementRootSet): Added. Ditto for results associated with A/B testing. * public/v3/models/test-group.js: Added. (TestGroup): Added. Represents a A/B testing on analysis task. (TestGroup.prototype.createdAt): Added. (TestGroup.prototype.buildRequests): Returns the list of build requests associated with this A/B testing. (TestGroup.prototype.addBuildRequest): Added. Used by BuildRequest's constructor to associate itself with this group. (TestGroup.prototype.didSetResult): Added. Called by BuildRequest.setResult when measured values are fetched and associated with a build request in this group. * public/v3/models/test.js: (Test): * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): (AnalysisTaskPage.prototype.updateFromSerializedState): Fetch the analysis task, test groups associated with it, and all A/B testing results based on the task id or the build request id specified in the URL. (AnalysisTaskPage.prototype._didFetchTask): Added. Start fetching the measured data. This is the data on charts page for which this analysis task was created, not results of A/B testing. (AnalysisTaskPage.prototype._didFetchMeasurement): Added. Display the fetched data in a table inside AnalysisResultsViewer. (AnalysisTaskPage.prototype._didFetchTestGroups): Added. Display the list of A/B test groups as well as the results of the first A/B testing. (AnalysisTaskPage.prototype._didFetchAnalysisResults): Added. (AnalysisTaskPage.prototype._assignTestResultsIfPossible): Added. Once both the analysis task, A/B test groups as well as their results are fetched, update build requests in each test group with their results. (AnalysisTaskPage.prototype.render): Show the list of test groups and highlight the currently selected one. (AnalysisTaskPage.prototype._showTestGroup): Added. A callback used by AnalysisResultsViewer and TestGroupResultsTable to notify this class when the user selects a new test group. (AnalysisTaskPage.htmlTemplate): Updated the template. (AnalysisTaskPage.cssTemplate): Ditto. * public/v3/pages/charts-page.js: (ChartsPage.createStateForAnalysisTask): Added. Creates a URL state object for opening a chart associated with an analysis task. 2015-12-22 Ryosuke Niwa Analysis task page is slow to load https://bugs.webkit.org/show_bug.cgi?id=152517 Reviewed by Andreas Kling. The slowness comes from r194130 which made the JSON API at /api/analysis-tasks to report the start and the end of each analysis task. This query was adding ~2s to the total JSON generation time. Cache these values on analysis_task table since they never change once an analysis task is created. * init-database.sql: Added columns task_start_run_time and task_end_run_time to analysis_task table. Also added the missing drop statements at the top. * public/api/analysis-tasks.php: (fetch_and_push_bugs_to_tasks): Don't fetch the latest commit time of the start and the end. (format_task): Report task_start_run_time and task_end_run_time as startRunTime and endRunTime. * public/privileged-api/create-analysis-task.php: (main): Set start_run_time and end_run_time when creating an analysis task. (time_for_run): Added. 2015-12-17 Ryosuke Niwa v3 UI shouldn't open/close pane selector by mouseenter/leave https://bugs.webkit.org/show_bug.cgi?id=152399 Reviewed by Andreas Kling. Removed the code to open and close the pane selector by mouseenter and mouseleave since multiple people have complained about the behavior. * public/v3/pages/charts-toolbar.js: (ChartsToolbar): Removed the event listeners. (ChartsToolbar.prototype._addPane): Don't close the pane selector when adding a new pane to better support the use case of adding multiple panes. (ChartsToolbar.cssTemplate): Tweaked CSS. 2015-12-17 Ryosuke Niwa Popover for analysis tasks shows up at the left edge of annotation bars in the v3 UI https://bugs.webkit.org/show_bug.cgi?id=152389 Reviewed by Darin Adler. Compute the x coordinate of the popover from the center of each annotation bar. Also adjust the x coordinate to keep the popover within the charts. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype._renderChartContent): 2015-12-17 Ryosuke Niwa Dashboard charts should have uniform widths on v3 UI https://bugs.webkit.org/show_bug.cgi?id=152395 Reviewed by Chris Dumez. Fix the bug by applying table-layout: fixed on the dashboard table. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype.render): Added header-column as a class name to explicitly set the header column with. (DashboardPage.cssTemplate): Adjusted CSS accordingly. 2015-12-17 Ryosuke Niwa Closing a pane on v3 UI always closes the last pane https://bugs.webkit.org/show_bug.cgi?id=152388 Reviewed by Chris Dumez. The bug was caused by closePane being called without arguments. (The first argument to bind is "this" value.) Fixed it by passing in "this" pane object to the first argument. * public/v3/pages/chart-pane.js: (ChartPane): 2015-12-16 Ryosuke Niwa Perf Dashboard v3 UI doesn't show recent data points on v2 UI https://bugs.webkit.org/show_bug.cgi?id=152368 Reviewed by Chris Dumez. The bug was caused by the last modified date in measurement set JSON being a string instead of a POSIX timestamp, which prevented the v3 UI from invalidating the cache. Specifically, the following boolean logic always evaluated to false because +data['lastModified'] was NaN in MeasurementSet.prototype._fetch (/v3/models/measurement-set.js): !clusterEndTime && useCache && +data['lastModified'] < self._lastModified Fixed the bug by calling Database::to_js_time on the last modified date fetched from the database. * public/api/measurement-set.php: (MeasurementSetFetcher::fetch_config_list): Convert the string returned by the database to a POSIX timestamp. * tests/api-measurement-set.js: Added a test to ensure the last modified date in JSON is numeric. Since the value of the last modified date depends on when tests run, we can't assert it to be a certain value. 2015-12-16 Ryosuke Niwa v3 UI should show and link the build number on charts page https://bugs.webkit.org/show_bug.cgi?id=152359 Reviewed by Chris Dumez. Show the hyperlinked build number in the v3 UI. * public/v3/models/builder.js: (Builder): Renamed _buildURL to _buildUrlTemplate. (Builder.prototype.urlForBuild): Added. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): (ChartPaneStatusView.prototype.render): Added the code to render hyperlinked build number when one is available. (ChartPaneStatusView.prototype.computeChartStatusLabels): Store currentPoint's measurement object as _buildInfo if the current point is set by an indicator (not by a selection). 2015-12-16 Ryosuke Niwa v3 dashboard doesn't stretch charts to fill the screen https://bugs.webkit.org/show_bug.cgi?id=152354 Reviewed by Chris Dumez. The bug was caused by a workaround to avoid canvas stretching table cell too much. Fix the problem instead by making the canvas absolutely positioned inside the "time-series-chart" element so that it does not contribute to the intrinsic/natural width of the cell. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype._ensureCanvas): Make the canvas absolutely positioned inside the shadow root. (TimeSeriesChart.prototype._updateCanvasSizeIfClientSizeChanged): Use the container element's size now that the canvas does not resize with it. * public/v3/pages/dashboard-page.js: (DashboardPage.cssTemplate): Updated the CSS so that the chart stretches all the way. 2015-12-16 Ryosuke Niwa The chart status on v3 UI sometimes show wrong revision ranges https://bugs.webkit.org/show_bug.cgi?id=152331 Reviewed by Chris Dumez. The bug was caused by the status view not taking the data sampling that happens in TimeSeriesChart into account when finding the previous point. Take this into account by using InteractiveTimeSeries.currentPoint(-1) which finds the sampled data point immediately preceding the current point (at which the indicator is shown). * public/v3/components/chart-status-view.js: (ChartStatusView.prototype.updateStatusIfNeeded): 2015-12-15 Ryosuke Niwa Perf dashboard's cycler page should use v3 UI https://bugs.webkit.org/show_bug.cgi?id=152324 Reviewed by Chris Dumez. Use the v3 UI in cycler.html after r194130. * public/cycler.html: * public/v3/index.html: Removed the reference to a non-existent platform-selector.js. 2015-12-15 Ryosuke Niwa Add v3 UI to perf dashboard https://bugs.webkit.org/show_bug.cgi?id=152311 Reviewed by Chris Dumez. Add the third iteration of the perf dashboard UI. UI for viewing and modifying analysis tasks is coming soon. The v3 UI is focused on speed, and removes all third-party script dependencies including jQuery, d3, and Ember. Both the DOM-based UI and graphing are implemented manually. The entire app is structured using new component library implemented in components/base.js. Each component is an instance of a subclass of ComponentBase which owns a single DOM element. Each subclass may supply static methods named htmlTemplate and cssTemplate as the template for a component instance. ComponentBase automatically clones the templates inside the associated element (or its shadow root on the supported browsers). Each subclass must supply a method called "render()" which constructs and updates the DOM as needed. There is a special component called Page, which represents an entire page. Each Page is opened by PageRouter's "route()" function. Each subclass of Page supplies "open()" for initialization and "updateFromSerializedState()" for a hash URL transition. The key feature of the v3 UI is the split of time series into chunks called clusters (see r194120). On an internal instance of the dashboard, the v2 UI downloads 27MB of data whereas the same page loads only 3MB of data in the v3. The key logic for fetching time series in chunks is implemented by MeasurementSet in /v3/models/measurement-set.js. We first fetch the cached primary cluster (the cluster that contains the newest data) at: /data/measurement-set--.json If that's outdated according to lastModified in manifest.json, then we immediately re-fetch the primary cluster at: /api/measurement-set/?platform=&metric= Once the up-to-date primary cluster is fetched, we fetch all "secondary" clusters. For each cluster being fetched, including the primary, we invoke registered callbacks. In addition, the v3 UI reduces the initial page load time by loading a single bundled JS file generated by tools/bundle-v3-scripts.py. index.html has a fallback to load all 44 JS files individually during development. * public/api/analysis-tasks.php: (fetch_and_push_bugs_to_tasks): Added the code to fetch start and end run times. This is necessary in V3 UI because no longer fetch the entire time series. See r194120 for the new measurement set JSON API. (format_task): Compute the category of an analysis task based on "result" value. This will be re-vamped once I add the UI for the analysis task page in v3. * public/include/json-header.php: (require_format): CamelCase the name. (require_match_one_of_values): Ditto. (validate_arguments): Renamed from require_existence_of and used in measurement-set.php landed in r194120. * public/v3: Added. * public/v3/components: Added. * public/v3/components/base.js: Added. (ComponentBase): The base component class. (ComponentBase.prototype.element): Returns the DOM element associated with the DOM element. (ComponentBase.prototype.content): Returns the shadow root if one exists and the associated element otherwise. (ComponentBase.prototype.render): To be implemented by a subclass. (ComponentBase.prototype.renderReplace): A helper function to "render" DOM contents. (ComponentBase.prototype._constructShadowTree): Called inside the constructor to instantiate the templates. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Instantiates components referred by its element name inside the instantiated content. (ComponentBase.isElementInViewport): A helper function. Returns true if the element is in the viewport and it has non-zero width and height. (ComponentBase.defineElement): Defines a custom element that can be automatically instantiated from htmlTemplate. (ComponentBase.createElement): A helper function to create DOM tree to be used in "render()" method. (ComponentBase._addContentToElement): A helper for "createElement". (ComponentBase.createLink): A helper function to create a hyperlink or another clickable element (via callback). (ComponentBase.createActionHandler): A helper function to create an event listener that prevents the default action and stops the event propagation. * public/v3/components/button-base.js: Added. * public/v3/components/chart-status-view.js: Added. (ChartStatusView): A component that reports the current status of time-series-chart. It's subclasses by ChartPaneStatusView to provide additional information in the charts page's panes. * public/v3/components/close-button.js: Added. (CloseButton): * public/v3/components/commit-log-viewer.js: Added. (CommitLogViewer): A component that lists commit revisions along with commit messages for a range of data points. * public/v3/components/interactive-time-series-chart.js: Added. (InteractiveTimeSeriesChart): A subclass of InteractiveTimeSeriesChart with interactivity (selection & indicator). Selection and indicator are mutually exclusive. * public/v3/components/pane-selector.js: Added. (PaneSelector): A component for selecting (platform, metric) pair to add in the charts page. * public/v3/components/spinner-icon.js: Added. * public/v3/components/time-series-chart.js: Added. (TimeSeriesChart): A canvas-based chart component without interactivity. It takes a source list and options as the constructor arguments. A source list is a list of measurement sets (measurement-set.js) with drawing options. This component fetches data via MeasurementSet.fetchBetween inside TimeSeriesChart.prototype.setDomain and progressively updates the charts as more data arrives. The canvas is updated on animation frame via rAF and all layout and rendering metrics are lazily computed in _layout. In addition, this component samples data before rendering the chart when there are more data points per pixel in _ensureSampledTimeSeries. * public/v3/index.html: Added. Loads bundled-scripts.js if it exists, or individual script files otherwise. * public/v3/instrumentation.js: Added. This class is used to gather runtime statistics of v3 UI. (It measures the performance of the perf dashboard UI). * public/v3/main.js: Added. Bootstraps the app. (main): (fetchManifest): * public/v3/models: Added. * public/v3/models/analysis-task.js: Added. * public/v3/models/bug-tracker.js: Added. * public/v3/models/bug.js: Added. * public/v3/models/builder.js: Added. * public/v3/models/commit-log.js: Added. * public/v3/models/data-model.js: Added. (DataModelObject): The base class for various data objects that correspond to database tables. It supplies static hash map to find entries by id as well as other keys. (LabeledObject): A subclass of DataModelObject with the capability to find an object via its name. * public/v3/models/measurement-cluster.js: Added. (MeasurementCluster): Represents a single cluster or a chunk of data in a measurement set. * public/v3/models/measurement-set.js: Added. (MeasurementSet): Represents a measurement set. (MeasurementSet.findSet): Returns the singleton set given (metric, platform). We use singleton to avoid issuing multiple HTTP requests for the same JSON when there are multiple TimeSeriesChart that show the same graph (e.g. on charts page with overview and main charts). (MeasurementSet.prototype.findClusters): Finds the list of clusters to fetch in a given time range. (MeasurementSet.prototype.fetchBetween): Fetch clusters for a given time range and calls callback whenever new data arrives. The number of callbacks depends on the how many clusters need to be newly fetched. (MeasurementSet.prototype._fetchSecondaryClusters): Fetches non-primary (non-latest) clusters. (MeasurementSet.prototype._fetch): Issues a HTTP request to fetch a cluster. (MeasurementSet.prototype._didFetchJSON): Called when a cluster is fetched. (MeasurementSet.prototype._failedToFetchJSON): Called when the fetching of a cluster has failed. (MeasurementSet.prototype._invokeCallbacks): Invokes callbacks upon an approval of a new cluster. (MeasurementSet.prototype._addFetchedCluster): Adds the newly fetched cluster in the order. (MeasurementSet.prototype.fetchedTimeSeries): Returns a time series that contains data from all clusters that have been fetched. (TimeSeries.prototype.findById): Additions to TimeSeries defined in /v2/data.js. (TimeSeries.prototype.dataBetweenPoints): Ditto. (TimeSeries.prototype.firstPoint): Ditto. * public/v3/models/metric.js: Added. * public/v3/models/platform.js: Added. * public/v3/models/repository.js: Added. * public/v3/models/test.js: Added. * public/v3/pages: Added. * public/v3/pages/analysis-category-page.js: Added. The "Analysis" page that lists the analysis tasks. * public/v3/pages/analysis-category-toolbar.js: Added. The toolbar to filter analysis tasks based on its category (unconfirmed, bisecting, identified, closed) and a keyword. * public/v3/pages/analysis-task-page.js: Added. Not implemented yet. It just has the hyperlink to the v2 UI. * public/v3/pages/chart-pane-status-view.js: Added. (ChartPaneStatusView): A subclass of ChartStatusView used in the charts page. In addition to the current value, comparison to baseline/target, it shows the list of repository revisions (e.g. WebKit revision, OS version). * public/v3/pages/chart-pane.js: Added. (ChartPane): A component a pane in the charts page. Each pane has the overview chart and the main chart. The zooming is synced across all panes in the charts page. * public/v3/pages/charts-page.js: Added. Charts page. * public/v3/pages/charts-toolbar.js: Added. The toolbar to set the number of days to show. This affects the overview chart's domain in each pane. * public/v3/pages/create-analysis-task-page.js: Added. (CreateAnalysisTaskPage): A page that gets shown momentarily while creating a new analysis task. * public/v3/pages/dashboard-page.js: Added. A dashboard page. * public/v3/pages/dashboard-toolbar.js: Added. Its toolbar with buttons to select the number of days to show. * public/v3/pages/domain-control-toolbar.js: Added. An abstract superclass of charts and dashboard toolbars. * public/v3/pages/heading.js: Added. A component for displaying the header and toolbar, if exists, on each page. * public/v3/pages/page-router.js: Added. This class is responsible for updating the URL hashes as well as opening and updating each page when the hash changes (via back/forward navigation). * public/v3/pages/page-with-charts.js: Added. An abstract subclass of page used by dashboards and charts page. Supplies helper functions for creating TimeSeriesChart options. * public/v3/pages/page-with-heading.js: Added. An abstract subclass of page that uses the heading component. * public/v3/pages/page.js: Added. The Page component. * public/v3/pages/toolbar.js: Added. An abstract toolbar component. * public/v3/remote.js: Added. (getJSON): Fetches JSON from the remote server. (getJSONWithStatus): Ditto. Rejects the response if the status is not "OK". (PrivilegedAPI.sendRequest): Posts a HTTP request to a privileged API in /privileged-api/. (PrivilegedAPI.requestCSRFToken): Creates a new CSRF token to request a privileged API post. * tools/bundle-v3-scripts.py: Added. (main): Bundles js files together and minifies them by jsmin.py for the v3 UI. Without this script, we're forced to download 44 JS files or making each JS file contain multiple classes. * tools/jsmin.py: Copied from WebInspector / JavaScriptCore code. 2015-12-15 Ryosuke Niwa Fix v2 UI after r194093. * public/v2/data.js: 2015-12-15 Ryosuke Niwa Add /api/measurement-set for v3 UI https://bugs.webkit.org/show_bug.cgi?id=152312 Rubber-stamped by Chris Dumez. The new API JSON allows the front end to fetch measured data in chunks called a "cluster" as specified in config.json for each measurement set specified by the pair of a platform and a metric. When the front end needs measured data in a given time range (t_0, t_1) for a measurement set, it first fetches the primary cluster by /api/measurement-set/?platform=&metric=. The primary cluster is the last cluster in the set (returning the first cluster here is not useful since we don't typically show very old data), and provides the information needed to fetch other clusters. Fetching the primary cluster also creates JSON files at: /data/measurement-set---.json to allow latency free access for secondary clusters. The front end code can also fetch the cache of the primary cluster at: /data/measurement-set--.json. Because the front end code has to behave as if all data is fetched, each cluster contains one data point immediately before the first data point and one immediately after the last data point. This avoids having to fetch multiple empty clusters for manually specified baseline data. To support this behavior, we generate all clusters for a given measurement set at once when the primary cluster is requested. Furthermore, all measurement sets are divided at the same time into clusters so that the boundary of clusters won't shift as more data are reported to the server. * config.json: Added clusterStart and clusterSize as options. * public/api/measurement-set.php: Added. (main): (MeasurementSetFetcher::__construct): (MeasurementSetFetcher::fetch_config_list): Finds configurations that belongs to this (platform, metric) pair. (MeasurementSetFetcher::at_end): Returns true if we've reached the end of all clusters for this set. (MeasurementSetFetcher::fetch_next_cluster): Generates the JSON data for the next cluster. We generate clusters in increasing chronological order (the oldest first and the newest last). (MeasurementSetFetcher::execute_query): Executes the main query. (MeasurementSetFetcher::format_map): Returns the mapping of a measurement field to an array index. This removes the need to have key names for each measurement and reduces the JSON size by ~10%. (MeasurementSetFetcher::format_run): Creates an array that contains data for a single measurement. The order matches that of keys in format_map. (MeasurementSetFetcher::parse_revisions_array): Added. Copied from runs.php. * tests/api-measurement-set.js: Added. Added tests for /api/measurement-set. 2015-12-14 Ryosuke Niwa Using fake timestamp in OS version make some results invisible https://bugs.webkit.org/show_bug.cgi?id=152289 Reviewed by Stephanie Lewis. Fix various bugs after r194088. * public/api/commits.php: (format_commit): Include the commit order. * public/v2/data.js: (CommitLogs._cacheConsecutiveCommits): Sort by commit order when commit time is missing. * tools/pull-os-versions.py: (OSBuildFetcher._assign_order): Use integer instead of fake time for commit order. (available_builds_from_command): Exit early when an exception is thrown. 2015-12-14 Ryosuke Niwa Fix a typo in the previous commit. * public/include/report-processor.php: 2015-12-14 Ryosuke Niwa Build fix after r192965. Suppress a warning about log being referred to as a closure variable. * public/include/report-processor.php: 2015-12-14 Ryosuke Niwa Using fake timestamp in OS version make some results invisible https://bugs.webkit.org/show_bug.cgi?id=152289 Reviewed by Stephanie Lewis. Added commit_order column to explicitly order OS versions. This fixes the bug whereby which baseline results reported with only OS versions are shown with x coordinate set to 10 years ago. To migrate the existing database, run: ALTER TABLE commits ADD COLUMN commit_order integer; CREATE INDEX commit_order_index ON commits(commit_order); Then for each repository $1, UPDATE commits SET (commit_time, commit_order) = (NULL, CAST(EXTRACT(epoch from commit_time) as integer)) WHERE commit_repository = $1; * init-database.sql: Added the column. * public/api/commits.php: (fetch_commits_between): Use commit_order to order commits when commit_time is missing. * public/api/report-commits.php: (main): Set commit_order. * tools/pull-os-versions.py: (OSBuildFetcher.fetch_and_report_new_builds): (OSBuildFetcher._assign_order): Renamed from _assign_fake_timestamps. Set the order instead of a fake timestmap. 2015-12-14 Ryosuke Niwa Perf dashboard can't merge when the destination platform is missing baseline/target https://bugs.webkit.org/show_bug.cgi?id=152286 Reviewed by Stephanie Lewis. The bug was caused by the query to migrate test configurations to new platform checking configuration type and metric separately; that is, it assumes the configuration exists only if either the same type or the same metric exists in the destination. Fixed the bug by checking both conditions simultaneously for each configuration. * public/admin/platforms.php: * tests/admin-platforms.js: Added a test. 2015-12-11 Ryosuke Niwa Perf dashboard's buildbot sync config JSON duplicates too much information https://bugs.webkit.org/show_bug.cgi?id=152196 Reviewed by Stephanie Lewis. Added shared, per-builder, and per-test (called type) configurations. * tools/sync-with-buildbot.py: (load_config): (load_config.merge): 2015-12-02 Ryosuke Niwa Perf dashboard should avoid overflow during geometric mean computation https://bugs.webkit.org/show_bug.cgi?id=151773 Reviewed by Chris Dumez. * public/include/report-processor.php: 2015-11-30 Ryosuke Niwa Perf dashboard should extend baseline and target to the future https://bugs.webkit.org/show_bug.cgi?id=151511 Reviewed by Darin Adler. * public/v2/data.js: (RunsData.prototype.timeSeriesByCommitTime): Added extendToFuture as an argument. (RunsData.prototype.timeSeriesByBuildTime): Ditto. (RunsData.prototype._timeSeriesByTimeInternal): Ditto. (TimeSeries): Add a new point to the end if extendToFuture is set and the series is not empty. * public/v2/manifest.js: (App.Manifest._formatFetchedData): Set extendToFuture to true for baselines and targets. 2015-11-30 Ryosuke Niwa Perf dashboard should always show comparison to baseline and target even if one is missing https://bugs.webkit.org/show_bug.cgi?id=151510 Reviewed by Darin Adler. Show the comparison status against the baseline when baseline is present but target is missing. To make the code more readable, this patch splits the logic into three cases: 1. Both baseline and target are present 2. Only baseline is present 3. Only target is present Also extracted a helper function to construct the label. * public/v2/app.js: (.labelForDiff): Added. (App.Pane.computeStatus): 2015-11-23 Commit Queue Unreviewed, rolling out r192716 and r192717. https://bugs.webkit.org/show_bug.cgi?id=151582 The patch was incorrect. We always need at least one data point in each configuration (Requested by rniwa on #webkit). Reverted changesets: "Perf dashboard's should not include results more than 366 days old in JSON" https://bugs.webkit.org/show_bug.cgi?id=151529 http://trac.webkit.org/changeset/192716 "Build fix for old version of PHP." http://trac.webkit.org/changeset/192717 2015-11-20 Ryosuke Niwa Build fix for old version of PHP. * public/api/runs.php: 2015-11-20 Ryosuke Niwa Perf dashboard's should not include results more than 366 days old in JSON https://bugs.webkit.org/show_bug.cgi?id=151529 Reviewed by Timothy Hatcher. Don't return results more than 366 days old in /api/runs/ JSON API. This is a ~5% runtime improvement and reduces the JSON file size by 20-50% in the internal perf dashboard. * public/api/runs.php: (main): Added the support for "?noResults" to avoid echoing results. This is useful for debugging. Also instantiate RunsGenerator before issuing the query to find all configurations so that the runtime cost of doing so will be included in elapsedTime. (RunsGenerator::fetch_runs): Skip a row when its build and commit times are more than 366 days old. (RunsGenerator::format_run): Takes build_time and revisions as arguments since fetch_runs uses them now. (RunsGenerator::parse_revisions_array): Compute the max of commit times. 2015-11-20 Ryosuke Niwa Remove chartPointRadius from interactive chart component https://bugs.webkit.org/show_bug.cgi?id=151480 Reviewed by Darin Adler. Replaced the parameter by CSS rules. * public/v2/chart-pane.css: (.chart .dot): (.chart .dot.foreground): (.chart .highlight): (.chart .extent): * public/v2/index.html: * public/v2/interactive-chart.js: (App.InteractiveChartComponent.Ember.Component.extend._constructGraphIfPossible): (App.InteractiveChartComponent.Ember.Component.extend._highlightedItemsChanged): 2015-11-20 Ryosuke Niwa Perf dashboard's runs API uses more than 128MB of memory https://bugs.webkit.org/show_bug.cgi?id=151478 Reviewed by Andreas Kling. Don't fetch all query results at once to avoid using twice as much memory as needed. Use iterative API to format each result at a time. This change is also a 5% runtime performance gain. * public/api/runs.php: (RunsGenerator::__construct): Takes a Database instance instead of a list of configurations. The latter is no longer needed as we pass in each configuration type explicitly to fetch_runs. (RunsGenerator::fetch_runs): Renamed from add_runs since it now executes the database query via execute_query. Also moved the logic to compute the last modified time here. (RunsGenerator::execute_query): Moved from fetch_runs_for_config. Use Database::query instead of query_and_fetch_all. (RunsGeneratorForTestGroup): (RunsGeneratorForTestGroup::__construct): (RunsGeneratorForTestGroup::execute_query): Moved from fetch_runs_for_config_and_test_group. * public/include/db.php: (generate_data_file): Lock the file to avoid corruption. 2015-11-19 Ryosuke Niwa Perf dashboard always fetches charts JSON twice https://bugs.webkit.org/show_bug.cgi?id=151483 Reviewed by Andreas Kling. Only re-generate "runs" JSON via /api/runs/ when the cache doesn't exist in /data/ or the cached JSON is obsolete (shouldRefetch is set true) or corrupt (the second closure). * public/v2/app.js: (App.Pane._fetch): 2015-11-18 Ryosuke Niwa Internal perf dashboard takes forever to load https://bugs.webkit.org/show_bug.cgi?id=151430 Rubber-stamped by Antti Koivisto. Fix a few performance problems with the perf dashboard v2 UI. * public/v2/app.js: (App.DashboardRow._createPane): Set "inDashboard" to true. (App.Pane._fetch): Immediately show the cached chart instead of waiting for the refetched data which invokes a PHP JSON API. Also don't fetch the analysis tasks when the chart is shown in the dashboard since we don't show annotate charts in the dashboard. 2015-10-15 Ryosuke Niwa Unreviewed fix of a test after r190687. * tests/admin-regenerate-manifest.js: 2015-10-12 Ryosuke Niwa Perf dashboard tools shouldn't require server credentials in multiple configuration files https://bugs.webkit.org/show_bug.cgi?id=149994 Reviewed by Chris Dumez. Made detect-changes.js and pull-svn.py pull username and passwords from the server config JSON to reduce the number of JSON files that need to include credentials. Also made each script reload the server config after sleep to allow dynamic credential updates. In addition, change the server config JSON's format to include scheme, host, and port numbers separately instead of a url since detect-changes.js needs each value separately. This reduces the number of JSONs with credentials to two for our internal dashboard. * tools/detect-changes.js: (main): Added a property argument parsing. Now takes --server-config-json, --change-detection-config-json, and --seconds-to-sleep like other scripts. (parseArgument): Added. (fetchManifestAndAnalyzeData): Reload the server config JSON. (loadServerConfig): Added. Set settings.perfserver and settings.slave from the server config JSON. Also add settings.perfserver.host to match the old format. (configurationsForTesting): Fixed a bug that we throw an exception when a dashboard contains an empty cell. * tools/pull-os-versions.py: (main): Use load_server_config after each sleep. * tools/pull-svn.py: (main): Use load_server_config after each sleep. (fetch_commits_and_submit): Use the perf dashboard's auth as subversion credential when useServerAuth is set. * tools/sync-with-buildbot.py: (main): Use load_server_config after each sleep. * tools/util.py: (load_server_config): Extracted from python scripts. Computes server's url from scheme, host, and port number to match the old format python scripts except. 2015-10-11 Ryosuke Niwa Build fix after r190817. Now that pull-os-versions store fake timestamps, we need to bypass timestamp checks for OS versions when bots try to report new results. Otherwise, we fail to process the reports with a MismatchingCommitTime error. * public/include/report-processor.php: (ReportProcessor::resolve_build_id): 2015-10-08 Ryosuke Niwa Perf dashboard erroneously shows an old OS build in A/B testing range https://bugs.webkit.org/show_bug.cgi?id=149942 Reviewed by Darin Adler. Ordering OS builds lexicologically turned out be a bad idea since 15A25 falls between 15A242 and 15A251. Use a fake/synthetic timestamp to force the commonly understood total order instead. Refactored pull-os-versions.py to share the server config JSON with other scripts. Also made the script support pulling multiple sources; e.g. both OS X and iOS. Also removed superfluous feature to submit results in chunks. The perf dashboard can handle thousands of revisions being submitted at once just fine. * public/api/commits.php: (main): A partial revert of r185574 since we no longer need to order builds lexicologically. * tools/pull-os-versions.py: (main): Takes --os-config-json, --server-config-json, and --seconds-to-sleep as arguments instead of a single --config argument to share the server config JSON with other scripts. (OSBuildFetcher): Extracted out of main. This class is instantiated for each OS kind (e.g. OS X). (OSBuildFetcher.__init__): Added. (OSBuildFetcher._fetch_available_builds): Extracted out of main. Fetches available builds from a website or custom commands. (OSBuildFetcher.fetch_and_report_new_builds): Extracted out of main. Submits the fetched builds after filtering out the ones we've already reported. (OSBuildFetcher._assign_fake_timestamps): Creates a fake timestamp to establish a total order amongst each OS X / iOS style build number such as 12A3456b. 2015-10-08 Ryosuke Niwa pull-svn.py fails to sync revisions when SVN credentials is not setup https://bugs.webkit.org/show_bug.cgi?id=149941 Reviewed by Chris Dumez. Added the support for specifying subversion credentials. Also added the support for pulling from multiple subversion servers. Subversion servers are specified in a JSON configuration file specified by --svn-config formatted as follows: [ { "name": "WebKit", "url": "http://svn.webkit.org/repository/webkit", "username": "webkitten", "password": "webkitten's password", "trustCertificate": true, "accountNameFinderScript": ["python", "/Volumes/Data/WebKit/Tools/Scripts/webkit-patch", "find-users"] }, ... ] In addition, refactored it to use the shared server config JSON for the dashboard access. * tools/pull-svn.py: (main): Now takes --svn-config-json, --server-config-json, --seconds-to-sleep and --max-fetch-count as required options instead of seven unnamed arguments. (fetch_commits_and_submit): Extracted from main. Fetches at most max_fetch_count new revisions from the subversion server, and submits them in accordance with server_config. (fetch_commit_and_resolve_author): Now takes a single repository dictionary instead of two separate arguments for name and URL to pass down the repository's authentication info to fetch_commit. (fetch_commit): Ditto. Add appropriate arguments when username and passwords are specified. (resolve_author_name_from_account): Use a list argument instead of a single string argument now that the argument comes from a JSON instead of sys.argv. 2015-10-07 Ryosuke Niwa Unreviewed race condition fix. Exit early when xScale or yScale is not defined. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._updateRangeBarRects): 2015-10-07 Ryosuke Niwa Add a page that cycles through v2 dashboards https://bugs.webkit.org/show_bug.cgi?id=149907 Reviewed by Chris Dumez. Add cycler.html that goes through each dashboard on v2 UI. This allows the dashboards to be cycled through on a TV screen. * public/cycler.html: Added. (loadURLAt): Appends a new iframe to load the next URL (i is the index of the dashboard to be shown) at the end of body. We don't immediately show the new iframe since it might take a while to load. (showNewFrameIfLoaded): Remove the current iframe and show the next iframe if the next dashboard has finished loading. We can't rely on DOMContentLoaded or load events because we use asynchronous XHR to load each chart's data. Instead, wait until some chart becomes available or fails to load and none of charts are still in progress to be shown. 2015-10-07 Ryosuke Niwa Allow custom revisions to be specified in A/B testing https://bugs.webkit.org/show_bug.cgi?id=149905 Reviewed by Chris Dumez. Allow custom revision number on each "repository" when creating a test group. * public/v2/app.css: (form .analysis-group [name=customValue]): Added. * public/v2/app.js: (App.AnalysisTaskController._createConfiguration): Added "Custom" as a revision option. Also added point labels such as (point 3) on "None" for when some points are missing revision info. (App.AnalysisTaskController._labelForPoints): Extracted from _createConfiguration. (App.AnalysisTaskController.actions.createTestGroup): Respect the custom revision number when custom revision option is selected. * public/v2/index.html: Added a text field for specifying a custom revision number. 2015-10-07 Ryosuke Niwa Make the site name configurable in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=149894 Reviewed by Chris Dumez. Added "siteTitle" as a new configuration key to specify the site name. * public/include/db.php: (config): Now takes the default value as an argument. * public/include/manifest.php: (ManifestGenerator::generate): Include siteTitle in the manifest. * public/index.html: Update the title and the heading when the manifest is loaded. * public/v2/index.html: Use App.Manifest.siteTitle as the heading. document.title needs to be updated manually. * public/v2/manifest.js: (App.MetricSerializer.normalizePayload): Update document.title and App.Manifest.siteTitle. 2015-10-07 Ryosuke Niwa Perf dashboard doesn't show analysis tasks anchored at outliers https://bugs.webkit.org/show_bug.cgi?id=149870 Reviewed by Chris Dumez. The bug was caused by the computation of start and end times of analysis tasks being dependent on time series provided to the interactive chart component even though they are already filtered. Since the interactive chart component shouldn't be messing with the underlying data models, moved the code to compute start and end times to App.Pane, to where it belongs, and made the moved code use the unfiltered time series newly exposed on ChartData. Also fixed a bug in fetch-from-remote.php which resulted in Ember endlessly fetching same JSON files. * public/admin/fetch-from-remote.php: (.): Use the full request URI for HTTP requests and caching. Otherwise, we're going to mix up caches and Ember can start hanging browsers (took me three hours to debug this). * public/v2/app.js: (App.Pane._showOutlierChanged): Added. Resets chartData when showOutlier flag has been changed. (App.Pane.fetchAnalyticRanges): The old code wasn't filtering analysis tasks by platforms and metrics at all since it relied on the server-side REST API to do the filtering, which I haven't implemented yet. Filter the results manually instead. (App.Pane.ranges): Moved the logic to compute startTime and endTime here from InteractiveChartComponent. (App.PaneController.toggleShowOutlier): Now that App.Pane responds to showOutlier changes, we don't need to call a private method on it. (App.AnalysisTaskController._chartDataChanged): When end points are not found, try showing outliers. This will cause chartData to be modified so just exit early and wait for getting called again. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._rangesChanged): The code to compute start and end time has been moved to App.Pane.ranges. * public/v2/manifest.js: (App.Manifest._formatFetchedData): Added unfiltered time series as new properties as they are now used to compute the end points of analysis tasks when their end points are outliers. 2015-10-07 Ryosuke Niwa Unreviewed. Fix a typo in r190645. * public/include/db.php: 2015-10-06 Ryosuke Niwa V2 UI shouldn't sort dashboards lexicologically https://bugs.webkit.org/show_bug.cgi?id=149856 Reviewed by Chris Dumez. Don't sort the dashboards by name in App.Manifest. * public/v2/app.js: (App.IndexRoute.beforeModel): Don't transition to "undefined" (string) dashboard. * public/v2/manifest.js: (App.Manifest.._fetchedManifest): 2015-10-06 Ryosuke Niwa V2 UI fails to show the data for the very first point in charts https://bugs.webkit.org/show_bug.cgi?id=149857 Reviewed by Chris Dumez. The bug was caused by seriesBetweenPoints returning null for when point.seriesIndex is 0. Explicitly check the type of this property instead. * public/v2/data.js: (TimeSeries.prototype.seriesBetweenPoints): 2015-10-06 Ryosuke Niwa Perf dashboard should have the capability to test local UI with production data https://bugs.webkit.org/show_bug.cgi?id=149834 Reviewed by Chris Dumez. Added tools/run-with-remote-server.py which runs a local httpd server and pulls data from a remote server. * Install.md: Added the instruction on how to use the script. Also updated the remaining instructions for El Capitan. * config.json: Added remote server configurations. * public/admin/fetch-from-remote.php: Added. This script fetches JSON from the remote server specified in config.json and caches the results in the location specified as "cacheDirectory" in config.json. (main): (fetch_remote): * public/include/db.php: (config_path): Extracted from generate_data_file. (generate_data_file): * tools/remote-server-relay.conf: Added. Apache 2.4 configuration file for a local http server launched by run-with-remote-server.py. * tools/run-with-remote-server.py: Added. Launches Apache with the right set of directives. (main): (abspath_from_root): 2015-07-13 Ryosuke Niwa Fix a typo. * public/js/helper-classes.js: 2015-06-27 Ryosuke Niwa build-requests should use conform to JSON API format https://bugs.webkit.org/show_bug.cgi?id=146375 Reviewed by Stephanie Lewis. Instead of returning single dictionary that maps root set id to a dictionary of repository names to revisions, timestamps, simply return root sets and roots "rows" or "objects" as defined in JSON API (http://jsonapi.org/). This API change makes it easier to resolve the bug 146374 and matches what we do in /api/test-groups. Also add the support for /api/build-requests/?id= to fetch the build request with . This is useful for debugging purposes. * public/api/build-requests.php: (main): Added the support for $_GET['id']. Also return "rootSets" and "roots". (update_builds): Extracted from main. * public/include/build-requests-fetcher.php: (BuildRequestFetcher::fetch_request): Added. Used for /api/build-requests/?id=. (BuildRequestFetcher::results_internal): Always call fetch_roots_for_set_if_needed. (BuildRequestFetcher::fetch_roots_for_set_if_needed): Renamed from fetch_roots_for_set. Moved the logic to exit early when the root set had already been fetched here. * public/v2/analysis.js: (App.TestGroup._fetchTestResults): Fixed the bug that test groups without any successful results won't be shown. * tools/pull-os-versions.py: (main): (setup_auth): Moved to util.py * tools/sync-with-buildbot.py: (main): Replaced a bunch of perf dashboard related options by --server-config-json. (update_and_fetch_build_requests): No longer takes build_request_auth since that's now taken care of by setup_auth. (organize_root_sets_by_id_and_repository_names): Added. Builds the old rootsSets directory based on "roots" and "rootSets" dictionaries returned by /api/build-requests. (config_for_request): Fixed a bug that the script blows up when the build request is missing the repository specified in the configuration. This tolerance is necessary when a new repository dependency is added but we want to run A/B tests for old builds without the dependency. (fetch_json): No longer takes auth. * tools/util.py: (setup_auth): Moved from pull-os-versions.py to be shared with sync-with-buildbot.py. 2015-06-23 Ryosuke Niwa Build fix. A/B testing is broken when continuous builders report revisions out of order. * public/v2/app.js: (App.AnalysisTaskController.Ember.Controller.extend.): 2015-06-22 Ryosuke Niwa A/B testing results should be shown even if they were submitted to different platforms https://bugs.webkit.org/show_bug.cgi?id=146219 Reviewed by Andreas Kling. Fetch A/B testing results regardless of the platform to which results are submitted by providing the platform ID to which the results were submitted for each test group. * public/api/test-groups.php: (main): Include the platform id in the test groups. * public/v2/analysis.js: (App.TestGroup._fetchTestResults): Fetch results from the platform associated with the group. 2015-06-19 Csaba OsztrogonĂ¡c Remove unnecessary svn:executable flags https://bugs.webkit.org/show_bug.cgi?id=146107 Reviewed by Alexey Proskuryakov. * public/js/helper-classes.js: Removed property svn:executable. * public/js/jquery.flot.plugins.js: Removed property svn:executable. * public/v2/app.css: Removed property svn:executable. * public/v2/app.js: Removed property svn:executable. * public/v2/chart-pane.css: Removed property svn:executable. * public/v2/data.js: Removed property svn:executable. * public/v2/index.html: Removed property svn:executable. * public/v2/js/d3/LICENSE: Removed property svn:executable. * public/v2/js/d3/d3.js: Removed property svn:executable. * public/v2/js/d3/d3.min.js: Removed property svn:executable. * public/v2/js/ember-data.js: Removed property svn:executable. * public/v2/js/ember.js: Removed property svn:executable. * public/v2/js/handlebars.js: Removed property svn:executable. * public/v2/js/jquery.min.js: Removed property svn:executable. * public/v2/js/statistics.js: Removed property svn:executable. * public/v2/manifest.js: Removed property svn:executable. * public/v2/popup.js: Removed property svn:executable. 2015-06-17 Ryosuke Niwa Reading the list of analysis tasks is extremely slow https://bugs.webkit.org/show_bug.cgi?id=146086 Reviewed by Darin Adler. The bug was caused by Ember data requesting manifest.js hundreds of times. Fetch it ahead of time in each route instead. * public/v2/app.js: (App.AnalysisRoute.model): (App.AnalysisTaskRoute.model): 2015-06-17 Ryosuke Niwa Update ReadMe.md and Install.md per database changes https://bugs.webkit.org/show_bug.cgi?id=146076 Reviewed by Darin Adler. Updated. * Install.md: * ReadMe.md: 2015-06-17 Ryosuke Niwa Increase the popup dismissal time from 100ms to 500ms https://bugs.webkit.org/show_bug.cgi?id=146077 Rubber-stamped by Andreas Kling. * public/v2/popup.js: (App.PopupView.scheduleHiding): 2015-06-16 Ryosuke Niwa v2 UI should have buttons to breakdown a test https://bugs.webkit.org/show_bug.cgi?id=146010 Reviewed by Chris Dumez. Added buttons beneath each chart pane to add "alternative panes". By default, it shows every platform as well as "Breakdown" to add all subtests' metrics. Also removed the metric submenu from tests that had exactly one metric. When a test only measures Time for example, we make the test itself clickable instead of showing a submenu that only contains one item. * public/v2/app.js: (App.ChartsController.addAlternativePanes): Added. (App.TestProxyForPopup.children): Calls _updateChildren and returns this._children. (App.TestProxyForPopup.actionName): Added. (App.TestProxyForPopup.actionArgument): Added. (App.TestProxyForPopup._updateChildren): Extracted from children. Now also sets _actionName and _actionArgument in the case there was exactly one metric so that showing submenu is unnecessary. (App.PaneController.alternativePanes): Added. Returns the list of alternative panes. The platform list excludes ones that don't have this metric (e.g. iOS doesn't have desktop PLT results) as well as ones that are already present in the list of panes. * public/v2/chart-pane.css: Added CSS rules for alternative pane buttons beneath the chart panes. * public/v2/index.html: * public/v2/manifest.js: (App.Metric.childMetrics): Added. 2015-06-15 Ryosuke Niwa Build fix after r185574. * public/v2/app.js: (set get App.Pane.Ember.Object.extend.): 2015-06-15 Ryosuke Niwa Fix a typo. * tools/pull-os-versions.py: (main): 2015-06-15 Ryosuke Niwa Perf dashboard should be able to list iOS versions as well as OS X versions https://bugs.webkit.org/show_bug.cgi?id=146003 Reviewed by Stephanie Lewis. Generalized pull-osx.py so that it can run an arbitrary shell command to fetch OS versions based on information specified in config.json. * tools/pull-os-versions.py: Renamed from pull-osx.py. (main): Use available_builds_from_command when 'customCommands' is specified. (available_builds_from_command): Added. Executes a shell command to fetch a list of available builds. (fetch_available_builds): Now takes the repository name. 2015-06-15 Ryosuke Niwa Removed a superfluous console.log per Chris's comment. * public/v2/app.js: 2015-06-15 Ryosuke Niwa Analysis task should show all possible revisions for A/B testing https://bugs.webkit.org/show_bug.cgi?id=145996 Reviewed by Chris Dumez. * public/api/commits.php: (fetch_commits_between): When the time stamp is not available for commits, use revision numbers to find revisions between two ranges. This is necessary for OS X and iOS versions since they don't have a "commit time". * public/v2/app.js: (App.AnalysisTaskController.updateRootConfigurations): Fetch commits between two end points. (App.AnalysisTaskController._createConfiguration): Extracted from updateRootConfigurations. List the fetched list of commits if available. (App.AnalysisTaskController._serializeNumbersSkippingConsecutiveEntries): Added. Serializes an list of numbers intelligently. For example, [1, 2, 4, 5] turns into "1-2, 4-5". Without this, some lists of points shown in the A/B testing configurations become too long. * public/v2/commits-viewer.js: (App.CommitsViewerComponent.commitsChanged): * public/v2/data.js: (CommitLogs.fetchCommits): Renamed from fetchForTimeRange. 2015-06-13 Ryosuke Niwa Add a script to post new OS X builds to perf dashboard https://bugs.webkit.org/show_bug.cgi?id=145955 Reviewed by Darin Adler. Added a new script pull-osx.py and relaxed the restrictions on commits accepted by the dashboard API. * public/api/report-commits.php: (main): Allow more characters than [A-Za-z0-9] in revision. e.g. "10.10.3 14D136". Also allow commits without the author, commit time, and commit message as OS versions do not have those. * tools/pull-osx.py: Added. (main): Fetch the list of builds from a website and submit them per submissionSize with submissionInterval. Once all builds have been submitted, wait for a long time as specified by fetchInterval. (setup_auth): Sets up basic or digest auth to access the dashboard. (fetch_available_builds): Fetches and parses the XML document from an internal website. (textContent): A helper function to get the text content out of a XML node. (submit_commits): Submits commits to the perf dashboard. * tools/pull-svn.py: (fetch_commit): * tools/util.py: Extracted submit_commits and text_content from pull-svn.py to be reused in pull-osx.py. 2015-06-13 Ryosuke Niwa Perf dashboard's v2 UI shouldn't hide auto-detected outliers https://bugs.webkit.org/show_bug.cgi?id=145940 Reviewed by Darin Adler. Don't fallback to the default strategies for moving averages and envelope when one is not specified. Also deleted the code to mark points outside the envelop as outliers. * public/v2/app.js: 2015-06-12 Ryosuke Niwa Unreviewed build fix for merging platforms. * public/admin/platforms.php: 2015-06-09 Ryosuke Niwa Unreviewed build fix. Some builder names are really long. * init-database.sql: 2015-05-22 Ryosuke Niwa Show results and status before revisions for A/B testing results https://bugs.webkit.org/show_bug.cgi?id=145327 Reviewed by Chris Dumez. Place the results and the status columns before the columns for revisions. Also show the absolute difference as well as the relative difference between the averages of A and B. * public/v2/app.js: (App.TestGroupPane._populate): (App.TestGroupPane._computeStatisticalSignificance): * public/v2/index.html: 2015-05-20 Ryosuke Niwa Build fix after r184591. * public/v2/manifest.js: 2015-05-20 Ryosuke Niwa Build fix. Use POSIX timestamp instead of human readable string for the commit time. * public/include/build-requests-fetcher.php: 2015-05-20 Ryosuke Niwa UI to associate bugs with an analysis task is crappy https://bugs.webkit.org/show_bug.cgi?id=145198 Reviewed by Andreas Kling. Make the UI less crappy by linkifying bug numbers and adding an explicit button to disassociate a bug and a separate select view with a text field to associate a new bug instead of implicitly updating or deleting the existing record based on what the user had typed. * init-database.sql: Removed the constraint that each bug tracker should appear exactly once for a given analysis task since it's perfectly reasonable for a given task to be associated with multiple WebKit bugs. * public/privileged-api/associate-bug.php: (main): Only remove the bug specified by newly added bugToDelete instead of implicitly deleting one that matches the analysis task and the bug tracker when the bug number is falsey. * public/v2/analysis.js: (App.Bug.url): Added. (App.BugAdapter.deleteRecord): Added. Uses the privileged API to delete the record. * public/v2/app.css: * public/v2/app.js: (App.AnalysisTaskController.actions.addBug): Added. (App.AnalysisTaskController.actions.deleteBug): Added. (App.AnalysisTaskController.associateBug): Deleted. * public/v2/index.html: Updated the templates. * public/v2/manifest.js: (App.BugTracker.urlFromBugNumber): Added. 2015-05-20 Ryosuke Niwa A/B testing rootSets should provide commit times as well as revisions https://bugs.webkit.org/show_bug.cgi?id=145207 Reviewed by Andreas Kling. Some continuous build systems need the commit time as well as the revision number / hash so provide one in the root sets but maintain the backwards compatibility with buildbots that use revision number directly. * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::fetch_roots_for_set): Made the revision info an associative array that contains the revision number as well as the commit time. * tools/sync-with-buildbot.py: (schedule_request): Removed "replacement" which was a superfluous copy of "roots". Use "revision" values when the JSON configuration refers to "root". This is necessary in buildbot instances that require WebKit revision to be specified on its own field instead of it being a JSON that contains "revision" and "time". 2015-05-19 Ryosuke Niwa Build fix. Don't fall into an infinite loop when value (renamed from bytes) is zero. * public/v2/manifest.js: (App.Manifest.Ember.Controller.extend.): (App.Manifest.Ember.Controller.extend): 2015-05-19 Ryosuke Niwa Don't show unit (bytes) separaetly from SI suffixes (K, M, etc...) https://bugs.webkit.org/show_bug.cgi?id=145181 Rubber-stamped by Chris Dumez. Show 'MB' in each y-axis label instead of showing 'bytes' separately and suffixing each label with just 'M' for clarity. This change also reduces the code complexity. * public/index.html: * public/v2/app.js: (App.AnalysisTaskController._chartDataChanged): (App.TestGroupPane._createConfigurationSummary): * public/v2/data.js: (RunsData.unitFromMetricName): Use 'B' instead of 'bytes' as the unit. * public/v2/interactive-chart.js: Removed the support for showing units separately. (App.InteractiveChartComponent._constructGraphIfPossible): (App.InteractiveChartComponent._relayoutDataAndAxes) * public/v2/manifest.js: (App.Manifest._makeFormatter): Renamed from _formatBytes. Support more SI suffixes such as micro and mili. Now takes the unit as the first argument. Adjust the base unit if it's 'ms'. (App.Manifest._formatFetchedData): Removed unit and formatWithUnit now that all all formatters would automatically include unit. 2015-05-18 Ryosuke Niwa REGRESSION: v2 UI reports a higher memory usage https://bugs.webkit.org/show_bug.cgi?id=145151 Reviewed by Chris Dumez. The bug was caused by v2 UI using 1000 to divide the number of bytes instead of by 1024 as done in v1. Fixed the bug by manually implementing the formatter as done in v1. * public/v2/manifest.js: (App.Manfiest._formatBytes): Added. (App.Manifest._formatFetchedData): Use _formatByte instead of format('s'). 2015-05-11 Ryosuke Niwa Unreviewed build fix. Add "Duration" as a time metric. * public/js/helper-classes.js: * public/v2/data.js: (RunsData.unitFromMetricName): 2015-05-06 Ryosuke Niwa Perf dashboard treats Speedometer and JetStream as smaller is better https://bugs.webkit.org/show_bug.cgi?id=144711 Reviewed by Chris Dumez. Added the support for "Score" metric. * public/js/helper-classes.js: (PerfTestRuns): * public/v2/data.js: (RunsData.unitFromMetricName): (RunsData.isSmallerBetter): 2015-04-23 Ryosuke Niwa Build fix after r183232. * public/include/json-header.php: 2015-04-23 Ryosuke Niwa Perf dashboard should automatically detect regressions https://bugs.webkit.org/show_bug.cgi?id=141443 Reviewed by Anders Carlsson. Added a node.js script detect-changes.js to detect potential regressions and progressions on the graphs tracked on v2 dashboards. * init-database.sql: Added analysis_strategies table and task_segmentation and task_test_range columns to analysis_tasks to keep the segmentation and test range selection strategies used to create an analysis task. * public/api/analysis-tasks.php: (format_task): Include task_segmentation and analysis_tasks in the results. * public/include/json-header.php: (remote_user_name): Returns null when the privileged API is authenticated as a slave instead of a CSRF prevention token. (should_authenticate_as_slave): Added. (ensure_privileged_api_data_and_token_or_slave): Added. Authenticate as a slave if slaveName and slavePassword are specified. Since detect-changes.js and other slaves are not susceptible to a CSRF attack, we don't need to check a CSRF token. * public/privileged-api/create-analysis-task.php: (main): Use ensure_privileged_api_data_and_token_or_slave to let detect-changes.js create new analysis task. Also add or find segmentation and test range selection strategies if specified. * public/privileged-api/create-test-group.php: (main): Use ensure_privileged_api_data_and_token_or_slave. * public/privileged-api/generate-csrf-token.php: * public/v2/app.js: (App.Pane._computeMovingAverageAndOutliers): _executeStrategy has been moved to Statistics. * public/v2/data.js: Export Measurement, RunsData, TimeSeries. Used in detect-changes.js. (Array.prototype.find): Added a polyfill to be used in node.js. (RunsData.fetchRuns): (RunsData.pathForFetchingRuns): Extracted from fetchRuns. Used in detect-changes.js. (RunsData.createRunsDataInResponse): Extracted from App.Manifest._formatFetchedData to use it in detect-changes.js. (RunsData.unitFromMetricName): Ditto. (RunsData.isSmallerBetter): Ditto. (RunsData.prototype._timeSeriesByTimeInternal): Added secondaryTime to sort points when commit times are identical. (TimeSeries): When commit times are identical, order points based on build time. This is needed for when we trigger two builds at two different OS versions with the same WebKit revision since OS versions don't change the commit times. (TimeSeries.prototype.findPointByIndex): Added. (TimeSeries.prototype.rawValues): Added. * public/v2/js/statistics.js: (Statistics.TestRangeSelectionStrategies.[0]): Use the 99% two-sided probability as claimed in the description of this strategy instead of the default probability. Also fixed a bug that debugging code was referring to non-existent variables. (Statistics.executeStrategy): Moved from App.Pane (app.js). * public/v2/manifest.js: (App.Manifest._formatFetchedData): Various code has been extracted into RunsData in data.js to be used in detect-changes.js. * tools/detect-changes.js: Added. The script fetches the manifest JSON, analyzes each graph in the v2 dashboards, and creates an analysis task for the latest regression or progression detected. It also schedules an A/B testing if possible and notifies another server; e.g. to send an email. (main): Loads the settings JSON specified in the argument. (fetchManifestAndAnalyzeData): The main loop that periodically wakes up to do the analysis. (mapInOrder): Executes callback sequentially (i.e. blocking) on each item in the array. (configurationsForTesting): Finds every (platform, metric) pair to analyze in the v2 dashbaords, and computes various values for when statistically significant changes are detected later. (analyzeConfiguration): Finds potential regressions and progression in the last X days where X is the specified maximum number of days using the specified strategies. Sort the resultant ranges in chronological order and create a new analysis task for the very last change we detected. We'll eventually create an analysis task for all detected changes since we're repeating the analysis in fetchManifestAndAnalyzeData after some time. (computeRangesForTesting): Fetch measured values and compute ranges to test using the specified segmentation and test range selection strategies. Once ranges are found, find overlapping analysis tasks as they need to be filtered out in analyzeConfiguration to avoid creating multiple analysis tasks for the same range (e.g. humans may create one before the script gets to do it). (createAnalysisTaskAndNotify): Create a new analysis task for the specified range, trigger an A/B testing if available, and notify another server with a HTML message as specified. (findStrategyByLabel): (changeTypeForRange): A change is a regression if values are getting larger in a smaller-is-better test or values are getting smaller in a larger-is-better test and vice versa. (summarizeRange): Create a human readable string that summarizes the change detected. e.g. "Potential 3.2% regression detected between 2015-04-20 12:00 and 17:00". (formatTimeRange): (getJSON): (postJSON): (postNotification): Recursively replaces $title and $massage in the specified JSON template. (instantiateNotificationTemplate): (fetchJSON): 2015-04-20 Ryosuke Niwa Perf dashboard should have UI to set status on analysis tasks https://bugs.webkit.org/show_bug.cgi?id=143977 Reviewed by Chris Dumez. Added the UI to set the result of an analysis task to 'progression', 'regression', 'unchanged', and 'inconclusive' as well as a boolean indicating whether creating the analysis task was the right thing to do or not. The latter will be a useful metric once we start automatically creating analysis tasks. * init-database.sql: Added two columns to analysis_tasks table. * public/api/analysis-tasks.php: Include the added columns in the JSON. * public/include/db.php: (Database::to_database_boolean): Added. * public/include/json-header.php: (require_match_one_of_values): Added. * public/privileged-api/update-analysis-task.php: Added. Updates 'result' and 'needed' values of an analysis task. (main): * public/v2/analysis.js: (App.AnalysisTask.result): Added. (App.AnalysisTask.needed): Added. We don't use DS.attr('boolean') here since that would coerce null into false and we want to differentiate null from false in order to differentiate the null-ness of the value. (App.AnalysisTask.saveStatus): Added. (App.AnalysisTask.statusLabel): Use 'result' as the label if it's set and all build requests have been processed. * public/v2/app.css: * public/v2/app.js: (App.AnalysisTaskController.analysisResultOptions): Added. (App.AnalysisTaskController.shouldNotHaveBeenCreated): Added. (App.AnalysisTaskController.needsFeedback): Added. Show the checkbox to indicate the analysis task should not have been created if 'no change' is selected. (App.AnalysisTaskController._updateChosenAnalysisResult): Added. (App.AnalysisTaskController.actions.saveStatus): Added. * public/v2/index.html: Extracted a partial template for updating the bug numbers. Also added the UI to update 'result' and 'needed' values of the analysis task. 2015-04-10 Ryosuke Niwa Unreviewed build fix. Updated config.json after recent changes. * config.json: 2015-04-10 Ryosuke Niwa Make the analysis page more useful https://bugs.webkit.org/show_bug.cgi?id=143617 Reviewed by Chris Dumez. * public/api/analysis-tasks.php: (fetch_and_push_bugs_to_tasks): Added total and finished numbers of build requests associated with the fetched analysis tasks as buildRequestCount and finishedBuildRequestCount respectively. * public/v2/analysis.js: (App.AnalysisTask.formattedCreatedAt): Added. (App.AnalysisTask._addLeadingZero): Added. (App.AnalysisTask.buildRequestCount): Added. (App.AnalysisTask.finishedBuildRequestCount): Added. (App.AnalysisTask.statusLabel): Added. Status total and finished numbers of build requests. (App.AnalysisTask.testGroups): (App.AnalysisTask.triggerable): (App.AnalysisTask.label): * public/v2/app.css: Tweaked style rules for the analysis page. * public/v2/app.js: (App.buildPopup): Sort the list of platforms by name. (App.AnalysisRoute.model): Sort the list of analysis tasks by the order they are created. (App.AnalysisTaskController._fetchedManifest): Added elementId to associate bug tracker names such as "Bugzilla" with the corresponding text field. * public/v2/index.html: Added a bunch of columns to the analysis page and also wrapped the table showing A/B testing results in a div with overflow: scroll so that it always leaves enough space for the accompanying graph. 2015-04-09 Ryosuke Niwa Perf dashboard should automatically select ranges for A/B testing https://bugs.webkit.org/show_bug.cgi?id=143580 Reviewed by Chris Dumez. Added a new statistics option for picking a A/B test range selection strategy. The selected ranges are shown in the graph using the same UI to show analysis tasks. * public/v2/app.js: (App.DashboardPaneProxyForPicker._platformOrMetricIdChanged): Updated the query parameters for charts page used by the dashboard since we've added a new parameter at the end. (App.Pane.ranges): Added. Merges ranges created for analysis tasks and A/B testing. (App.Pane.updateStatisticsTools): Clone and set the test range selection strategies. (App.Pane._cloneStrategy): Copy isSegmentation. (App.Pane._updateMovingAverageAndEnvelope): Set testRangeCandidates. (App.Pane._movingAverageOrEnvelopeStrategyDidChange): Update the charts when a new text range selection strategy is picked by the user. (App.Pane._computeMovingAverageAndOutliers): Compute the test ranges using the chosen strategy. Avoid going through isAnomalyArray when no anomaly detection strategy is enabled. Also changed the return value from the moving average time series to a dictionary that contains the moving average time series, a dictionary of anomalies, and an array of test ranges. (App.ChartsController._parsePaneList): Parse the test range selection strategy configuration. (App.ChartsController._serializePaneList): Ditto for serialization. (App.ChartsController._scheduleQueryStringUpdate): Update the URL hash when the user picks a new test range selection strategy. * public/v2/chart-pane.css: Fixed a typo as well as added a CSS rule for test ranges markers. * public/v2/index.html: Added UI for selecting a test range selection strategy. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._rangesChanged): Pass down "status" to be used as a class name. * public/v2/js/statistics.js: (Statistics.MovingAverageStrategies): Added isSegmentation to segmentation strategies. (Statistics.TestRangeSelectionStrategies): Added. 2015-04-08 Ryosuke Niwa The results of A/B testing should state statistical significance https://bugs.webkit.org/show_bug.cgi?id=143552 Reviewed by Chris Dumez. Added statistical comparisons between results for each configuration on analysis task page using Welch's t-test. The probability as well as t-statistics and the degrees of freedoms are reported. * public/v2/app.js: (App.TestGroupPane._populate): Report the list of statistical comparison between every pair of root configurations in the results. e.g. if we've got A, B, C configurations then compare A/B, A/C and B/C. (App.TestGroupPane._computeStatisticalSignificance): Compute the statistical significance using Welch's t-test. Report the probability by which two samples do not come from the same distribution. (App.TestGroupPane._createConfigurationSummary): Include the array of results for this configuration. Also renamed "items" to "requests" for clarity. * public/v2/index.html: Added the template for showing statistical comparisons. * public/v2/js/statistics.js: Renamed tDistributionQuantiles to tDistributionByOneSidedProbability for clarity. Also factored out the functions to convert from one-sided probability to two-sided probability and vice versa. (Statistics.supportedConfidenceIntervalProbabilities): (Statistics.confidenceIntervalDelta): (Statistics.probabilityRangeForWelchsT): Added. Computes the lower bound and the upper bound for the probability that two values are sampled from distinct distributions using Welch's t-test. (Statistics.computeWelchsT): This function now takes two-sided probability like all other functions. (.tDistributionByOneSidedProbability): Renamed from tDistributionQuantiles. (.oneSidedToTwoSidedProbability): Extracted. (.twoSidedToOneSidedProbability): Extracted. (Statistics.MovingAverageStrategies): Converted the one-sided probability to the two-sided probability now that computeWelchsT takes two-sided probability. 2015-04-08 Ryosuke Niwa Unreviewed fix after r182496 for when the cached runs JSON doesn't exist. * public/v2/app.js: (App.Pane._fetch): (App.Pane.refetchRuns): 2015-04-07 Ryosuke Niwa Perf dashboard should have a way of marking outliers https://bugs.webkit.org/show_bug.cgi?id=143466 Reviewed by Chris Dumez. Address kling's in-person comment to notify users when the new run status is saved in the database. * public/v2/app.js: (App.PaneController._selectedItemIsMarkedOutlierDidChange) * public/v2/chart-pane.css: Fixed a typo. 2015-04-07 Ryosuke Niwa Perf dashboard should have a way of marking outliers https://bugs.webkit.org/show_bug.cgi?id=143466 Reviewed by Chris Dumez. Added UI to mark a data point as an outlier as well as a button to toggle the visibility of outliers. Added a new privileged API /privileged-api/update-run-status to store this boolean flag. * init-database.sql: Added run_marked_outlier column to test_runs table. * public/admin/tests.php: * public/api/runs.php: (main): Only emit Cache-Control and Expires headers in v1 UI. (RunsGenerator::format_run): Emit markedOutlier. * public/include/admin-header.php: * public/include/db.php: (Database::is_true): Made it static. * public/include/manifest.php: (Manifest::platforms): * public/index.html: Call into /api/runs/ with ?cache=true. * public/privileged-api/update-run-status.php: Added. (main): Updates the newly added column in test_runs table. * public/v2/app.js: (App.Pane._fetch): (App.Pane.refetchRuns): Extracted from App.Pane._fetch. (App.Pane._didFetchRuns): Renamed from _updateChartData. (App.Pane._setNewChartData): Added. Pick the right time series based based on the value of showOutlier. Cloning chartData is necessary when toggling the outlier visibility or using statistics tools because the interactive chart component only observes changes to chartData and not individual properties of it. (App.Pane._highlightPointsMarkedAsOutlier): Added. Highlight points marked as outliers. (App.Pane._movingAverageOrEnvelopeStrategyDidChange): Call to _setNewChartData replaced the code to clone chartData here. (App.PaneController.actions.toggleShowOutlier): Toggle the visibility of points marked as outliers by invoking App.Pane._setNewChartData. (App.PaneController._detailsChanged): Don't hide the analysis pane when details changed since keep opening the pane for marking points as outliers would be annoying. (App.PaneController._updateCanAnalyze): Update 'cannotMarkOutlier' as well as 'cannotAnalyze'. (App.PaneController.selectedMeasurement): Added. (App.PaneController.showOutlierTitle): Added. (App.PaneController._selectedItemIsMarkedOutlierDidChange): Added. Call out to setMarkedOutlier to mark the selected point as an outlier via the newly added privileged API. * public/v2/chart-pane.css: Updated styles. * public/v2/data.js: (PrivilegedAPI._post): Report the semantic errors. (Measurement.prototype.markedOutlier): Added. (Measurement.prototype.setMarkedOutlier): Added. Uses PrivilegedAPI to update the database. (RunsData.prototype.timeSeriesByCommitTime): Added a new argument, includeOutliers, to indicate whether the time series should include measurements marked as outliers or not. (RunsData.prototype.timeSeriesByBuildTime): Ditto. (RunsData.prototype._timeSeriesByTimeInternal): Extracted from timeSeriesByCommitTime and timeSeriesByBuildTime to share code. Now ignores measurements marked as outliers if needed. * public/v2/index.html: Added an icon for showing and hiding outliers. Also added a checkbox to mark individual points as outliers. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._selectClosestPointToMouseAsCurrentItem): Re-enable the distance heuristics that takes vertical closeness into account. This heuristics is more useful when marking some points as outliers. This heuristics was disabled because the behavior was unpredictable but with the arrow key navigation support, this is no longer an issue. * public/v2/manifest.js: (App.Manifest._formatFetchedData): Added showOutlier to the chart data. This function dynamically updates the time series in this chart data in order to include or exclude outliers. 2015-04-03 Ryosuke Niwa Perf dashboard should be able to trigger A/B testing jobs for iOS https://bugs.webkit.org/show_bug.cgi?id=143398 Reviewed by Chris Dumez. Fix various bugs in the perf dashboard so that it can schedule A/B testing jobs for iOS. Also generalized sync-with-buildbot.py slightly to meet the requirements of iOS builders. * public/api/triggerables.php: (main): Avoid spitting a warning when $id_to_triggerable doesn't contain the triggerable. * public/v2/analysis.js: (App.AnalysisTask.triggerable): Log an error when failed to fetch triggerables for debugging purposes. * public/v2/app.js: (App.AnalysisTaskController.updateRootConfigurations): Show 'None' when a revision is missing from some of the data points. This will happen when we modify the list of projects we build for iOS. (App.AnalysisTaskController.actions.createTestGroup): Gracefully fail by showing alerts when an user attempts to create an invalid test group; when there is already another test group of the same or when only either configuration specifies the revision for some repository. (App.AnalysisTaskController._updateRootsBySelectedPoints): Fixed a typo: sets[i] -> set. * public/v2/index.html: Don't show the form to create a new test group if it's not available. * tools/sync-with-buildbot.py: (find_request_updates): (schedule_request): iOS builders take a JSON that contains the list of roots. Generate this JSON when a dictionary of the form {rootsExcluding: ["WebKit"]} is specified. Also replaced the way we refer to a revision from $-based text replacements to an explicit dictionary of the form {root: "WebKit"}. (request_id_from_build): Don't hard code the parameter name here. Retrieve the name from the config. 2015-04-03 Ryosuke Niwa Add time series segmentation algorithms as moving averages https://bugs.webkit.org/show_bug.cgi?id=143362 Reviewed by Chris Dumez. This patch implements two preliminary time series segmentation algorithms as moving averages. Recursive t-test: Compute Welch's t-statistic at each point in a given segment of the time series. If Welch's t-test implicates a statistically significance difference, then split the segment into two sub segments with the maximum t-statistic (i.e. the point at which if split would yield the highest probability that two segments do not share the same "underlying" mean in classical / frequentist sense). We repeat this process recursively. See [1] for the evaluation of this particular algorithm. Schwarz criterion: Use Schwarz or Bayesian information criterion to heuristically find the optimal segmentation. Intuitively, the problem of finding the best segmentation comes down to minimizing the residual sum of squares in each segment as in linear regressions. That is, for a given segment with values y_1 through y_n with mean y_avg, we want to minimize the sum of (y_i - y_avg)^2 over i = 1 through i = n. However, we also don't want to split every data point into a separate segment so we need to account the "cost" of introducing new segments. We use a cost function that's loosely based on two models discussed in [2] for simplicity. We will tune this cost function further in the future. The problem of finding the best segmentation then reduces to a search problem. Unfortunately, our problem space is exponential with respect to the size of the time series since we could split at each data point. We workaround this problem by first splitting the time series into a manageable smaller grids, and only considering segmentation of a fixed size (i.e. the number of segments is constant). Since time series tend to contain a lot more data points than segments, this strategy finds the optimal solution without exploring much of the problem space. Finding the optimal segmentation of a fixed size is, itself, another search problem that is equivalent to finding the shortest path of a fixed length in DAG. Here, we use dynamic programming with a matrix of size n by n where n is the length of the time series (grid). Each entry in this matrix at (i, k) stores the minimum cost of segmenting data points 1 through i using k segments. We start our search at i = 1. Clearly C(1, 0) = 0 (note the actual code uses 0-based index). In i-th iteration, we compute the cost S(i, j) of each segment starting at i and ending at another point j after i and update C(j, k + 1) by min( C(j, k + 1), C(i, k) + S(i, j) ) for all values of j above i. [1] Kensuke Fukuda, H. Eugene Stanley, and Luis A. Nunes Amaral, "Heuristic segmentation of a nonstationary time series", Physical Review E 69, 021108 (2004) [2] Marc Lavielle, Gilles Teyssi`ere, "Detection of Multiple Change–Points in Multivariate Time Series" Lithuanian Mathematical Journal, vol 46, 2006 * public/v2/index.html: Show the optional description for the chosen moving average strategy. * public/v2/js/statistics.js: (Statistics.testWelchsT): (Statistics.computeWelchsT): Extracted from testWelchsT. Generalized to take the offset and the length of each value array between which Welch's t-statistic is computed. This generalization helps the Schwarz criterion segmentation algorithm avoid splitting values array O(n^2) times. (.sampleMeanAndVarianceForValues): Ditto for the generalization. (.recursivelySplitIntoTwoSegmentsAtMaxTIfSignificantlyDifferent): Added. Implements recursive t-test. (.splitIntoSegmentsUntilGoodEnough): Added. Implements Schwarz criterion. (.findOptimalSegmentation): Added. Implements the algorithm to find the optimal segmentation of a fixed segment count. (.SampleVarianceUpperTriangularMatrix): Added. Stores S(i, j) used by findOptimalSegmentation. (.SampleVarianceUpperTriangularMatrix.prototype.costBetween): Added. 2015-04-03 Ryosuke Niwa REGRESSION: Perf dashboard sometimes fails to update zooming level https://bugs.webkit.org/show_bug.cgi?id=143359 Reviewed by Darin Adler. The bug was caused by various bugs that ended up in an exception. * public/v2/app.js: (App.Pane._handleFetchErrors): Removed superfluous console.log. (App.Pane.computeStatus): Fixed the bug in r182185 that previousPoint could be null. (App.PaneController.actions.zoomed): Update the overview when the main chart triggered a zoom. * public/v2/index.html: Replaced all instances of href="#" by href="javascript:false" to avoid navigating to # when Ember.js fails to attach event listeners on time. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._updateDimensionsIfNeeded): Avoid using a negative width or height when the containing element's size is 0. (App.InteractiveChartComponent._updateBrush): Ditto. 2015-04-02 Ryosuke Niwa Perf dashboard should have UI to test out anomaly detection strategies https://bugs.webkit.org/show_bug.cgi?id=143290 Reviewed by Benjamin Poulain. Added the UI to select anomaly detection strategies. The detected anomalies are highlighted in the graph. Implemented the Western Electric Rules 1 through 4 in http://en.wikipedia.org/wiki/Western_Electric_rules as well as Welch's t-test that compares the last five points to the prior twenty points. The latter is what Mozilla uses (or at least did in the past) to detect performance regressions on their performance tests although they compare medians instead of means. All of these strategies don't quite work for us since our data points are too noisy but this is a good start. * public/v2/app.js: (App.Pane.updateStatisticsTools): Clone anomaly detection strategies. (App.Pane._updateMovingAverageAndEnvelope): Highlight anomalies detected by the enabled strategies. (App.Pane._movingAverageOrEnvelopeStrategyDidChange): Observe changes to anomaly detection strategies. (App.Pane._computeMovingAverageAndOutliers): Detect anomalies by each strategy and aggregate results. Only report the first data point when multiple consecutive data points are detected as anomalies. * public/v2/chart-pane.css: Updated styles. * public/v2/index.html: Added the pane for selecting anomaly detection strategies. * public/v2/js/statistics.js: (Statistics.testWelchsT): Added. Implements Welch's t-test. (.sampleMeanAndVarianceForValues): Added. (.createWesternElectricRule): Added. (.countValuesOnSameSide): Added. (Statistics.AnomalyDetectionStrategy): Added. 2015-03-31 Ryosuke Niwa REGRESSION: Searching commits can highlight wrong data points https://bugs.webkit.org/show_bug.cgi?id=143272 Reviewed by Antti Koivisto. The bug was caused by /api/commits returning commit times with millisecond precision whereas /api/runs return commit times with only second precision. This resulted in the frontend code to match a commit with the data point that included the next commit when the millisecond component of commit's timestamp wasn't identically 0. This discrepancy was caused by the fact PHP's strtotime only ignores milliseconds and /api/commits was returning timestamp as string instead of parsing via Database::to_js_time as done in /api/runs so miliseconds component was only preserved in /api/commits. Fixed the bug by always using Database::to_js_time to return commit time. Also fixed to_js_time so that it returns time in milisecond precision. * public/api/commits.php: (fetch_commits_between): Use Database::to_js_time for format commit times. (format_commit): Ditto. * public/include/db.php: (Database::to_js_time): Parse and append millisecond component. Ignore sub-milliseconds for simplicity. * public/v2/data.js: (CommitLogs.fetchForTimeRange): The commit time is now an integer so don't call "replace" on it. 2015-03-31 Ryosuke Niwa Perf dashboard should show relative change in values https://bugs.webkit.org/show_bug.cgi?id=143252 Reviewed by Antti Koivisto. When a range of values are selected, show the percentage difference between the start and the end in addition to the absolute value difference. When a single point is selected, show the relative difference with respect to the previous point. Use two significant figures and always show plus sign when the difference is positive. * public/v2/app.js: Compute and format the relative difference. * public/v2/chart-pane.css: Don't let commits view shrink itself when they're all collapsed. * public/v2/index.html: Show the relative difference. 2015-03-31 Ryosuke Niwa REGRESSION(r180000): Changing moving average or enveloping strategy doesn't update the graph https://bugs.webkit.org/show_bug.cgi?id=143254 Reviewed by Antti Koivisto. The bug was caused by App.Pane no longer replacing 'chartData' property when updating the moving average or the enveloping values. Fixed the bug by creating a new chartData object when the strategy is changed so that the interactive chart component will observe a change to 'chartData'. * public/v2/app.js: (App.Pane._movingAverageOrEnvelopeStrategyDidChange): Added. 2015-03-19 Ryosuke Niwa Unreviewed build fixes. * public/include/manifest.php: (Manifest::generate): These should be {} instead of [] when they're empty. * public/v2/data.js: (Measurement.prototype.formattedRevisions): Don't assume previousRevisions[repositoryId] exits. * public/v2/manifest.js: (App.Metric.fullName): Fixed the typo. * tests/admin-regenerate-manifest.js: Fixed the test. 2015-02-20 Ryosuke Niwa Commit the erroneously reverted change. * public/api/runs.php: (RunsGenerator::results): 2015-02-20 Ryosuke Niwa Loading the perf dashboard takes multiple seconds https://bugs.webkit.org/show_bug.cgi?id=141860 Reviewed by Andreas Kling. This patch introduces the caches of JSON files returned by /api/ in /data/ directory. It also records the last time test_runs rows associated with the requested platforms and metrics are inserted, updated, or removed in the caches as well as the manifest JSON files ("last modified time"). Because the manifest is regenerated each time a new test result is reported, the front end can compare last modified time in the manifest file with that in a /api/runs JSON cache to detect the stale-ness. More concretely, the front end first optimistically fetches the JSON in /data/. If the cache doesn't exit or the last modified time in the cache doesn't match with that in the manifest file, it would fetch it again via /api/runs. In the case the cache did exist, we render the charts based on the cache meanwhile. This dramatically reduces the perceived latency for the page load since charts are drawn immediately using the cache and we would only re-render the charts as new up-to-date JSON comes in. This patch also changes the format of runs JSONs by pushing the exiting properties into 'configurations' and adding 'lastModified' and 'elapsedTime' at the top level. * init-database.sql: Added config_runs_last_modified to test_configurations table as well as a trigger to auto-update this column upon changes to test_runs table. * public/admin/test-configurations.php: (add_run): Regenerate the manifest file to invalidate the /api/runs JSON cache. (delete_run): Ditto. * public/api/runs.php: (main): Fetch all columns of test_configurations table including config_runs_last_modified. Also generate the cache in /data/ directory. (RunsGenerator::__construct): Compute the last modified time for this (platform, metric) pair. (RunsGenerator::results): Put the old content in 'configurations' property and include 'lastModified' and 'elapsedTime' properties. 'elapsedTime' is added for debugging purposes. (RunsGenerator::add_runs): (RunsGenerator::parse_revisions_array): * public/include/db.php: (CONFIG_DIR): Added. (generate_data_file): Added based on ManifestGenerator::store. (Database::to_js_time): Extracted from RunsGenerator::add_runs to share code. * public/include/json-header.php: (echo_success): Renamed from success_json. Return the serialized JSON instead of echo'ing it so that we can generate caches in /api/runs/. (exit_with_success): * public/include/manifest.php: (ManifestGenerator::generate): Added 'elapsedTime' property for the time taken to generate the manifest. It seems like we're generating it in 200-300ms for now so that's good. (ManifestGenerator::store): Uses generate_data_file. (ManifestGenerator::platforms): Added 'lastModified' array to each platform entry. This array contains the last modified time for each (platform, metric) pair. * public/index.html: (fetchTest): Updated per the format change in runs JSON. * public/v2/app.js: (App.Pane._fetch): Fetch the cached JSON first. Refetch the uncached version if instructed as such. (App.Pane._updateChartData): Extracted from App.Pane._fetch. (App.Pane._handleFetchErrors): Ditto. * public/v2/data.js: (RunsData.fetchRuns): Takes the fourth argument indicating whether we should fetch the cached version or not. The cached JSON is located in /data/ with the same filename. When fetching a cached JSON results in 404, fulfill the promise with null as the result instead of rejecting it. The only client of this function which sets useCache to true is App.Manifest.fetchRunsWithPlatformAndMetric, and it handles this special case. * public/v2/manifest.js: (App.DateArrayTransform): Added. Handles the array of last modified dates in platform objects. (App.Platform.lastModifiedTimeForMetric): Added. Returns the last modified date in the manifest JSON. (App.Manifest.fetchRunsWithPlatformAndMetric): Takes "useCache" like RunsData.fetchRuns. Set shouldRefetch to true if response is null (the cache didn't exit) or the cache is out-of-date. (App.Manifest._formatFetchedData): Extracted from App.Manifest.fetchRunsWithPlatformAndMetric. * run-tests.js: (initializeDatabase): Avoid splitting function definitions in the middle. * tests/api-report.js: Added tests to verify that reporting new test results updates the last modified time in test_configurations. 2015-02-20 Ryosuke Niwa REGRESSION(r180333): Analysis tasks can't be associated with bugs https://bugs.webkit.org/show_bug.cgi?id=141858 Reviewed by Andreas Kling. Added back the erroneously removed table to associate bugs. Also moved "details-table-container" div outside of the chart-details partial template as it needs to wrap associate bugs in analysis task pages. * public/v2/chart-pane.css: * public/v2/index.html: 2015-02-20 Ryosuke Niwa Selecting revisions for A/B testing is hard https://bugs.webkit.org/show_bug.cgi?id=141824 Reviewed by Andreas Kling. Update the revisions used in A/B testing based on the selection in the overview chart. This allows users to intuitively select revisions based on points shown in the chart. Removed the old select elements used to select A/B testing points manually. Also renamed 'testSets' to 'configurations', 'roots' to 'rootConfigurations', and 'revisions' in each root's sets to 'options' for clarity. * public/v2/app.css: Reorganized style rules. * public/v2/app.js: (App.AnalysisTaskController): (App.AnalysisTaskController._taskUpdated): Merged updateTestGroupPanes. (App.AnalysisTaskController._chartDataChanged): Renamed from paneDomain. It's now an observer instead of a property, which sets 'overviewDomain' property as well as other properties. (App.AnalysisTaskController.updateRootConfigurations): Renamed from updateRoots. (App.AnalysisTaskController._updateRootsBySelectedPoints): Added. Select roots based on the selected points in the overview chart. * public/v2/chart-pane.css: Added arrows next to the configuration names (e.g. 'A') to indicate whether individual build requests / test results are shown or not. * public/v2/index.html: Removed the select element per configuration column. Also moved the select element for the number of runs as it doesn't belong in the same table as the one that lists repositories and roots. 2015-02-20 Ryosuke Niwa Unreviewed test fixes after r179037, r179591, and r179763. * tests/admin-regenerate-manifest.js: * tests/admin-reprocess-report.js: 2015-02-19 Ryosuke Niwa Relationship between A/B testing results are unclear https://bugs.webkit.org/show_bug.cgi?id=141810 Reviewed by Andreas Kling. Show a "reference chart" indicating which two points have been tested in each test group pane. Now the chart shown at the top of an analysis task page is called the "overview pane", and we use the pane and the domain used in this chart to show charts in each test group. Also renamed an array of revisions used in the A/B test results tables from 'revisions' to 'revisionList'. * public/v2/analysis.js: (App.TestGroup._fetchTestResults): Renamed from _fetchChartData. Set 'testResults' instead of 'chartData' since this is the results of A/B testing results, not the data for charts shown next to them. * public/v2/app.css: Added CSS rules for reference charts. * public/v2/app.js: (App.AnalysisTaskController.paneDomain): Set 'overviewPane' and 'overviewDomain' on each test group pane. (App.TestGroupPane._populate): Updated per 'chartData' to 'testResults' rename. (App.TestGroupPane._updateReferenceChart): Get the chart data via the overview pane and find points that identically matches root sets. If one of configuration used a set of revisions for which no measurement was made in the original chart, don't show the reference chart as that would be misleading / confusing. (App.TestGroupPane._computeRepositoryList): Updated per 'chartData' to 'testResults' rename. (App.TestGroupPane._createConfigurationSummary): Ditto. Also renamed 'revisions' to 'revisionList'. In addition, renamed 'buildNumber' to 'buildLabel' and prefixed it with "Build ". * public/v2/data.js: (Measurement.prototype.revisionForRepository): Added. (Measurement.prototype.commitTimeForRepository): Cleanup. (TimeSeries.prototype.findPointByRevisions): Added. Finds a point based on a set of revisions. * public/v2/index.html: Added the reference chart. Streamlined the status label for each build request by including the build number in the title attribute instead of in the markup. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._updateDomain): Fixed a typo introduced as a consequence of r179913. (App.InteractiveChartComponent._computeYAxisDomain): Expand the y-axis to show the highlighted points. (App.InteractiveChartComponent._highlightedItemsChanged): Adjust the y-axis as needed. 2015-02-18 Ryosuke Niwa Analysis task pages are unusable https://bugs.webkit.org/show_bug.cgi?id=141786 Reviewed by Andreas Kling. This patch makes following improvements to analysis task pages: 1. Making the main chart interactive. This change required the use of App.Pane as well as moving the code to compute the data for the details pane from PaneController. 2. Moving the form to add a new test group to the top of test groups instead of the bottom of them. 3. Grouping the build requests in each test group by root sets instead of the order by which they were ran. This change required the creation of App.TestGroupPane as well as its methods. 4. Show a box plot for each root set configuration as well as each build request. This change required App.BoxPlotComponent. 5. Show revisions of each repository (e.g. WebKit) for each root set and build request. * public/api/build-requests.php: (main): Update per the rename of BuildRequestsFetcher::root_sets to BuildRequestsFetcher::root_sets_by_id. * public/api/test-groups.php: (main): Include root sets and roots in the response. (format_test_group): * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::root_sets_by_id): Renamed from root_sets. (BuildRequestsFetcher::root_sets): Added. (BuildRequestsFetcher::roots): Added. (BuildRequestsFetcher::fetch_roots_for_set): Takes a boolean argument $resolve_ids. This flag is only set to true in /api/build-requests/ (as done prior to this patch) to use repository names as identifiers since tools/sync-with-buildbot.py can't convert repository names to their ids. * public/v2/analysis.js: (App.Root): Added. (App.RootSet): Added. (App.RootSet.revisionForRepository): Added. (App.TestGroup.rootSets): Deleted the code to compute root set ids from build requests now that the JSON response at /api/test-groups will include them. (App.BuildRequest): Ditto. Also deleted 'configLetter' property, which has been moved to a proxy created by _createConfigurationSummary. (App.BuildRequest.statusLabel): Use 'Completed' as the human readable label for 'completed' status. (App.BuildRequest.aggregateStatuses): Added. Generates a human readable status for a set of build requests. * public/v2/app.css: Updated style rules for analysis task pages. * public/v2/app.js: (App.Pane): This class is now used in analysis task pages to make the main chart interactive. (App.Pane._updateDetails): Moved from App.PaneController. (App.PaneController._updateCanAnalyze): Updated the code per the move of selectedPoints. (App.AnalysisTaskController): Added 'details'. (App.AnalysisTaskController._taskUpdated): (App.AnalysisTaskController.paneDomain):Renamed from _fetchedRuns. (App.AnalysisTaskController.updateTestGroupPanes): Added. Creates App.TestGroupPane for each test group. (App.AnalysisTaskController.actions.toggleShowRequestList): Added. (App.TestGroupPane): Added. (App.TestGroupPane._populate): Added. Group build requests by root sets and create a summary for each group. (App.TestGroupPane._computeRepositoryList): Added. Returns a sorted list of repositories which is the union of all repositories appearing in root sets and builds associated with A/B testing results. (App.TestGroupPane._groupRequestsByConfigurations): Added. Groups build requests by root sets. (App.TestGroupPane._createConfigurationSummary): Added. Creates a summary for a group of build requests that use the same root set. We start by wrapping "raw" build requests in a proxy with formatted values, build numbers, etc... obtained from the fetched chart data. The list of revisions shown in the group summary is a union of revisions in the root set and the first build request in the group. We null-out revision info for a build request if it is identical to the one in the summary. The range of values is expanded as needed by the values in the group as well as 95% percentile confidence interval. (App.BoxPlotComponent): Added. Controls a box plot shown for each test group summary and build request. (App.BoxPlotComponent.didInsertElement): Added. Inserts a SVG element as well as two indicator rects to show the mean and the confidence interval. (App.BoxPlotComponent._updateBars): Added. Updates the dimensions of the indicator rects. (App.BoxPlotComponent.valueChanged): Added. Computes the relative dimensions of the indicator rects and calls _updateBars to update the rects. * public/v2/chart-pane.css: Added some style rules to be used in the details pane in analysis task pages. * public/v2/data.js: (Measurement.prototype.formattedRevisions): (Measurement.formatRevisionRange): Renamed from Measurement.prototype._formatRevisionRange so that it can be called in _createConfigurationSummary. * public/v2/index.html: Updated the templates for analysis task pages. Moved the form to create a new test group above all test groups, and replaced the list of data points by "details" pane used in the charts page. Also made the fetching of chartData no longer block showing of test groups. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._updateDomain): Added an early exit to fix a newly revealed race condition. (App.InteractiveChartComponent._domainChanged): Ditto. (App.InteractiveChartComponent._updateSelectionToolbar): Made it respect 'zoomable' boolean property. * public/v2/js/statistics.js: (Statistics.min): Added. (Statistics.max): Added. * public/v2/manifest.js: (App.Manifest.fetchRunsWithPlatformAndMetric): Added formatWithDeltaAndUnit to be used in _createConfigurationSummary. 2015-02-14 Ryosuke Niwa Build URL on new perf dashboard doesn't resolve $builderName https://bugs.webkit.org/show_bug.cgi?id=141583 Reviewed by Darin Adler. Support $builderName in the build URL template. * public/js/helper-classes.js: (TestBuild.buildUrl): Replaced $builderName with the builder name. * public/v2/manifest.js: (App.Metric.fullName): Fixed the typo. We need &ni, not &in. (App.BuilderurlFromBuildNumber): Replaced $builderName with the builder name. 2015-02-13 Ryosuke Niwa Unreviewed build fix after r179591. * public/api/commits.php: 2015-02-13 Ryosuke Niwa The status of a A/B testing request always eventually becomes "Failed" https://bugs.webkit.org/show_bug.cgi?id=141523 Reviewed by Andreas Kling. The bug was caused by /api/build-requests always setting the status of a build request to 'failed' when 'failedIfNotCompleted' was sent by the buildbot sync'er. Fixed the bug by only setting the status to 'failed' if it wasn't set to 'completed'. * public/api/build-requests.php: (main): 2015-02-13 Csaba OsztrogonĂ¡c Unreviewed, remove empty directories. * public/data: Removed. 2015-02-12 Ryosuke Niwa Perf dashboard should show the results of A/B testing https://bugs.webkit.org/show_bug.cgi?id=141500 Reviewed by Chris Dumez. Added the support for fetching test_runs for a specific test group in /api/runs/, and used it in the analysis task page to fetch results for each test group. Merged App.createChartData into App.Manifest.fetchRunsWithPlatformAndMetric so that App.BuildRequest can use the formatter. * public/api/runs.php: (fetch_runs_for_config_and_test_group): Added. (fetch_runs_for_config): Just return the fetched rows since main will format them with RunsGenerator. (main): Use fetch_runs_for_config_and_test_group to fetch rows when a test group id is specified. Also use RunsGenerator to format results. (RunsGenerator): Added. (RunsGenerator::__construct): Added. (RunsGenerator::add_runs): Added. (RunsGenerator::format_run): Moved. (RunsGenerator::parse_revisions_array): Moved. * public/v2/analysis.js: (App.TestGroup): Fixed a typo. The property on a test group that refers to an analysis task is "task". (App.TestGroup._fetchChartData): Added. Fetches all A/B testing results for this group. (App.BuildRequest.configLetter): Renamed from config since this returns a letter that identifies the configuration associated with this build request such as "A" and "B". (App.BuildRequest.statusLabel): Added the missing label for failed build requests. (App.BuildRequest.url): Added. Returns the URL associated with this build request. (App.BuildRequest._meanFetched): Added. Retrieve the mean and the build number for this request via _fetchChartData. * public/v2/app.js: (App.Pane._fetch): Set chartData directly here. (App.Pane._updateMovingAverageAndEnvelope): Renamed from _computeChartData. No longer sets chartData now that it's done in App.Pane._fetch. (App.AnalysisTaskController._fetchedRuns): Updated per createChartData merge. * public/v2/data.js: (Measurement.prototype.buildId): Added. (TimeSeries.prototype.findPointByBuild): Added. * public/v2/index.html: Fixed a bug that build status URL was broken. We can't use link-to helper since url is not an Ember routed path. * public/v2/manifest.js: (App.Manifest.fetchRunsWithPlatformAndMetric): Takes testGroupId as the third argument. Merged App.createChartData here so that App.BuildRequest can use the formatter 2015-02-12 Ryosuke Niwa v2 UI should adjust the number of ticks on dashboards based on screen size https://bugs.webkit.org/show_bug.cgi?id=141502 Reviewed by Chris Dumez. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._updateDimensionsIfNeeded): Compute the number of ticks based on the content size. 2015-02-11 Ryosuke Niwa New perf dashboard shows too much space around interesting data points https://bugs.webkit.org/show_bug.cgi?id=141487 Reviewed by Chris Dumez. Revise the y-axis range adjustment algorithm in r179913. Instead of showing the entire moving average, show the current time series excluding points in the series outside the moving average envelope. * public/v2/app.js: (App.Pane._computeChartData): Don't deal with missing moving average or enveloping strategy here. (App.Pane._computeMovingAverageAndOutliers): Set isOutliner to true on all data points in the current time series if the point lies outside the moving average envelope. Don't expose the moving average or the envelope computed for this purpose if they're not set by the user. * public/v2/data.js: (TimeSeries.prototype.minMaxForTimeRange): Takes a boolean argument, ignoreOutlier. When the flag is set to true, min/max computation will ignore any point in the series with non-falsy "isOutliner" property. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._constructGraphIfPossible): Unsupport hideMovingAverage and hideEnvelope. (App.InteractiveChartComponent._computeYAxisDomain): Removed the commented out code. Also moved the code to deal with showFullYAxis here. (App.InteractiveChartComponent._minMaxForAllTimeSeries): Rewrote the code. Takes ignoreOutliners as an argument instead of directly inspecting showFullYAxis. 2015-02-10 Ryosuke Niwa New perf dashboard shouldn't always show outliners https://bugs.webkit.org/show_bug.cgi?id=141445 Reviewed by Chris Dumez. Use the simple moving average with an average difference envelope to compute the y-axis range to show to avoid expanding it spuriously to show one off outlier. * public/v2/app.js: (App.Pane): Don't show the full y-axis range by default. (App.Pane._computeChartData): Use the first strategies for the moving average and the enveloping if one is not specified by the user but without showing them in the charts. (App.Pane._computeMovingAverage): Takes moving average and enveloping strategies as arguments instead of retrieving via chosenMovingAverageStrategy and chosenEnvelopingStrategy. (App.ChartsController._parsePaneList): Added showFullYAxis as a query string argument to each pane. (App.ChartsController._serializePaneList): Ditto. * public/v2/chart-pane.css: Added a CSS rule for when y-axis is clickable. * public/v2/index.html: Pass in showFullYAxis as an argument to the main interactive chart. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._constructGraphIfPossible): Add an event listener on y-axis labels when the chart is interactive so that toggle showFullYAxis. Also hide the moving average and/or the envelope if they are not specified by the user (i.e. only used to adjust y-axis range). (App.InteractiveChartComponent._updateDomain): Don't exit early if y-axis domains are different even if x-axis domain remained the same. Without this change, the charts would never redraw. (App.InteractiveChartComponent._minMaxForAllTimeSeries): Use the moving average instead of the current time series to compute the y-axis range if showFullYAxis is false. When showFullYAxis is true, expand y-axis all the way down to 0 or the minimum value in the current time series whichever is smaller. * public/v2/js/statistics.js: (Statistics.MovingAverageStrategies): Use a wider window in Simple Moving Average by default. 2015-02-10 Ryosuke Niwa Unreviewed build fix. * public/v2/app.js: (set get App.Pane.Ember.Object.extend): 2015-02-10 Ryosuke Niwa New perf dashboard should have the ability to overlay moving average with an envelope https://bugs.webkit.org/show_bug.cgi?id=141438 Reviewed by Andreas Kling. This patch adds three kinds of moving average strategies and two kinds of enveloping strategies: Simple Moving Average - The moving average x̀„_i of x_i is computed as the arithmetic mean of values from x_(i - n) though x_(i + m) where n is a non-negative integer and m is a positive integer. It takes n, backward window size, and m, forward window size, as an argument. Cumulative Moving Average - x̀„_i is computed as the arithmetic mean of all values x_0 though x_i. That is, x̀„_1 = x_1 and x̀„_i = ((i - 1) * M_(i - 1) + x_i) / i for all i > 1. Exponential Moving Average - x̀„_i is computed as the weighted average of x_i and x̀„_(i - 1) with α as an argument specifying x_i's weight. To be precise, x̀„_1 = x_1 and x̀„_i = α * x_i + (α - 1) x̀„_(i-1). Average Difference - The enveloping delta d is computed as the arithmetic mean of the difference between each x_i and x̀„_i. Moving Average Standard Deviation - d is computed like the standard deviation except the deviation for each term is measured from the moving average instead of the sample arithmetic mean. i.e. it uses the average of (x_i - x̀„_i)^2 as the "sample variance" instead of the conventional (x_i - x̀„)^2 where x̀„ is the sample mean of all x_i's. This change was necessary since our time series is non-stationary. Each strategy is cloned for an App.Pane instance so that its parameterList can be configured per pane. The configuration of the currently chosen strategies is saved in the query string for convenience. Also added the "stat pane" to choose a moving average strategy and a enveloping strategy in each pane. * public/v2/app.css: Specify the fill color for all SVG groups in the pane toolbar icons. * public/v2/app.js: (App.Pane._fetch): Delegate the creation of 'chartData' to _computeChartData. (App.Pane.updateStatisticsTools): Added. Clones moving average and enveloping strategies for this pane. (App.Pane._cloneStrategy): Added. Clones a strategy for a new pane. (App.Pane._configureStrategy): Added. Finds and configures a strategy from the configuration retrieved from the query string via ChartsController. (App.Pane._computeChartData): Added. Creates chartData from fetchedData. (App.Pane._computeMovingAverage): Added. Computes the moving average and the envelope. (App.Pane._executeStrategy): Added. (App.Pane._updateStrategyConfigIfNeeded): Pushes the strategy configurations to the query string via ChartsController. (App.ChartsController._parsePaneList): Merged the query string arguments for the range and point selections, and added two new arguments for the moving average and the enveloping configurations. (App.ChartsController._serializePaneList): Ditto. (App.ChartsController._scheduleQueryStringUpdate): Observes strategy configurations. (App.PaneController.actions.toggleBugsPane): Hides the stat pane. (App.PaneController.actions.toggleSearchPane): Hides the stat pane. (App.PaneController.actions.toggleStatPane): Added. * public/v2/chart-pane.css: Added CSS rules for the new stat pane. Also added .foreground class for the current (as opposed to baseline and target) time series for when it's the most foreground graph without moving average and its envelope overlapping on top of it. * public/v2/index.html: Added the templates for the stat pane and the corresponding icon (Σ). * public/v2/interactive-chart.js: (App.InteractiveChartComponent.chartDataDidChange): Unset _totalWidth and _totalHeight to avoid exiting early inside _updateDimensionsIfNeeded when chartData changes after the initial layout. (App.InteractiveChartComponent.didInsertElement): Attach event listeners here instead of inside _constructGraphIfPossible since that could be called multiple times on the same SVG element. (App.InteractiveChartComponent._constructGraphIfPossible): Clear down the old SVG element we created but don't bother removing individual paths and circles. Added the code to show the moving average time series when there is one. Also add "foreground" class on SVG elements for the current time series when we're not showing the moving average. chart-pane.css has been updated to "dim down" the current time series when "foreground" is not set. (App.InteractiveChartComponent._minMaxForAllTimeSeries): Take the moving average time series into account when computing the y-axis range. (App.InteractiveChartComponent._brushChanged): Removed 'selectionIsLocked' argument as it's useless. * public/v2/js/statistics.js: (Statistics.MovingAverageStrategies): Added. (Statistics.EnvelopingStrategies): Added. 2015-02-06 Ryosuke Niwa The delta value in the chart pane sometimes doens't show '+' for a positive delta https://bugs.webkit.org/show_bug.cgi?id=141340 Reviewed by Andreas Kling. The bug was caused by computeStatus prefixing the value delta with '+' if it's greater than 0 after it had already been formatted. Fixed the bug by using a formatter that always emits a sign symbol. * public/v2/app.js: (App.Pane.computeStatus): (App.createChartData): 2015-02-06 Ryosuke Niwa Unreviewed build fix. currentPoint wasn't defined when selectedPoints was used to find points. * public/v2/app.js: (App.PaneController._updateDetails): 2015-02-06 Ryosuke Niwa Unreviewed. Commit the forgotten change. * public/include/manifest.php: 2015-02-06 Ryosuke Niwa New perf dashboard should have multiple dashboard pages https://bugs.webkit.org/show_bug.cgi?id=141339 Reviewed by Chris Dumez. Added the support for multiple dashboard pages. Also added the status of the latest data point. e.g. "5% better than target" * public/v2/app.css: Tweaked the styles to work around the fact Ember.js creates empty script elements. Also hid the border lines around charts on the dashboard page for a cleaner look. * public/v2/app.js: (App.IndexRoute): Added. Navigate to /dashboard/ once the manifest.json is loaded. (App.IndexRoute.beforeModel): Added. (App.DashboardRoute): Added. (App.DashboardRoute.model): Added. Return the dashboard specified by the name. (App.CustomDashboardRoute): Added. This route is used for a customized dashboard specified by "grid". (App.CustomDashboardRoute.model): Create a dashboard model from "grid" query parameter. (App.CustomDashboardRoute.renderTemplate): Use the dashboard template. (App.DashboardController): Renamed from App.IndexController. (App.DashboardController.modelChanged): Renamed from gridChanged. Removed the code to deal with "grid" and "defaultDashboard" as these are taken care of by newly added routers. (App.DashboardController.computeGrid): Renamed from updateGrid. No longer updates "grid" since this is now done in actions.toggleEditMode. (App.DashboardController.actions.toggleEditMode): Navigate to CustomDashboardRoute when start editing an existing dashboard. (App.Pane.computeStatus): Moved from App.PaneController so that to be called in App.Pane.latestStatus. Also moved the code to compute the delta with respect to the previous data point from _updateDetails. (App.Pane._relativeDifferentToLaterPointInTimeSeries): Ditto. (App.Pane.latestStatus): Added. Used by the dashboard template to show the status of the latest result. (App.createChartData): Added deltaFormatter to show less significant digits for differences. (App.PaneController._updateDetails): Updated per changes to computeStatus. * public/v2/chart-pane.css: Added style rules for the status labels on the dashboard. * public/v2/data.js: (TimeSeries.prototype.lastPoint): Added. * public/v2/index.html: Prefetch manifest.json as soon as possible, show the latest data points' status on the dashboard, and enumerate all predefined dashboards. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._relayoutDataAndAxes): Slightly adjust the offset at which we show unit for the dashboard page. * public/v2/manifest.js: (App.Dashboard): Inherit from App.NameLabelModel now that each predefined dashboard has a name. (App.MetricSerializer.normalizePayload): Parse all predefined dashboards instead of a single dashboard. IDs are generated for each dashboard for forward compatibility. (App.Manifest): (App.Manifest.dashboardByName): Added. (App.Manifest.defaultDashboardName): Added. (App.Manifest._fetchedManifest): Create dashboard model objects for all predefined ones. 2015-02-05 Ryosuke Niwa Move commits viewer to the end of details view https://bugs.webkit.org/show_bug.cgi?id=141315 Rubber-stamped by Andreas Kling. Show the difference instead of the old value per kling's request. * public/v2/app.js: (App.PaneController._updateDetails): * public/v2/index.html: 2015-02-05 Ryosuke Niwa Move commits viewer to the end of details view https://bugs.webkit.org/show_bug.cgi?id=141315 Reviewed by Andreas Kling. Improved the way list of commits are shown per kling's request. * public/v2/app.js: (App.PaneController._updateDetails): Always show the old value even when a single point is selected. * public/v2/chart-pane.css: Updated the style for the commits viewer. * public/v2/commits-viewer.js: (App.CommitsViewerComponent): Added "visible" property to hide the list of commits. (App.CommitsViewerComponent.actions.toggleVisibility): Added. Toggles "visible" property. * public/v2/index.html: Updated the template for commits viewer to support "visible" property. Also moved the commits viewers out of the details tables so that they don't interleave revision data. 2015-02-05 Ryosuke Niwa New perf dashboard should compare results to baseline and target https://bugs.webkit.org/show_bug.cgi?id=141286 Reviewed by Chris Dumez. Compare the selected value against baseline and target values as done in v1. e.g. "5% below target" Also use d3.format to format the selected value to show four significant figures. * public/v2/app.js: (App.Pane.searchCommit): (App.Pane._fetch): Create time series here via createChartData so that _computeStatus can use them to compute the status text without having to recreate them. (App.createChartData): Added. (App.PaneController._updateDetails): Use 3d.format on current and old values. (App.PaneController._computeStatus): Added. Computes the status text. (App.PaneController._relativeDifferentToLaterPointInTimeSeries): Added. (App.AnalysisTaskController._fetchedManifest): Use createChartData as done in App.Pane._fetch. Also format the values using chartData.formatter. * public/v2/chart-pane.css: Enlarge the status text. Show the status text in red if it's worse than the baseline and in blue if it's better than the target. * public/v2/data.js: (TimeSeries.prototype.findPointAfterTime): Added. * public/v2/index.html: Added a new tbody for the status text and the selected value. Also fixed the bug that we were not showing the old value's unit. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._constructGraphIfPossible): Use chartData.formatter. Also cleaned up the code to show the baseline and the target lines. * public/v2/manifest.js: (App.Manifest.fetchRunsWithPlatformAndMetric): Added smallerIsBetter. 2015-02-05 Ryosuke Niwa Unreviewed build fix. * public/v2/app.js: (App.IndexController.gridChanged): Use store.createRecord to create a custom dashboard as required by Ember.js 2015-02-04 Ryosuke Niwa New perf dashboard doesn't preserve the number of days when clicking on a dashboard chart https://bugs.webkit.org/show_bug.cgi?id=141280 Reviewed by Chris Dumez. Fixed the bug by passing in "since" as a query parameter to the charts page. Also fixed the styling issue that manifests when a JSON fetching fails on "Dashboard" page. * public/v2/app.css: Fixed CSS rules for error messages shown in the place of charts. * public/v2/app.js: (App.IndexController): Changed the default number of days from one month to one week. (App.IndexController._sharedDomainChanged): Set "since" property on the controller. * public/v2/index.html: Pass in "since" property on the controller as a query parameter. 2015-02-04 Ryosuke Niwa New perf dashboard erroneously clears zoom when poping history items https://bugs.webkit.org/show_bug.cgi?id=141278 Reviewed by Chris Dumez. The bug was caused by _sharedZoomChanged updating overviewSelection without updating mainPlotDomain. Updating overviewSelection resulted in _overviewSelectionChanged, which observes changes to overviewSelection, to schedule a call to propagateZoom, which in turn overrode "sharedZoom" we just parsed from the query string. * public/v2/app.js: (App.PaneController._overviewSelectionChanged): Don't schedule propagateZoom if the selected domain is already shown in the main plot. (App.PaneController._sharedZoomChanged): Set both overviewSelection and mainPlotDomain to avoid overriding "sharedZoom" via propagateZoom inside _overviewSelectionChanged. 2015-02-04 Ryosuke Niwa New perf dashboard shows null as the aggregator name if no aggregation is done https://bugs.webkit.org/show_bug.cgi?id=141256 Reviewed by Chris Dumez. Don't show the aggregator name if there isn't one. * public/v2/manifest.js: (App.Metric.label): 2015-02-04 Ryosuke Niwa Unreviewed build fix after r179611. * public/v2/interactive-chart.js: 2015-02-04 Ryosuke Niwa Perf dashboard doesn’t show the right unit for Safari UI tests https://bugs.webkit.org/show_bug.cgi?id=141238 Reviewed by Darin Adler. Safari UI tests use custom metrics that end with "Time". This patch teaches the perf dashboard how to get the unit for a given metric based on the suffix of the metric name instead of hard-coding the mapping between metrics and their units. * public/js/helper-classes.js: (PerfTestRuns): Use the suffix of the metric name to compute the unit. * public/v2/manifest.js: (App.Manifest.fetchRunsWithPlatformAndMetric): Ditto. Also set "useSI" property iff for "bytes". * public/v2/interactive-chart.js: (App.InteractiveChartComponent._constructGraphIfPossible): Respect useSI. Use toPrecision(3) otherwise. (App.InteractiveChartComponent._relayoutDataAndAxes): Place the unit vertically on the left of ticks. 2015-02-04 Ryosuke Niwa Interactive chart component provides two duplicate API for highlighting points https://bugs.webkit.org/show_bug.cgi?id=141234 Reviewed by Chris Dumez. Prior to this patch, the interactive chart component supported highlightedItems for finding commits on the main charts page and markedPoints to show the two end points in the analysis task page. This patch merges markedPoints into highlightedItems. * public/v2/app.js: (App.AnalysisTaskController._fetchedRuns): Use highlightedItems. * public/v2/chart-pane.css: * public/v2/index.html: Ditto. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._constructGraphIfPossible): Make this._highlights an array instead of array of arrays. Also call _highlightedItemsChanged at the end to fix the bug that we never highlight items if highlightedItems was set before the initial layout. (App.InteractiveChartComponent._relayoutDataAndAxes): (App.InteractiveChartComponent._updateHighlightPositions): Now that highlights are circles instead of vertical lines, just set cx and cy as done for other "dots". (App.InteractiveChartComponent._highlightedItemsChanged): Exit early only if _clippedContainer wasn't already set; i.e. _constructGraphIfPossible hasn't been called. Also updated the logic to accommodate the fact this._highlights is an array of elements instead of an array of arrays of elements. Finally, set the radius of highlight circles here. 2015-02-03 Ryosuke Niwa Don’t use repository names as id’s. https://bugs.webkit.org/show_bug.cgi?id=141226 Reviewed by Chris Dumez. Not using repository names as their id's reduces the need to fetch the entire repositories table. Since names of repositories are available in manifest.json, we can resolve their names in the front end. * Websites/perf.webkit.org/public/api/runs.php: (parse_revisions_array): No longer uses $repository_id_to_name. (main): No longer populates $repository_id_to_name. * Websites/perf.webkit.org/public/api/triggerables.php: (main): Don't resolve repository names. * Websites/perf.webkit.org/public/include/manifest.php: (ManifestGenerator::repositories): Use repositories ids as keys in the result and include their names. (ManifestGenerator::bug_trackers): Don't resolve repository names. * Websites/perf.webkit.org/public/js/helper-classes.js: (TestBuild): Renamed repositoryName to repositoryId. (TestBuild.revision): Ditto. (TestBuild.formattedRevisions): Ditto. Continue to use the repository name in the formatted result since this is the text shown to human. * Websites/perf.webkit.org/public/v2/app.js: (App.pane.searchCommit): Renamed repositoryName to repositoryId. (App.PaneController._updateDetails): Ditto. (App.AnalysisTaskController.updateRoots): Ditto. * Websites/perf.webkit.org/public/v2/data.js: (Measurement): Ditto. (Measurement.prototype.commitTimeForRepository): Ditto. (Measurement.prototype.formattedRevisions): Ditto. * Websites/perf.webkit.org/public/v2/index.html: Use the repository name and the repository id as select element's label and value respectively. 2015-02-03 Ryosuke Niwa Unreviewed build fix. Declare $repository_id_to_name in the global scope. * public/api/runs.php: 2015-02-03 Ryosuke Niwa /api/runs.php should have main function https://bugs.webkit.org/show_bug.cgi?id=141220 Reviewed by Benjamin Poulain. Wrapped the code inside main function for clarity. * public/api/runs.php: 2015-01-27 Ryosuke Niwa Unreviewed build fix. "eta" isn't set on a in-progress build on a newly added builder. * tools/sync-with-buildbot.py: (find_request_updates): 2015-01-23 Ryosuke Niwa Perf dashboard always assigns the result of A/B testing with build request 1 https://bugs.webkit.org/show_bug.cgi?id=140382 Reviewed by Darin Adler. The bug was caused by the expression array_get($report, 'jobId') or array_get($report, 'buildRequest') which always evaluated to 1 when the report contained jobId. Fixed the bug by cascading array_get instead. Also fixed a typo as well as a bug that reports were never associated with builds. * public/include/report-processor.php: (ReportProcessor::process): Don't use "or" to find the non-null value since that always evaluates to 1 instead of the first non-null value. (ReportProcessor::resolve_build_id): Fixed the typo by adding the missing "$this->". (ReportProcessor::commit): Associate the report with the corresponding build as intended. 2015-01-23 Ryosuke Niwa Unreviewed typo fix. The prefix in triggerable_configurations is "trigconfig", not "trigrepo". * public/admin/tests.php: 2015-01-10 Ryosuke Niwa Unreviewed build fix. Removed the stale code. * public/admin/triggerables.php: 2015-01-09 Ryosuke Niwa Perf dashboard should have the ability to post A/B testing builds https://bugs.webkit.org/show_bug.cgi?id=140317 Rubber-stamped by Simon Fraser. This patch adds the support for triggering A/B testing from the perf dashboard. We add a few new tables to the database. "build_triggerables", which represents a set of builders that accept A/B testing. "triggerable_repositories" associates each "triggerable" with a fixed set of repositories for which an arbitrary revision can be specified for A/B testing. "triggerable_configurations" specifies a triggerable available on a given test on a given platform. "roots" table which specifies the revision used in a given root set in each repository. * init-database.sql: Added "build_triggerables", "triggerable_repositories", "triggerable_configurations", and "roots" tables. Added references to "build_triggerables", "platforms", and "tests" tables as well as columns to store status, status url, and creation time to build_requests table. Also made each test group's name unique in a given analysis task as it would be confusing to have multiple test groups of the same name. * public/admin/tests.php: Added the UI and the code to associate a test with a triggerable. * public/admin/triggerables.php: Added. Manages the list of triggerables as well as repositories for which a specific revision can be set in an A/B testing on a given triggerable. * public/api/build-requests.php: Added. Returns the list of open build requests on a specified triggerable. Also updates the status' and the status urls of specified build requests when buildRequestUpdates is provided in the raw POST data. (main): * public/api/runs.php: (fetch_runs_for_config): Don't include results associated with a build request, meaning they are results of an A/B testing. * public/api/test-groups.php: (main): Use the newly added BuildRequestsFetcher. Also merged fetch_test_groups_for_task back. * public/api/triggerables.php: Added. (main): Returns a list of triggerables or a triggerable associated with a given analysis task. * public/include/admin-header.php: * public/include/build-requests-fetcher.php: Added. Extracted from public/api/test-groups.php. (BuildRequestsFetcher): This class abstracts the process of fetching a list of builds requests and root sets used in those requests.D (BuildRequestsFetcher::__construct): (BuildRequestsFetcher::fetch_for_task): (BuildRequestsFetcher::fetch_for_group): (BuildRequestsFetcher::fetch_incomplete_requests_for_triggerable): (BuildRequestsFetcher::has_results): (BuildRequestsFetcher::results): (BuildRequestsFetcher::results_with_resolved_ids): (BuildRequestsFetcher::results_internal): (BuildRequestsFetcher::root_sets): (BuildRequestsFetcher::fetch_roots_for_set): * public/include/db.php: (Database::prefixed_column_names): Don't return "$prefix_" when there are no columns. (Database::insert_row): Support taking an empty array for values. This is useful in "root_sets" table since it only has the primary key, id, column. (Database::select_or_insert_row): (Database::update_or_insert_row): (Database::update_row): Added. (Database::_select_update_or_insert_row): Takes an extra argument specifying whether a new row should be inserted when no row matches the specified criteria. This is used while updating build_requests' status and url in public/api/build-requests.php since we shouldn't be inserting new build requests in that API. (Database::select_rows): Also use "1 == 1" in the select query when the query criteria is empty. This is used in public/api/triggerables.php when no analysis task is specified. * public/include/json-header.php: (find_triggerable_for_task): Added. Finds a triggerable available on a given test. We return the triggerable associated with the closest ancestor of the test. Since issuing a new query for each ancestor test is expensive, we retrieve triggerable for all ancestor tests at once and manually find the closest ancestor with a triggerable. * public/include/report-processor.php: (ReportProcessor::process): (ReportProcessor::resolve_build_id): Associate a build request with the newly created build if jobId or buildRequest is specified. * public/include/test-name-resolver.php: (TestNameResolver::map_metrics_to_tests): Store the entire metric row instead of its name so that test_exists_on_platform can use it. The last diff in public/admin/tests.php adopts this change. (TestNameResolver::test_exists_on_platform): Added. Returns true iff the test has ever run on a given platform. * public/include/test-path-resolver.php: Added. (TestPathResolver): This class abstracts the ancestor chains of a test. It retrieves the entire "tests" table to do this since there could be arbitrary number of ancestors for a given test. This class is a lot more lightweight than TestNameResolver, which retrieves a whole bunch of tables in order to compute full test metric names. (TestPathResolver::__construct): (TestPathResolver::ancestors_for_test): Returns the ordered list of ancestors from the closest to the highest (a test without a parent). (TestPathResolver::path_for_test): Returns a test "path", the ordered list of test names from the highest ancestor to the test itself. (TestPathResolver::ensure_id_to_test_map): Fetches "tests" table to construct id_to_test_map. * public/privileged-api/create-test-group.php: Added. An API to create A/B testing groups. (main): (commit_sets_from_root_sets): Given a dictionary of repository names to a pair of revisions for sets A and B respectively, returns a pair of arrays, each of which contains the corresponding set of "commits" for sets A and B respectively. e.g. {"WebKit": [1, 2], "Safari": [3, 4]} will result in [[WebKit commit at r1, Safari commit at r3], [WebKit commit at r2, Safari commit at r4]]. * public/v2/analysis.js: (App.AnalysisTask.testGroups): Takes arguments so that set('testGroups') will invalidate the cache. (App.AnalysisTask.triggerable): Added. Retrieves the triggerable associated with the task lazily. (App.TestGroup.rootSets): Added. Returns the list of root set ids used in this A/B testing group. (App.TestGroup.create): Added. Creates a new A/B testing group. (App.Triggerable): Added. (App.TriggerableAdapter): Added. (App.TriggerableAdapter.buildURL): Added. (App.BuildRequest.testGroup): Renamed from group. (App.BuildRequest.orderLabel): Added. One-based index to be used in labels. (App.BuildRequest.config): Added. Returns either 'A' or 'B' depending on the configuration used in this build request. (App.BuildRequest.status): Added. (App.BuildRequest.statusLabel): Added. Returns a human friendly label for the current status. (App.BuildRequest): Removed buildNumber, buildBuilder, as well as buildTime as they're unused. * public/v2/app.js: (App.AnalysisTaskController.testGroups): Added. (App.AnalysisTaskController.possibleRepetitionCounts): Added. (App.AnalysisTaskController.updateRoots): Renamed from roots. This is also no longer a property but an observer that updates "roots" property. Filter out the repositories that are not accepted by the associated triggerable as they will be ignored. (App.AnalysisTaskController.actions.createTestGroup): Added. * public/v2/index.html: Updated the UI, and added a form element to trigger createTestGroup action. * tools/sync-with-buildbot.py: Added. This scripts posts new builds on buildbot and reports back the status of those builds to the perf dashboard. A similar script can be written to support other continuous builds systems. (main): Fetches the list of pending builds as well as currently running or completed builds from a buildbot, and report new statuses of builds requests to the perf dashboard. It will then schedule a single new build on each builder with no pending builds, and marks the set of open build requests that have been scheduled to run on the buildbot but not found in the first step as stale. (load_config): Loads a JSON that contains the configurations for each builder. e.g. [ { "platform": "mac-mavericks", "test": ["Parser", "html5-full-render.html"], "builder": "Trunk Syrah Production Perf AB Tests", "arguments": { "forcescheduler": "force-mac-mavericks-release-perf", "webkit_revision": "$WebKit", "jobid": "$buildRequest" } } ] (find_request_updates): Return a list of build request status updates to make based on the pending builds as well as in-progress and completed builds on each builder on the buildbot. When a build is completed, we use the special status "failedIfNotCompleted" which results in "failed" status only if the build request had not been completed. This is necessary because a failed build will not report its failed-ness back to the perf dashboard in some cases; e.g. lost slave or svn up failure. (update_and_fetch_build_requests): Submit the build request status updates and retrieve the list of open requests the perf dashboard has. (find_stale_request_updates): Compute the list of build requests that have been scheduled on the buildbot but not found in find_request_updates. These build requests are lost. e.g. a master reboot or human canceling a build may trigger such a state. (schedule_request): Schedules a build with the arguments specified in the configuration JSON after replacing repository names with their revisions and buildRequest with the build request id. (config_for_request): Finds a builder for the test and the platform of a build request. (fetch_json): Fetches a JSON from the specified URL, optionally with BasicAuth. (property_value_from_build): Returns the value of a specific property in a buildbot build. (request_id_from_build): Returns the build request id of a given buildbot build if there is one. 2015-01-09 Ryosuke Niwa Cache-control should be set only on api/runs https://bugs.webkit.org/show_bug.cgi?id=140312 Reviewed by Andreas Kling. Some JSON APIs such as api/analysis-tasks can't be cached even for a short period of time (e.g. a few minutes) since they can be modified by the user on demand. Since only api/runs.php takes a long time to generate JSONs, just set cache-control there instead of json-header.php which is used by other JSON APIs. Also set date_default_timezone_set in db.php since we never use non-UTC timezone in our scripts. * public/api/analysis-tasks.php: * public/api/runs.php: Set the cache control headers. * public/api/test-groups.php: * public/include/db.php: Set the default timezone to UTC. * public/include/json-header.php: Don't set the cache control headers. 2015-01-09 Ryosuke Niwa api/report-commit should authenticate with a slave name and password https://bugs.webkit.org/show_bug.cgi?id=140308 Reviewed by Benjamin Poulain. Use a slave name and a password to authenticate new commit reports. * public/api/report-commits.php: (main): * public/include/json-header.php: (verify_slave): Renamed and repurposed from verify_builder in report-commits.php. Now authenticates with a slave name and a password instead of a builder name and a password. * tests/api-report-commits.js: Updated tests. * tools/pull-svn.py: (main): Renamed variables. (submit_commits): Submits slaveName and slavePassword instead of builderName and builderPassword. 2014-12-19 Ryosuke Niwa Perf dashboard should support authentication via a slave password https://bugs.webkit.org/show_bug.cgi?id=139837 Reviewed by Andreas Kling. For historical reasons, perf dashboard conflated builders and build slaves. As a result we ended up having to add multiple builders with the same password when a single build slave is shared among them. This patch introduces the concept of build_slave into the perf dashboard to end this madness. * init-database.sql: Added build_slave table as well as references to it in builds and reports. * public/admin/build-slaves.php: Added. * public/admin/builders.php: Added the support for updating passwords. * public/include/admin-header.php: (update_field): Takes an extra argument when a new value needs to be supplied by the caller instead of being retrieved from $_POST. (AdministrativePage::render_table): Use array_get to retrieve a value out of the database row since the raw may not exist (e.g. new_password). (AdministrativePage::render_form_to_add): Added the support for post_insertion. Don't render the form control here when this flag evaluates to TRUE. * public/include/report-processor.php: (ReportProcessor::process): Added the logic to authenticate with slaveName and slavePassword if those values are present in the report. In addition, try authenticating builderName with slavePassword if builderPassword is not specified. When neither password is specified, exit with BuilderNotFound. Also insert the slave or the builder whichever is missing after we've successfully authenticated. (ReportProcessor::construct_build_data): Takes a builder ID and an optional slave ID instead of a builder row. (ReportProcessor::store_report): Store the slave ID with the report. (ReportProcessor::resolve_build_id): Exit with MismatchingBuildSlave when the slave associated with the matching build is different from what's being reported. * tests/api-report.js: Added a bunch of tests to test the new features of /api/report. (.addSlave): Added. 2014-12-18 Ryosuke Niwa New perf dashboard should not duplicate author information in each commit https://bugs.webkit.org/show_bug.cgi?id=139756 Reviewed by Darin Adler. Instead of each commit having author name and email, make it reference a newly added committers table. Also replace "email" by "account" since some repositories don't use emails as account names. This improves the keyword search performance in commits.php since LIKE now runs on committers table, which only contains as many rows as there are accounts in each repository, instead of commits table which contains every commit ever happened in each repository. To migrate an existing database into match the new schema, run: BEGIN; INSERT INTO committers (committer_repository, committer_name, committer_email) (SELECT DISTINCT commit_repository, commit_author_name, commit_author_email FROM commits WHERE commit_author_email IS NOT NULL); ALTER TABLE commits ADD COLUMN commit_committer integer REFERENCES committers ON DELETE CASCADE; UPDATE commits SET commit_committer = committer_id FROM committers WHERE commit_repository = committer_repository AND commit_author_email = committer_email; ALTER TABLE commits DROP COLUMN commit_author_name CASCADE; ALTER TABLE commits DROP COLUMN commit_author_email CASCADE; COMMIT; * init-database.sql: Added committers table, and replaced author columns in commits table by a foreign reference to committers. Also added the missing drop table statements. * public/api/commits.php: (main): Fetch the corresponding committers row for a single commit. Also wrap a single commit by an array here instead of doing it in format_commit. (fetch_commits_between): Updated queries to JOIN commits with committers. (format_commit): Takes both commit and committers rows. Also don't wrap the result in an array as that is now done in main. * public/api/report-commits.php: (main): Store the reported committer information or update the existing entry if there is one. * tests/admin-regenerate-manifest.js: Fixed tests. * tests/api-report-commits.js: Ditto. Also added a test for updating an existing committer entry. * tools/pull-svn.py: Renamed email to account. (main): (fetch_commit_and_resolve_author): (fetch_commit): (resolve_author_name_from_account): (resolve_author_name_from_email): Deleted. 2014-12-17 Ryosuke Niwa Unreviewed build fix. * public/v2/index.html: Include js files we extracted in r177424. 2014-12-16 Ryosuke Niwa Unreviewed. Adding the forgotten svnprop. * tools/pull-svn.py: Added property svn:executable. 2014-12-16 Ryosuke Niwa Split InteractiveChartComponent and CommitsViewerComponent into separate files https://bugs.webkit.org/show_bug.cgi?id=139716 Rubber-stamped by Benjamin Poulain. Refactored InteractiveChartComponent and CommitsViewerComponent out of app.js into commits-viewer.js and interactive-chart.js respectively since app.js has gotten really large. * public/v2/app.js: * public/v2/commits-viewer.js: Added. * public/v2/interactive-chart.js: Added. 2014-12-02 Ryosuke Niwa New perf dashboard's chart UI is buggy https://bugs.webkit.org/show_bug.cgi?id=139214 Reviewed by Chris Dumez. The bugginess was caused by weird interactions between charts and panes. Rewrote the code to fix it. Superfluous selectionChanged and domainChanged "event" actions were removed from the interactive chart component. This is not how Ember.js components should interact to begin with. The component now exposes selectedPoints and always updates selection instead of sharedSelection. * public/v2/app.js: (App.ChartsController.present): Added. We can't call Date.now() in various points in our code as that would lead to infinite mutual recursions since X-axis domain values wouldn't match up. (App.ChartsController.updateSharedDomain): This function was completely useless. The overview's start and end time should be completely determined by "since" and the present time. (App.ChartsController._startTimeChanged): Ditto. (App.ChartsController._scheduleQueryStringUpdate): (App.ChartsController._updateQueryString): Set "zoom" only if it's different from the shared domain. (App.domainsAreEqual): Moved from InteractiveChartComponent._xDomainsAreSame. (App.PaneController.actions.createAnalysisTask): Use selectedPoints property set by the chart. (App.PaneController.actions.overviewDomainChanged): Removed; only needed to call updateSharedDomain. (App.PaneController.actions.rangeChanged): Removed. _showDetails (renamed to _updateDetails) directly observes the changes to selectedPoints property as it gets updated by the main chart. (App.PaneController._overviewSelectionChanged): This was previously a dead code. Now it's used again with a bug fix. When the overview selection is cleared, we use the same domain in the main chart and the overview chart. (App.PaneController._sharedDomainChanged): Fixed a but that it erroneously updates the overview domain when domain arrays aren't identical. This was causing a subtle race with other logic. (App.PaneController._sharedZoomChanged): Ditto. Also don't set mainPlotDomain here as any changes to overviewSelection will automatically propagate to the main plot's domain as they're aliased. (App.PaneController._currentItemChanged): Merged into _updateDetails (renamed from _showDetails). (App.PaneController._updateDetails): Previously, this function took points and inspected _hasRange to see if those two points correspond to a range or a single data point. Rewrote all that logic by directly observing selectedPoints and currentItem properties instead of taking points and relying on an instance variable, which was a terrible API. (App.PaneController._updateCanAnalyze): Use selectedPoints property. Since this property is only set when the main plot has a selected range, we don't have to check this._hasRange anymore. (App.InteractiveChartComponent._updateDomain): No longer sends domainChanged "event" action. (App.InteractiveChartComponent._sharedSelectionChanged): Removed. This is a dead code. (App.InteractiveChartComponent._updateSelection): (App.InteractiveChartComponent._xDomainsAreSame): Moved to App.domainsAreEqual. (App.InteractiveChartComponent._setCurrentSelection): Update the selection only if needed. Also set selectedPoints property. (App.AnalysisTaskController._fetchedRuns): (App.AnalysisTaskController._rootChangedForTestSet): * public/v2/index.html: Removed non-functional sharedSelection and superfluous selectionChanged and domainChanged actions. 2014-11-21 Ryosuke Niwa Unreviewed. Fixed syntax errors. * init-database.sql: * public/api/commits.php: 2014-11-21 Ryosuke Niwa The dashboard on new perf monitor should be configurable https://bugs.webkit.org/show_bug.cgi?id=138994 Reviewed by Benjamin Poulain. For now, make it configurable via config.json. We should eventually make it configurable via an administrative page but this will do for now. * config.json: Added the empty dashboard configuration. * public/include/manifest.php: Include the dashboard configuration in the manifest file. * public/v2/app.js: (App.IndexController): Removed defaultTable since this is now dynamically obtained via App.Manifest. (App.IndexController.gridChanged): Use App.Dashboard to parse the dashboard configuration. Also obtain the default configuration from App.Manifest. (App.IndexController._normalizeTable): Moved to App.Dashboard. * public/v2/manifest.js: (App.Repository.urlForRevision): Fixed the position of the open curly bracket. (App.Repository.urlForRevisionRange): Ditto. (App.Dashboard): Added. (App.Dashboard.table): Extracted from App.IndexController.gridChanged. (App.Dashboard.rows): Ditto. (App.Dashboard.headerColumns): Ditto. (App.Dashboard._normalizeTable): Moved from App.IndexController._normalizeTable. (App.MetricSerializer.normalizePayload): Synthesize a dashboard record from the configuration. Since there is exactly one dashboard object per app, it's okay to hard code an id here. (App.Manifest._fetchedManifest): Set defaultDashboard to the one and only one dashboard we have. 2014-11-21 Ryosuke Niwa There should be a way to associate bugs with analysis tasks https://bugs.webkit.org/show_bug.cgi?id=138977 Reviewed by Benjamin Poulain. Updated associate-bug.php to match the new database schema. * public/include/json-header.php: (require_format): Removed the call to camel_case_words_separated_by_underscore since the name is already camel-cased in require_existence_of. This makes the function usable elsewhere. * public/privileged-api/associate-bug.php: (main): Changed the API to take run, bugTracker, and number to match the new database schema. Also verify that those values are integers using require_format. * public/v2/analysis.js: (App.AnalysisTask.label): Added. Concatenates the task's name with the bug numbers. (App.Bug.label): Added. (App.BugAdapter): Added. (App.BugAdapter.createRecord): Use PrivilegedAPI instead of the builtin ajax call. (App.BuildRequest): Inherit from newly added App.Model, which is set to DS.Model right now. * public/v2/app.css: Renamed .test-groups to .analysis-group. Also added new rules for the table containing the bug information. * public/v2/app.js: (App.InteractiveChartComponent._rangesChanged): Added label to range bar objects. (App.AnalysisTaskRoute): (App.AnalysisTaskController): Replaced the functionality of App.AnalysisTaskViewModel. (App.AnalysisTaskController._fetchedManifest): Added. (App.AnalysisTaskController.actions.associateBug): Added. * public/v2/chart-pane.css: Renamed .bugs-pane to .analysis-pane. * public/v2/data.js: (Measurement.prototype.associateBug): Deleted. * public/v2/index.html: Renamed .bugs-pane to .analysis-pane and .test-groups to .analysis-group. Added a table show the bug information. Also hide the chart until chartData is available. * public/v2/manifest.js: (App.Model): Added. 2014-11-20 Ryosuke Niwa Fix misc bugs and typos in app.js https://bugs.webkit.org/show_bug.cgi?id=138946 Reviewed by Benjamin Poulain. * public/v2/app.js: (App.DashboardPaneProxyForPicker._platformOrMetricIdChanged): (App.ChartsController.init): (App.buildPopup): Renamed from App.BuildPopup. (App.InteractiveChartComponent._constructGraphIfPossible): Fixed the bug that we were calling remove() on the wrong object (an array as opposed to elements in the array). (App.InteractiveChartComponent._highlightedItemsChanged): Check the length of _highlights as _highlights is always an array and evalutes to true. 2014-11-20 Ryosuke Niwa New perf dashboard should provide UI to create a new analysis task https://bugs.webkit.org/show_bug.cgi?id=138910 Reviewed by Benjamin Poulain. This patch reverts some parts of r175006 and re-introduces bugs associated with analysis tasks. I'll add UI to show and edit bug numbers associated with an analysis task in a follow up patch. With this patch, we can create a new analysis task by selection a range of points and opening "analysis pane" (renamed from "bugs pane"). Each analysis task created is represented by a yellow bar in the chart hyperlinked to the analysis task. * init-database.sql: Redefined the bugs to be associated with an analysis task instead of a test run. * public/api/analysis-tasks.php: Added the support for querying analysis tasks for a specific metric on a specific platform. Also retrieve and return all bugs associated with analysis tasks. (main): (fetch_and_push_bugs_to_tasks): Added. Fetches all bugs associated with an array of analysis tasks and adds the associated bugs to each task in the array. (format_task): * public/api/runs.php: Reverted changes made in r175006. (fetch_runs_for_config): (format_run): * public/api/test-groups.php: (fetch_test_groups_for_task): Use the newly added Database::select_rows. * public/include/db.php: (Database::select_first_or_last_row): (Database::select_rows): Extracted from select_first_or_last_row. * public/v2/analysis.js: (App.AnalysisTask): Added "bugs" property. (App.Bug): Added now that bugs are regular data store objects. * public/v2/app.js: (App.Pane._fetch): Calls this.fetchAnalyticRanges to fetch analysis tasks as well as test runs. (App.Pane.fetchAnalyticRanges): Added. Fetches analysis tasks for the current metric on the current platform that are associated with a specific range of runs. (App.PaneController.actions.toggleBugsPane): Updated per showingBugsPane to showingAnalysisPane rename. (App.PaneController.actions.associateBug): Deleted. (App.PaneController.actions.createAnalysisTask): Replaced the pre-condition checks with assertions as this action should never be triggered when the pre-condition is not met. Also re-fetch analysis tasks once we've created one. (App.PaneController.toggleSearchPane): Updated per showingBugsPane to showingAnalysisPane rename. (App.PaneController._detailsChanged): Ditto. Removed selectedSinglePoint since it's no longer used. (App.PaneController._showDetails): Call _updateCanAnalyze to update the status of "Analyze" button. (App.PaneController._updateBugs): Deleted. (App.PaneController._updateMarkedPoints): Deleted. (App.PaneController._updateCanAnalyze): Added. Disables the button to create an analysis task when the name is missing or when at most one point is selected. (App.InteractiveChartComponent._constructGraphIfPossible): Update the locations of range rects. (App.InteractiveChartComponent._relayoutDataAndAxes): Ditto. (App.InteractiveChartComponent._mousePointInGraph): Don't return a point unless the mouse cursor is on our svg element to avoid locking the current item when a bar shown for an analysis task is clicked. (App.InteractiveChartComponent._rangesChanged): Added. Creates an array of objects representing clickable bars for analysis tasks. (App.InteractiveChartComponent._updateRangeBarRects): Computes the inline style used by each clickable bar for analysis tasks to place them at the right location. (App.InteractiveChartComponent.actions.openRange): Added. Forwards the action to the parent controller. * public/v2/chart-pane.css: (.chart .extent): Use the same color as the vertical indicator in the highlight behind the selection. (.chart .rangeBar): Added. * public/v2/data.js: (TimeSeries.prototype.nextPoint): Added. Used by _rangesChanged. * public/v2/index.html: Renamed "bugs pane" to "analysis pane" and removed the UI to associate bugs. This ability will be reinstated in a follow up patch. Also added a container div and spans for analysis task bars in the interactive chart component. 2014-11-19 Ryosuke Niwa Fix typos in r176203. * public/v2/app.js: (App.ChartsController.actions.addPaneByMetricAndPlatform): (App.AnalysisTaskRoute): 2014-11-18 Ryosuke Niwa Unreviewed. Updated the install instruction. * Install.md: 2014-11-17 Ryosuke Niwa App.Manifest shouldn't use App.__container__.lookup https://bugs.webkit.org/show_bug.cgi?id=138768 Reviewed by Andreas Kling. Removed the hack to find the store object via App.__container__.lookup. Pass around the store object instead. * public/v2/app.js: (App.DashboardRow._createPane): Add "store" property to the pane. (App.DashboardPaneProxyForPicker._platformOrMetricIdChanged): Ditto. (App.IndexController.gridChanged): Ditto. (App.IndexController.actions.addRow): Ditto. (App.IndexController.init): Ditto. (App.Pane._fetch): Ditto. (App.ChartsController._parsePaneList): Ditto. (App.ChartsController._updateQueryString): Ditto. (App.ChartsController.actions.addPaneByMetricAndPlatform): Ditto. (App.BuildPopup): Ditto. (App.AnalysisTaskRoute.model): Ditto. (App.AnalysisTaskViewModel._taskUpdated): Ditto. * public/v2/manifest.js: (App.Manifest.fetch): Removed the code to find the store object. 2014-11-08 Ryosuke Niwa Fix Ember.js warnings the new perf dashboard https://bugs.webkit.org/show_bug.cgi?id=138531 Reviewed by Darin Adler. Fixed various warnings. * public/v2/app.js: (App.InteractiveChartComponent._relayoutDataAndAxes): We can't use "rem". Use this._rem as done for x. * public/v2/data.js: (PrivilegedAPI._post): Removed the superfluous console.log. (CommitLogs.fetchForTimeRange): Ditto. * public/v2/index.html: Added tbody as required by the HTML specification. 2014-11-07 Ryosuke Niwa Fix typos in r175768. * public/v2/app.js: (App.AnalysisTaskViewModel.roots): 2014-11-07 Ryosuke Niwa Introduce the concept of analysis task to perf dashboard https://bugs.webkit.org/show_bug.cgi?id=138517 Reviewed by Andreas Kling. Introduced the concept of an analysis task, which is created for a range of measurements for a given metric on a single platform and used to bisect regressions in the range. Added a new page to see the list of active analysis tasks and a page to view the contents of an analysis task. * init-database.sql: Added a bunch of tables to store information about analysis tasks. analysis_tasks - Represents each analysis task. Associated with a platform and a metric and possibly with two test runs. Analysis tasks not associated with test runs are used for try new patches. analysis_test_groups - A test group in an analysis task represents a bunch of related A/B testing results. root_sets - A root set represents a set of roots (or packages) installed in each A/B testing. build_requests - A build request represents a single pending build for A/B testing. * public/api/analysis-tasks.php: Added. Returns the specified analysis task or all analysis tasks in an array. (main): (format_task): * public/api/test-groups.php: Added. Returns analysis task groups for the specified analysis task or returns the specified analysis task group as well as build requests associated with them. (main): (fetch_test_groups_for_task): (fetch_build_requests_for_task): (fetch_build_requests_for_group): (format_test_group): (format_build_request): * public/include/json-header.php: (remote_user_name): Extracted from compute_token so that we can use it in create-analysis-task.php. (compute_token): * public/privileged-api/associate-bug.php: (main): Fixed a typo. * public/privileged-api/create-analysis-task.php: Added. Creates a new analysis task for a given test run range. (main): (ensure_row_by_id): (ensure_config_from_runs): * public/privileged-api/generate-csrf-token.php: Use remote_user_name. * public/v2/analysis.js: Added. Various Ember data store models to represent analysis tasks and related objects. (App.AnalysisTask): (App.AnalysisTask.create): (App.TestGroup): (App.TestGroupAdapter): (App.AnalysisTaskSerializer): (App.TestGroupSerializer): (App.BuildRequest): * public/v2/app.css: Added style rules for the analysis page. * public/v2/app.js: (App.Pane._fetch): Use fetchRunsWithPlatformAndMetric, which has been refactored into App.Manifest. (App.PaneController.actions.toggleBugsPane): Show bugs pane even when there are no bug trackers or there is not exactly one selected point as we can still create an analysis task. (App.PaneController.actions.associateBug): Renamed singlySelectedPoint to selectedSinglePoint to be more grammatical and also alert'ed the error message when there is one. (App.PaneController.actions.createAnalysisTask): Added. Creates a new analysis task and opens it in a new tab. Since window.open only works during the click, we open the new "window" preemptively and navigates or closes it once XHR request has completed. (App.PaneController._detailsChanged): Changes due to singlySelectedPoint to selectedSinglePoint rename. (App.PaneController._updateBugs): Fixed a bug that we were showing bugs in the previous point when a single point is selected in the details pane. (App.AnalysisRoute): Added. (App.AnalysisTaskRoute): Added. (App.AnalysisTaskViewModel): Added. (App.AnalysisTaskViewModel._taskUpdated): Fetch runs for the associated platform and metric. (App.AnalysisTaskViewModel._fetchedRuns): Setup the chart data to show. (App.AnalysisTaskViewModel.testSets): The computed property used to update roots for all repositories/projects. (App.AnalysisTaskViewModel._rootChangedForTestSet): Updates root selections for all repositories/projects when the user selects an option for all roots in A or B configuration. (App.AnalysisTaskViewModel.roots): The computed property used to show root choices for each repository/project. * public/v2/chart-pane.css: Added style rules for details view in the analysis task page. * public/v2/data.js: (Measurement.prototype._formatRevisionRange): Don't prefix a revision number with "At " when there is no previous point so that we can use it in App.AnalysisTaskViewModel.roots. (TimeSeries.prototype.findPointByMeasurementId): Added. (TimeSeries.prototype.seriesBetweenPoints): Added. * public/v2/index.html: Use Metric.fullName since the same value is needed in the analysis task page. Also added a button to create an analysis task, and made bugs pane button always enabled since we can an analysis task even when multiple points are selected. Finally, added a new template for the analysis task page. * public/v2/manifest.js: (App.Metric.fullName): Added to share code between the charts page and the analysis task page. (App.Manifest.fetchRunsWithPlatformAndMetric): Extracted from App.Pane._fetch to be reused in App.AnalysisTaskViewModel._taskUpdated. 2014-10-28 Ryosuke Niwa Remove App.PaneController.bugsChangeCount in the new perf dashboard https://bugs.webkit.org/show_bug.cgi?id=138111 Reviewed by Darin Adler. * public/v2/app.js: (App.PaneController.bugsChangeCount): Removed. (App.PaneController.actions.associateBug): Call _updateMarkedPoints instead of incrementing bugsChangeCount. (App.PaneController._updateMarkedPoints): Extracted from App.InteractiveChartComponent._updateDotsWithBugs. Finds the list of current run's points that are associated with bugs. (App.InteractiveChartComponent._updateMarkedDots): Renamed from _updateDotsWithBugs. * public/v2/chart-pane.css: (.chart .marked): Renamed from .hasBugs. * public/v2/index.html: Specify chartPointRadius and markedPoints. 2014-10-27 Ryosuke Niwa REGRESSION: commit logs are not shown sometimes on the new dashboard UI https://bugs.webkit.org/show_bug.cgi?id=138099 Reviewed by Benjamin Poulain. The bug was caused by _currentItemChanged not passing the previous point in the list of points and also _showDetails inverting the order of the current and old measurements. * public/v2/app.js: (App.PaneController._currentItemChanged): Pass in the previous point to _showDetails when there is one. (App.PaneController._showDetails): Since points are ordered chronologically, the last point is the current (latest) measurement and the first point is the oldest measurement. (App.CommitsViewerComponent.commitsChanged): Don't show a single measurement as a range for clarity. 2014-10-18 Ryosuke Niwa Perf dashboard should provide a way to associate bugs with a test run https://bugs.webkit.org/show_bug.cgi?id=137857 Reviewed by Andreas Kling. Added a "privileged" API, /privileged-api/associate-bug, to associate a bug with a test run. /privileged-api/ is to be protected by an authentication mechanism such as DigestAuth over https by the Apache configuration. The Cross Site Request (CSRF) Forgery prevention for privileged APIs work as follows. When a user is about to make a privileged API access, the front end code obtains a CSRF token generated by POST'ing to privileged-api/generate-csrf-token; the page sets a randomly generated salt and an expiration time via the cookie and returns a token computed from those two values as well as the remote username. The font end code then POST's the request along with the returned token. The server side code verifies that the specified token can be generated from the salt and the expiration time set in the cookie, and the token hasn't expired. * init-database.sql: Added bug_url to bug_trackers table, and added bugs table. Each bug tracker will have zero or exactly one bug associated with a test run. * public/admin/bug-trackers.php: Added the support for editing bug_url. * public/api/runs.php: (fetch_runs_for_config): Modified the query to fetch bugs associated with test_runs. (parse_bugs_array): Added. Parses the aggregated bugs and creates a dictionary that maps a tracker id to an associated bug if there is one. (format_run): Calls parse_bugs_array. * public/include/json-header.php: Added helper functions to deal for CSRF prevention. (ensure_privileged_api_data): Added. Dies immediately if the request's method is not POST or doesn't have a valid JSON payload. (ensure_privileged_api_data_and_token): Ditto. Also checks that the CSRF prevention token is valid. (compute_token): Computes a CSRF token using the REMOTE_USER (e.g. set via BasicAuth), the salt, and the expiration time stored in the cookie. (verify_token): Returns true iff the specified token matches what compute_token returns from the cookie. * public/include/manifest.php: (ManifestGenerator::bug_trackers): Include bug_url as bugUrl in the manifest. Also use tracker_id instead of tracker_name as the key in the manifest. This requires changes to both v1 and v2 front end. * public/index.html: (Chart..showTooltipWithResults): Updated for the manifest format changed mentioned above. * public/privileged-api/associate-bug.php: Added. (main): Added. Associates or dissociates a bug with a test run inside a transaction. It prevent a CSRF attack via ensure_privileged_api_data_and_token, which calls verify_token. * public/privileged-api/generate-csrf-token.php: Added. Generates a CSRF token valid for one hour. * public/v2/app.css: (.disabled .icon-button:hover g): Used by the "bugs" icon when a range of points or no points are selected in a chart. * public/v2/app.js: (App.PaneController.actions.toggleBugsPane): Added. Toggles the visibility of the bugs pane when exactly one point is selected in the chart. Also hides the search pane when making the bugs pane visible since they would overlap on each other if both of them are shown. (App.PaneController.actions.associateBug): Makes a privileged API request to associate the specified bug with the currently selected point (test run). Updates the bug information in "details" and colors of dots in the charts to reflect new states. Because chart data objects aren't real Ember objects for performance reasons, we have to use a dirty hack of modifying a dummy counter bugsChangeCount. (App.PaneController.actions.toggleSearchPane): Renamed from toggleSearch. Also hides the bugs pane when showing the search pane. (App.PaneController.actions.rangeChanged): Takes all selected points as the second argument instead of taking start and end points as the second and the third arguments so that _showDetails can enumerate all bugs in the selected range. (App.PaneController._detailsChanged): Added. Hide the bugs pane whenever a new point is selected. Also update singlySelectedPoint, which is used by toggleBugsPane and associateBug. (App.PaneController._currentItemChanged): Updated for the _showDetails change. (App.PaneController._showDetails): Takes an array of selected points in place of old arguments. Simplified the code to compute the revision information. Calls _updateBugs to format the associated bugs. (App.PaneController._updateBugs): Sets details.bugTrackers to a dictionary that maps a bug tracker id to a bug tracker proxy with an array of (bugNumber, bugUrl) pairs and also editedBugNumber, which is used by the bugs pane to associate or dissociate a bug number, if exactly one point is selected. (App.InteractiveChartComponent._updateDotsWithBugs): Added. Sets hasBugs class on dots as needed. (App.InteractiveChartComponent._setCurrentSelection): Finds and passes all points in the selected range to selectionChanged action instead of just finding the first and the last points. * public/v2/chart-pane.css: Updated the style. * public/v2/data.js: (PrivilegedAPI): Added. A wrapper for privileged APIs' CSRF tokens. (PrivilegedAPI.sendRequest): Makes a privileged API call. Fetches a new CSRF token if needed. (PrivilegedAPI._generateTokenInServerIfNeeded): Makes a request to privileged-api/generate-csrf-token if we haven't already obtained a CSRF token or if the token has already been expired. (PrivilegedAPI._post): Makes a single POST request to /privileged-api/* with a JSON payload. (Measurement.prototype.bugs): Added. (Measurement.prototype.hasBugs): Returns true iff bugs has more than one bug number. (Measurement.prototype.associateBug): Associates a bug with a test run via privileged-api/associate-bug. * public/v2/index.html: Added the bugs pane. Also added a list of bugs associated with the current run in the details. * public/v2/manifest.js: (App.BugTracker.bugUrl): (App.BugTracker.newBugUrl): Added. (App.BugTracker.repositories): Added. This was a missing back reference to repositories. (App.MetricSerializer.normalizePayload): Now parses/loads the list of bug trackers from the manifest. (App.Manifest.repositoriesWithReportedCommits): Now initialized to an empty array instead of null. (App.Manifest.bugTrackers): Added. (App.Manifest._fetchedManifest): Sets App.Manifest.bugTrackers. Also sorts the list of repositories by their respective ids to make the ordering stable. 2014-10-14 Ryosuke Niwa Remove unused jobs table https://bugs.webkit.org/show_bug.cgi?id=137724 Reviewed by Daniel Bates. Removed jobs table in the database as well as related code. * init-database.sql: * public/admin/jobs.php: Removed. * public/admin/tests.php: * public/include/admin-header.php: 2014-10-13 Ryosuke Niwa New perf dashboard should have an ability to search commits by a keyword https://bugs.webkit.org/show_bug.cgi?id=137675 Reviewed by Geoffrey Garen. /api/commits/ now accepts query parameters to search a commit by a keyword. Its output format changed to include "authorEmail" and "authorName" directly as columns instead of including an "author" object. This API change allows fetch_commits_between to generate results without processing Postgres query results. In the front end side, we've added a search pane in pane controller, and the interactive chart component now has a concept of highlighted items which is used to indicate commits found by the search pane. * public/api/commits.php: (main): Extract query parameters: keyword, from, and to and use that to fetch appropriate commits. (fetch_commits_between): Moved some code from main. Now takes a search term as the third argument. We look for a commit if its author name or email contains the keyword or if its revision matches the keyword. (format_commit): Renamed from format_commits. Now only formats one commit. * public/include/db.php: (Database::query_and_fetch_all): Now returns array() when the query results is empty (instead of false). * public/v2/app.css: Renamed .close-button to .icon-button since it's used by a search button as well. * public/v2/app.js: (App.Pane.searchCommit): Added. Finds the commits by a search term and assigns 'highlightedItems', which is a hash table that contains highlighted items' measurements' ids as keys. (App.PaneController.actions.toggleSearch): Toggles the visibility of the search pane. Also sets the default commit repository. (App.PaneController.actions.searchCommit): Delegates the work to App.Pane.searchCommit. (App.InteractiveChartComponent._constructGraphIfPossible): Fixed a bug that we weren't removing old this._dots. Added the code to initialize this._highlights. (App.InteractiveChartComponent._updateDimensionsIfNeeded): Updates dimensions of highlight lines. (App.InteractiveChartComponent._updateHighlightPositions): Added. Ditto. (App.InteractiveChartComponent._highlightedItemsChanged): Adds vertical lines for highlighted items and deletes the existing lines for the old highlighted items. (App.CommitsViewerComponent.commitsChanged): Updated the code per JSON API change mentioned above. Also fixed a bug that the code tries to update the commits viewer even if the viewer had already been destroyed. * public/v2/chart-pane.css: Added style for the search pane and the search button. * public/v2/data.js: Turned FetchCommitsForTimeRange into a class: CommitLogs. (CommitLogs): Added. (CommitLogs.fetchForTimeRange): Renamed from FetchCommitsForTimeRange. Takes a search term as an argument. (CommitLogs._cachedCommitsBetween): Extracted from FetchCommitsForTimeRange. (CommitLogs._cacheConsecutiveCommits): Ditto. (FetchCommitsForTimeRange._cachedCommitsByRepository): Deleted. (Measurement.prototype.commitTimeForRepository): Extracted from formattedRevisions. (Measurement.prototype.formattedRevisions): Uses formattedRevisions. Deleted the unused code for commitTime. * public/v2/index.html: Added the search pane and the search button. Also removed the unused attribute binding for showingDetails since this property is no longer used. * public/v2/manifest.js: (App.Manifest.repositories): Added. (App.Manifest.repositoriesWithReportedCommits): Ditto. Used by App.PaneController.actions.toggleSearch to find the default repository to search. (App.Manifest._fetchedManifest): Populates repositories and repositoriesWithReportedCommits. 2014-10-13 Ryosuke Niwa Unreviewed build fix after r174555. * public/include/manifest.php: (ManifestGenerator::generate): Assign an empty array to $repositories_with_commit when there are no commits. * tests/admin-regenerate-manifest.js: Fixed the test case. 2014-10-09 Ryosuke Niwa New perf dashboard UI tries to fetch commits all the time https://bugs.webkit.org/show_bug.cgi?id=137592 Reviewed by Andreas Kling. Added hasReportedCommits boolean to repository meta data in manifest.json, and used that in the front end to avoid issuing HTTP requests to fetch commit logs for repositories with no reported commits as they are all going to fail. Also added an internal cache to FetchCommitsForTimeRange in the front end to avoid fetching the same commit logs repeatedly. There are two data structures we cache: commitsByRevision which maps a given commit revision/hash to a commit object; and commitsByTime which is an array of commits sorted chronologically by time. * public/include/manifest.php: * public/v2/app.js: (App.CommitsViewerComponent.commitsChanged): * public/v2/data.js: (FetchCommitsForTimeRange): (FetchCommitsForTimeRange._cachedCommitsByRepository): * public/v2/manifest.js: (App.Repository): 2014-10-08 Ryosuke Niwa Another unreviewed build fix after r174477. Don't try to insert a duplicated row into build_commits as it results in a database constraint error. This has been caught by a test in /api/report. I don't know why I thought all tests were passing. * public/include/report-processor.php: 2014-10-08 Ryosuke Niwa Unreviewed build fix after r174477. * init-database.sql: Removed build_commits_index since it's redundant with build_commit's primary key. Also fixed a syntax error that we were missing "," after line that declared build_commit column. * public/api/runs.php: Fixed the query so that test_runs without commits data will be retrieved. This is necessary for baseline and target values manually added via admin pages. 2014-10-08 Ryosuke Niwa Add v2 UI for the perf dashboard https://bugs.webkit.org/show_bug.cgi?id=137537 Rubber-stamped by Andreas Kling. * public/v2: Added. * public/v2/app.css: Added. * public/v2/app.js: Added. * public/v2/chart-pane.css: Added. * public/v2/data.js: Added. * public/v2/index.html: Added. * public/v2/js: Added. * public/v2/js/d3: Added. * public/v2/js/d3/LICENSE: Added. * public/v2/js/d3/d3.js: Added. * public/v2/js/d3/d3.min.js: Added. * public/v2/js/ember-data.js: Added. * public/v2/js/ember.js: Added. * public/v2/js/handlebars.js: Added. * public/v2/js/jquery.min.js: Added. * public/v2/js/statistics.js: Added. * public/v2/manifest.js: Added. * public/v2/popup.js: Added. 2014-10-08 Ryosuke Niwa Remove superfluously duplicated code in public/api/report-commits.php. 2014-10-08 Ryosuke Niwa Perf dashboard should store commit logs https://bugs.webkit.org/show_bug.cgi?id=137510 Reviewed by Darin Adler. For the v2 version of the perf dashboard, we would like to be able to see commit logs in the dashboard itself. This patch replaces "build_revisions" table with "commits" and "build_commits" relations to store commit logs, and add JSON APIs to report and retrieve them. It also adds a tools/pull-svn.py to pull commit logs from a subversion directory. The git version of this script will be added in a follow up patch. In the new database schema, each revision in each repository is represented by exactly one row in "commits" instead of one row for each build in "build_revisions". "commits" and "builds" now have a proper many-to-many relationship via "build_commits" relations. In order to migrate an existing instance of this application, run the following SQL commands: BEGIN; INSERT INTO commits (commit_repository, commit_revision, commit_time) (SELECT DISTINCT ON (revision_repository, revision_value) revision_repository, revision_value, revision_time FROM build_revisions); INSERT INTO build_commits (commit_build, build_commit) SELECT revision_build, commit_id FROM commits, build_revisions WHERE commit_repository = revision_repository AND commit_revision = revision_value; DROP TABLE build_revisions; COMMIT; The helper script to submit commit logs can be used as follows: python ./tools/pull-svn.py "WebKit" https://svn.webkit.org/repository/webkit/ https://perf.webkit.org feeder-slave feeder-slave-password 60 "webkit-patch find-users" The above command will pull the subversion server at https://svn.webkit.org/repository/webkit/ every 60 seconds to retrieve at most 10 commits, and submits the results to https://perf.webkit.org using "feeder-slave" and "feeder-slave-password" as the builder name and the builder password respectively. The last, optional, argument is the shell command to convert a subversion account to the corresponding username. e.g. "webkit-patch find-users rniwa@webkit.org" yields "Ryosuke Niwa" in the stdout. * init-database.sql: Replaced "build_revisions" relation with "commits" and "build_commits" relations. * public/api/commits.php: Added. Retrieves a list of commits based on arguments in its path of the form /api/commits//. The behavior of this API depends on as follows: - Not specified - It returns every single commit for a given repository. - Matches "oldest" - It returns the commit with the oldest timestamp. - Matches "latest" - It returns the commit with the latest timestamp. - Matches "last-reported" - It returns the commit with the latest timestamp added via report-commits.php. - Is entirely alphanumeric - It returns the commit whose revision matches the filter. - Is of the form : or - - It retrieves the list of commits added via report-commits.php between two timestamps retrieved from commits whose revisions match the two alphanumeric values specified. Because it retrieves commits based on their timestamps, the list may contain commits that do not appear as neither hash's ancestor in git/mercurial. (main): (commit_from_revision): (fetch_commits_between): (format_commits): * public/api/report-commits.php: Added. A JSON API to report new subversion, git, or mercurial commits. See tests/api-report-commits.js for examples on how to use this API. * public/api/runs.php: Updated the query to use "commit_builds" and "commits" relations instead of "build_revisions". Regrettably, the new query is 20% slower but I'm going to wait until the new UI is ready to optimize this and other JSON APIs. * public/include/db.php: (Database::select_or_insert_row): (Database::update_or_insert_row): Added. (Database::_select_update_or_insert_row): Extracted from select_or_insert_row. Try to update first and then insert if the update fails for update_or_insert_row. Preserves the old behavior when $should_update is false. (Database::select_first_row): (Database::select_last_row): Added. (Database::select_first_or_last_row): Extracted from select_first_row. Fixed a bug that we were asserting $order_by to be not alphanumeric/underscore. Retrieve the last row instead of the first if $descending_order. * public/include/report-processor.php: (ReportProcessor::resolve_build_id): Store commits instead of build_revisions. We don't worry about the race condition for adding "build_commits" rows since we shouldn't have a single tester submitting the same result concurrently. Even if it happened, it will only result in a PHP error and the database will stay consistent. * run-tests.js: (pathToTests): Don't call path.resolve with "undefined" testName; It throws an exception in the latest node.js. * tests/api-report-commits.js: Added. * tests/api-report.js: Fixed a test per build_revisions to build_commits/commits replacement. * tools: Added. * tools/pull-svn.py: Added. See above for how to use this script. (main): (determine_first_revision_to_fetch): (fetch_revision_from_dasbhoard): (fetch_commit_and_resolve_author): (fetch_commit): (textContent): (resolve_author_name_from_email): (submit_commits): 2014-09-30 Ryosuke Niwa Update Install.md for Mavericks and fix typos https://bugs.webkit.org/show_bug.cgi?id=137276 Reviewed by Benjamin Poulain. Add the instruction to copy php.ini to enable the Postgres extension in PHP. Also use perf.webkit.org as the directory name instead of WebKitPerfMonitor. Finally, init-database.sql is no longer located inside database directory. * Install.md: 2014-08-11 Ryosuke Niwa Report run id's in api/runs.php for the new dashboard UI https://bugs.webkit.org/show_bug.cgi?id=135813 Reviewed by Andreas Kling. Include run_id in the generated JSON. * public/api/runs.php: (fetch_runs_for_config): Don't sort results by time since that has been done in the front end for ages now. (format_run): 2014-08-11 Ryosuke Niwa Merging platforms mixes baselines and targets into reported data https://bugs.webkit.org/show_bug.cgi?id=135260 Reviewed by Andreas Kling. When merging two platforms, move test configurations of a different type (baseline, target) as well as of different metric (Time, Runs). Also avoid fetching the entire table of runs just to see if there are no remaining runs. It's sufficient to detect one such test_runs object. * public/admin/platforms.php: (merge_platforms): 2014-07-30 Ryosuke Niwa Merging platforms mixes baselines and targets into reported data https://bugs.webkit.org/show_bug.cgi?id=135260 Reviewed by Geoffrey Garen. Make sure two test configurations we're merging are of the same type (e.g. baseline, target, current). Otherwise, we'll erroneously mix up runs for baseline, target, and current (reported values). * public/admin/platforms.php: 2014-07-23 Ryosuke Niwa Build fix after r171361. * public/js/helper-classes.js: (.this.formattedBuildTime): 2014-07-22 Ryosuke Niwa Perf dashboard spends 2s processing JSON data during the page loads https://bugs.webkit.org/show_bug.cgi?id=135152 Reviewed by Andreas Kling. In the Apple internal dashboard, we were spending as much as 2 seconds converting raw JSON data into proper JS objects while loading the dashboard. This caused the apparent unresponsiveness of the dashboard despite of the fact charts themselves updated almost instantaneously. * public/index.html: * public/js/helper-classes.js: (TestBuild): Compute the return values of formattedTime and formattedBuildTime lazily as creating new Date objects and running string replace is expensive. (TestBuild.formattedTime): (TestBuild.formattedBuildTime): (PerfTestRuns.setResults): Added. Pushing each result was the biggest bottle neck. (PerfTestRuns.addResult): Deleted. 2014-07-18 Ryosuke Niwa Perf dashboard shouldn't show the full git hash https://bugs.webkit.org/show_bug.cgi?id=135083 Reviewed by Benjamin Poulain. Detect Git/Mercurial hash by checking the length. If it's a hash, use the first 8 characters in the label while retaining the full length to be used in hyperlinks. * public/js/helper-classes.js: (.this.formattedRevisions): (TestBuild): 2014-05-29 Ryosuke Niwa Add an instruction on how to backup the database. https://bugs.webkit.org/show_bug.cgi?id=133391 Rubber-stamped by Andreas Kling. * Install.md: 2014-04-08 Ryosuke Niwa Build fix after r166479. 'bytes' is now abbreviated as 'B'. * public/js/helper-classes.js: (PerfTestRuns.smallerIsBetter): 2014-04-08 Ryosuke Niwa Some CSS teaks. * public/common.css: (#title): * public/index.html: (#charts .pane): (#charts .arrow): 2014-04-03 Ryosuke Niwa WebKitPerfMonitor: There should be a way to add all metrics of a suite without also adding subtests https://bugs.webkit.org/show_bug.cgi?id=131157 Reviewed by Andreas Kling. Split "all metrics" into all metrics of a test suite and all subtests of the suite. This allows, for example, adding all metrics such as Arithmetic and Geometric for a given test suite without also adding its subtests. * public/index.html: (init.showCharts): (init): 2014-04-03 Ryosuke Niwa WebKitPerfMonitor: Tooltips cannot be pinned after using browser's back button https://bugs.webkit.org/show_bug.cgi?id=131155 Reviewed by Andreas Kling. The bug was caused by Chart.attach binding event listeners on plot container on each call. This resulted in the click event handler toggling the visiblity of the tooltip twice upon click when attach() has been called even number of times, keeping the tooltip invisible. Fixed the bug by extracting the code to bind event listeners outside of Chart.attach as a separate function, bindPlotEventHandlers, and calling it exactly once when Chart.attach is called for the first time. * public/index.html: (Chart.attach): (Chart..bindPlotEventHandlers): 2014-04-03 Ryosuke Niwa WebKitPerfMonitor: Tooltips can be cut off at the top https://bugs.webkit.org/show_bug.cgi?id=130960 Reviewed by Andreas Kling. * public/common.css: (#title): Removed the gradients, box shadows, and border from the header. (#title h1): Reduce the font size. (#title ul): Use line-height to vertically align the navigation bar instead of specifying a padding atop. * public/index.html: (.tooltop:before): Added. Identical to .tooltop:after except it's upside down (arrow facing up). (.tooltip.inverted:before): Show the arrow facing up when .inverted is set. (.tooltip.inverted:before): Hide the arrow facing down when .inverted is set. * public/js/helper-classes.js: (Tooltip.show): Show the tooltip below the point if placing it above the point results in the top of the tooltip extending above y=0. 2014-04-03 Ryosuke Niwa WebKitPerfMonitor: Y-axis adjustment is too aggressive https://bugs.webkit.org/show_bug.cgi?id=130937 Reviewed by Andreas Kling. Previously, adjusted min. and max. were defined as the two standards deviations away from EWMA of measured results. This had two major problems: 1. Two standard deviations can be too small to show the confidence interval for results. 2. Sometimes baseline and target can be more than two standards deviations away. Fixed the bug by completely rewriting the algorithm to compute the interval. Instead of blindly using two standard deviations as margins, we keep adding quarter the standard deviation on each side until more than 90% of points lie in the interval or we've expanded 4 standard deviations. Once this condition is met, we reduce the margin on each side separately to reduce the empty space on either side. A more rigorous approach would involve computing least squared value of results with respect to intervals but that seems like an overkill for a simple UI problem; it's also computationally expensive. * public/index.html: (Chart..adjustedIntervalForRun): Extracted from computeYAxisBoundsToFitLines. (Chart..computeYAxisBoundsToFitLines): Compute the min. and max. adjusted intervals out of adjusted intervals for each runs (current, baseline, and target) so that at least one point from each set of results is shown. We wouldn't see the difference between measured values versus baseline and target values otherwise. * public/js/helper-classes.js: (PerfTestResult.unscaledConfidenceIntervalDelta): Returns the default value if the confidence interval delta cannot be computed. (PerfTestResult.isInUnscaledInterval): Added. Returns true iff the confidence intervals lies within the given interval. (PerfTestRuns..filteredResults): Extracted from unscaledMeansForAllResults now that PerfTestRuns.min and PerfTestRuns.max need to use both mean and confidence interval delta for each result. (PerfTestRuns..unscaledMeansForAllResults): (PerfTestRuns.min): Take the confidence interval delta into account. (PerfTestRuns.max): Ditto. (PerfTestRuns.countResults): Returns the number of results in the given time frame (> minTime). (PerfTestRuns.countResultsInInterval): Returns the number of results whose confidence interval lie within the given interval. (PerfTestRuns.exponentialMovingArithmeticMean): Fixed the typo so that it actually computes the EWMA. 2014-03-31 Ryosuke Niwa Some CSS tweaks after r166477 and r166479, * public/index.html: 2014-03-30 Ryosuke Niwa WebKitPerfMonitor: Sometimes text inside panes overlap https://bugs.webkit.org/show_bug.cgi?id=130956 Reviewed by Gyuyoung Kim. Revamped the pane UI. Now build info uses table element instead of plane text with BRs. The computed status of the latest result against baseline/target such as "3% until target" is now shown above the current value. This reduces the total height of the pane and fits more information per screen capita on the dashboard. * public/index.html: Updated and added a bunch of CSS rules for the new look. (.computeStatus): Don't append the build info here. The build info is constructed as a separate table now. (.createSummaryRowMarkup): Use th instead of td for "Current", "Baseline", and "Target" in the summary table. (.buildLabelWithLinks): Construct table rows instead of br separated lines of text. This streamlines the look of the build info shown in a chart pane and a tooltip. (Chart): Made .status a table. (Chart.populate): Prepend status.text, which contains text such as "3% until target", into the summary rows right above "Current" value, and populate .status with buildLabelWithLinks manually instead of status.text now that status.text no longer contains it. (Chart..showTooltipWithResults): Wrap buildLabelWithLinks with a table element. * public/js/helper-classes.js: (TestBuild.formattedRevisions): Don't include repository names in labels since repository names are now added by buildLabelWithLinks inside th elements. Also place spaces around '-' between two different OS X versions. e.g. "OS X 10.8 - OS X 10.9" instead of "OS X 10.8-OS X 10.9". (PerfTestRuns): Use "/s" for "runs/s" and "B" for "bytes" to make text shorter in .status and .summaryTable. (PerfTestRuns..computeScalingFactorIfNeeded): Avoid placing a space between 'M' and a unit starting with a capital letter; e.g. "MB" instead of "M B". 2014-03-30 Ryosuke Niwa WebKitPerfMonitor: Header and number-of-days slider takes up too much space https://bugs.webkit.org/show_bug.cgi?id=130957 Reviewed by Gyuyoung Kim. Moved the slider into the header. Also reduced the spacing between the header and platform names. This reclaims 50px Ă— width of the screen real estate. * public/common.css: (#title): Reduced the space below the header from 20px to 10px. * public/index.html: (#numberOfDaysPicker): Removed the rounded border around the number-of-days slider. (#dashboard > tbody > tr > td): Added a 1.5em padding at the bottom. (#dashboard > thead th): That allows us to remove the padding at the top here. This reduces the wasted screen real estate between the header and the platform names. 2014-03-10 Zoltan Horvath Update the install guidelines for perf.webkit.org https://bugs.webkit.org/show_bug.cgi?id=129895 Reviewed by Ryosuke Niwa. The current install guideline for perf.webkit.org discourages the use of the installed Server application. I've actualized the documentation for Mavericks, and modified the guideline to include the instructions for Server.app also. * Install.md: 2014-03-08 Zoltan Horvath Update perf.webkit.org json example https://bugs.webkit.org/show_bug.cgi?id=129907 Reviewed by Andreas Kling. The current example is not valid json syntax. I fixed the syntax errors and indented the code properly. * ReadMe.md: 2014-01-31 Ryosuke Niwa Merge database-common.js and utility.js into run-tests.js. Reviewed by Matthew Hanson. Now that run-tests is the only node.js script, merged database-common.js and utility.js into it. Also moved init-database.sql out of the database directory and removed the directory entirely. * database: Removed. * database/database-common.js: Removed. * database/utility.js: Removed. * init-database.sql: Moved from database/init-database.sql. * run-tests.js: (connect): Moved from database-common.js. (pathToDatabseSQL): Extracted from pathToLocalScript. (pathToTests): Moved from database-common.js. (config): Ditto. (TaskQueue): Ditto. (SerializedTaskQueue): Ditto. (main): (initializeDatabase): (TestEnvironment.it): (TestEnvironment.queryAndFetchAll): (sendHttpRequest): 2014-01-30 Ryosuke Niwa Remove the dependency on node.js from the production code. Reviewed by Ricky Mondello. Work towards Upstream SafariPerfMonitor. Removed node.js dependency from TestRunsGenerator. It was really a design mistake to invoke node.js from php. It added so much complexity with only theoretical extensibility of adding aggregators. It turns out that many aggregators we'd like to add are a lot more complicated than ones that could be written under the current infrastructure, and we need to make the other aspects (e.g. the level of aggregations) a lot more extensible. Removing and simplifying TestRunsGenerator allows us to implement such extensions in the future. Also removed the js files that are no longer used. * config.json: Moved from database/config.json. * database/aggregate.js: Removed. No longer used. * database/database-common.js: Removed unused functions, and updated the path to config.json. * database/process-jobs.js: Removed. No longer used. * database/sample-data.sql: Removed. We have a much better corpus of data now. * database/schema.graffle: Removed. It's completely obsolete. * public/include/db.php: Updated the path to config.json. * public/include/evaluator.js: Removed. * public/include/report-processor.php: (TestRunsGenerator::aggregate): Directly aggregate values via newly added aggregate_values method instead of storing values into $expressions and calling evaluate_expressions_by_node. (TestRunsGenerator::aggregate_values): Added. (TestRunsGenerator::compute_caches): Directly compute the caches. 2014-01-30 Ryosuke Niwa Build fix. Don't fail the platform merges even if there are no test configurations to be moved to the new platform. * public/admin/platforms.php: * public/include/db.php: 2014-01-30 Ryosuke Niwa Zoomed y-axis view is ununsable when the last result is an outlier. Reviewed by Stephanie Lewis. Show two standard deviations from the exponential moving average with alpha = 0.3 instead of the mean of the last result so that the graph looks sane if the last result was an outlier. However, always show the last result's mean even if it was an outlier. * public/index.html: * public/js/helper-classes.js: (unscaledMeansForAllResults): Extracted from min/max/sampleStandardDeviation. Also added the ability to cache the unscaled means to avoid recomputation. (PerfTestRuns.min): Refactored to use unscaledMeansForAllResults. (PerfTestRuns.max): Ditto. (PerfTestRuns.sampleStandardDeviation): Ditto. (PerfTestRuns.exponentialMovingArithmeticMean): Added. 2014-01-30 Ryosuke Niwa Minor fixes. * public/admin/tests.php: * public/js/helper-classes.js: 2014-01-29 Ryosuke Niwa Use two standard deviations instead as I mentioned in the mailing list. * public/index.html: 2014-01-28 Ryosuke Niwa The performance dashboard erroneously shows upward arrow for combined metrics. A single outlier can ruin the zoomed y-axis view. Rubber-stamped by Antti Koivisto. * public/index.html: (computeYAxisBoundsToFitLines): Added adjustedMax and adjustedMin, which are pegged at 4 standard deviations from the latest results' mean. (Chart): Renamed shouldStartYAxisAtZero to shouldShowEntireYAxis. (Chart.attachMainPlot): Use the adjusted max and min when we're not showing the entire y-axis. (Chart.toggleYAxis): * public/js/helper-classes.js: (PerfTestRuns.sampleStandardDeviation): Added. (PerfTestRuns.smallerIsBetter): 'Combined' is a smaller is better metric. 2014-01-28 Ryosuke Niwa Don't include the confidence interval when computing the y-axis. Rubber-stamped by Simon Fraser. * public/js/helper-classes.js: (PerfTestRuns.min): (PerfTestRuns.max): 2014-01-25 Ryosuke Niwa Tiny CSS tweak for tooltips. * public/index.html: 2014-01-25 Ryosuke Niwa Remove the erroneously repeated code. * public/admin/test-configurations.php: 2014-01-24 Ryosuke Niwa perf dashboard should show baseline numbers Reviewed by Stephanie Lewis. * public/admin/bug-trackers.php: (associated_repositories): Return an array of HTMLs instead of echo'ing as expected by AdministrativePage. Also fixed a typo. * public/admin/platforms.php: (merge_list): Ditto. * public/admin/test-configurations.php: Added. (add_run): Adds a "synthetic" test run and a corresponding build. It doesn't create run_iterations and build_revisions as they're not meaningful for baseline / target numbers. (delete_run): Deletes a synthetic test run and its build. It verifies that the specified build has exactly one test run so that we don't accidentally delete a reported test run. (generate_rows_for_configurations): Generates rows of configuration IDs and types. (generate_rows_for_test_runs): Ditto for test runs. It also emits the form to add new "synthetic" test runs and delete existing ones. * public/admin/tests.php: We wrongfully assumed there is exactly one test configuration for each metric on each platform; there could be configurations of distinct types such as "current" and "baseline". Thus, update all test configurations for a given metric when updating config_is_in_dashboard. * public/api/runs.php: Remove the NotImplemented when we have multiple test configurations. (fetch_runs_for_config): "Synthetic" test runs created on test-configurations page are missing revision data so we need to left-outer-join (instead of inner-join) build_revisions. To avoid making the query unreadable, don't join revision_repository here. Instead, fetch the list of repositories upfront and resolve names in parse_revisions_array. This actually reduces the query time by ~10%. (parse_revisions_array): Skip an empty array created for "synthetic" test runs. * public/include/admin-header.php: (AdministrativePage::render_table): Now custom columns support sub columns. e.g. a configuration column may have id and type sub columns, and each custom column could generate multiple rows. Any table with sub columns now generates two rows for thead. We generate td's in in the first row without sub columns with rowspan of 2, and generate ones with sub columns with colspan set to the sub column count. We then proceed to generate the second header row with sub column names. When generating the actual content, we first generate all custom columns as they may have multiple rows in which case regular columns need rowspan set to the maximum number of rows. Once we've generated the first row, we proceed to generate subsequent rows for those custom columns that have multiple rows. (AdministrativePage::render_custom_cells): Added. This function is responsible for generating table cells for a given row in a given custom column. It generates an empty td when the custom column doesn't have enough rows. It also generates empty an td when it doesn't have enough columns in some rows except when the entire row consists of exactly one cell for a custom column with sub columns, in which case the cell is expanded to occupy all sub columns. * public/include/manifest.php: (ManifestGenerator::platforms): Don't add the metric more than once. * public/include/test-name-resolver.php: (TestNameResolver::__construct): We had wrongfully assumed that we have exactly one test configuration on each platform for each metric like tests.php. Fixed that. Also fetch the list of aggregators to compute the full metric name later. (TestNameResolver::map_metrics_to_tests): Populate $this->id_to_metric. (TestNameResolver::test_id_for_full_name): Simplified the code using array_get. (TestNameResolver::full_name_for_test): Added. (TestNameResolver::full_name_for_metric): Added. (TestNameResolver::configurations_for_metric_and_platform): Renamed as it returns multiple configurations. * public/js/helper-classes.js: (TestBuild): Use the build time as the maximum time when revision information is missing for "synthetic" test runs created to set baseline and target points. 2014-01-24 Ryosuke Niwa Build fix after r57928. Removed a superfluous close parenthesis. * public/api/runs.php: 2014-01-24 Ryosuke Niwa Unreviewed build & typo fixes. * public/admin/platforms.php: * tests/admin-platforms.js: 2014-01-24 Ryosuke Niwa perf dashboard should show baseline numbers Rubber-stamped by Antti Koivisto. Organize some code into functions in runs.php. Also added back $paths that was erroneously removed in r57925 from json-header.php. * public/api/runs.php: (fetch_runs_for_config): Extracted. (format_run): Ditto. 2014-01-23 Ryosuke Niwa Merge the upstream json-shared.php as of https://trac.webkit.org/r162693. * database/config.json: * public/admin/reprocess-report.php: * public/api/report.php: * public/api/runs.php: * public/include/json-header.php: 2014-01-23 Ryosuke Niwa Commit yet another forgotten change. Something went horribly wrong with my merge :( * database/init-database.sql: 2014-01-23 Ryosuke Niwa Commit one more forgotten change. Sorry for making a mess here. 2014-01-23 Ryosuke Niwa Commit the forgotten files. * public/admin/platforms.php: Added. * tests/admin-platforms.js: Added. 2014-01-23 Ryosuke Niwa SafariPerfMonitor: there should be a way to merge and hide platforms Reviewed by Stephanie Lewis. Added /admin/platforms/ page to hide and merge platforms. Merging two platforms is tricky because we need to migrate test runs as well as some test configurations. Recall that each test (e.g. Dromaeo) can have many "test metrics" (e.g. MaxAllocations, EndAllocations), and they have a distinct "test configuration" for each platform (e.g. MaxAllocation on Mountain Lion), and each test configuration a distinct "test run" for each build. In order to merge platform A into platform B, we must migrate all test runs that belong to platform A via their test configurations into platform B. Suppose we're migrating a test run R for test configuration T_A in platform A for metric M. Since M exists independent of platforms, R should continue to relate to M through some test configuration. Unfortunately, we can't simply move T_A into platform B since we may already have a test configuration T_B for metric M in platform B, in which case R should relate to T_B instead. Thus, we first migrate all test runs for which we already have corresponding test configurations in the new platform. We then migrate the test configurations of the remaining test runs. * database/init-database.sql: Added platform_hidden. * public/admin/platforms.php: Added. (merge_platforms): Added. Implements the algorithm described above. (merge_list): Added. * public/admin/tests.php: Disable the checkbox to show a test configuration on the dashboard if its platform is hidden since it doesn't do anything. * public/include/admin-header.php: Added the hyperlink to /admin/platforms. (update_field): Don't bail out if the newly added "update-column" is set to the field name even if $_POST is missing it since unchecked checkbox doesn't set the value in $_POST. (AdministrativePage::render_form_control_for_column): Added the support for boolean edit mode. Also used switch statement instead of repeated if's. (AdministrativePage::render_table): Emit "update-column" for update_field. * public/include/db.php: Disable warnings when we're not in the debug mode. * public/include/manifest.php: (ManifestGenerator::platforms): Skip platforms that have been hidden. * run-tests.js: (TestEnvironment.postJSON): (TestEnvironment.httpGet): (TestEnvironment.httpPost): Added. (sendHttpRequest): Set the content type if specified. * tests/admin-platforms.js: Added tests. 2014-01-22 Ryosuke Niwa Extract the code to compute full test names from tests.php. Reviewed by Stephanie Lewis. Extracted TestNameResolver out of tests.php. This reduces the number of global variables in tests.php and paves our way to re-use the code in other pages. * public/admin/tests.php: * public/include/db.php: (array_set_default): Renamed from array_item_set_default and moved from tests.php as it's used in both tests.php and test-name-resolver.php. * public/include/test-name-resolver.php: Added. (TestNameResolver::__construct): (TestNameResolver::compute_full_name): Moved from tests.php. (TestNameResolver::map_metrics_to_tests): Ditto. (TestNameResolver::sort_tests_by_full_name): Ditto. (TestNameResolver::tests): Added. (TestNameResolver::test_id_for_full_name): Ditto. (TestNameResolver::metrics_for_test_id): Ditto. (TestNameResolver::child_metrics_for_test_id): Ditto. (TestNameResolver::configuration_for_metric_and_platform): Ditto. 2014-01-21 Ryosuke Niwa Perf dashboard is erroneously associating reported results with old revisions Reviewed by Stephanie Lewis. Add the ability to reprocess reports so that I can re-associate wrongfully associated reports. Added public/admin/reprocess-report.php. It doesn't have any nice UI to find reports and it returns JSON but that's sufficient to correct the wrongfully processed reports for now. * public/admin/reprocess-report.php: Added. Takes a report id in $_GET or $_POST and process the report. We should eventually add a nice UI to find and reprocess reports. * public/api/report.php: ReportProcessor and TestRunsGenerator have been removed. * public/include/db.php: Added the forgotten call to prefixed_column_names. * public/include/report-processor.php: Copied from public/api/report.php. (ReportProcessor::__construct): Fetch the list of aggregators here for simplicity. (ReportProcessor::process): Optionally takes $existing_report_id. When this value is specified, we don't create a new report or authenticate the builder password (the password is never stored in the report). Also use select_first_row instead of query_and_fetch_all to find the builder for simplicity. (ReportProcessor::construct_build_data): Extracted from store_report_and_get_build_data. (ReportProcessor::store_report): Ditto. * tests/admin-reprocess-report.js: Added. 2014-01-21 Ryosuke Niwa Perf dashboard is erroneously associating reported results with old revisions Reviewed by Ricky Mondello. The bug was caused by a build fix r57645. It attempted to treat multiple reports from the same builder for the same build number as a single build by ignoring build time. This was necessary to associate multiple reports by a single build - e.g. for different performance test suites - because the scripts we use to submit results computed its own "build time" when they're called. An unintended consequence of this change was revealed when we moved a buildbot master to the new machine last week; new reports were wrongfully associated with old build numbers. Fixed the bug by not allowing reports made more than 1 day after the initial build time to be assigned to the same build. Instead, we create a new build object for those reports. Since the longest set of tests we have only take a couple of hours to run, 24 hours should be more than enough. * database/init-database.sql: We can no longer constrain that each build number is unique to a builder or that build number and build time pair is unique. Instead, constrain the uniqueness of the tuple (builder, build number, build time). * public/api/report.php: (ReportProcessor::resolve_build_id): Look for any builds made within the past one day. Create a new build when no such build exists. This prevents a report from being associated with a very old build of the same build number. Also check that revision numbers or hashes match when we're adding revision info. This will let us catch a similar bug in the future sooner. * tests/api-report.js: Added three test cases. 2014-01-20 Ryosuke Niwa Merged the upstream changes to db.php See http://trac.webkit.org/browser/trunk/Websites/test-results/public/include/db.php * public/include/db.php: 2014-01-20 Ryosuke Niwa Update other scripts and tests per previous patch. * public/include/manifest.php: * tests/admin-regenerate-manifest.js: 2014-01-20 Ryosuke Niwa Remove metrics_unit. Reviewed by Ricky Mondello. This column is no longer used by the front-end code since r48360. * database/init-database.sql: * public/admin/tests.php: 2014-01-16 Ryosuke Niwa Unreviewed build fix. * public/api/report.php: 2014-01-15 Ryosuke Niwa Automate DoYouEvenBench (124497) Reviewed by Ricky Mondello. Support a new alternative format for aggregated results where we have raw values as well as the list aggregators so that instead of "metrics": {"Time": ["Arithmetic"]} we can have "metrics": {"Time": { "aggregators" : ["Arithmetic"], "current": [300, 310, 320, 330] }} This allows single JSON generated by run-perf-tests in WebKit to be shared between the perf dashboard and the generated results page, which doesn't know how to aggregate values. We need to keep the support for the old format because all other existing performance tests all rely on the old format. Even if we updated the tests, we need the dashboard to support the old format during the transition. * public/api/report.php: (ReportProcessor::recursively_ensure_tests): Support the new format in addition to the old one. (ReportProcessor::aggregator_list_if_exists): Replaced is_list_of_aggregators. * tests/api-report.js: Updated one of aggregator test cases to test the new format. 2013-05-31 Ryosuke Niwa Unreviewed; Tweak the CSS so that chart panes align vertically. * public/index.html: 2013-05-31 Ryosuke Niwa SafariPerfMonitor should support Combined metric. * public/js/helper-classes.js: (PerfTestRuns): Added 'Combined' metric. In general, it could be used for smaller-is-better value as well but assume it to be greater-is-better for now. 2013-05-30 Ryosuke Niwa Commit the forgotten init-database change to add iteration_relative_time. * database/init-database.sql: 2013-05-30 Ryosuke Niwa SafariPerfMonitor: Support accepting (relative time, value) pairs Reviewed by Ricky Mondello. Add the support for each value to have a relative time. This is necessary for frame rate history since a frame rate needs to be associated with a time it was sampled. * database/init-database.sql: Added iteration_relative_time to run_iterations. * public/api/report.php: (TestRunsGenerator::test_value_list_to_values_by_iterations): Reject any non-numeral values here. This code is used to aggregate values but it doesn't make sense to aggregate iteration values with relative time since taking the average of two frame rates for two subtests taken at two different times doesn't make any sense. (TestRunsGenerator::compute_caches): When we encounter an array value while computing sum, mean, etc..., use the second element since we assume values are of the form (relative time, frame rate). Also exit early with an error if the number of elements in the array is not a pair. (TestRunsGenerator::commit): Store the relative time and the frame rate as needed. * tests/api-report.js: Added a test case. Also modified existing test cases to account for iteration_relative_time. 2013-05-27 Ryosuke Niwa SafariPerfMonitor: Support accepting single-value results Reviewed by Ricky Mondello. Support that. It's one line change. * public/api/report.php: (ReportProcessor.recursively_ensure_tests): When there is exactly one value, wrap it inside an array to match the convention assumed elsewhere. * tests/api-report.js: Added a test case. 2013-05-26 Ryosuke Niwa SafariPerfMonitor shows popups for points outside of the visible region. Rubber-stamped by Simon Fraser. * public/index.html: (Chart.closestItemForPageXRespectingPlotOffset): renamed from closestItemForPageX. (Chart.attach): Always use closestItemForPageXRespectingPlotOffset to work around the fact flot may return an item underneath y-axis labels. 2013-05-26 Ryosuke Niwa Tweak the CSS a little to avoid the test name overlapping with the summary table. * public/index.html: 2013-05-26 Ryosuke Niwa Unreviewed. Fix the typo. The anchor element should wrap the svg element, not the other way around. * public/index.html: 2013-05-26 Ryosuke Niwa Should be a toggle to show entire Y-axis range Should scale Y axis to include error ranges Reviewed by Ricky Mondello. Add the feature. Also made adjust y-axis respect confidence interval delta so that the gray shade behind the main graph doesn't go outside the graph even when the y-axis is adjusted. * database/config.json: * public/index.html: (Chart): Add a SVG arrow to toggle y-axis mode, and bind click on the arrow to toggleYAxis(). (Chart.attachMainPlot): Respect shouldStartYAxisAtZero. (Chart.toggleYAxis): Toggle the y-axis mode of this chart by toggling shouldStartYAxisAtZero and calling attachMainPlot. * public/js/helper-classes.js: (PerfTestResult.confidenceIntervalDelta): (PerfTestResult.unscaledConfidenceIntervalDelta): Extracted. (PerfTestRuns.min): Take confidence interval delta into account. (PerfTestRuns.max): Ditto. (PerfTestRuns.hasConfidenceInterval): Not sure why this function was checking the typeof. Just use isNaN. 2013-04-26 Ryosuke Niwa A build fix of the previous. Don't look for a test with NULL parent because NULL != NULL in our beloved SQL. * public/api/report.php: (ReportProcessor::recursively_ensure_tests): * tests/api-report.js: Added a test. 2013-04-26 Ryosuke Niwa Unreviewed build fixes. * public/api/report.php: (ReportProcessor::process): Explicitly exit with error when builder name or build time is missing. Also, tolerate reports without any revision information. (ReportProcessor::recursively_ensure_tests): When looking for a test, don't forget to compare its parent test. * tests/api-report.js: Added few test cases. 2013-04-26 Ryosuke Niwa Commit another change that was supposed to be committed in r50331. * run-tests.js: (TestEnvironment.this.postJSON): (TestEnvironment.this.httpGet): (sendHttpRequest): 2013-04-09 Ryosuke Niwa Commit the remaining files. * public/admin/regenerate-manifest.php: * public/include/admin-header.php: * public/include/json-header.php: * public/include/manifest.php: * run-tests.js: (TestEnvironment.this.postJSON): (TestEnvironment.this.httpGet): (sendHttpRequest): 2013-03-15 Ryosuke Niwa SafariPerfMonitor: Add some tests for admin/regenerate-manifest. Reviewed by Ricky Mondello. Added some tests for admin/regenerate-manifest. * public/admin/regenerate-manifest.php: Use require_once instead of require. * public/include/admin-header.php: Ditto. * public/include/json-header.php: Ditto. * public/include/manifest.php: (ManifestGenerator::builders): Removed a reference to a non-existent variable. When there are no builders, simply return an empty array. * run-tests.js: (TestEnvironment.postJSON): (TestEnvironment.httpGet): Added. (sendHttpRequest): Renamed from postHttpRequest as it now takes method as an argument. * tests/admin-regenerate-manifest.js: Added with a bunch of test cases. 2013-03-14 Ryosuke Niwa Unreviewed. Added more tests for api/report to ensure it creates tests, metrics, test_runs, and run_iterations. Also fixed a typo in report.php found by new tests. * public/api/report.php: (main): Fix a bug in the regular expression to wrap numbers with double quotations. * tests/api-report.js: Added more test cases. 2013-03-12 Ryosuke Niwa SafariPerfMonitor: Need integration tests Reviewed by Ricky Mondello. Add a test runner script and some simple test cases. * database/config.json: Added the configuration for "testServer". * database/database-common.js: (pathToTests): Added. * run-tests.js: Added. (main): (confirmUserWantsDatabaseToBeInitializedIfNeeded): Checks whether there are any non-empty tables, and if there are, asks the user if it’s okay to delete all of the data contained therein. (confirmUserWantsDatabaseToBeInitializedIfNeeded.findNonEmptyTable): Find a table with non-zero number of rows. (confirmUserWantsDatabaseToBeInitializedIfNeeded.fetchTableNames): Fetch the list of all tables in the current database using PostgreSQL's information_schema. (askYesOrNoQuestion): (initializeDatabase): Executes init-database.sql. It drops all tables and creates them again. (TestEnvironment): The global object exposed in tests. Provides various utility functions. (TestEnvironment.assert): Exposes assert to tests. (TestEnvironment.console): Exposes console to tests. (TestEnvironment.describe): Adds a description. (TestEnvironment.it): Adds a test case. (TestEnvironment.postJSON): (TestEnvironment.queryAndFetchAll): (TestEnvironment.sha256): (TestEnvironment.notifyDone): Ends the current test case. (postHttpRequest): (TestContext): An object created for each test case. Conceptually, this object is always on "stack" when a test case is running. TestEnvironment and an uncaughtException handler accesses this object via currentTestContext. (TestContext.description): (TestContext.done): (TestContext.logError): * tests: Added. * tests/api-report.js: Added some basic tests for /api/report.php. 2013-03-08 Ryosuke Niwa Unreviewed administrative page fix. Make it possible to remove all configuration from dashboard. The problem was that we were detecting whether we're updating dashboard or not by checking the existence of metric_configurations in $_POST but this key doesn't exist when we're removing all configurations. Use separate 'dashboard' action to execute the code even when metric_configurations is empty. * public/admin/tests.php: 2013-03-08 Ryosuke Niwa SafariPerfMonitor: Extract a class to aggregate and store values from ReportProcessor. Reviewed by Ricky Mondello. This patch extracts TestRunsGenerator, which aggregates and compute caches of values, from ReportProcessor as a preparation to replace deprecated aggregate.js. * public/api/report.php: (ReportProcessor::exit_with_error): Moved. (ReportProcessor::process): Use the extracted TestRunsGenerator. (TestRunsGenerator): Added. (TestRunsGenerator::exit_with_error): Copied from ReportProcessor. (TestRunsGenerator::add_aggregated_metric): Moved. (TestRunsGenerator::add_values_for_aggregation): Moved. Made public. (TestRunsGenerator::aggregate): Moved. Made public. (TestRunsGenerator::aggregate_current_test_level): Moved. (TestRunsGenerator::test_value_list_to_values_by_iterations): Moved. (TestRunsGenerator::evaluate_expressions_by_node): Moved. (TestRunsGenerator::compute_caches): Moved. Made public. (TestRunsGenerator::add_values_to_commit): Moved. Made public. (TestRunsGenerator::commit): Moved. Made public. Also takes build_id and platform_id. (TestRunsGenerator::rollback_with_error): Moved. 2013-03-08 Ryosuke Niwa SafariPerfMonitor: Administrative pages should update manifest JSON as needed. Reviewed by Remy Demarest. Regenerate the manifest file when updating fields or adding new items that are included in the manifest JSON. * public/admin/bug-trackers.php: * public/admin/builders.php: * public/admin/regenerate-manifest.php: * public/admin/repositories.php: * public/admin/tests.php: * public/include/admin-header.php: (regenerate_manifest): Extracted from regenerate-manifest.php. 2013-03-08 Ryosuke Niwa Unreviewed build fix for memory test results. Make aggregation work in the nested cases. We start from the "leaf" tests and move our ways up, aggregating at each level. * public/api/report.php: (ReportProcessor::recursively_ensure_tests): (ReportProcessor::add_aggregated_metric): Renamed from ensure_aggregated_metric. (ReportProcessor::add_values_for_aggregation): (ReportProcessor::aggregate): (ReportProcessor::aggregate_current_test_level): Extracted from aggregate. 2013-03-02 Ryosuke Niwa Build fixes. iteration_count_cache should be the total number of values in all iteration group, not the number of iteration groups. Also, don't set group number when the entire run belongs a single iteration group. * public/api/report.php: (ReportProcessor::commit): 2013-03-01 Ryosuke Niwa SafariPerfMonitor: Introduce iteration groups Reviewed by Remy Demarest. In WebKit land, we're going to use multiple instances of DumpRenderTree or WebKitTestRunner to amortize the runtime environment variances to get more stable results. And it's desirable to keep track of the instance of DumpRenderTree or WebKitTestRunner used to generate each iteration value. This patch introduces "iteration groups" to keep track of this extra information. Instead of receiving a flat array of iteration values, we can now receive a two dimensional array where the outer array denotes iteration groups and each inner array contains iteration values for each group. * database/init-database.sql: Add iteration_group column. * public/api/report.php: (ReportProcessor::recursively_ensure_tests): Always use the two dimensional array internally. (ReportProcessor::aggregate): test_value_list_to_values_by_iterations now returns an associative array contains the list of values indexed by the iteration order and group sizes. Store the group size so that we can restore the iteration groups before passing it to node.js and restore them later. (ReportProcessor::test_value_list_to_values_by_iterations): Flatten iteration groups into an array of values and construct group_size array to restore the groups later in ReportProcessor::aggregate. Also check that each iteration group in each subtest are consistent with one another. To see why we need to do this, suppose we're aggregating two tests T1 and T2 with the following values. Then it's important that each iteration group in T1 and T2 have the same size: T1 = [[1, 2], [3, 4, 5]] T2 = [[6, 7], [8, 9, 10]] so that the aggregated result (the sum in this case) can have the same groups as in: T = [[7, 9], [11, 13, 15]] If some iteration groups in T1 and T2 had a different size as in: T1 = [[1, 2, 3], [4, 5]] T2 = [[6, 7], [8, 9, 10]] Then iteration groups of the aggregated T is ambiguous. (ReportProcessor::compute_caches): Flatten iteration groups to compute caches (e.g. mean, stdev, etc...) (ReportProcessor::commit): Store iteration_group values. 2013-03-01 Ryosuke Niwa Unreviewed. Delete the migration tool for webkit-perf.appspot.com now that we have successfully migrated to perf.webkit.org. * database/perf-webkit-migrator.js: Removed. 2013-03-01 Ryosuke Niwa Build fix. Don't forget to add metrics of the top level tests e.g. Dromaeo:Time:Arithmetic. * public/index.html: (.showCharts): 2013-03-01 Ryosuke Niwa SafariPerfMonitor: Make it possible to add charts for all subtests or all platforms. Reviewed by Ricky Mondello. It is often desirable to see charts of a given test for all platforms, or to be able to see charts of all subtests on a given platform when trying to triage perf. regressions. Support this use case by adding the ability to do so on the charts page. Also, we used to disable items on the test list based on the platform chosen. This turned out to be a bad UI because in many situations you want to be able to compare results of the same test on multiple platforms. In this new UI, we have three select elements, each of which selects the following: 1. Top-level test - Test suite such as Dromaeo 2. Metric - Pages and subtests under the suite such as www.webkit.org for dom-modify:Runs (where dom-modify is the name of the subtest and Runs is a metric in that subtest) for Dromaeo. 3. Platform - Mountain Lion, Qt, etc... A user can select "all" for metric and platform but we disallow doing both at once since adding all metrics on all platforms tends to add way too many charts and hang the browser. I also can't think of a use case where you want to look at that many charts at once. We can support this later if valid use cases come up. * public/index.html: (.showCharts.addOption): Extracted. (.showCharts): Added "metricList" that shows the list of test and metrics (in the form of relative metrics paths such as "DOMWalk:Time") for each top-level test selected in testList. metricList has onchange handler that enables/disables items on platformList. (init): Sort tests and test metrics here instead of doing that in showCharts. 2013-02-28 Ryosuke Niwa SafariPerfMonitor: tooltip should include a link to build URLs Reviewed by Remy Demarest and Ricky Mondello. Added a hyperlink to build page in tooltips. Repeating the entire build URL in each build was a bad idea because it bloats the resultant JSON file too much. So move the build URL templates to the manifest file instead. Each build now only contains the builder id. * public/api/runs.php: Removed the part of the query that joined builders table. This speeds up the query quite a bit. * public/include/manifest.php: (ManifestGenerator::generate): Generate builders field. (ManifestGenerator::builders): Added. Returns an associative array of builder ids to an associative array that contains name and its build URL template. * public/index.html: (.buildLabelWithLinks.linkifyIfNotNull): Renamed from linkifiedLabel. Take a label and url instead of a revision since this function is used for revisions and build page URLs now. (.buildLabelWithLinks): Include the linkified build number. * public/js/helper-classes.js: (TestBuild.builder): Added. (TestBuild.buildNumber): Added. (TestBuild.buildUrl): Returns the build URL. The variable name in the URL template has been changed from %s to $buildNumber to be more descriptive and consistent with other URL templates. 2013-02-27 Ryosuke Niwa Tooltips interfere with user interactions Rubber-stamped by Simon Fraser. Disable tooltip on the dashboard page since graphs are too small to be useful there. Also, show graphs for only 10 days by default as opposed to 20. Finally, dismiss the hovering tooltip when mouse enters a "pinned" tooltip. * public/index.html: * public/js/helper-classes.js: 2013-02-24 Ryosuke Niwa Fix some serious typo. We're supposed to be using SHA-256, not SHA-1 to hash our passwords, to be compatible with webkit-perf.appspot.com. * public/admin/builders.php: * public/api/report.php: 2013-02-23 Ryosuke Niwa Unreviewed. Add a missing constraint on builds table. For a given builder, there should be exactly one build for a given build number. Also add report_committed_at to reports table to record the time at which a given report was processed and test_runs and run_iterations rows were committed into the database. * database/config.json: * public/api/report.php: 2013-02-22 Ryosuke Niwa Unreviewed. Add more checks for empty SQL query results. * public/include/manifest.php: 2013-02-21 Ryosuke Niwa More build fixes on perf.webkit.org. * public/api/runs.php: Make PostgreSQL happier. * public/include/manifest.php: Don't assume we always have bug trackers. 2013-02-21 Ryosuke Niwa SafariPerfMonitor: index.html duplicates the code in PerfTestRuns to determine smallerIsBetter and fix other miscellaneous UI bugs. Rubber-stamped by Simon Fraser. Removed the code to determine whether smaller value is better or not for a given test in index.html in the favor of using that of PerfTestRuns. * public/include/manifest.php: Fixed a typo. * public/index.html: (Chart): (Chart.attachMainPlot): Fixed a bug to access previousPoint.left even when previousPoint is null. * public/js/helper-classes.js: (PerfTestRuns): Added EndAllocations, MaxAllocations, and MeanAllocations. (PerfTestRuns.computeScalingFactorIfNeeded): When the mean is almost 10,000 units, we may end up using 5 digits instead of 4, resulting in the use of scientific notations. Go up to the next unit at roughly 2,000 units to avoid this. (Tooltip.show): Show the tooltip even when the new content is identical to the previous content. The only thing we can avoid is innerHTML. 2013-02-21 Ryosuke Niwa Another build fix. The path to node is /usr/local/bin/node, not /usr/bin/local/node * public/include/evaluator.js: 2013-02-21 Ryosuke Niwa SafariPerfMonitor: Bug trackers should be configurable Reviewed by Remy Demarest. Made the list of bug trackers configurable. Namely, each bug tracker can be added in admin/bug-trackers.php and can be associated with multiple repositories. The association between bug trackers and repositories (such as WebKit, Safari, etc...) are used to determine the set of bug trackers to show for a given set of blame lists. e.g. if a test regressed due to a change in Safari, then we don't want to show WebKit Bugzilla as a place to file bugs against the regression. F * database/init-database.sql: Added bug_trackers and tracker_repositories. Also drop those tables before creating them (note "DROP TABLE reports" was missing). * public/admin/bug-trackers.php: Added. The administrative interface for adding and managing bug trackers, namely associated repositories. * public/include/admin-header.php: Added a link to bug-trackers.php * public/include/manifest.php: (ManifestGenerator::generate): Include the list of bug trackers in the manifest. Also moved the code to fetch repositories table here from ManifestGenerator::repositories. (ManifestGenerator::repositories): (ManifestGenerator::bug_trackers): Added. Generates an associative array of bug trackers where keys are names of bug trackers and values are associative arrays with keys 'new_bug_url' and 'repositories' where the latter contains the list of associated repository names. * public/index.html: (Chart): Takes bugTrackers as as argument. (Chart.showTooltipWithResults): Removed the hard-coded list. (init): (init.addPlatformsToDashboard): (init.showCharts.createChartFromListPair): (init): Stores the list of bug trackers in the manifest to a local variable. 2013-02-21 Ryosuke Niwa A follow up on the previous build fix. When using proc_open, we need to make evalulator.js executable. * public/include/evaluator.js: 2013-02-21 Ryosuke Niwa SafariPerfMonitor: Extract the code to generate tabular view in administrative pages Reviewed by Remy Demarest. Extracted AdministrativePage to share the code to generate a tabular view of data and a form to insert new row into the database. * public/admin/aggregators.php: Use AdministrativePage. * public/admin/builders.php: Ditto. * public/admin/repositories.php: Ditto. * public/include/admin-header.php: (AdministrativePage): Added. (AdministrativePage::__construct): column_info is an associative array that maps a SQL column name to an associative array that describes the column. - editing_mode: Specifies the type of form ('text', 'url', or 'string') to show for this column. - label: Human readable name of the column. - pre_insertion: Signifies that this column exists only before the row is inserted. e.g. password column exists only before we create password_hash column at the insertion time. (AdministrativePage::name_to_titlecase): Converts an underscored lowercase name to a human readable titlecase (e.g. new_bug is converted to New Bug). (AdministrativePage::column_label): Obtains the label specified in column_info or titlecased column name. (AdministrativePage::render_form_control_for_column): "Renders" a text form control such as input and textarea for a given editing mode ('text', 'url', or 'string'). (AdministrativePage::render_table): Renders a whole SQL table after sorting rows by the specified column. (AdministrativePage::render_form_to_add): Renders a form to insert new row. 2013-02-20 Ryosuke Niwa Build fix. Some systems don't support r+. Use proc_open instead. * public/api/report.php: 2013-02-15 Ryosuke Niwa Build fix. Use the mean data series as supposed to upper or lower confidence bounds when computing the y-axis of data points to show tooltips at. * public/index.html: 2013-02-15 Ryosuke Niwa Unreviewed. Removed .htaccess in favor of directly putting directives in httpd.conf. * Install.md: * public/.htaccess: Removed. 2013-02-14 Ryosuke Niwa Unreviewed. * public/include/manifest.php: Build fix. db is on this. * public/js/statistics.js: (Statistics.confidenceInterval): Added. An utility function for debugging purposes. 2013-02-13 Ryosuke Niwa SafariPerfMonitor doesn't work on perf.webkit.org (Part 2) Reviewed by Anders Carlsson. Rewrote and merged populate-from-report.js into report.php. * database/config.json: Added a path to node.js. * database/init-database.sql: Don't require unit to be always present since it's no longer used by the front end. Once we land this patch and update the administrative pages, we can remove this column. Also add a new reports table to store JSON reported by builders. We used to store everything in jobs table but that table is going away once we remove the node.js backend. * database/populate-from-report.js: Removed. * public/api/report.php: Added. (ReportProcessor): (ReportProcessor.__construct): (ReportProcessor.process): (ReportProcessor.store_report_and_get_build_data): We store the report into the database as soon as it has been verified to be submitted by a known builder. (ReportProcessor.exit_with_error): Store the error message and details in the database if the report had been stored. If not, then notify that to the client via 'failureStored' in the JSON response. (ReportProcessor.resolve_build_id): Insert build and build_revisions rows if needed. We don't do this atomically inside a transaction because there could be multiple reports for a single build, each containing results for different tests. (ReportProcessor.recursively_ensure_tests): Parse a tree of tests and insert tests and test_metrics rows as needed. It also computes the metrics to aggregate and prepares values to commit via ensure_aggregated_metric, add_values_to_commit, and add_values_for_aggregation. (ReportProcessor.is_list_of_aggregators): When a metric is an aggregation, it contains an array of aggregator names, e.g. ["Arithmetic", "Geometric"], instead of a dictionary of configuration types to their values, e.g. {Time: {current: [1, 2, 3,]}}. This function detects the former. (Note that dictionary and list are both array's in PHP). (ReportProcessor.ensure_aggregated_metric): Create a metric with aggregator to add it to the list of metrics to be aggregated in ReportProcessor.aggregate. (ReportProcessor.add_values_for_aggregation): Called by test metrics with aggregated parent test metrics. (ReportProcessor.aggregate): Compute results for aggregated metrics. Consider a matrix with rows representing child tests and columns representing "iterations" for a given aggregated metrics M. Initially, we have values given for each row (child metrics of M). This function extracts each column (iteration) via test_value_list_to_values_by_iterations, and feeds it into evaluate_expressions_by_node to get aggregated values for each column (iteration of M). Finally, it registers those aggregated values to be committed. Note that we don't want to start a new node.js process for each aggregation, so we accumulate all values to be aggregated in node.js in $expressions. Each entry in $expressions is a JSON string that contains code and values to be aggregated. node.js gives us back a list of JSON strings that contain aggregated values. (ReportProcessor.test_value_list_to_values_by_iterations): See above. (ReportProcessor.evaluate_expressions_by_node): See above. (ReportProcessor.compute_caches): Compute cached mean, sum, and square sums for each run we're about to add using evaluate_expressions_by_node. We can't do this before computing aggregated results since those aggregated results also need the said caches. (ReportProcessor.add_values_to_commit): (ReportProcessor.commit): Add test_runs and run_iterations atomically inside a transaction, rolling back the transaction as needed if anything goes wrong. (ReportProcessor.rollback_with_error) (main): * public/include/db.php: (Database.prepare_params): Use $values (instead of $placeholders) to compute the current index since placeholders ($1, $2, etc...) may be split up into multiple arrays given they may not necessarily show up contiguously in a SQL statement. (Database.select_or_insert_row): Added. Selects a row if the attempt to insert the same row fails. It automatically creates a query string from a dictionary of unprefixed column names and table. It returns a column value of the choice. (Database.begin_transaction): Added. (Database.commit_transaction): Added. (Database.rollback_transaction): Added. * public/include/evaluator.js: Added. * public/include/json-header.php: (exit_with_error): Take error details and merge it with "additional details". This allows report.php to provide context under which the request failed. (successful_exit): Merge "additional details". (set_exit_detail): Added. Sets "additional details" to the JSON returned by exit_with_error or successful_exit. (merge_additional_details): 2013-02-12 Ryosuke Niwa SafariPerfMonitor: Add more helper functions to db.php Reviewed by Remy Demarest. Added Database::insert_row and array_get to make common database operations easier. * public/admin/aggregators.php: Use Database::insert_row instead of execute_query_and_expect_one_row_to_be_affected. * public/admin/builders.php: Ditto. * public/admin/tests.php: Ditto; We used to run a separate SELECT query just to get the id after inserting a row. With insert_row, we don't need that. * public/include/admin-header.php: Ditto. * public/include/db.php: (array_get): Added. It returns the value of an array given a key if the key exists; otherwise return the default value (defaults to NULL) if the key doesn't exist. (Database::column_names): Added. Prefixes an array of column names and creates a comma separated list of the names. (Database::prepare_params): Added. Takes an associative array of column names and their values, and builds up arrays for placeholder (e.g. $1, $2, etc...) and values, then returns an array of column names all in the same order. (Database::insert_row): Added. Inserts a new row into the specified table where column names have the given prefix. Values are given in a form of an associative array where keys are unprefixed column names and values are corresponding values. When the row is successfully inserted, it returns the specified column's value (defaults to prefix_id). If NULL is specified, it returns a boolean indicating the success of the insertion. 2013-02-11 Ryosuke Niwa SafariPerfMonitor doesn't work on perf.webkit.org (Part 1) Reviewed by Conrad Shultz. Rewrote the manifest generator in PHP. * database/generate-manifest.js: Removed. * public/admin/regenerate-manifest.php: Added. Use ManifestGenerator to generate and store the manifest. * public/include/db.php: (array_ensure_item_has_array): Added. * public/include/evaluator.js: Added. * public/include/json-header.php: * public/include/manifest.php: Added. 2013-02-11 Ryosuke Niwa Dates on overflow plot are overlapping Rubber-stamped by Simon Fraser. Don't show more than 5 days. * public/index.html: * public/js/helper-classes.js: (TestBuild.UTCtoPST): (TestBuild.now): 2013-02-07 Ryosuke Niwa Show build time as well as commit time on the dashboard and tooltips. Rubber-stamped by Simon Fraser. Include both the maximum commit time and build time in buildLabelWithLinks. Also use ISO format to save the screen real estate. * public/index.html: (buildLabelWithLinks): * public/js/helper-classes.js: (TestBuild): (TestBuild.buildTime): (TestBuild.formattedBuildTime): 2013-02-08 Ryosuke Niwa Unreviewed; Convert metric.name to metric.unit in the front end. * public/js/helper-classes.js: 2013-02-07 Ryosuke Niwa SafariPerfMonitor: Need hyperlinks to file bugs Rubber-stamped by Simon Fraser. This patch adds hyperlinks to file new bugs on Radar and WebKit Bugzilla. Because we want to include information such as the degree of progression or regression and the regression ranges when filing new bugs, broke various label() functions into smaller pieces to be used in both generating tooltips and the hyperlinks. * public/index.html: (.buildLabelWithLinks): Extracted from TestBuild.label. (.showTooltipWithResults): Extracted from Tooltip.show. Also added the code to generate hyperlinks to file new bugs on Radar and WebKit Bugzilla. * public/js/helper-classes.js: (PerfTestResult.metric): Replaced test() as runs.test() no longer exists. (PerfTestResult.isBetterThan): Added. (PerfTestResult.formattedRelativeDifference): Extracted from PerfTestResult.label. (PerfTestResult.formattedProgressionOrRegression): Ditto. Also use "better" and "worse" instead of arrow symbols to indicate progressions or regressions. (PerfTestResult.label): (TestBuild.formattedTime): Added. (TestBuild.platform): Added. (TestBuild.formattedRevisions): Extracted from TestBuild.label. Merged a part of linkifyLabel. (TestBuild.smallerIsBetter): Added. (Tooltip.show): Take a raw markup instead of two results. 2013-02-06 Ryosuke Niwa SafariPerfMonitor: Dashboard can cause excessive horizontal scrolling when there are many platforms Rubber-stamped by Tim Horton. Stack platforms when there are more than 3 of them since making the layout adaptive is tricky since each platform may have a different number of tests to be shown on the dashboard. * public/index.html: 2013-02-05 Ryosuke Niwa Build fix. Don't prefix a SVn revision with 'r' when constructing a changeset / blame URL. * public/js/helper-classes.js: (TestBuild.label): 2013-02-05 Ryosuke Niwa SafariPerfMonitor: repository names or revisions are double-quoted when they contain a space Rubber-stamped by Tim Horton. The bug was in the PHP code that parsed Postgres array. Trim double quotations as needed. Also fixed a bug in TestBuild where we used to show the revision range as r1234-1250 when the revision r1234 was the revision used in the previous build. * public/api/runs.php: (parse_revisions_array): Trim double quotations around repository names and revisions. * public/js/helper-classes.js: (TestBuild.label): 2013-02-05 Ryosuke Niwa SafariPerfMonitor: Tooltip is unusable Rubber-stamped by Tim Horton. * public/index.html: (Chart.attachMainPlot): Disable auto highlighting (circle around a data point that shows up on hover) on the dashboard page as it's way too noisy. (Chart.hideTooltip): Added. Hides the tooltip that shows up on hover. (.toggleClickTooltip): Extracted from the code for "mouseout" bind (now replaced by "mouseleave"). Pins or unpins a tooltip. When pinning a tooltip, we create a tooltip behind the scene and show that so that the tooltip for hover can be reused further. (.closestItemForPageX): Find the closest item given pageX. We iterate data points from left to right, and find the first point that lies on the right of the cursor position. We then compute the midpoint between this and the previous point and pick the closer of the two. It returns an item-like object that has all properties we need since flot doesn't provide an API to retrieve the real item object. (Chart): Call toggleClickTooltip when a (hover) tooltip is clicked. (Chart.attach): In "plothover" bind, call closestItemForPageX when item is not provided by flot on the first or "current" data points (as opposed to target or baseline data points). Also bind the code to clear crosshair and hide tooltips to "mouseleave" instead of "mouseout", and avoid triggering this code when the cursor is still within the plot's rectangle (e.g. when a cursor moves onto a tooltip) to avoid the premature dismissal of a tooltip. * public/js/helper-classes.js: (Tooltip.ensureContainer): Don't automatically close then the user clicks on tooltip. Delegate this work to the client via bindClick. (Tooltip.show): Move tooltip up by 5px. Also added a FIXME to move this offset computation to the client. (Tooltip.bindClick): Added. 2013-02-03 Ryosuke Niwa Yet another build fix. metricId*s*. * public/admin/tests.php: 2013-02-03 Ryosuke Niwa Another build fix. Use the new payload format for the aggregate job. * public/admin/tests.php: 2013-02-03 Ryosuke Niwa Build fixes. * database/aggregate.js: Use variables that actually exist. * database/database-common.js: (ensureConfigurationIdFromList): Add the newly added configuration to the list so that subsequent function calls will find this configuration. 2013-01-31 Ryosuke Niwa SafariPerfMonitor: Add ReadMe Reviewed by Ricky Mondello. Turned InstallManual into a proper markdown document and added ReadMe.md. * InstallManual: Removed. * InstallManual.md: Moved from InstallManual. * ReadMe.md: Added. 2013-01-31 Ryosuke Niwa SafariPerfMonitor: Add baseline and target lines Reviewed by Ricky Mondello. This patch prepares the front end code to process baseline and target results properly. * public/index.html: (fetchTest.createRunAndResults): Extracted. (fetchTest): Call createRunAndResults on current, baseline, and target values of the JSON. Deleted the comment about how sorting will be unnecessary once we start results in the server side since sorting by the maximum revision commit time turned out to be non-trivial in php. 2013-01-29 Ryosuke Niwa SafariPerfMonitor: Use newer version of flot that supports timezone properly Reviewed by Tim Horton. Use flot at https://github.com/flot/flot/commit/ec168da2cb8619ebf59c7e721d12c44a7960ff41. These files are "dynamically linked" to our app. * public/index.html: * public/js/jquery-1.8.2.min.js: Removed. * public/js/jquery.colorhelpers.js: Added. * public/js/jquery.flot.categories.js: Added. * public/js/jquery.flot.crosshair.js: Added. * public/js/jquery.flot.errorbars.js: Added. * public/js/jquery.flot.fillbetween.js: Added. * public/js/jquery.flot.js: Added. * public/js/jquery.flot.min.js: Removed. * public/js/jquery.flot.navigate.js: Added. * public/js/jquery.flot.resize.js: Added. * public/js/jquery.flot.selection.js: Added. * public/js/jquery.flot.stack.js: Added. * public/js/jquery.flot.symbol.js: Added. * public/js/jquery.flot.threshold.js: Added. * public/js/jquery.flot.time.js: Added. * public/js/jquery.js: Added. 2013-01-29 Ryosuke Niwa Return NaN instead of throwing when there aren't enough samples. Reviewed by Sam Weinig. It's better to return NaN when we don't have enough samples so that we can treat it as if we don't have any confidence interval. * public/js/statistics.js: (Statistics.new): 2013-01-28 Ryosuke Niwa Build fix. Apparently Safari sometimes appends / at the end of hash location. Remove that. * public/js/helper-classes.js: (URLState.parseIfNeeded): 2013-01-28 Ryosuke Niwa SafariPerfMonitor: Always use parameterized SQL functions in php code Reviewed by Ricky Mondello. Parameterized execute_query_and_expect_one_row_to_be_affected and updated the code accordingly. * public/admin/aggregators.php: Use heredoc. * public/admin/builders.php: * public/admin/jobs.php: * public/admin/repositories.php: * public/admin/tests.php: Updated the forms to use unprefixed field names to match other pages. This allows us to use update_field when updating test's url and metric's unit. Changed the action to regenerate aggregated matrix from "update" to "add" to simplify the dependencies in if-else. Also removed a stray code to update unit and url simultaneously since it's never used. * public/include/admin-header.php: (execute_query_and_expect_one_row_to_be_affected): Added $params. Also automatically convert empty strings to NULL as it was previously done via $db->quote_string_or_null_if_empty in callers. (update_field): Moved from repositories.php. (add_job): * public/include/db.php: (quote_string_or_null_if_empty): Removed now that nobody uses this function. 2013-01-25 Ryosuke Niwa Build fixes. Treat mean, sum, and square sum as float, not int. Also use 95% confidence interval instead of 90% confidence interval. * public/api/runs.php: * public/js/helper-classes.js: (.this.confidenceIntervalDelta): 2013-01-24 Ryosuke Niwa Add an administrative page to edit repository information. Reviewed by Ricky Mondello. * public/admin/repositories.php: Added. * public/include/admin-header.php: 2013-01-23 Ryosuke Niwa SafariPerfMonitor: Automatically create aggregated metrics from builder reports Reviewed by Ricky Mondello. Auto-create aggregated matrix such as arithmetic means and geometric means as requested and add a job to aggregate results for those matrix in populate-from-report.js. * database/generate-manifest.js: (.): Include aggregator names such as Arithmetic and Geometric in the list of metrics. * database/init-database.sql: Remove an erroneous unique constraint. There could be multiple matrix that share the same test and name (e.g. Dromaeo, Time) with different aggregators (e.g. Arithmetic and Geometric). * database/populate-from-report.js: (main): (getReport): No change even though the diff looks as if it moved. (processReport): Extracted from main. Fetch the list of aggregators, pass that to recursivelyEnsureTestsIdsAndMetricsIds to obtain the list of aggregated metrics (such as arithmetic means) that need to be passed to aggregate.js (scheduleJobs): Extracted from processReport. Add a job to aggregate results. (recursivelyEnsureTestsIdsAndMetricsIds): When a metric is a list of names, assume them as aggregator names, and add corresponding metrics for them. Note we convert those names to ids using the dictionary we obtained in processReport. (ensureMetricId): Take an aggregator id as an argument. * database/process-jobs.js: Support multiple metric ids and build id. Note that aggregate.js aggregates results for all builds when the build id is not specified. * public/admin/tests.php: * public/index.html: Include the aggregator name in the full name since there could be multiple metrics of the same name with different aggregators. 2013-01-22 Ryosuke Niwa Build fix. Don't pass in arguments to in the wrong order. * database/aggregate.js: 2013-01-21 Ryosuke Niwa SafariPerfMonitor: x-axis is messed up Reviewed by Ricky Mondello. Since the version of flot we use doesn't support showing graphs in the current locate or in a specific timezone, convert all timestamps to PST manually (Date's constructor will still treat them as in UTC). We don't want to use the current locate because other websites on webkit.org assume PST. Also append this information to build's label. * public/js/helper-classes.js: (TestBuild): (TestBuild.label): 2013-01-21 Ryosuke Niwa Store test URLs reported by builders. Reviewed by Ricky Mondello. * database/populate-from-report.js: (recursivelyEnsureTestsIdsAndMetricsIds): Pass in the test url. (ensureTestId): Store the URL. 2013-01-20 Ryosuke Niwa Yet another build fix; don't blow up even if we didn't have any test configurations. * public/admin/tests.php: 2013-01-21 Ryosuke Niwa Build fix; don't instantiate Date when a timestamp wasn't provided. * database/populate-from-report.js: 2013-01-18 Ryosuke Niwa Rename SafariPerfDashboard to SafariPerfMonitor and add a install manual. Reviewed by Tim Horton. Added an install manual. * InstallManual: Added. 2012-12-21 Ryosuke Niwa Minor build fix. Don't unset builderPassword when it's not set. * public/api/report.php: 2012-12-18 Ryosuke Niwa Prettify JSON payloads and make very large payloads not explode the table in jobs.php. Reviewed by Ricky Mondello. * public/admin/admin.css: Make a very large payload scrollable. * public/admin/jobs.php: Format JSONs. 2012-12-19 Ryosuke Niwa SafariPerfMonitor: Add ability to report results from bots Reviewed by Ricky Mondello. Add report.php and populate-from-report.js that process JSON files submitted by builders. * database/populate-from-report.js: Added. (main): (getReport): Obtains the payload (the actual report) from "jobs" table. (recursivelyEnsureTestsIdsAndMetricsIds): "reports.tests" contain a tree of tests, test metrics, and their results. This function recursively traverses tests and metrics and ensure their ids. (ensureTestId): (metricToUnit): Maps a metric name to a unit. This should really be done in the client side since there is no point in storing unit given that every metric maps to exactly one unit (i.e. the mapping is a "function" in mathematical sense). (ensureMetricId): (ensureRepositoryIdsForAllRevisions): (getIdOrCreateBuildWithRevisions): (ensureBuildIdAndRevisions): Obtains a build id given a builder name, a build number, and a build time if one already exists. If not, then inserts a new build and corresponding revisions information (e.g. build 123 may contain WebKit revision r456789). We don't retrieve rows for revisions since we don't use it elsewhere. (insertRun): Insert new rows into "test_runs" and "run_iterations" tables, thereby recording the new test results all in a single transaction. This allows us to keep the database consistent in that either a build has been reported or not at least in "test_runs" and "run_iterations" tables. It'll be ideal if we could do the same for "builds" and "build_revisions" but that's not a hard requirement as far as other parts of the application are concerned. (scheduleQueriesToInsertRun): * database/process-jobs.js: Add a call to populate-from-report.js. * public/api/report.php: Added. Adds a new job named "report" to be processed by populate-from-report.js. * public/include/db.php: Support parameterized query. * public/include/json-header.php: Always include 'status' in the response so that builder submitting a test result could confirm that the submission indeed succeeded. 2012-12-18 Ryosuke Niwa Rename get(Id)OrCreate*(Id) to ensure*Id as suggested by Ricky on one of his code reviews. * database/aggregate.js: * database/database-common.js: (selectColumnCreatingRowIfNeeded): (ensureRepositoryId): (ensureConfigurationIdFromList): * database/perf-webkit-migrator.js: (.migrateStat.): (.migrateStat): (getOrCreateBuildId): 2012-12-17 Ryosuke Niwa Extract commonly-used functions from aggregate.js and perf-webkit-migrator.js. Reviewed by Ricky Mondello. As a preparation to add report.js that processes a JSON file submitted by bots, extract various functions and classes from aggregate.js and perf-webkit-migrator.js to be shared. * database/aggregate.js: Extracted TaskQueue and SerializedTaskQueue into utility.js. (main): (processBuild): (saveAggregatedResults): * database/database-common.js: (getIdOrCreatePlatform): Extracted from webkit-perf-migrator.js. (getIdOrCreateRepository): Ditto. (getConfigurationsForPlatformAndMetrics): Renamed from fetchConfigurations. Extracted from aggregator.js. (getIdFromListOrInsertConfiguration): Renamed from getOrInsertConfiguration. Extracted from aggregator.js. * database/perf-webkit-migrator.js: * database/utility.js: Added. (TaskQueue): Extracted from aggregator.js. Fixed a bug that prevented tasks added after start() is called from being executed. (TaskQueue.startTasksInQueue): Execute remaining tasks without serializing them. If the queue is empty, call the callback passed into start(). (TaskQueue.taskCallback): The function each task calls back. Decrement the counter and call statTasksInQueue. (TaskQueue.addTask): (TaskQueue.start): (SerializedTaskQueue): Unlike TaskQueue, this class executes each task sequentially. (SerializedTaskQueue.executeNextTask): (SerializedTaskQueue.addTask): (SerializedTaskQueue.start): 2012-12-18 Ryosuke Niwa Revert erroneously committed changes. * database/config.json: 2012-12-18 Ryosuke Niwa aggregator.js should be able to accept multiple metric ids and a single build id. Reviewed by Ricky Mondello. Make aggregator.js accept multiple ids and generate results for single build when bots are reporting new results. * database/aggregate.js: (parseArgv): Added. Returns an object containing the parsed representation of argv, which currently contains metricIDs and buildIds. (main): Use parseArgv and processConfigurations (processPlatform): Use build ids passed in or obtain all builds for the given platform. (processPlatform.processConfigurations): Extracted. 2012-12-17 Ryosuke Niwa Add an administrative page for builders. Reviewed by Ricky Mondello. We need an administrative page to add and edit builder information. Also renamed "slaves" to "builders" in order to reduce the amount of technical jargon we use. * database/init-database.sql: Renamed slaves table to builders. Drop slave_os and slave_spec since we don't have plans to use those columns in near future. Also make builder_name unique as required by the rest of the app. * public/admin/builders.php: Added. * public/api/runs.php: Updated per the table rename. * public/include/admin-header.php: Added a link to builders.php. 2012-12-14 Ryosuke Niwa Build fixes for r46982. * database/aggregate.js: (fetchConfigurations): Bind i so that it's not always metricIds.length. (fetchBuildsForPlatform): Return run_build as build_id since that's what caller expects. (processBuild): Don't print "." until we've committed transactions. It's misleading. 2012-12-13 Ryosuke Niwa Unreviewed. Move some php files to public/include as suggested by Mark on a code review. * public/admin/aggregators.php: * public/admin/footer.php: Removed. * public/admin/header.php: Removed. * public/admin/index.php: * public/admin/jobs.php: * public/admin/tests.php: * public/api/json-header.php: Removed. * public/api/runs.php: * public/db.php: Removed. * public/include: Added. * public/include/admin-footer.php: Copied from public/admin/footer.php. * public/include/admin-header.php: Copied from public/admin/header.php. * public/include/db.php: Copied from public/db.php. * public/include/json-header.php: Copied from public/api/json-header.php. 2012-12-13 Ryosuke Niwa SafariPerfMonitor: implement naive value aggregation mechanism Reviewed by Ricky Mondello. Added the initial implementation of value aggregation. Also added abilities to configure the dashboard page in tests.php. * database/aggregate.js: Added. (TaskQueue): Added. Execute all tasks at once and waits for those tasks to complete. (TaskQueue.addTask): (TaskQueue.start): (SerializedTaskQueue): Added. Execute tasks sequentially after one another until all of them are completed. (SerializedTaskQueue.addTask): (SerializedTaskQueue.start): (main): (processPlatform): (fetchConfigurations): (fetchBuildsForPlatform): (processBuild): (testsWithDifferentIterationCounts): (aggregateIterationsForMetric): Retrieve run_iterations and aggregate results in memory. (saveAggregatedResults): Insert into test_runs and test_config in transactions. (getOrInsertConfiguration): (fetchAggregators): * database/database-common.js: (fetchTable): Log an error as an error. (getOrCreateId): Extracted from perf-webkit-migrator. (statistics): Added. * database/perf-webkit-migrator.js: (migrateTestConfig): Converted units to respective metric names. Also removed the code to add jobs to update runs JSON since runs JSONs are generated on demand now. (migrateStat): (getOrCreatePlatformId): (getOrCreateTestId): (getOrCreateConfigurationId): (getOrCreateRevisionId): (getOrCreateRepositoryId): (getOrCreateBuildId): * database/process-jobs.js: (processJob): Handle 'aggregate' type. 2012-12-11 Ryosuke Niwa Fix the dashboard after adding test_metrics. Reviewed by Ricky Mondello. Rename test to metrics in various functions and sort tests on the charts page. Also representing whether a test appears or not by setting a flag on dashboard was bogus because test objects are shared by multiple platforms. Instead, store dashboard platform list as intended by the manifest JSON. * public/index.html: (PerfTestRuns): Renamed test to metric. (fetchTest): Ditto. (showCharts): Ditto; also sort metrics' full names before adding them to the select element. (fullName): Moved so that it appears above where it's called. * public/js/helper-classes.js: 2012-12-10 Ryosuke Niwa Update tests.php to reflect recent changes in the database schema. Reviewed by Conrad Shultz. Made the following changes to tests.php: 1. Disallow adding metrics to tests without subtests. 2. Made dashboard configurable by adding checkboxes for each platform on each metric. 3. Linkified tests with subtests instead of showing all them at once. * public/admin/admin.css: (.action-field, .notice): (label): * public/admin/header.php: Specify paths by absolute paths so that tests.php can use PATH_INFO. (execute_query_and_expect_one_row_to_be_affected): Return a boolean. Used in tests.php while adding test_metrics. (add_job): Extracted. * public/admin/tests.php: See above. (array_item_set_default): Added. (array_item_or_default): Renamed from get_value_with_default. (compute_full_name): Extracted. (sort_tests): Ditto. (map_metrics_to_tests): Ditto. 2012-12-06 Ryosuke Niwa SafariPerfMonitor: Linkify test names Reviewed by Simon Fraser. Linkify the headers using metric.test.url when it's provided. * public/index.html: 2012-12-03 Ryosuke Niwa Use parameterized pg_query_params in query_and_fetch_all Reviewed by Conrad Shultz. Address a review comment by Mark by using pg_query_params instead of pg_query in query_and_fetch_all. * public/api/runs.php: * public/db.php: (ctype_alnum_underscore): Added. 2012-12-04 Ryosuke Niwa Update the migration tool to support test_metrics. Reviewed by Mark Rowe. Updated the migration tool from webkit-perf.appspot.com to support test_metrics. Also import run_iteration rows as runs JSON files now include individual values. * database/database-common.js: (addJob): Extracted. * database/perf-webkit-migrator.js: (migrateTestConfig): Interchange the order in which we fetch runs and add configurations so that we can pass in the metric name and unit to getOrCreateConfigurationId. (getOrCreateConfigurationId): Updated to add both test configuration and test metric. (ensureCheckout): 2012-12-03 Ryosuke Niwa Build fix. Suppress "Undefined index" warning. * public/admin/tests.php: 2012-12-03 Ryosuke Niwa Fix a commit error in r46756. api/ should obviously be added under public/ * api: Removed. * api/json-header.php: Removed. * api/runs.php: Removed. * public/api: Copied from api. 2012-12-03 Ryosuke Niwa SafariPerfMonitor: Linkify revisions and revisions range Reviewed by Mark Rowe. Linkify revisions in TestBuild.label. Pass in manifest.repositories to TestBuild's constructor since it needs to know "url" and "blameUrl". Also tweaked the appearance of graphs on charts page to better align graphs when unit names are long. * public/index.html: * public/js/helper-classes.js: (TestBuild): (TestBuild.revision): Renamed from webkitRevision. Now returns an arbitrary revision number. (TestBuild.label): Add labels for all revisions. (TestBuild): (.ensureContainer): 2012-12-03 Ryosuke Niwa Make the generation of "runs" JSON dynamic and support test_metrics. Reviewed by Mark Rowe. It turned out that we can fetch all runs for a given configuration in roughly 100-200ms. Since there could be hundreds, if not thousands, of tests for each configuration and users aren't necessarily interested in looking at all test results, it's much more efficient to generate runs JSON dynamically (i.e. polling) upon a request instead of generating all of them when bots report new results (i.e. pushing). Rewrote the script to generate runs JSON in php and also supported test_metrics table. * api: Added. * api/json-header.php: Added. Sets Content-Type and cache policies (10 minutes by default). (exit_with_error): Added. (successful_exit): Added. * api/runs.php: Added. Ported database/database-common.js. It's much shorter in php! * database/generate-runs.js: Removed. * database/process-jobs.js: No longer supports "runs". * public/.htaccess: Added. Always add MultiView so that api/runs can receive a path info. * public/db.php: Print "Nothing to see here." when it's accessed directly. (ends_with): Added. * public/index.html: Fetch runs JSONs from /api/runs/ instead of data/. 2012-12-03 Ryosuke Niwa Update tests.php and sample-data.sql per addition of test_metrics. Rubber-stamped by Timothy Hatcher. Remove a useless code from tests.php that used to update the unit and the url of a test since it's no longer used, and add the UI and the ability to add a new aggregator to a test. Also update the sample data to reflect the addition of test_metrics. * database/sample-data.sql: * public/admin/tests.php: 2012-11-30 Ryosuke Niwa Share more code between admin pages. Reviewed by Timothy Hatcher. Added notice and execute_query_and_expect_one_row_to_be_affected helper functions to share more code between admin pages. Also moved the code to connect to the database into header.php to be shared. Admin pages just need to check the nullity of global $db now. * public/admin/aggregators.php: * public/admin/header.php: (notice): Added (execute_query_and_expect_one_row_to_be_affected): Added. * public/admin/index.php: * public/admin/jobs.php: * public/admin/tests.php: 2012-11-29 Ryosuke Niwa SafariPerfMonitor: Add admin page to edit aggregators Reviewed by Mark Rowe. Add aggregators.php. It's very simple. We should probably share more code between various admin pages. * public/admin/aggregators.php: Added. * public/admin/header.php: * public/admin/jobs.php: Removed an erroneous hidden input element. 2012-11-28 Ryosuke Niwa Fix a syntax error in init-database.sql and add the missing drop table at the beginning. * database/init-database.sql: 2012-11-28 Ryosuke Niwa SafariPerfMonitor: Allow multiple metrics per test Rubber-stamped by Mark Rowe. Introduce a new table test_metrics. This table represents metrics each test can have such as time, memory allocation, frame rate as well as aggregation such as arithmetic mean and geometric mean. Updated admin/tests.php and index.html accordingly. Also create few indexes based on postgres' "explain analysis" as suggested by Mark. * database/generate-manifest.js: (buildPlatformMapIfPossible): * database/generate-runs.js: (fetchRuns): * database/init-database.sql: * database/schema.graffle: * public/admin/admin.css: (table): (tbody.odd): * public/admin/tests.php: * public/index.html: 2012-11-27 Ryosuke Niwa SafariPerfMonitor: Improve the webkit-perf migration tool Reviewed by Mark Rowe. Make the migrator tool skip runs when fetching runs failed since webkit-perf.appspot.com is unreliable and we don't want to pause the whole importation process until the user comes back to decide whether to retry or not. Also place form controls next to each test in tests.php so that users don't have to scroll all the way down to make modifications. Finally, add unique constraint to (run_config, run_build) in test_runs table in order to optimize a query of the form: "SELECT run_id FROM test_runs WHERE run_config = $1 AND run_build = $2", * database/init-database.sql: * database/perf-webkit-migrator.js: (migrateTestConfig): * database/schema.graffle: * public/admin/admin.css: (table): * public/admin/tests.php: 2012-11-16 Ryosuke Niwa Create a new performance dashboard Rubber-stamped by Mark Rowe. Add the initial implementation of the perf dashboard. * database: Added. * database/config.json: Added. * database/database-common.js: Added. (connect): (fetchTable): (manifestPath): (pathToRunsJSON): (pathToLocalScript): (config): * database/generate-manifest.js: Added. (ensureProperty): (buildTestMap): (buildPlatformMapIfPossible): (generateFileIfPossible): * database/perf-webkit-migrator.js: Added. * database/process-jobs.js: Added. * database/sample-data.sql: Added. * database/schema.graffle: Added. * public: Added. * public/admin: Added. * public/admin/README: Added. * public/admin/admin.css: Added. * public/admin/footer.php: Added. * public/admin/header.php: Added. * public/admin/index.php: Added. * public/admin/jobs.php: Added. * public/admin/tests.php: Added. * public/common.css: Added. * public/data: Added. * public/db.php: Added. * public/index.html: Added. * public/js: Added. * public/js/helper-classes.js: Added. * public/js/jquery-1.8.2.min.js: Added. * public/js/jquery.flot.min.js: Added. * public/js/jquery.flot.plugins.js: Added. * public/js/shared.js: Added. (fileNameFromPlatformAndTest): * public/js/statistics.js: Added.