WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
182266
Should fetch owner commits in build-requests-fetcher.
https://bugs.webkit.org/show_bug.cgi?id=182266
Summary
Should fetch owner commits in build-requests-fetcher.
dewei_zhu
Reported
2018-01-29 15:27:00 PST
Should fetch owner commits in build-requests-fetcher.
Attachments
Patch
(8.34 KB, patch)
2018-01-29 15:36 PST
,
dewei_zhu
no flags
Details
Formatted Diff
Diff
Patch
(7.18 KB, patch)
2018-01-29 17:19 PST
,
dewei_zhu
rniwa
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
dewei_zhu
Comment 1
2018-01-29 15:36:25 PST
Created
attachment 332590
[details]
Patch
Ryosuke Niwa
Comment 2
2018-01-29 16:55:01 PST
Comment on
attachment 332590
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=332590&action=review
> Websites/perf.webkit.org/public/include/build-requests-fetcher.php:135 > + if ($commit_owner_id && !array_key_exists($commit_owner_id, $this->commits_by_id)) > + $commit_owners[$commit_owner_id] = TRUE;
Rather than manually finding owner commits like this, we should simply query the database as so: SELECT * FROM commits, repositories WHERE commit_repository = repository_id AND commit_id IN (SELECT commitset_commit FROM commit_set_items WHERE commitset_set = $1);
dewei_zhu
Comment 3
2018-01-29 17:19:26 PST
Created
attachment 332607
[details]
Patch
Ryosuke Niwa
Comment 4
2018-01-30 00:26:58 PST
Comment on
attachment 332607
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=332607&action=review
> Websites/perf.webkit.org/public/include/build-requests-fetcher.php:149 > + $owner_commits_rows = $this->db->query_and_fetch_all('SELECT * FROM commits WHERE commit_id IN > + (SELECT DISTINCT(commitset_commit_owner) FROM commit_set_items WHERE commitset_set = $1 > + AND commitset_commit_owner IS NOT NULL)', array($commit_set_id));
I would have indented this query as: SELECT * FROM commits WHERE commit_id IN (SELECT DISTINCT(commitset_commit_owner) FROM commit_set_items WHERE commitset_set = $1 AND commitset_commit_owner IS NOT NULL)
> Websites/perf.webkit.org/public/include/build-requests-fetcher.php:158 > + 'repository' => $row['commit_repository'],
Do: $resolve_ids ? $row['repository_name'] : $row['repository_id'];
> Websites/perf.webkit.org/public/include/build-requests-fetcher.php:159 > + 'commitOwner' => NULL,
We should assert that $row['commitset_commit_owner'] is NULL.
> Websites/perf.webkit.org/server-tests/api-build-requests-tests.js:289 > + return MockData.addTestGroupWithOwnerCommitNotInCommitSet(TestServer.database()).then(() => { > + return Manifest.fetch(); > + }).then(() => { > + return BuildRequest.fetchForTriggerable('build-webkit'); > + }).then((buildRequests) => {
Use await! await MockData.addTestGroupWithOwnerCommitNotInCommitSet(TestServer.database()); await Manifest.fetch(); const buildRequests = await BuildRequest.fetchForTriggerable('build-webkit');
> Websites/perf.webkit.org/server-tests/api-build-requests-tests.js:292 > + let test = Test.findById(200);
const.
> Websites/perf.webkit.org/server-tests/api-build-requests-tests.js:295 > + let platform = Platform.findById(65);
const.
dewei_zhu
Comment 5
2018-01-30 01:54:21 PST
Comment on
attachment 332607
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=332607&action=review
>> Websites/perf.webkit.org/public/include/build-requests-fetcher.php:158 >> + 'repository' => $row['commit_repository'], > > Do: $resolve_ids ? $row['repository_name'] : $row['repository_id'];
Nice catch.
>> Websites/perf.webkit.org/public/include/build-requests-fetcher.php:159 >> + 'commitOwner' => NULL, > > We should assert that $row['commitset_commit_owner'] is NULL.
$owner_commits_rows only contains information from commits table which does not contains 'commitset_commit_owner'
Ryosuke Niwa
Comment 6
2018-01-30 13:57:58 PST
Comment on
attachment 332607
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=332607&action=review
>>> Websites/perf.webkit.org/public/include/build-requests-fetcher.php:159 >>> + 'commitOwner' => NULL, >> >> We should assert that $row['commitset_commit_owner'] is NULL. > > $owner_commits_rows only contains information from commits table which does not contains 'commitset_commit_owner'
That just happens to be true for our database today. We always should be asserting those conditions in the case they change. What's the chance you'd remember to fix this code five years from now when that condition changes?
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug