[Webkit-unassigned] [Bug 168962] Add the ability to report a commit with sub-commits.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Feb 27 23:36:14 PST 2017


https://bugs.webkit.org/show_bug.cgi?id=168962

--- Comment #2 from Ryosuke Niwa <rniwa at webkit.org> ---
Comment on attachment 302923
  --> https://bugs.webkit.org/attachment.cgi?id=302923
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=302923&action=review

> Websites/perf.webkit.org/ChangeLog:9
> +        On existing production server, run '''

You should probably use ``` instead.

> Websites/perf.webkit.org/ChangeLog:11
> +                commit_owner integer NOT NULL REFERENCES commits ON DELETE CASCADE,

We should rename repository_parent to repository_owner if we're going with owner/owned.

> Websites/perf.webkit.org/public/api/report-commits.php:5
> +function get_repository_id($repository_name, $parent_repoistory_id, $db) {

$db must be the first argument.
Also { should appear on the following line on its own: https://webkit.org/code-style-guidelines/#braces
and no get_ prefix: https://webkit.org/code-style-guidelines/#names-out-argument

We should probably call this ensure_repository_id or select_or_insert_repository_row.

> Websites/perf.webkit.org/public/api/report-commits.php:10
> +    $repository_id = $db->select_or_insert_row('repositories', 'repository', $repository_info);

This would happily insert (WebKit, non-null) value yet that would break
ReportProcessor::resolve_build_id, ManifestGenerator::repositories (we should include all repositories there with parent repository set),
and CommitLogFetcher::repository_id_from_name (should only find top-level repository).

> Websites/perf.webkit.org/public/api/report-commits.php:18
> +function process_one_commit($commit_info, $repository_id, $owner_commit_id, $db) {

We should probably call insert_commit.
Again, $db should be the first argument.

> Websites/perf.webkit.org/public/api/report-commits.php:59
> +        $db->insert_row('commit_ownerships', '', array('commit_owner' => $owner_commit_id, 'commit_ownee' => $inserted_commit_id), NULL);

Just pass in "commit" as the prefix.

> Websites/perf.webkit.org/server-tests/api-report-commits-tests.js:90
> +                    "WebKit": {

We should add a test case where WebKit is a non-sub repository,
and make sure submitting it as a sub commit would either fail or insert a new repository.

> Websites/perf.webkit.org/server-tests/api-report-commits-tests.js:92
> +                        "time": "2013-02-06T08:55:20.9Z",

I think we should enforce that sub-commit never specifies commit time
because it makes no sense for a sub-commit to have a time and its parent to not have one or them to be different.
I think it's best to forbid altogether for simplify for now.

> Websites/perf.webkit.org/server-tests/api-report-commits-tests.js:198
> +            const osxCommit = find_first_matching(commits, {'revision': 'Sierra16D32'});

This would not catch this particular revision getting inserted into a wrong repository.
It's probably better if we manually fetched repository list, and fetch commit for each instead.

Something like this would catch more bugs:
(() =>  {
    return Promise.all[db.selectAll('repositories'), db.selectAll('commits')];
}).then((result) => {
    const repositories = result[0];
    const repositoryNames = repositories.map((row) => row['repository_name']).sort();
    asset.deepEqual(repositoryNames, ["WebKit", ...]);

    const repositoryIdByName = {};

    const commitByRepository = {};
    for (let commit of result[1]) {
        const repsoitoryId = commit['commit_repository'];
        assert(!(repsoitoryId in commitByRepository));
        commitByRepository[repsoitoryId] = commit;
    }

    assert(repsoitoryId[repositoryIdByName["WebKit"]]['commit_revision'], '1235');
});

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170228/d6bdbc8f/attachment.html>


More information about the webkit-unassigned mailing list