-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Suggested Edits endpoints #1153
Conversation
3288e19
to
157483f
Compare
@mateusbs17 This is an example of adding a basic endpoint or set of endpoints to RESTBase with no provision for Cassandra storage. |
157483f
to
3f4f8be
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need some more work. Namely, end points that have the source and target language cannot go under specific projects, e.g. what is the meaning of source
and target
if the end point is accessed via en.wp.org
? In the same vein, blindly adding all of the recommendation end points to commons doesn't work either. What is the source language for end points that only expect the target to be provided by the client?
TL;DR: these end points need to be separated: one set should go under the global domain (those with both source and target) and another set should go under each project (those for which the target and/or source is known). Better yet, for end points that have both source and target, we should probably rework them so that the source is taken from the domain and then let the client specify the target (that's how it is currently done).
@d00rman I'm gonna try to answer these questions.
It will return The allowed domains are:
I might be wrong, but the addition endpoints only need to know the target language which will get the new description/caption, the source doesn't matter since there is no manipulation of previously existing description/caption.
That's something I'm don't know how to answer, probably @joewalsh have a better idea about the service architecture. I might be missing something, but these endpoints are supposed to work exclusively with commons and there is no need to do language differentiation per client since the users need to have set multiple languages in the app |
So, I guess we'd need a special project for commons now :( |
There's nothing requiring us to use the wikidata and commons domains per se. We could just treat the domain as the target language, since there's a target language in every case. The source could be a path parameter. (Addition endpoints have no source language.) IOW, they could look like:
The big drawback to using the wiki language subdomain as the target language is that it means we can't specify a language variant as the target. That would be unfortunate. The same applies for the caption addition and translation endpoints, though Wikipedia domains would be a more awkward fit in that case, since the results are Commons file pages for files that aren't necessarily used on Wikipedias. |
The reason for preferring wikidata and commons for description and caption suggestions, respectively, is that those are the domains that the results most relate to. |
@mdholloway @mateusbs17 FYI, we have merged #1148, so now you can rebase and start working on this. |
Adds four new recommendation endpoints: - /data/recommendation/caption/addition/{target} - /data/recommendation/caption/translation/from/{source}/to/{target} - /data/recommendation/description/addition/{target} - /data/recommendation/description/translation/from/{source}/to/{target} The caption suggestion endpoints are supported only for Commons domains, and the description suggestion endpoints are supported only for Wikidata domains. Support for commons.wikimedia.org as a default project is added to config.example.wikimedia.yaml for development and testing. Support for recommendations endpoints is added to the wikidata.org project in the example config. Phab: https://phabricator.wikimedia.org/T224754
1- Rebase. 2- Split recommend configurations and add into projects wikidata.wmf and commons.wmf. 3- Create commons.wmf per copy of default.wmf and add recommend-caption entries.
3f4f8be
to
314688c
Compare
config.frontend.test.yaml
Outdated
paths: | ||
/{api:v1}: | ||
x-modules: | ||
- path: projects/v1/commons.wmf.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point I've had on the meeting about being able not to create a commons project. We can just use the default project and add the recommned-captions right here in the config
The |
1- Remove commons from projects and add recommend-caption direct in the config file 2- Add wikidata and commons to the monitoring test script as allowed domains
I fixed the recommend.yaml but tests still fails. When accessing
The last commit removes wikidata.org from the monitoring test just to make CI happy, any thoughts about that? |
This depends on the work being done in PR wikimedia#1148. Bug: T223953
@mateusbs17 the domain name is |
Thanks, that was the problem indeed. Seems fixed, let me know if there is anything else. |
Expose new talk endpoint in the wikipedia projects only, no cassandra storage is needed, only regular Varnish layer. The endpoints are: /{domain}/v1/page/talk/{title} /{domain}/v1/page/talk/{title}/{revision} Both return JSON with structured talk page. Bug: T225733
1- Remove cache-control header 2- Add accept-language header 3- Remove unnedeed config
OK, thanks for the update, @Pchelolo. @mateusbs17 please keep Joe up to date on what's happening with this. |
This endpoint won't be cached for now
Release v1.0.0
options: '{{options.recommendation}}' | ||
- path: projects/proxy.yaml | ||
options: *proxy_options | ||
/{api:sys}: *default_sys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This portion actually needs to be transferred to the production config. Want me to do it or want me to show you how it's done @mateusbs17 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we need to update config.fronted.wikimedia.yaml
similarly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went ahead and made a prod config change for you https://gerrit.wikimedia.org/r/c/mediawiki/services/restbase/deploy/+/519500
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question.
- get_from_backend: | ||
request: | ||
uri: '{{options.host}}/{{domain}}/v1/caption/addition/{target}' | ||
x-amples: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs x-monitor: true as well
- get_from_backend: | ||
request: | ||
uri: '{{options.host}}/{{domain}}/v1/caption/translation/from/{source}/to/{target}' | ||
x-amples: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs x-monitor: true as well
- get_from_backend: | ||
request: | ||
uri: '{{options.host}}/{{domain}}/v1/description/addition/{target}' | ||
x-amples: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs x-monitor: true as well
- get_from_backend: | ||
request: | ||
uri: '{{options.host}}/{{domain}}/v1/description/translation/from/{source}/to/{target}' | ||
x-amples: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs x-monitor: true as well.
Actually. while you're at it, could you amend our tests to fail if there IS x-amples and no x-monitoring. Right about here: https://github.com/wikimedia/restbase/blob/master/test/features/specification/monitoring.js#L43
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x-monitor
is actually not needed if it's value is supposed to be true
. The default is x-monitor: true
in service-checker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
olala... that's the shitty part of having the checker reimplemented in node for testing. out tests need x-monitor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which config file should we now be using for ordinary testing? These now pass with x-monitor: true
when using config.fullstack.test.yaml
but only for beta cluster domains. But won't this put beta cluster domains on the Swagger doc page, even in production?
Also, I noticed that most endpoints have x-monitor: false
in RESTBase. That's why I did likewise in the new PR before seeing this comment.
After adding x-monitor true it was possible to see that the x-amples tests don't work properly, the reason I found is related with the wmflabs host passed as options.
Even though I added the options to both wikidata and commons, some tests still get 404. |
Adding the recommend-caption endpoints in the config file seems is breaking on tests, it seems that the host for appeditortask is ignored, this commit adds it to the default project.
projects/v1/default.wmf.yaml
Outdated
@@ -96,3 +96,5 @@ paths: | |||
- path: v1/javascript.yaml | |||
options: | |||
host: '{{options.mobileapps.host}}' | |||
- path: v1/recommend-caption.yaml | |||
options: '{{options.appeditortasks}}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmmm... Haven't we decided that this will only be exposed on commons?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmmm... Haven't we decided that this will only be exposed on commons?
Er, that's news to me. Was that discussed in the sync meeting last week? The description suggestion endpoints don't make sense on Commons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind, misunderstood the comment ;)
As for |
and pass default options to x-modules.
Expose new talk endpoint
config.frontend.test.yaml
Outdated
@@ -29,6 +29,8 @@ default_project: &default_project | |||
host: https://citoid-beta.wmflabs.org | |||
recommendation: | |||
host: https://recommendation-api-beta.wmflabs.org | |||
appeditortasks: | |||
host: https://app-editor-tasks.wmflabs.org |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this domain pointing too? it's a different instance of recommendation api service or what is this?
And if so, why are we pointing this to a different domain here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the labs instance @mdholloway was working on. I think this instance has a special setup for the endpoints to work with Extension:WikimediaEditorTasks, commons and wikidata.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. but where would we point production too? To recommendation-api LVS? I think we need a bit more info from @mdholloway here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pchelolo, see #1153 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. but where would we point production too? To recommendation-api LVS? I think we need a bit more info from @mdholloway here.
Yes, the deployment followed the regular recommendation-api target machines. The limitations of the beta-cluster that made us create a new instance to perform the actions the Apps team needed for testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure why the normal recommendation-api
service can not handle these recommendations.. Since the normal recommendation-api.beta.wmflabs.org is as well completely under our control, why can't we make that one work and not create additional installations of the same thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhas cause the recommendation service installed in beta doesn't seem to work. Then we need to fix it and not create a separate installation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should indeed point to the Beta Cluster. app-editor-tasks
was just for prototyping and testing, particularly before the code was merged onto recommendation-api master.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Pointing to app-editor-tasks
in this PR rather than BC like the others was probably just an error on my part.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, OK, I see what's going on here. Yeah, we definitely don't want to introduce an appeditortasks
service to RB. I'll update the PR.
That's something @mdholloway would know more about. EDIT: Extension:WikimediaEditorTasks/Testing_environment_setup |
I'm not able to force-push my updates, so I opened a new PR at #1159. |
This is just an early-stage dev/testing instance. All testing here should be performed against Recommendation API in the Beta Cluster.
ok, now we have 2 of these and also something clearly went wrong with git history here... we definitely can't merge this with broken history. |
Sorry for the mess. Cleaned up and rebased in #1160. @thesocialdev You're not configured as a reviewer in this repo, so I can't add you, but your reviews are also welcome. |
Adds four new recommendation endpoints:
The caption suggestion endpoints are supported only for Commons domains,
and the description suggestion endpoints are supported only for Wikidata
domains. (This is enforced in the service configuration, and is not reflected here.)
Support for commons.wikimedia.org as a default project is added to
config.example.wikimedia.yaml for development and testing.
Support for recommendations endpoints is added to the wikidata.org
project in the example config.
Phab: https://phabricator.wikimedia.org/T224754