Issue with Module:Bicolor, Template:Bicolor9, and similar templates edit

I've noticed an issue with {{Bicolor9}}, {{Bcolor Y}}, {{Bicolor X}}, {{Bicolor2}}, and {{Bicolor3}}.

On those templates' pages, the documentation subpage won't appear properly. The post-expand include size is also large enough that each of those templates is listed in Category:Pages where template include size is exceeded:

My guess is that this results from a case of too many non-rendered tranclusions. Curiously, none of the issues happen with {{Bicolor4}} (which doesn't have a documentation subpage), even though it also uses the new parameters you added to Module:Bicolor for {{Bicolor}} to use. Might it be from not using {{TemplateBox}} in each documentation subpage? Shāntián Tàiláng (talk) 20:14, 28 February 2024 (UTC)Reply

Oof, yeah. IIRC this is because the template is including all the color combinations and then hiding the ones that don't have corresponding categories, which is, it turns out, a lot of combinations. This is arguably an improvement on the previous code where it was calling ifexist on every category (and putting pages in Category:Pages with script errors thereby) but, you know, only arguably. Ideally I'd like to add some sort of filter to Module:Bicolor for which categories exist which is less expensive than ifexist (get a list of all a category's subcategories?), but I'm not really sure how one would do that. —CalendulaAsteraceae (talkcontribs) 03:31, 29 February 2024 (UTC)Reply
@CalendulaAsteraceae: Let me see if I understand the issue. These set of templates (via {{Bicolor}} and {{#invoke:Bicolor|bicolor}}) are generating a large number of links (to pages in Category namespace) based upon permutations of two colors from a list of about 50 colors. I am not sure I fully understand how the these are "hiding the ones that don't have corresponding categories". Is this via this bit of CSS magic: Template:Bicolor/styles.css#L-20 (i.e., the "redlinks" display is being altered)? It seems the template (prior to its conversion to Scribunto Lua) used to employ the {{#ifexist:}} parser function to filter these permutation vs. just hiding the display of the links on the page as it does now and you want to return to filtering the list instead of hiding entries is this correct? —Uzume (talk) 23:52, 10 March 2024 (UTC)Reply
As for possible solutions, we need to further understand that this is a large page caching issue as the resulting page output is dependent upon all the pages it links to (or else the page cache will not know when to update the cache entry when one of its link targets changes, e.g., its existence, etc.). {{#ifexist:}} is explicitly "expensive" (and creates a transclusion dependency link) exactly for this reason (although a large number of regular links can also cause a similar issue due to "redlinks" display, etc.). There are Scribunto Lua equivalents to {{#ifexist:}} (i.e, mw.title.new().exists), however, most of them are also "expensive". That said, I believe one can manually create transclusion links via mw.title:getContent() without incurring an "expensive" hit. getContent() should take care of the page caching dependencies and the code can decide base upon the nil returned when the page does not exist. —Uzume (talk) 23:52, 10 March 2024 (UTC)Reply
@Shāntián Tàiláng: I tested this in the sandbox and have deployed it via 859483298 since they were already seemingly broken and my sandbox tests seemed to do no worse. Now we just need to do something similar for {{Tricolor}}. —Uzume (talk) 23:52, 10 March 2024 (UTC)Reply
I just realized this might get noticed though as it create piles of transclusions to categories, including many missing ones. I guess we shall see who shows up to complain. Here are the new numbers:
Uzume (talk) 23:56, 10 March 2024 (UTC)Reply
Thank you for taking care of this! —CalendulaAsteraceae (talkcontribs) 03:26, 16 March 2024 (UTC)Reply

Module:Fmbox edit

Hi CalendulaAsteraceae!

Are you still planning to use this module? I'm cleaning up references to internal mbox classes at the moment, in preparation of moving some of its styles from MediaWiki:Common.css to Template:Mbox. I noticed Module:Fmbox was created last year by you and makes use of some of these classes. I imagine it's easy to make that a wrapper around Mbox and/or to load the same styles, but for now I've skipped it until I know that it's actually needed. Let me know if you want any help! More details at Template talk:Mbox#TemplateStyles. Krinkle (talk) 00:31, 17 March 2024 (UTC)Reply

@Krinkle: Thanks for checking! I have no memory of creating that module, so don't worry about it! —CalendulaAsteraceae (talkcontribs) 01:17, 17 March 2024 (UTC)Reply