Skip to content

Expose version list for diffing, rework reviewers api to be more concise#10684

Merged
EnTeQuAk merged 10 commits into
masterfrom
10432-expose-versions
Feb 15, 2019
Merged

Expose version list for diffing, rework reviewers api to be more concise#10684
EnTeQuAk merged 10 commits into
masterfrom
10432-expose-versions

Conversation

@EnTeQuAk

@EnTeQuAk EnTeQuAk commented Feb 13, 2019

Copy link
Copy Markdown
Contributor

We're now mounting any listing/browsing/future diffing APIs under the
already existing addon/<addon_id>/ endpoint which makes the whole
reviewer APIs behave more consistently.

Also implements the listing of versions that can be used for browsing
and diffing.

Fixes mozilla/addons#6327

cc @willdurand @bobsilverberg and @kumar303 that the URLs will unfortunately change and now require an addon-id, that will be given through the link to the code-manager. That addon-id will then be used to retrieve the list of versions that can be used for diffing or other actions later.

We're now mounting any listing/browsing/future diffing APIs under the
already existing addon/<addon_id>/ endpoint which makes the whole
reviewer APIs behave more consistently.

Also implements the listing of versions that can be used for browsing
and diffing.

Fixes #10432
@EnTeQuAk
EnTeQuAk force-pushed the 10432-expose-versions branch from 83bb1de to b80f7bc Compare February 13, 2019 13:19
@EnTeQuAk
EnTeQuAk requested a review from diox February 13, 2019 14:10
@kumar303

Copy link
Copy Markdown
Contributor

Thanks, noted.

@EnTeQuAk

Copy link
Copy Markdown
Contributor Author

Meh, travis didn't communicate the progress of that test-suite, both are actually green :)

def list(self, request, *args, **kwargs):
"""Return all (re)viewable versions for this add-on.

Full list, no pagination."""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why no pagination? This seems like a bad idea, some add-ons have a lot of versions...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because that list is being shown in a drop-down of some kind and I personally don't think fetching the versions through pagination is a worthwhile undertaking.

I don't know how the current file-viewer handles huge amounts of versions but I'd guess, it just looks very stupid.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah... (see https://reviewers.addons.mozilla.org/en-US/firefox/files/compare/1683453...1679753/ for 83 versions - it's slow)

But if it only every returns minimal information (like the serializer does now) then it's probably okay. It'll just get terrible quickly if we start returning nested serializers and other objects (e.g. translations). Maybe add a comment to the serializer for future us to not add anything crazy to it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could even make the query a bit quicker by reducing the number of fields we are selecting to the ones we actually need which should be fine then.

@eviljeff eviljeff Feb 15, 2019

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id, channel, version shouldn't be terrible.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best way to make it super fast (besides caching and accepting that the first request is going to be slow) would be to only select columns that are part of the same composite index ; that way MySQL wouldn't need to fetch the data from disk. Unfortunately we don't have an index that match those fields...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally don't think we have to make it super-fast, fast enough should be fine as long as the loading doesn't time-out and stays responsive for the user.

@EnTeQuAk

Copy link
Copy Markdown
Contributor Author

@diox or @eviljeff does one of you have some time for this today? I have other PRs in the queue that built on top of this one, as it refactors how the API works.

Comment thread docs/topics/api/reviewers.rst Outdated
def list(self, request, *args, **kwargs):
"""Return all (re)viewable versions for this add-on.

Full list, no pagination."""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah... (see https://reviewers.addons.mozilla.org/en-US/firefox/files/compare/1683453...1679753/ for 83 versions - it's slow)

But if it only every returns minimal information (like the serializer does now) then it's probably okay. It'll just get terrible quickly if we start returning nested serializers and other objects (e.g. translations). Maybe add a comment to the serializer for future us to not add anything crazy to it.

Comment thread src/olympia/reviewers/serializers.py Outdated
@EnTeQuAk
EnTeQuAk merged commit 1352908 into master Feb 15, 2019
@EnTeQuAk
EnTeQuAk deleted the 10432-expose-versions branch February 15, 2019 14:53
MelissaAutumn pushed a commit to thunderbird/addons-server that referenced this pull request Aug 25, 2024
…ise (mozilla#10684)

* Expose version list for diffing, rework reviewers api to be more concise

We're now mounting any listing/browsing/future diffing APIs under the
already existing addon/<addon_id>/ endpoint which makes the whole
reviewer APIs behave more consistently.

Also implements the listing of versions that can be used for browsing
and diffing.

Fixes #10432

* Simplify view, don't rely on @action decorator but just make it the detail view

* Smaller cleanups, fix permissions

* More smaller cleanups, split list/retreive better

* Fix link in docs

* Improve tests, remove 'should_show_channel' and 'url'

* Smaller performance optimization

* Fix flake8

* Improve docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reviewers/Browse API: Expose all related versions

5 participants