Page MenuHomePhabricator

log entry has no title
Closed, ResolvedPublic

Description

Probably caused by revision deletion of the page?

https://travis-ci.org/wikimedia/pywikibot-core/jobs/43590174

======================================================================
ERROR: testLogEvents (tests.site_tests.SiteUserTestCase)
Test the site.logevents() method.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/wikimedia/pywikibot-core/tests/site_tests.py", line 732, in testLogEvents
    for entry in mysite.logevents(logtype=typ, total=3):
  File "/home/travis/build/wikimedia/pywikibot-core/pywikibot/data/api.py", line 1512, in __iter__
    yield self.result(item)
  File "/home/travis/build/wikimedia/pywikibot-core/pywikibot/data/api.py", line 1710, in result
    return self.entryFactory.create(pagedata)
  File "/home/travis/build/wikimedia/pywikibot-core/pywikibot/logentries.py", line 294, in create
    return self._creator(logdata)
  File "/home/travis/build/wikimedia/pywikibot-core/pywikibot/logentries.py", line 283, in <lambda>
    self._creator = lambda data: logclass(data, self._site)
  File "/home/travis/build/wikimedia/pywikibot-core/pywikibot/logentries.py", line 98, in __init__
    pos = self.data['title'].find('#')
  File "/home/travis/build/wikimedia/pywikibot-core/pywikibot/logentries.py", line 28, in __missing__
    raise KeyError("Log entry has no '%s' key" % key, key)
KeyError: ("Log entry has no 'title' key", 'title')

Event Timeline

jayvdb renamed this task from logenty has no title to log entry has no title.
jayvdb raised the priority of this task from to Low.
jayvdb updated the task description. (Show Details)
jayvdb added a project: Pywikibot.
jayvdb changed Security from none to None.
jayvdb subscribed.

It happened a few times in that build: https://travis-ci.org/wikimedia/pywikibot-core/builds/44664702

and with a bit of debugging info added, .. yes it is revision suppression causing this

WARNING: LogeventsPageGenerator: failed to load page for {u'comment': u'', u'logid': 61024842, u'type': u'newusers', u'timestamp': u'2014-12-20T12:59:28Z', u'actionhidden': u'', u'userhidden': u'', u'suppressed': u''}; skipping
WARNING: LogeventsPageGenerator: failed to load page for {u'comment': u'', u'logid': 61024830, u'type': u'newusers', u'timestamp': u'2014-12-20T12:58:34Z', u'actionhidden': u'', u'userhidden': u'', u'suppressed': u''}; skipping
WARNING: LogeventsPageGenerator: failed to load page for {u'comment': u'', u'logid': 61024686, u'type': u'newusers', u'timestamp': u'2014-12-20T12:49:05Z', u'actionhidden': u'', u'userhidden': u'', u'suppressed': u''}; skipping
WARNING: LogeventsPageGenerator: failed to load page for {u'comment': u'', u'logid': 61024617, u'type': u'newusers', u'timestamp': u'2014-12-20T12:45:20Z', u'actionhidden': u'', u'userhidden': u'', u'suppressed': u''}; skipping

What do you mean with 'revision suppression'?

Change 181255 had a related patch set uploaded (by John Vandenberg):
LogeventsPageGenerator: skip problematic entries

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

Patch-For-Review

revision deletion / revision suppression should be documented on mediawiki.org or meta - it is where a part of the log entry has been hidden from public / sysop eyes by sysops / oversighters respectively (using en.wp terminology and implementation).

Change 181255 merged by jenkins-bot:
LogeventsPageGenerator: skip problematic entries

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

Xqt claimed this task.

A more general solution is needed.

This problem is also occurring in RecentChangesPageGenerator, with a breakage regularly occurring now due to an action on fr.wikt

https://travis-ci.org/wikimedia/pywikibot-core/builds/65682020

Change 216413 had a related patch set uploaded (by John Vandenberg):
Skip RC entries without a title

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

Change 216413 merged by jenkins-bot:
Skip RC entries without a title

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

Change 223863 had a related patch set uploaded (by Merlijn van Deen):
Skip RC entries without a title

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

Change 223863 merged by jenkins-bot:
Skip RC entries without a title

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

Change 230285 had a related patch set uploaded (by Xqt):
[FIX] BlockEntry constructor fails for hidden title

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

Change 230405 had a related patch set uploaded (by John Vandenberg):
Special User subclass for autoblock IDs

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

Xqt lowered the priority of this task from High to Medium.Jan 24 2016, 7:46 AM

Now it raises HiddenKeyError when construction the log entry

=================================== FAILURES ===================================
_________________________ TestLogEvents.test_logevents _________________________

self = <tests.site_tests.TestLogEvents testMethod=test_logevents>

    def test_logevents(self):
        """Test logevents method."""
        mysite = self.get_site()
        le = list(mysite.logevents(total=10))
        self.assertLessEqual(len(le), 10)
        self.assertTrue(all(isinstance(entry, pywikibot.logentries.LogEntry)
                            for entry in le))
        for typ in ("block", "protect", "rights", "delete", "upload",
                    "move", "import", "patrol", "merge"):
>           for entry in mysite.logevents(logtype=typ, total=3):

tests/site_tests.py:1239: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pywikibot/data/api.py:2817: in __iter__
    result = self.result(item)
pywikibot/data/api.py:3033: in result
    return self.entryFactory.create(pagedata)
pywikibot/logentries.py:471: in create
    return self._creator(logdata)
pywikibot/logentries.py:454: in <lambda>
    self._creator = lambda data: logclass(data, self._site)
pywikibot/logentries.py:194: in __init__
    pos = self.data['title'].find('#')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = {u'comment': u'{{uw-uhblock}} <!-- Username violation, hard block -->', u'logi...-04-19T13:45:56Z', u'actionhidden': u'', u'userhidden': u'', u'type': u'block'}
key = 'title'

    def __missing__(self, key):
        """Debug when the key is missing."""
        pywikibot.debug(u"API log entry received:\n" + repr(self),
                        _logger)
        if ((key in ('ns', 'title', 'pageid', 'logpage', 'params', 'action')
             and 'actionhidden' in self)
                or (key == 'comment' and 'commenthidden' in self)
                or (key == 'user' and 'userhidden' in self)):
            raise HiddenKeyError(
                "Log entry ({0}) has a hidden '{1}' key and you don't have "
>               'permission to view it.'.format(self._type, key))
E           HiddenKeyError: Log entry (block) has a hidden 'title' key and you don't have permission to view it.

pywikibot/logentries.py:43: HiddenKeyError

Removing task assignee due to inactivity, as this open task has been assigned to the same person for more than two years (see the emails sent to the task assignee on Oct27 and Nov23). Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome.
(See https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator.)

Current failure log is:

======================================================================
ERROR: test_BlockEntry_tewp (tests.logentries_tests.TestLogentries)
Test a single logtype entry on wikipedia:test
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\pywikibot-g4xqx\tests\aspects.py", line 653, in wrapped_method
    func(self, key)
  File "C:\projects\pywikibot-g4xqx\tests\logentries_tests.py", line 150, in test_logevent
    self._test_logevent(logtype)
  File "C:\projects\pywikibot-g4xqx\tests\logentries_tests.py", line 75, in _test_logevent
    logentry = self._get_logentry(logtype)
  File "C:\projects\pywikibot-g4xqx\tests\logentries_tests.py", line 68, in _get_logentry
    le = next(iter(self.site.logevents(logtype=logtype, total=1)))
  File "C:\projects\pywikibot-g4xqx\pywikibot\data\api.py", line 2609, in __iter__
    yield from self._extract_results(resultdata)
  File "C:\projects\pywikibot-g4xqx\pywikibot\data\api.py", line 2558, in _extract_results
    result = self.result(item)
  File "C:\projects\pywikibot-g4xqx\pywikibot\data\api.py", line 2833, in result
    return self.entryFactory.create(pagedata)
  File "C:\projects\pywikibot-g4xqx\pywikibot\logentries.py", line 367, in create
    return self._creator(logdata)
  File "C:\projects\pywikibot-g4xqx\pywikibot\logentries.py", line 357, in <lambda>
    self._creator = lambda data: logclass(data, self._site)
  File "C:\projects\pywikibot-g4xqx\pywikibot\logentries.py", line 159, in __init__
    pos = self['title'].find('#')
  File "c:\python353-x64\lib\collections\__init__.py", line 988, in __getitem__
    return self.__class__.__missing__(self, key)
  File "C:\projects\pywikibot-g4xqx\pywikibot\logentries.py", line 63, in __missing__
    'permission to view it.'.format(self['type'], key))
pywikibot.exceptions.HiddenKeyError: Log entry (block) has a hidden 'title' key and you don't have permission to view it.

https://ci.appveyor.com/project/Ladsgroup/pywikibot-g4xqx/builds/42694768/job/9w6g9cyg0f0fdhmp#L4819
https://integration.wikimedia.org/ci/job/pywikibot-core-tox-deeptest-py36-docker/821/console

Change 230285 merged by Xqt:

[pywikibot/core@master] [FIX] BlockEntry constructor fails for hidden title

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

Xqt removed a project: Patch-Needs-Improvement.