User:Quiddity (WMF)/MassMessage fixes

Hi all. This error was partially my fault. I tried to fix it myself but ran into difficulties. I've now requested assistance, and the fix is currently being added. (all the technical details are below). I'm very embarrassed about this. My apologies to you all for the error and distraction, and the delay to resolving it. Quiddity (WMF) (talk) 07:03, 10 February 2017 (UTC)

Trying to find more help to finish this... Quiddity (WMF) (talk) 23:57, 16 April 2017 (UTC)

MassMessage error fix

edit

I made a mistake,[1] and would love help fixing it.

Essentially we need a bot/script-run to fix (with an edit like this) an error in a MassMessage post that went to a few thousand pages.

I couldn't find a page to specifically request this kind of help.[2] Many complaints were coming in, and the problem lingers.[3]

Specifically

edit
  1. Change these 2 strings in each message, * from x ** to y. -- (It's just changing <ref> into <ref group=survey> in each)
  2. Add <references group=survey /> to each section

Locations

edit

Three groups, semi-ready for AWB/etc.

  1. large Wikipedias and Wikidata, ready to go
  2. other Wikipedias, lines need slight regex manipulation
  3. sister projects, lines need slight regex manipulation

(Alternatively, the original separated MessMessage lists are in these subpages: Community Engagement Insights/MassMessages/Lists/2016/ - some are a single wiki, and some combine targets at many wikis)

String variants

edit

En:

  • <ref>This survey is primarily meant to get feedback
    • <ref group=survey>This survey is primarily meant to get feedback
  • <ref>Legal stuff: No purchase necessary.
    • <ref group=survey>Legal stuff: No purchase necessary.

Ar (RTL):

  • <ref>هذا الاستطلاع موجه في المقام
    • <ref group=survey>هذا الاستطلاع موجه في المقام
  • <ref>أمور قانونية: لا يتطلب الأمر
    • <ref group=survey>أمور قانونية: لا يتطلب الأمر

De:

  • <ref>Diese Umfrage ist vor allem dazu gedacht
    • <ref group=survey>Diese Umfrage ist vor allem dazu gedacht
  • <ref>Rechtliches: Keine Kaufverpflichtung. Volljährigkeit erforderlich
    • <ref group=survey>Rechtliches: Keine Kaufverpflichtung. Volljährigkeit erforderlich

Es:

  • <ref>Esta encuesta está principalmente
    • <ref group=survey>Esta encuesta está principalmente
  • <ref>Cuestiones legales: No es necesario comprar nada
    • <ref group=survey>Cuestiones legales: No es necesario comprar nada

Fr:

  • <ref>Le principal objectif de l’enquête
    • <ref group=survey>Le principal objectif de l’enquête
  • <ref>Questions légales : pas d’achat nécessaire
    • <ref group=survey>Questions légales : pas d’achat nécessaire

It:

  • <ref>Questa inchiesta è sta principalmente pensata
    • <ref group=survey>Questa inchiesta è sta principalmente pensata
  • <ref>Problemi legali: Non ci sono acquisti previsti
    • <ref group=survey>Problemi legali: Non ci sono acquisti previsti

Ja:

  • <ref>この調査では、
    • <ref group=survey>この調査では、
  • <ref>法的事項: 購入の必要はありません
    • <ref group=survey>法的事項: 購入の必要はありません

Pl:

  • <ref>Ta ankieta dotyczy głównie opinii na temat
    • <ref group=survey>Ta ankieta dotyczy głównie opinii na temat
  • <ref>Kwestie prawne: Nie jest konieczne dokonanie zakupu
    • <ref group=survey>Kwestie prawne: Nie jest konieczne dokonanie zakupu

Pt / Pt-br:

  • <ref>Essa pesquisa foi projetada para receber
    • <ref group=survey>Essa pesquisa foi projetada para receber
  • <ref>Por questões legais: nenhuma compra necessária
    • <ref group=survey>Por questões legais: nenhuma compra necessária

Uk:

  • <ref>Це опитування перш за все має на меті отримати
    • <ref group=survey>Це опитування перш за все має на меті отримати
  • <ref>Юридичні примітки. Не потрібно нічого купувати
    • <ref group=survey>Юридичні примітки. Не потрібно нічого купувати

Ru:

  • (Not needed, TextworkerBot fixed it)

Zh:

  • (Not needed, it was fixed before that batch was sent)

Fiwiki:

  • (Not needed, Stryn fixed it with AWB)

Commons:

  • (Not needed, SteinsplitterBot fixed it)


Bonus fix at Portuguese Wikipedia

edit

(If easy, could this be fixed at the same time...?)

I noticed there was a partial-translation version (just the heading) sent to the editors on this list, 20 minutes before the proper version: Community Engagement Insights/MassMessages/Lists/2016/07-AEPT (but not the other 3 lists of Ptwiki editors)

Perhaps the first version (in mostly English) could be removed entirely?


Footnotes

edit
  1. I gave bad advice on formatting the message in Community Engagement Insights/MassMessages/2016 - First message whilst trying to wikify other parts, by neglecting to put a <references /> in. Whilst it worked fine in previews (now filed as phab:T156167) and tests, we didn't check/remember what happens when a new section is added after the message (it puts the automatically-generated <references /> at the very bottom of the page, not within the specific section).
  2. Is there a metawiki page for requests to *create/run* a bot for crosswiki fixes? (not permissions, that's Steward_requests/Bot_status, but someone to actually write/run the bot). I'm sure I've seen one before, but can't find it now. I searched various pages (and their talkpages, and SeeAlso sections), including Bot_policy, Tech, plus pages like Synchbot and more.)
  3. Complaints are at:


PAWS attempts

edit

I've tried learning how to fix this with wikitech:PAWS, but ran into some problems. Notes below, for posterity.

Extended content

command

edit

Current draft:

pwb.py replace -simulate -fix:massmessagecor -file:targetpages

Questions:

  • How would I make it mark the edits as minor? (or is that just a function of the necessary bot-flag?)

My user-fixes.py

edit

Is this right?

# -*- coding: utf-8  -*-

# fix massmessage strings. 

fixes['massmessagecor'] = {
	'regex': True,
	'msg': { 'Fixing massmessage ref tags. Sorry for the error.', },
	'replacements': [
		(r'<!-- Message sent by User:EGalvez', r"<references group=survey />\n<!-- Message sent by User:EGalvez"), # fix-all
		(r'<ref>Le principal objectif de l’enquête', r"<ref group=survey>Le principal objectif de l’enquête"), # fix-1-FR
		(r'<ref>Questions légales : pas d’achat nécessaire', r"<ref group=survey>Questions légales : pas d’achat nécessaire"),	#fix-2-FR
		(r'<ref>Esta encuesta está principalmente', r"<ref group=survey>Esta encuesta está principalmente"), # fix-1-ES
		(r'<ref>Cuestiones legales: No es necesario comprar nada', r"<ref group=survey>Cuestiones legales: No es necesario comprar nada"),	#fix-2-ES	
	]
}

If yes, then here's the full version. (But I'm not sure if the Arabic RTL lines are formatted correctly...):

Extended content
# -*- coding: utf-8  -*-

# fix massmessage strings. 
# This fix is used with command:
# python replace.py -fix:massmessagecor -file:targetpages

fixes['massmessagecor'] = {
	'regex': True,
	'msg': { 'Fixing massmessage ref tags. Sorry for the error.', },
	'replacements': [
		(r'<!-- Message sent by User:EGalvez', r"<references group=survey />\n<!-- Message sent by User:EGalvez"), # fix-all
		(r'<ref>This survey is primarily meant to get feedback', r"<ref group=survey>This survey is primarily meant to get feedback"), # fix-1-EN
		(r'<ref>Legal stuff: No purchase necessary', r"<ref group=survey>Legal stuff: No purchase necessary"), #fix-2-EN
		(r'<ref>هذا الاستطلاع موجه في المقام', r"<ref group=survey>هذا الاستطلاع موجه في المقام"), # fix-1-AR
		(r'<ref>أمور قانونية: لا يتطلب الأمر', r"<ref group=survey>أمور قانونية: لا يتطلب الأمر"), #fix-2-AR
		(r'<ref>Diese Umfrage ist vor allem dazu gedacht', r"<ref group=survey>Diese Umfrage ist vor allem dazu gedacht"), # fix-1-DE
		(r'<ref>Rechtliches: Keine Kaufverpflichtung. Volljährigkeit erforderlich', r"<ref group=survey>Rechtliches: Keine Kaufverpflichtung. Volljährigkeit erforderlich"), #fix-2-DE
		(r'<ref>Esta encuesta está principalmente', r"<ref group=survey>Esta encuesta está principalmente"), # fix-1-ES
		(r'<ref>Cuestiones legales: No es necesario comprar nada', r"<ref group=survey>Cuestiones legales: No es necesario comprar nada"), #fix-2-ES
		(r'<ref>Le principal objectif de l’enquête', r"<ref group=survey>Le principal objectif de l’enquête"), # fix-1-FR
		(r'<ref>Questions légales : pas d’achat nécessaire', r"<ref group=survey>Questions légales : pas d’achat nécessaire"), #fix-2-FR
		(r'<ref>Questa inchiesta è sta principalmente pensata', r"<ref group=survey>Questa inchiesta è sta principalmente pensata"), # fix-1-IT
		(r'<ref>Problemi legali: Non ci sono acquisti previsti', r"<ref group=survey>Problemi legali: Non ci sono acquisti previsti"), #fix-2-IT
		(r'<ref>この調査では、', r"<ref group=survey>この調査では、"), # fix-1-JA
		(r'<ref>法的事項: 購入の必要はありません', r"<ref group=survey>法的事項: 購入の必要はありません"), #fix-2-JA
		(r'<ref>Ta ankieta dotyczy głównie opinii na temat', r"<ref group=survey>Ta ankieta dotyczy głównie opinii na temat"), # fix-1-PL
		(r'<ref>Kwestie prawne: Nie jest konieczne dokonanie zakupu', r"<ref group=survey>Kwestie prawne: Nie jest konieczne dokonanie zakupu"), #fix-2-PL
		(r'<ref>Essa pesquisa foi projetada para receber', r"<ref group=survey>Essa pesquisa foi projetada para receber"), # fix-1-PT
		(r'<ref>Por questões legais: nenhuma compra necessária', r"<ref group=survey>Por questões legais: nenhuma compra necessária"), #fix-2-PT
		(r'<ref>Це опитування перш за все має на меті отримати', r"<ref group=survey>Це опитування перш за все має на меті отримати"), # fix-1-UK
		(r'<ref>Юридичні примітки. Не потрібно нічого купувати', r"<ref group=survey>Юридичні примітки. Не потрібно нічого купувати"), #fix-2-UK
	]
}

targetpages file

edit

This seems to work. (Note: Full URLs didn't. It was also failing on the test: prefix until I remembered that testwiki was my default.)

w:fr:Discussion_utilisateur:Quiddity_(WMF)/Brouillon
User_talk:Quiddity_(WMF)/sandbox
m:User_talk:Quiddity_(WMF)/sandbox
w:ar:User talk:Quiddity_(WMF)/ملعب
Status
  • I've got 1/3 of the list ready (the larger Wikipedias)
Problem
  • But I don't know how to most easily convert these strings:
    this :User talk:Foo | site = xy.project
    into project:xy:User talk:Foo
(a 6,000 line textfile. I have Sublimetext, but don't know how to use it...)

Current error

edit
  • In -simulate or in an actual test, if I accept the changes, then it fails with this error message:
Do you want to accept these changes? ([y]es, [N]o, [e]dit, open in [b]rowser, [a]ll, [q]uit): y
Traceback (most recent call last):
  File "/srv/paws/pwb/pwb.py", line 263, in <module>
    if not main():
  File "/srv/paws/pwb/pwb.py", line 257, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "/srv/paws/pwb/pwb.py", line 121, in run_python_file
    main_mod.__dict__)
  File "/srv/paws/pwb/scripts/replace.py", line 1164, in <module>
    main()
  File "/srv/paws/pwb/scripts/replace.py", line 1155, in main
    bot.run()
  File "/srv/paws/pwb/scripts/replace.py", line 793, in run
    page.save(summary=self.generate_summary(applied), async=True,
  File "/srv/paws/pwb/scripts/replace.py", line 693, in generate_summary
    summary_messages.add(replacement.edit_summary)
TypeError: unhashable type: 'set'
<class 'TypeError'>
CRITICAL: Closing network session.
Quiddity_(WMF)@PAWS:~$