[14:08:14] [[Tech]]; 129.0.210.246; ABBASALI; https://meta.wikimedia.org/w/index.php?diff=18829457&oldid=18812474&rcid=13116047 [14:10:31] [[Tech]]; Defender; Reverted changes by [[Special:Contributions/129.0.210.246|129.0.210.246]] ([[User talk:129.0.210.246|talk]]) to last version by ArchiverBot; https://meta.wikimedia.org/w/index.php?diff=18829463&oldid=18829457&rcid=13116055 [15:00:16] Technical Advice IRC meeting starting in 60 minutes in channel #wikimedia-tech, hosts: @amir1 & @Thiemo_WMDE - all questions welcome, more infos: https://www.mediawiki.org/wiki/Technical_Advice_IRC_Meeting [15:00:26] Hello there o/ [15:50:16] Technical Advice IRC meeting starting in 10 minutes in channel #wikimedia-tech, hosts: @amir1 & @Thiemo_WMDE - all questions welcome, more infos: https://www.mediawiki.org/wiki/Technical_Advice_IRC_Meeting [16:01:49] o/ [16:02:07] o/ [16:02:17] Hello tech people. [16:02:19] Hello and welcome to TAIM. Thiemo_WMDE and I are your hosts today [16:03:18] xSavitar: o/ [16:05:07] Q1. Can one escape using global $IP like other globals such as $wgVersion? One way is using Config to get the values of such but I'm wondering how that can be done with $IP. Any ideas please? [16:05:44] According to https://www.mediawiki.org/wiki/Technical_Advice_IRC_Meeting we don't have questions prepared. Today is your chance to ask all the ORES questions you might have, and everything else. [16:06:04] xSavitar: Mostly services [16:06:10] let me show an example [16:06:17] Okay, nice! :) [16:06:18] (and context object) [16:07:42] xSavitar: https://github.com/wikimedia/mediawiki-extensions-Cognate/blob/master/src/ServiceWiring.php#L35 [16:07:55] While you're getting the example, I've used MediaWikiServices to get $wgParser that was deprecated in 1.32 [16:07:57] This is one example of getting the config from services [16:08:12] Okay! [16:08:58] The other option is get the context that is injected to the class (e.g. an API module, Special page, etc.) [16:09:08] So Amir1, from that example you just shared, one needs to write a service for getting $IP right? Or does one already exist? [16:09:51] Amir1: For the second option, you mean something like RequestContext::getMain()->getConfig()->get(...) right? [16:10:21] xSavitar: Sorry to ask, but what is the issue you want to solve? As far as I can tell it's fine to use the global $IP. [16:11:07] Thiemo_WMDE: I'm working on this currently: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/487057 [16:11:14] It should be used like this: MediawikiServices::getInstance()->getMainConfig()->get( 'CognateCluster' ); [16:11:26] xSavitar: This would give you the config value [16:11:32] And yes, global $IP is fine but I'm just wondering if there are better alternatives apart from using global [16:11:43] it's better to inject the "mainConfig" object though but it's optional [16:12:28] xSavitar: Can I see the gerrit patch? [16:12:31] I might have an idea [16:12:39] Amir1: Yeah, this is it: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/487057 [16:13:02] Amir1: Thanks! Using services is fine by me or even context. [16:13:21] xSavitar: In that case it's better to use the context injected to the special page class [16:13:35] replace RequestContext::getMain()->getConfig(); with $this->context->getConfig() [16:14:17] s/$this->context/$this->getContext() [16:14:48] Okay! $this->getContext()->getConfig() should do the trick you mean? [16:15:03] yup [16:15:24] on top of that, ->get( 'IP' )? [16:15:31] but regarding $IP is not part of config [16:15:36] Exactly [16:15:39] it's not accessible [16:15:48] I tried it and it didn't work. You're perfectly correct! [16:16:06] Maybe a service can be introduced for that? [16:16:15] I don't have any better alternative for $IP, maybe we can define a config variable in a central place [16:16:22] xSavitar: I would suggest to not touch any code using $IP for the patch you are currently working on. Focus on the other stuff first. [16:16:23] Or just use global $IP for this special case as Thiemo_WMDE suggested? [16:16:34] it's very speciall [16:16:37] *special [16:17:04] You're right! That is why I've been dealing with other issues and left $IP as-is [16:17:19] I wanted clues and better ideas in the meeting before moving ahead with the patch [16:17:30] So in that case, global $IP is fine ATM [16:17:59] It's not fine (no global is fine :D) but we don't have a good alternative for now [16:18:10] Okay! [16:18:13] :) [16:20:24] Q2. How does one know following the deprecation policy here: https://www.mediawiki.org/wiki/Deprecation_policy when a deprecated variable or method or class should be finally removed [16:20:44] Sometimes I see variables, methods etc saying they have been deprecated from mw 1.xx [16:20:57] But doesn't state which version of mw that method or var etc should be removed [16:21:21] I've seen some cases that explicitly say that but rare. So I'm wondering if that should be highlighted too? [16:21:29] Just a suggestion, not really a technical question per say [16:22:24] Amir1, Thiemo_WMDE, ^^ [16:22:28] Deprecation is just a marker, but doesn't actually change the code. Removal on the other hand will break stuff when it is still used, but gone. Usually this means we remove stuff only when we are sure it is not used any more (according to our codesearch). [16:23:36] My personal opinion is: having a deprecation sit there for a long time is not a big issue. It's important to not introduce new usages of deprecated code. But actually removing it can wait. [16:23:42] xSavitar: we usually let one release pass after removing a deprecated functionality so things that are deprecated in 1.32 and 1.33 should better stay [16:24:19] Letting 1 release pass is the minimum. But it can be dragged for many, many versions when it's hard to remove/replace usages. [16:24:38] Cool! [16:24:51] Also assuming that some extensions don't have very active contributors as others [16:25:03] So some extensions using such could be lagging behind [16:25:19] And removing those could break the usage of those extensions [16:25:23] xSavitar: To be fair, we only care about WMF-deployed extensions which they should have a maintainer [16:25:26] Makes a lot of sense, thanks thanks [16:25:38] Oh okay! [16:25:38] others would just follow the release cycle [16:25:55] Alright, nice! [16:26:41] Amir1: But you know sometimes it's not also easy to follow the release cycle [16:26:56] Especially when things are moving pretty fast [16:27:11] On one hand and catching up is slow on the other [16:27:22] yeah [16:27:44] But generally I get the point. Thanks! [16:27:57] There are things that make changes easier, like avoid using globals and such (standard software engineering practices) [16:28:14] but they are not followed in lots of extensions [16:28:41] Yeah! [16:28:41] xSavitar: I tend to think of deprecated code as non-existing. We should act like it is not there, not use it, and replace usages when we can. Some day we will realize it is not used any more. [16:29:18] Thiemo_WMDE: Cool! :) [16:29:42] Meaning patches coming in with deprecated usage shouldn't be adviced to be merged right? [16:29:48] As it's causing more harm than good in the long run [16:30:24] xSavitar: They ones that introduce new usages on deprecated functionalities definitely should get a -1 [16:30:53] * xSavitar jots down this review tip! [16:31:59] xSavitar: As always, the answer is "it depends". ;-) Usually it's worth a -1, but only if a replacement exists. Sometimes it doesn't. [16:32:57] Thiemo_WMDE: Cool! That raises another question. Why should something be deprecated if one isn't working or there isn't a replace for it on board? [16:33:09] *replacement [16:33:52] Or maybe it's the kind of deprecation whose future doesn't want to be supported anymore? [16:34:09] Like this is the last version of xyz and we are removing this support from core etc [16:34:21] it can have lots of reasons [16:34:38] Okay! [16:34:52] it can be there to address technical debt (e.g. we recently split a huge class to several small ones) [16:35:06] So in that case, one should double check before dropping a -1 as Thiemo_WMDE mentioned then :) [16:35:07] the main class got deprecated [16:35:12] yup [16:35:28] Oh nice! That example is a good illustration point. Thanks [16:36:31] Q3. I had a weird scenario today on this patch! [16:36:37] https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Renameuser/+/487134 [16:37:07] I and Thiemo_WMDE have a question (right Thiemo)? [16:37:36] So the idea is a call to Title::moveTo() passes the reason with $this->msg() causes phan to throw a warning [16:37:55] one thing: The hook handlers should not return any value (that got deprecated :P) [16:37:56] But assigning the value of $this->msg() to a variable doesn't, now sure why [16:39:49] Amir1: Ohhhh yeah! Needs to be removed [16:39:57] I'll update that patch soon :), thanks very much! [16:40:31] Plus, styling convention, one argument per line when is too big [16:41:03] :) [16:41:18] the big reason is php is stupid and unlike python doesn't have named arguments, so it's better 1- not to have too many arguments 2- make sure it's very visible [16:41:45] if you call the function in wrong order things break (one month ago I caused data corruption because of that) [16:42:05] the good thing was it was just a vandalism that went on the wrong revision :D [16:43:00] Amir1: Wow, I've been in such a situation. Recently one of my patches broke production and translatewiki.net due to type hints :( [16:43:04] I'm so ashamed :( [16:43:28] I've done that twice [16:44:06] don't be ashamed, when you get things done, breaking things is inevitable [16:44:37] IMHO, it's a good sign [16:45:17] Hmmm... I honestly pray I shouldn't do that again. I need to be more care next time and check and double check to always be sure. [16:45:29] Though, there is really no guarantee [16:45:43] that's the point of breaking things, we learn not to them again [16:46:04] (which apparently I didn't and did it twice) [16:46:25] Amir1: I've updated this patch: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Renameuser/+/487134 and looped in your feedback + that of Thiemo_WMDE :) [16:46:26] regarding you fun phan issue. I don't know much about phan, Thiemo_WMDE is the expert here [16:46:38] s/you/your [16:47:03] Okay, thanks! [16:48:55] Yours is really scary Amir1, I'm still thinking about it now [16:49:11] I'm really afraid of such issues [16:49:57] :D [16:50:17] My last question that just came up in mind now: Q4: I think mediawiki-docker is meant just for production right? or testing but not for development? [16:50:31] Maybe addshore has a word here? Not sure! [16:50:34] Just in case, does somebody else have a question? ;-) [16:51:37] Please tech people, we've got some bigs brains hosting, ask your questions! :) [16:52:34] s/bigs/big [16:53:12] Thiemo_WMDE: that phan thing seems to be a false positive or kinda flaky [16:53:26] xSavitar: regarding your docker question [16:53:28] Just got the warning again but this time with the variable [16:53:40] the plan is to have docker in prod in one or two years [16:53:44] as part of SSDD [16:53:51] https://wikitech.wikimedia.org/wiki/Streamlined_Service_Delivery_Design [16:54:16] but CI uses docker to test [16:54:41] it's always easier to use docker to develop and push changed to gerrit once you achieved what you want [16:55:09] (because it's self-contained and easy to set up) [16:55:23] Okay! Cool! [16:55:40] and at the end, in gerrit, it doesn't matter if you used vagrant or docker or native installation [16:56:25] :) [17:00:42] With no questions and no time left, I conclude this TAIM. Have a nice evening/morning/whatever everyone! [17:01:04] Thanks Amir1 & Thiemo_WMDE :), much much appreciated! [17:01:41] Anytime <3 [20:06:20] Is there a good reason why, on a page with only one revision, diff=prev loads just the one diff (wgDiffOldId is false, no .diff-otitle) while doing diff=cur or diff=next loads the two-column diff as if there were two revisions (wgDiffOldId and wgDiffNewId both true, etc.)? [20:08:55] Whoops, sorry, probably better in #mediawiki [22:20:14] xSavitar: I have no idea why phan seccheck is not repeatable on https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/Renameuser/+/487134/ :( [22:27:53] *sigh* i need to work more on that tool