Page MenuHomePhabricator

LinkRecommendation: Don't convert underscores to dashes
Closed, ResolvedPublic

Description

In rRMWA56ea941af2fa: Modify URL structure for service we included a line of code that converted underscores to dashes for the wiki_id specified in a request:

wiki_id = wiki_id.replace("_", "-")

In retrospect, I don't think we needed this. And it is blocking completion of T304549: Deploy "add a link" to 5th round of wikis because bat_smg and be_x_old get converted to bat-smg and be-x-old when looking in the database to load models and datasets, but the model and datasets are stored using the underscore and not the dash.

Acceptance Criteria

  1. Should be able to pass a wiki ID for bat_smg and be_x_old and use it without the underscore getting converted to a dash.
Completion checklist

Functionality

  • The patches have been code reviewed and merged
  • The task passes its acceptance criteria

Engineering

  • There are existing and passing unit/integration tests
  • Tests for every involved patch should pass
  • Coverage for every involved project should have improved or stayed the same

Design & QA

  • If the task is UX/Design related: it must be reviewed and approved by the UX/Design team
  • Must be reviewed and approved by Quality Assurance.

Documentation

  • Related and updated documentation done where necessary

Event Timeline

Change 843497 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[research/mwaddlink@main] app: Do not convert underscore to dash in wiki_id

https://gerrit.wikimedia.org/r/843497

Change 843497 merged by jenkins-bot:

[research/mwaddlink@main] app: Do not convert underscore to dash in wiki_id

https://gerrit.wikimedia.org/r/843497

Change 843936 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[operations/deployment-charts@master] linkrecommendation: Bump version

https://gerrit.wikimedia.org/r/843936

Change 843936 merged by jenkins-bot:

[operations/deployment-charts@master] linkrecommendation: Bump version

https://gerrit.wikimedia.org/r/843936

Seems it did not work:

[urbanecm@deploy1002 ~]$ curl 'https://linkrecommendation.discovery.wmnet:4005/v1/linkrecommendations/wikipedia/be_x_old/%D0%94%D1%8B%D0%B2%D1%96%D0%B7%D1%96%D1%8F_%D0%BA%D0%B0%D1%80%D0%B0%D0%B1%D0%BB%D1%91%D1%9E'
upstream connect error or disconnect/reset before headers. reset reason: connection termination
[urbanecm@deploy1002 ~]$

Seems it did not work:

[urbanecm@deploy1002 ~]$ curl 'https://linkrecommendation.discovery.wmnet:4005/v1/linkrecommendations/wikipedia/be_x_old/%D0%94%D1%8B%D0%B2%D1%96%D0%B7%D1%96%D1%8F_%D0%BA%D0%B0%D1%80%D0%B0%D0%B1%D0%BB%D1%91%D1%9E'
upstream connect error or disconnect/reset before headers. reset reason: connection termination
[urbanecm@deploy1002 ~]$

It works for bat_smg, though. I think this issue has to do with the redirection to be-tarask, for reasons as yet unknown to me.

Seems it did not work:

[urbanecm@deploy1002 ~]$ curl 'https://linkrecommendation.discovery.wmnet:4005/v1/linkrecommendations/wikipedia/be_x_old/%D0%94%D1%8B%D0%B2%D1%96%D0%B7%D1%96%D1%8F_%D0%BA%D0%B0%D1%80%D0%B0%D0%B1%D0%BB%D1%91%D1%9E'
upstream connect error or disconnect/reset before headers. reset reason: connection termination
[urbanecm@deploy1002 ~]$

It works for bat_smg, though. I think this issue has to do with the redirection to be-tarask, for reasons as yet unknown to me.

See T321082: Requests to be-x-old.wikipedia.org result in HTTP 504 Gateway Timeout

The following works:

curl -X GET "https://api.wikimedia.org/service/linkrecommendation/v1/linkrecommendations/wikipedia/be_x_old/%D0%8F?threshold=0.5&max_recommendations=3" -H  "accept: application/json"

{"links":[{"context_after":" [дж] (у а","context_before":". Азначае ","link_index":0,"link_target":"Гук","link_text":"гук","match_index":0,"score":0.6176603436470032,"wikitext_offset":301},{"context_after":" паходзіць","context_before":" [дзь]).\n\n","link_index":1,"link_target":"Літара","link_text":"Літара","match_index":0,"score":0.7106323838233948,"wikitext_offset":339}],"links_count":2,"meta":{"application_version":"8b645e0","dataset_checksums":{"anchors":"eab7fe29819e60e77c92c1940f83bdd7ba823f7ef3c8a4e1033f92d6c92dfb93","model":"6af707ee07f48fc334ac231ef9fb85dfa47ae6dc05f296081a3cb66584cd5155","pageids":"463cbc1ee192edf7e7fa78af29f172e0680125bb8e3f9a43a365eb60e35ce5ca","redirects":"b531e4f81bea989bd2a3a9d6ee8056b46ad1a7b025f5b8719a1f217accf1d2d8","w2vfiltered":"dae6d40a580469c8dd4dabe03f591293648ba07fa10a942152fb4a3a947ebec4"},"format_version":1},"page_title":"Џ","pageid":188939,"revid":2363514}
curl -X GET "https://api.wikimedia.org/service/linkrecommendation/v1/linkrecommendations/wikipedia/bat_smg/Skuomont%C4%81?threshold=0.5&max_recommendations=3" -H  "accept: application/json"

{"links":[],"links_count":0,"meta":{"application_version":"8b645e0","dataset_checksums":{"anchors":"4ea6695cd96f8cf10ed118cc07e8c436836779523980b052d7d9dbb1dd510131","model":"7bcff86b41daa10e2c83758168489b0e447ba519437aefffcf4a0a486ad81ed5","pageids":"1e55a43ec36894fb60289ddd0916c40e8231fe75fe85f4f6e0bc5ab7ba6ade71","redirects":"3183797eae6a9bd087685db06d995c81161cb1591135289d797f190ffbd663d8","w2vfiltered":"31e58594b21222ca6a590c30c16c1c13096dffc029953938d5acd146a0c6b9da"},"format_version":1},"page_title":"Skuomontā","pageid":15043,"revid":352788}