Variable article_first_contributor always returns empty string in eswiki
Closed, InvalidPublic3 Story Points

Description

When trying to use the Abusefilter variable article_first_contributor in eswiki filters, I found that the only way for the condition to return true is: article_first_contributor == "". I don't know if the variable works in other wikis, if other variables are affected, or if it has worked before, since it was implemented ( T69793).

See AbuseFilterVariableHolder.php for the relevant code.

Acceptance criteria

  • The article_first_contributor AbuseFilter condition should function properly on all wikis with AbuseFilter enabled

Note: this may be a bug on all wikis; this ticket includes checking out whether the bug applies everywhere.

-jem- created this task.Mar 8 2017, 5:53 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 8 2017, 5:53 PM
kaldari updated the task description. (Show Details)Jul 7 2017, 11:34 PM
TBolliger moved this task from Untriaged to Cards ready for development on the Anti-Harassment board.
TBolliger added a subscriber: TBolliger.
TBolliger updated the task description. (Show Details)Jul 24 2017, 9:04 PM
DannyH updated the task description. (Show Details)Jul 25 2017, 5:37 PM
kaldari set the point value for this task to 3.Jul 25 2017, 5:39 PM
dbarratt claimed this task.
dbarratt changed the task status from Open to Stalled.Aug 4 2017, 11:12 PM

@-jem-

I can't replicate this issue. Although I did notice that it is case sensitive.

Do you have some test usernames I can try? Can you verify this is still an issue?

-jem- added a comment.Aug 5 2017, 6:51 PM

@dbarratt: The issue is still there. No need for test usernames; I just use the "examine" interface for any abusefilter log entry, and from any test code that matches the change, if I add

& article_first_contributor == ""

the test remains positive, but with the correct or any other value inside the "", the test doesn't match. I've checked again a few minutes ago.

@-jem-

Can you provide a url to the log entry that failed?

-jem- added a comment.EditedAug 5 2017, 7:29 PM

@dbarratt I didn't get a fail. I wanted to include article_first_contributor in an existing filter (to let the article creator remove his/her text), and when I began doing tests with it, as explained, I found the problem, so I didn't move on, as it was obvious it wasn't going to work "in production".

@-jem-

Can you try something like this?

article_first_contributor == user_name
-jem- added a comment.Aug 7 2017, 7:00 PM

@dbarratt , I've tried and the results are as expected: user_name has always correct data, so, as it can't never be an empty string, when I test

article_first_contributor == user_name

the result is always false. And I've also discovered that, when I use the "Test a filter against previous edits" page, article_first_contributor does have always the correct value, but I'm using the "Examine individual changes" page from any log entry, and the value is always empty there (but other variables, including user_name, have the correct values).

@-jem-

It looks like the value is lazy loaded, which means it only gets it if it is being used. If it isn't in use when the filter is executed then it's an empty string (as far as I can tell).

@-jem-

Can you send me an example edit where article_first_contributor == user_name returns false where it should be true ?

dbarratt reassigned this task from dbarratt to -jem-.Aug 9 2017, 4:23 PM
dbarratt added a subscriber: dbarratt.
dbarratt added a comment.EditedAug 16 2017, 2:35 PM

@-jem- We're you able to find an example? I mean I can go into es wiki and add one, but I didn't want to mess anything up. :)

-jem- added a comment.EditedAug 17 2017, 7:06 PM

@dbarratt , as I said, I have done just tests, and I'm not aware of article_first_contributor being used in any filter, so I have no examples; but after your previous comment of the "lazy load", I think that maybe it works "in production" even if it doesn't in the tests (which should be fixed anyway, or documented, at least), so I want to add it to a filter and check its log afterwards, but I have been busy these days. It's no problem if you want to try it yourself :), I'll do it in a few days, I hope.

Daimona added a subscriber: Daimona.

@-jem- I tried to replicate the issue, both on my local wiki and on it.wiki, but it doesn't appear: article_first_contributor is never empty. Since I don't have enough rights, could you please check if this still happens on es.wiki? IMHO there's nothing wrong with that variable, and the issue may actually be something else (e.g. T168736).

Daimona closed this task as Invalid.Apr 4 2018, 12:57 PM

Now I got it. As dbarratt said above, the value is lazy loaded. This means that if no filter uses this variable (or, better, no filter computes it), it won't be saved for any action. So it's intended that if you examine a past log, generated when article_first_contributor wasn't used, the variable isn't populated. Instead, if you try it in batch testing it has a value (and you noticed it yourself) and it'll also have one for single logs if you add a filter that uses it.