Page MenuHomePhabricator

MediaWiki:Missing-revision should provide link to deleted revision for administrators
Closed, ResolvedPublic

Description

https://en.wikipedia.org/wiki/User:Enterprisey/link-deleted-revs should be a core feature of MediaWiki.

Steps to reproduce: Click https://en.wikipedia.org/w/index.php?title=&oldid=844151270

Expected behavior: Show administrators a link to the deleted revision, or the deleted revision itself.

Current behavior: "The revision #844151270 of the page named "Main Page" does not exist."

Possibly related: T59445

Event Timeline

RhinosF1 subscribed.

Is this an issue with deletion, page history, diffs, or something else? Can’t think where it fits best.

Can the title describe the issue better as well?

  • "Main Page" is incorrect.
  • "Does not exist" is incorrect.
  • Lack of a link to the indeed existing deleted revision is uncomfortable.

I sadly don't know which part of the software causes this incorrect message.

  • "Main Page" is incorrect.
  • "Does not exist" is incorrect.
  • Lack of a link to the indeed existing deleted revision is uncomfortable.

I forgot how bad that message really was. If no one beats me to it, I’ll look at some point tommorow to find what message it is and what code uses it so I can tag better.

If it helps, I can at least note that the system message text comes from here: https://en.wikipedia.org/wiki/MediaWiki:Missing-revision

Aklapper renamed this task from "The revision X of the page named "Main Page" does not exist." to MediaWiki:Missing-revision should provide link to deleted revision for administrators.Apr 27 2020, 8:31 AM
Aklapper removed a project: Platform Engineering.
Aklapper removed a project: MediaWiki-General.
Ammarpad subscribed.
  • "Main Page" is incorrect.

This is because &title= is empty in the request so Main Page is used as fallback. If a permalink contains correct title, main page would not be used.

  • "Does not exist" is incorrect.

All deleted revisions are presumed to "not exist". It's debatable, however, whether that's a fair description or not.

  • Lack of a link to the indeed existing deleted revision is uncomfortable.

I have made a patch that adds a diff link to the message. But you may still see the old message in cases where the "revision does not exist" thing still applies even though the revision may "exists" in theory. But I think it's an improvement overall.

@Ammarpad thank you so much! Two quick questions: Would the diff link appear in all cases where the link-deleted-revs script currently displays it? (That is, can I turn off the script once this change goes live?) Also, how does it deal with two revisions that happened in the same second - would the error page of the later one link you to the diff of the first one?

I've just noticed that T251910 occurs with an existing "title=" parameter. Is it entirely unrelated? I have marked it as parent of this task for now, because I thought it's the "larger issue" behind all this. Feel free to undo.

I have made a patch that adds a diff link to the message. But you may still see the old message in cases where the "revision does not exist" thing still applies even though the revision may "exists" in theory. But I think it's an improvement overall.

Can you link the patch to this task? I can't see it (or comment/CR etc.).

Change 596683 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/core@master] Provide link to view diff of deleted revision in missing-rev message

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

In T251066#6107662, @APerson wrote:

@Ammarpad thank you so much! Two quick questions: Would the diff link appear in all cases where the link-deleted-revs script currently displays it?

Thanks. Generally yes, but I'd not say 'in all cases.' Because in core we're checking permission on the revision itself, the link will only appear when the context user has permission to view the revision in question. I see that the script unconditionally creates the link, so relatively speaking, it 'works' even for non-admin and would create link to suppressed edits for non-oversighters; of course either would eventually lead to a hard permission error message. So that's the difference, I believe.

Also, how does it deal with two revisions that happened in the same second - would the error page of the later one link you to the diff of the first one?

I think such cases are rare, but yes, the link will fallback to the first diff (I don't know whether that is deterministic itself, though). That's a core bug unfortunately as the page we're linking to does not accept revision id (which is guaranteed to be unique) as far as I can see and previous attempts to make it so have been left in limbo for years.

Can you link the patch to this task? I can't see it (or comment/CR etc.).

I was occupied with something elsewhere. I uploaded it now.

Change 596683 merged by jenkins-bot:
[mediawiki/core@master] Provide link to view diff of deleted revision in missing-rev message

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

Ok... am I doing something wrong? Because when I visit https://en.wikipedia.org/w/index.php?title=&oldid=844151270, the same URL from the original post of the task, there's no extra text. It seems to be using the interface message missing-revision, not missing-revision-permission. My link-deleted-revs script pulls up the revision, though.

I've confirmed with a couple of other enwiki administrators that there is no revision linked from that page, although this task's status would suggest it is. @Ammarpad could we be doing something wrong with interface message configuration?

The patch doesn't work here because it expects the user-provided title to be correct (it calls getArchivedRevisionRecord($oldid) on the PageArchive, which only looks up revisions for that page—the Main Page in Enterprisey's example, because the provided title is blank).

The correct message is displayed for https://en.wikipedia.org/w/index.php?title=22.86%20Centimetre%20Nails&oldid=844151270, but it would be useful for this message to work if the title is not known, as is often the case.

Also seems like the page should link to the oldid in this case, not the diff.

The patch doesn't work here because it expects the user-provided title to be correct (it calls getArchivedRevisionRecord($oldid) on the PageArchive, which only looks up revisions for that page—the Main Page in Enterprisey's example, because the provided title is blank).

No, that's not the reason. The reason is a bug/old behavior from core T264765

We use title to construct the link, so a title is needed in the request. The links generated by the UI of history and diff pages both contain this parameter, so any link from there would work. I am not sure what tool is generating that URL without the title. The tool should be fixed. (I know the &title= is not required, but nevertheless, history/diff pages have it, so it not bad to ask whatever tool is that to also add it when generating that URL).

T264765 is restricted so I can't confirm what you are saying. Does it suggest that this should work without a correct title? (But that goes against your follow-up comment?) Or that it's unrelated to the behavior of getArchivedRevisionRecord?

There are plenty of situations where you have a link with an oldid or diff but no title. Anything generated via Special:Diff or Special:PermanentLink is an example. The IRC edit feed is as well (though these include the title as part of the message, but not as part of the link). Omitting the the title makes the link much shorter and if it works for not-deleted pages, I don't think it's reasonable to say that it shouldn't work for deleted pages, unless we make it clear the behavior for not-deleted pages is unsupported, or a fluke, etc.

I think the reason why this doesn't work for links with 'oldid' but no 'title' is that back in the day it was impossible to reliably look up a deleted revision by ID only. This was fixed in T193180, but various internal APIs still discourage looking up deleted revisions by just the ID (e.g. there's no function to do that, you'd have to write some custom queries).

I think this could be improved easily enough.

Change 954345 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] ArchivedRevisionLookup: Allow lookups using just the revision ID

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

I think the reason why this doesn't work for links with 'oldid' but no 'title' is that back in the day it was impossible to reliably look up a deleted revision by ID only. This was fixed in T193180, but various internal APIs still discourage looking up deleted revisions by just the ID (e.g. there's no function to do that, you'd have to write some custom queries).

I think this could be improved easily enough.

Without the title provided, it fallbacks to the main page, so the page view would not even go through Article::showMissingArticle().
So, unfortunately, there is more work to do.

Yes, but that can be fixed too. I worked out how to do it, but it affects the same code as T264765, so I'm waiting for a resolution there before I submit the patch.

Change 954345 merged by jenkins-bot:

[mediawiki/core@master] ArchivedRevisionLookup: Allow lookups using just the revision ID

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

Change 955395 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] Show link to view diff of deleted revision also when title not given

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

Jdforrester-WMF subscribed.

Not sure if this warrants an entry in Tech/News; thoughts?

Change 955395 merged by jenkins-bot:

[mediawiki/core@master] Show link to view diff of deleted revision also when title not given

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

matmarex closed this task as Resolved.EditedSep 27 2023, 2:04 AM

Not sure if this warrants an entry in Tech/News; thoughts?

I don't think so, it seems like a minor feature, and the biggest part of it was already implemented 3 years ago by @Ammarpad and I am just finishing up a corner case.