Page MenuHomePhabricator

Fatal in getUserLinks for a revision that undoes a suppression
Closed, ResolvedPublicPRODUCTION ERROR

Description

https://he.wikipedia.org/w/index.php?title=%D7%A9%D7%99%D7%97%D7%AA_%D7%9E%D7%A9%D7%AA%D7%9E%D7%A9:Amire80&offset=sdz2zmduqy6i3e83&action=history&uselang=en

2015-03-21 22:20:33 mw1039 hewiki: [bb869023] /w/index.php?title=%D7%A9%D7%99%D7%97%D7%AA_%D7%9E%D7%A9%D7%AA%D7%9E%D7%A9:Amire80&action=history&uselang=en Flow\Exception\FlowException from line 90 of /srv/mediawiki/php-1.25wmf21/extensions/Flow/includes/Templating.php: Insufficient permissions to see userlinks for rev_id = sdz2yqxntmi9sy48

Root issue seems to be that getUserLinks is called from the history formatApi when they don't have permission to view that history row.

Event Timeline

Mattflaschen-WMF claimed this task.
Mattflaschen-WMF raised the priority of this task from to Unbreak Now!.
Mattflaschen-WMF updated the task description. (Show Details)
Krenair subscribed.
2015-03-21 22:20:33 mw1039 hewiki: [bb869023] /w/index.php?title=%D7%A9%D7%99%D7%97%D7%AA_%D7%9E%D7%A9%D7%AA%D7%9E%D7%A9:Amire80&action=history&uselang=en   Flow\Exception\FlowException from line 90 of /srv/mediawiki/php-1.25wmf21/extensions/Flow/includes/Templating.php: Insufficient permissions to see userlinks for rev_id = sdz2yqxntmi9sy48

It may be useful to know the following: The history worked earlier today. To experiment with some stuff, I made the board header empty. To restore it, I clicked the diff in the page history where I deleted it and got an error. Since then I cannot see the history page at all.

The root error seems to be:

$last = $cache->getLastRevisionFor( $header );

Caught exception Flow\Exception\InvalidDataException: Revisions for sdz2x83s6yzg3zez could not be found

where $header is a Header object corresponding to sdz2yqxntmi9sy48 .

It may be useful to know the following: The history worked earlier today. To experiment with some stuff, I made the board header empty.

Okay, I think I found this in the logs:

2015-03-21 20:54:17 mw1043 hewiki: [08e3d6ce] /w/index.php?title=%D7%A9%D7%99%D7%97%D7%AA_%D7%9E%D7%A9%D7%AA%D7%9E%D7%A9:Amire80&action=compare-header-revisions&header_newRevision=sdz1gou6maddn1u6   Flow\Exception\WrongNumberArgumentsException from line 520 of /srv/mediawiki/php-1.25wmf21/extensions/Flow/includes/TemplateHelper.php: Expected nine arguments but received 7
2015-03-21 21:12:27 mw1218 hewiki: [ac52974f] /w/index.php?title=%D7%A9%D7%99%D7%97%D7%AA_%D7%9E%D7%A9%D7%AA%D7%9E%D7%A9:Amire80&action=compare-header-revisions&header_newRevision=sdz1gou6maddn1u6   Flow\Exception\WrongNumberArgumentsException from line 520 of /srv/mediawiki/php-1.25wmf21/extensions/Flow/includes/TemplateHelper.php: Expected nine arguments but received 7
2015-03-22 00:49:31 mw1257 hewiki: [7df478d5] /w/index.php?title=%D7%A9%D7%99%D7%97%D7%AA_%D7%9E%D7%A9%D7%AA%D7%9E%D7%A9:Amire80&action=compare-header-revisions&header_newRevision=sdz1gou6maddn1u6   Flow\Exception\WrongNumberArgumentsException from line 520 of /srv/mediawiki/php-1.25wmf21/extensions/Flow/includes/TemplateHelper.php: Expected nine arguments but received 7
2015-03-22 00:49:45 mw1067 hewiki: [861240fc] /w/index.php?title=%D7%A9%D7%99%D7%97%D7%AA_%D7%9E%D7%A9%D7%AA%D7%9E%D7%A9:Amire80&action=compare-header-revisions&header_newRevision=sdz1gou6maddn1u6   Flow\Exception\WrongNumberArgumentsException from line 520 of /srv/mediawiki/php-1.25wmf21/extensions/Flow/includes/TemplateHelper.php: Expected nine arguments but received 7

Since this happened repeatedly all on the same branch, it looks like header editing is entirely broken on the 1.25wmf21 branch. I tested this earlier tonight, but that was on 1.25wmf22.

It may be useful to know the following: The history worked earlier today. To experiment with some stuff, I made the board header empty. To restore it, I clicked the diff in the page history where I deleted it and got an error. Since then I cannot see the history page at all.

Can you go into a little more depth here?

When you made it empty, did you just use the pencil icon, empty the header field, then save? Do you recall getting any errors here?

I see you then checked the diff. When first showing the diff, it probably showed an error from T93504.

When you say, "I deleted it", you're just referring to your prior action of blanking the header (not an additional action), right?

Also, am I correct in understanding you didn't actually use any 'delete' UI?

Tomorrow, I'll try to look further at sdz2x83s6yzg3zez.

In T93492#1138864, @Mattflaschen wrote:

It may be useful to know the following: The history worked earlier today. To experiment with some stuff, I made the board header empty. To restore it, I clicked the diff in the page history where I deleted it and got an error. Since then I cannot see the history page at all.

Can you go into a little more depth here?

When you made it empty, did you just use the pencil icon, empty the header field, then save? Do you recall getting any errors here?

Yes - I blanked: pencil icon, empty the header field, then save. I don't recall any errors.

I see you then checked the diff. When first showing the diff, it probably showed an error from T93504.

Possibly. Unfortunately, I don't remember.

When you say, "I deleted it", you're just referring to your prior action of blanking the header (not an additional action), right?

Yes, blanking.

Also, am I correct in understanding you didn't actually use any 'delete' UI?

No, not delete UI.

In T93492#1138687, @Mattflaschen wrote:

where $header is a Header object corresponding to sdz2yqxntmi9sy48 .

Actually, this is a post (I should have verified this first), which rendered my "root error" comment wrong (I think it couldn't find any revisions since it was using the wrong Storage).

For my future reference, a short way to check this and other info is:

> echo strtoupper( Flow\Model\UUID::alnum2hex( Flow\Model\UUID::create( 'sdz2yqxntmi9sy48' )->getAlphadecimal() ) );
0530F87BEDEBFC660E6CB8
> echo strtoupper( Flow\Model\UUID::alnum2hex( Flow\Model\UUID::create( 'sdz2x83s6yzg3zez' )->getAlphadecimal() ) );
0530F87925B84A239EF20B
SELECT HEX(rev_id), rev_type, HEX(rev_type_id), rev_change_type, rev_mod_reason FROM flow_revision WHERE HEX(rev_id) = '0530F87BEDEBFC660E6CB8';
+------------------------+----------+------------------------+-----------------+----------------------------+
| HEX(rev_id)            | rev_type | HEX(rev_type_id)       | rev_change_type | rev_mod_reason             |
+------------------------+----------+------------------------+-----------------+----------------------------+
| 0530F87BEDEBFC660E6CB8 | post     | 0530F87925B84A239EF20B | restore-topic   | <flow-topic-undo-suppress> |
+------------------------+----------+------------------------+-----------------+----------------------------+

The real issue seems to be https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FFlow.git/2bfc84772d5dc914b23f60f6f4afcdd7e5d0e1d2/FlowActions.php#L710 . As shown above, this is a restore from a suppression (using the undo moderation link):

$container = Flow\Container::getContainer();
$storage = $container['storage'];
$postObjectManager = $storage->getStorage( 'post' );
$revId = Flow\Model\UUID::create( 'sdz2yqxntmi9sy48' );
$post = $postObjectManager->get( $revId );
echo 'Original post ID: ';
echo strtoupper( Flow\Model\UUID::alnum2hex( $post->getRevisionId() ) );

$collection = $post->getCollection();
$previous = $collection->getPrevRevision( $post );
echo strtoupper( Flow\Model\UUID::alnum2hex( $previous->getRevisionId() ) );
SELECT HEX(rev_id), rev_type, rev_change_type, HEX(rev_type_id) FROM flow_revision WHERE HEX(rev_id) = '0530F87BBA7C50C77B07A4';
+------------------------+----------+-----------------+------------------------+
| HEX(rev_id)            | rev_type | rev_change_type | HEX(rev_type_id)       |
+------------------------+----------+-----------------+------------------------+
| 0530F87BBA7C50C77B07A4 | post     | suppress-topic  | 0530F87925B84A239EF20B |
+------------------------+----------+-----------------+------------------------+

If this is the rule for suppression, then we need to simply drop the row for users without permission, rather than trying to show it then triggering an error.

Mattflaschen-WMF renamed this task from Fatal on Amire80's user talk page to Fatal in getUserLinks for a revision that undoes a suppression.Mar 24 2015, 1:15 AM
Mattflaschen-WMF updated the task description. (Show Details)

I updated the link since the row causing the exception scrolled off due to newer activity.

Change 199188 had a related patch set uploaded (by Mattflaschen):
Don't assume you can view history for a rev if you can view content

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

Change 199188 merged by jenkins-bot:
Don't assume you can view history for a rev if you can view content

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

Change 199677 had a related patch set uploaded (by EBernhardson):
Don't assume you can view history for a rev if you can view content

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

Needs to be cherry-picked to 22 as well.

Change 199678 had a related patch set uploaded (by EBernhardson):
Don't assume you can view history for a rev if you can view content

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

Change 199677 merged by jenkins-bot:
Don't assume you can view history for a rev if you can view content

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

Change 199678 merged by jenkins-bot:
Don't assume you can view history for a rev if you can view content

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

Deployed and confirmed. The URL in the description (which was hitting the bug before) now works.

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:11 PM