https://bugzilla.wikimedia.org/show_bug.cgi?id=55016
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Priority|Unprioritized |Normal CC| |jayvdb@gmail.com, | |valhallasw@arctus.nl Version|unspecified |core (2.0)
--- Comment #1 from John Mark Vandenberg jayvdb@gmail.com --- In July there were three threads of discussion about user-agents for bots.
http://thread.gmane.org/gmane.science.linguistics.wikipedia.technical/78356
http://lists.wikimedia.org/pipermail/pywikipedia-l/2014-July/008924.html
http://lists.wikimedia.org/pipermail/pywikipedia-l/2014-July/008932.html
Following that Amir did some work to allow customisation of the user-agent, specifically adding site based information (https://gerrit.wikimedia.org/r/#/c/147381/), and I've put up a patch to allow the user agent functionality to be usable in more circumstances and be tested more easily. https://gerrit.wikimedia.org/r/#/c/152200/
As it is now a customisable string, it is possible to add email addresses, links to bot approvals, etc, etc. And lightly documented at
https://www.mediawiki.org/wiki/Manual:Pywikibot/User-agent
During the discussions I suggested something like what this bug is about: Identifying what code is running, is it the 'maintainer' version or customised by the bot operator, and putting that in the useragent.
http://article.gmane.org/gmane.science.linguistics.wikipedia.technical/78363 http://article.gmane.org/gmane.science.linguistics.wikipedia.technical/78413
In an IRC discussion with valhallasw, I suggested that we include the contact details of the maintainers of the running script, which can be parsed from the script docstring.
So, currently pywikibot _has_ the commit hash, sequential pywikibot revision, and
It only puts the sequential pywikibot revision into the user-agent, in the variable {version}. The sequential pywikibot revision is only a good reference point, but the running code could be different.
The commit hash is (almost) useless for ops staff, as it frequently changes.
The $Rev$ for each file that is checked in is more granular, but that doesnt help if the script file is modified or isnt checked in.
If I understand this enhancement request, it is suggesting that we get a hash of some/all of module that are used by the running script, and include that in the user-agent.
IMO, the first step is to get a hash for the script/module executed on the command line. This hash will change less frequently, and will often be common even for different branches of pywikibot. If the file is unmodified, I suggest we keep the existing user-agent value for {script}/{version}, which has a version prefix of 'g' and 's' for git or subversion. If the file is modified, I suggest we put the file hash in {version}, with a different prefix - e.g. 'm69789e1' where 'm' is for 'modified'.