Page MenuHomePhabricator

MobileDiff redirect page uses Codex markup without appropriate style pack
Closed, ResolvedPublic2 Estimated Story PointsBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

  • A Codex message box appears at the top of the page
  • A warning message is sent to logstash (code,

Screenshot 2024-12-09 at 1.11.37 PM.png (472×2 px, 76 KB)

What should have happened instead?:

  • Please add the mediawiki.codex.messagebox.styles module to the page explicitly.

Event Timeline

Jdlrobson moved this task from Backlog to Small isolated bugs on the Web-Team-Housekeeping board.
Jdlrobson added a project: patch-welcome.

Forgive me if this is a stupid idea, but now that (to my knowledge) Special:MobileDiff has been sunsetted (T358293?), would it make sense to just redirect it to Special:Diff when it's called without any parameters? That would fix this issue, and would also mean that anyone going to Special:MobileDiff would be taken to the form at Special:Diff instead of being shown an error message.

@A_smart_kitten yes I think that would be fine. Patch very much welcome!

I will attempt to submit a patch to do that within the next few days if I can. Hopefully I don’t mess anything up too badly…

@Jdlrobson (and/or anyone else): Would it matter if there's a redirect chain from Special:MobileDiff/1234 -> Special:Diff/1234 -> index.php?diff=1234? I ask because, if that isn't an issue, the SpecialMobileDiff class might just be able to be replaced with the following:

class SpecialMobileDiff extends SpecialRedirectToSpecial {
	public function __construct() {
		parent::__construct( 'MobileDiff', 'Diff' );
	}
}

Doing this may also reduce the possibility of future tech-debt, as it would remove the logic in SpecialMobileDiff::getDesktopUrl() that currently appears to at least partially duplicate logic in the mw/core file SpecialDiff::getRedirect(); and would mean that - in the (albeit potentially unlikely) event of any changes being made to the inner functionality of Special:Diff - the changes should be (effectively) automatically mirrored to Special:MobileDiff.

Annoyingly, specialpage/RedirectSpecialPage.php (and therefore by inheritance specialpage/SpecialRedirectToSpecial.php) doesn't currently have an option to redirect with a custom response code, as is currently done (with a 301 status code) in SpecialMobileDiff.php. Then again, core Special:Diff/1234 redirects to index.php?diff=1234 with a 302 code (due to SpecialDiff itself extending RedirectSpecialPage), so maybe it wouldn't be an issue for Special:MobileDiff to switch from issuing 301 redirects to 302s?

@A_smart_kitten I think that would be fine. The main goal of this task is to not break the web and traffic on these URL's is likely to be very low at this point.

Jdlrobson changed the task status from Open to In Progress.Jan 10 2025, 11:37 PM
Jdlrobson moved this task from Incoming to Sprint Backlog on the Web-Team board.
Jdlrobson set the point value for this task to 2.Jan 10 2025, 11:54 PM

Turns out I was wrong about being able to redirect it directly to Special:Diff in all cases -- I think I misread the logic in SpecialMobileDiff, and didn't initially see that it gets called like Special:MobileDiff/oldid...diff rather than Special:MobileDiff/oldid/diff.

I've put something together that I think resolves this, but because it'd be my first patch to a MediaWiki repo, I'm not completely sure on some of the things about exactly how the code/comments should be formatted/structured/etc . I'll push it to Gerrit shortly as a WIP patch and keep reading through the contributor docs myself, and if there's anything in the patch that could do with changing/being improved then please leave a comment on it :)

Change #1110047 had a related patch set uploaded (by A smart kitten; author: A smart kitten):

[mediawiki/extensions/MobileFrontend@master] [WIP] MobileDiff: Redirect to Special:Diff when called without parameters

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

Change #1110047 had a related patch set uploaded (by A smart kitten; author: A smart kitten):

[mediawiki/extensions/MobileFrontend@master] [WIP] MobileDiff: Redirect to Special:Diff when called without parameters

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

I've now uploaded an updated patch that is no longer WIP, and should (hopefully) now be in a good state for review

Change #1110047 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] MobileDiff: Redirect to Special:Diff when visited without a subpage

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

Jdlrobson added a project: Verified.

Thanks @A_smart_kitten for working on this (and for the creative solution/improvement)!
Your code is live and working on https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Special:MobileDiff and will be in production early next week :-)

@Jdlrobson No problem! Glad to help :) (also, ignore the last comment I left on Gerrit, I clicked a button without knowing what it does lol)

On a semi-related note, is this an issue? (from https://integration.wikimedia.org/ci/job/mwext-phpunit-coverage-patch/22848/console)

16:24:04 Generating code coverage report in Clover XML format ... done [00:00.198]
16:24:04 #!/usr/bin/env php
16:24:04 PHP Warning:  file_get_contents(specials/SpecialMobileDiff.php): failed to open stream: No such file or directory in /opt/phpunit-patch-coverage/vendor/mediawiki/phpunit-patch-coverage/src/CheckCommand.php on line 150

Not sure what happened there but don't worry about it!