Page MenuHomePhabricator

113: The script can't return from empty lists
Closed, DeclinedPublic

Description

Hi. Reproducing steps.

  1. Open a GW with multiple unseen edits.
  2. Read them in other tabs one by one.
  3. Click Refresh.
  4. The watchlist shows .globalWatch-col only.
  5. Wait a lot of time, say a day.
  6. Open other GW in other tab.
  7. Make sure there are a lot of edits there.
  8. Go to the original tab.
  9. Click refresh.
  10. The watchlist shows .globalWatch-col only, while expecting the new edits.
  11. It includes all the wikis in the settings, not just those that have no edits at this moment.
  12. The console outputs that the feed is legal, all the edits are there, they are just not shown.
  13. The Inspector shows there are no hidden elements over there.
  14. Click refresh again.
  15. Get the same result.
  16. Click F5.
  17. Get the expected result this time.

Looks like it's not happening every time, but at least once a day I can see that.
Thank you.

Related Objects

Event Timeline

IKhitron created this task.Feb 17 2020, 1:02 PM
Restricted Application assigned this task to DannyS712. · View Herald TranscriptFeb 17 2020, 1:02 PM
Restricted Application added a subscriber: DannyS712. · View Herald Transcript
DannyS712 updated the task description. (Show Details)Feb 17 2020, 5:41 PM
Restricted Application added a project: User-DannyS712. · View Herald TranscriptFeb 17 2020, 5:41 PM

Please paste the console output

Do you mean to spend an hour to open all the objects again, or the new one you've added?

Do you mean to spend an hour to open all the objects again, or the new one you've added?

The console outputs that the feed is legal, all the edits are there, they are just not shown. - I need to know what it says
But, you should be able to type console.log( GlobalWatchlist.debugLog );, which will have something easy to copy and will take care of the objects

For example,

GlobalWatchlist@www.wikidata:getWikidataLabels wdlabels: index.php:195:11
{…}
​
Q17523682: Object { type: "item", id: "Q17523682", labels: {…} }
​
<prototype>: Object { … }
index.php:196:11

About the debugLog, where do you want me to paste it?

Masumrezarock100 added a comment.EditedFeb 17 2020, 6:34 PM

About the debugLog, where do you want me to paste it?

On Phabricator likely. Use either form 14 (for public paste) or form 45 (for private paste). You should be able to see the forms since I have now added you to Trusted-Contributors group.

One more observation. I did a lot of tests in the last couple of hours, and can focus the problem much better.

  1. Open the GW.
  2. Open in other tabs and read all the shown diffs for some wiki.
  3. Click refresh.
  4. See the list is gone to globalWatch-col.
  5. Wait until there will be at least one new edit from that wiki.
  6. Click refresh.
  7. Expected: The list moves from globalWatch-col up and shows the new edits.
  8. Got: The list remains in globalWatch-col without showing edits.
DannyS712 renamed this task from The script can't return from empty lists to 113: The script can't return from empty lists.Feb 17 2020, 11:07 PM

@IKhitron looking through the paste, it seems like this isn't a bug with the script: at line 344, eg, you can see a refresh start, and the api response it gets is empty for all of the sites. This is the response before any processing by the script

I do not understand. Do you mean that you're going to remove the refresh button entirely, because api does not support its functionality? And there us nothing you can do?

I do not understand. Do you mean that you're going to remove the refresh button entirely, because api does not support its functionality? And there us nothing you can do?

No, I'm saying that, in this case, the refresh button is working fine, and its the api that isn't returning properly; i.e., this is an Upstream issue with MediaWiki-API

Exactly what I said, you can't use the refresh button, because api does not return the right answer.

Exactly what I said, you can't use the refresh button, because api does not return the right answer.

But I'm not removing the refresh button

So it will remain there, but will not work?

So it will remain there, but will not work?

it should work. When it doesn't work, its because of an issue with the api, not the script

Nevermind why. The result is that the button does not do what it supposed to do.

DannyS712 closed this task as Invalid.Feb 18 2020, 2:08 AM

Nevermind why. The result is that the button does not do what it supposed to do.

Only because of some other issue; there is no problem with the script, and nothing that I can do

Yes, you can. You can remove the Refresh button, because it can't work as promised. In any case, I'll try to find some time to investigate this. Seems quite impossible that api returns different answers in different tabs at the same time, depends on the screen layout, which this api even does not need to see. Maybe the api just gets wrong parameters from the script in this case - timestamp or something else and as a result of this return wrong answer. Especially when we can see the right answer on the console, and it must come from somewhere, it is new, so couldn't remain from before. @Masumrezarock100, can you help in this investigation, please?

IKhitron added a comment.EditedFeb 18 2020, 12:56 PM

Well, working on this in meta:User:IKhitron/Global Watchlist.js. Now I'm certain that the problem is in script, in api usage, and not in api itself. This what I have now on a console, while there is no wikidata in the list:


and this what I have in another tab, after F5:

As you can see, there is the same wikidata item in both, Q9095390, and the same summary, and all the relevant data. So, the script is aware about this edit, it just do not show it. So, the task closing was too soon. Continuing to work on this.

DannyS712 reopened this task as Open.Feb 18 2020, 1:41 PM

Continuing working. Opened two windows on hewiki with GL on the same wiki, emptied all, waited to a new edit. Clicked Refresh on the first, get nothing. Clicked F5 on the second, get the result. After running a query on both consules, get the same output:

var api = new mw.ForeignApi( 'https://ru.wikipedia.org/w/api.php' );
api.get( {
    action: 'query',
    list: 'watchlist',
    wlshow: 'unread'
} ).done( function ( data ) {
    console.log( data );
} );
Object { abort: abort(), state: state(), always: always(), catch: catch(), pipe: pipe(), then: then(), promise: promise(), progress: add(), done: add(), fail: add()
 }

{}

batchcomplete: ""

query: {}
​​
watchlist: (1) []
​​​
0: Object { type: "edit", ns: 0, title: "Бердымухамедов, Гурбангулы Мяликгулыевич",  }
​​​
length: 1
​​​
<prototype>: Array []
​​
<prototype>: Object {  }

<prototype>: Object {  }
DannyS712 closed this task as Declined.Jun 11 2020, 5:24 AM

[batch] My grant to create a global watchlist extension has been approved, and I will no longer be working on the user script. Please file any new bug reports and feature requests with the extension rather than here.

Hi, @DannyS712. Congrats. I can understand why you've declined all the future requests. But I do not see why to decline this. The main software engineering rule that I teach my students every year is "Never make red refactoring". If something is broken, you can't convert the script to the extension, you should make the script green first. Only if you're going to forget about the script code and write the extension from scratch. It's possible, but it's a waste of time. Not saying that it will be broken for script users in the four years that will take to write and deploy the extension.

Hi, @DannyS712. Congrats. I can understand why you've declined all the future requests. But I do not see why to decline this. The main software engineering rule that I teach my students every year is "Never make red refactoring". If something is broken, you can't convert the script to the extension, you should make the script green first. Only if you're going to forget about the script code and write the extension from scratch. It's possible, but it's a waste of time. Not saying that it will be broken for script users in the four years that will take to write and deploy the extension.

I'm planning on rewriting most of it from scratch, and this doesn't seem like it affects many users. Sorry, but I just don't have time to work on this. If you would like to submit a patch to fix it (just tell me what to change, or have a fork on meta with the fixed code) I'll take a look though

IKhitron added a comment.EditedJun 15 2020, 2:14 PM

Well, I think it affects all the users, it's just too difficult to pay attention that the displayed data is wrong. A pity.