Talk:Synchronizer

Edit summaries
@Sophivorus: I tested this out a few times and it seems like it is not always creating edit summaries correctly. MediaWiki:Synchronizer.js appears to be trying to create a link with an interwiki prefix (with things like ) however it looks like it sometimes bases this off of Wikidata sitelinks which use database names and not interwiki prefixes. I do not think you want to attempt to maintain a complete mapping. You would be better off linking through Wikidata since it already knows how to link to each page via its sitelinks, e.g.,: Notice how the database name  is now useful when used in conjunction with   at Wikidata.
 * Edit a summary that seems good: 1144856459
 * Edits with problematic summaries: 71665579 13075854 24722031 5827927
 * Should have had more useful summaries like: Update from master using Synchronizer
 * Edits with problematic summaries: 71665579 13075854 24722031 5827927
 * Should have had more useful summaries like: Update from master using Synchronizer

You should do away with hackery like  (luckily it seems this is only used to create the "master" wikitext link in the summary). Instead, use master wiki database id combined with the Wikidata item id to create the "master" wikitext link for the summary by going through d:Special:GoToLinkedPage (using something like  and   if I am reading the code correctly).

I would attempt to edit it myself but I do not have access as I am not an interface/UI editor like you are (at least for the next few months anyway). —Uzume (talk) 00:51, 16 March 2023 (UTC)


 * You might want to consider adding a hashtag to these edits too. See Hashtags. Even better (but much more difficult) would be figuring out how to add a revision/change tag. See Manual:Tags and Help:Tags. —Uzume (talk) 01:15, 16 March 2023 (UTC)
 * The definition of which site is "master" also seems fragile (and perhaps flawed), e.g., contains text   and yet "master" seems to be defined for that at User:Sophivorus/sync by master on the template and module at the button creation site (which can be different from page to page across different wikis). Perhaps you should consider a more centralized method of defining that like a sitelink badge. —Uzume (talk) 12:42, 16 March 2023 (UTC)
 * Another problem with this tool is lack of attribution since you are not importing changes (likely due to permission issues). This makes me wonder if this tool would not be better implemented as a bot at toolforge or similar. —Uzume (talk) 12:42, 16 March 2023 (UTC)
 * @Uzume Thanks so much! I was unaware of d:Special:GoToLinkedPage and it was just what was needed. I just updated the code to get rid of that ugly getInterwikiPrefix method.
 * I was also unaware of Hashtags! I just added #synchronizer to the edit summary.
 * As to change tags, I agree they are much more difficult. Adding them to the API edit request is trivial, but as you probably know, the tag needs to be proposed and approved independently in each wiki for it to work in that wiki. I did that for Proveit on several wikis, and it's just not worth the effort. However, if you're interested in tracking edits in a specific wiki, feel free to request the tag there and I'll be happy to add it to the API edit request.
 * As to the inconsistent master with Module:Transcluder, you're right, I was transitioning to enwiki as the master version and you caught me mid-way. I just started updating the comments to point to enwiki as the master version. As to sitelink badges, I didn't know about those! They sound great, but I wonder if the benefits they promise are worth the added complexity for new users of Synchronzier. Perhaps by having a fallback system in which if no sitebadge is set, the "master" parameter is checked, and else the current wiki is considered the master? I'll give it some thought and would be happy to hear yours!
 * As to lack of attribution, perhaps the tool could check the usernames of the revisions being copied and write an edit summary like "Updating from master via Synchronizer, contributions by Foo, Bar and Baz"?
 * Thanks for all the help and new info I was unaware of! I've been editing and hacking wikis for 10+ years and I'm always amazed to keep finding new stuff! I'm looking forward to your thoughts and replies, and please let me know of any more issues you find or features you'd like to see. Cheers! Sophivorus (talk) 13:01, 16 March 2023 (UTC)
 * @Sophivorus: Cool, that looks much better:
 * 741359519
 * And it will work with any sitelinks at Wikidata even the more esoteric ones like wikimania and it is future proof too.
 * As for sitelink badges, I believe it would make sense to get a badge made for Wikimedia multi-site master page. They are just flags on the sitelinks. As such they do not enforce that only one sitelink for a Wikidata item has such, so yes, some methodology would be need to manage that. You mentioned a "fallback system" for ensuring such but I would rather the script instead provide a means to edit the Wikidata item (not unlike how its sends edits to the other sites for for synchronization) specifying such when an item does not adhere to "exactly one sitelink needs to have the master badge". It could also provide a small button at the top of the synchronization table to allow one to respecify such later affecting the ability to "rehome" like you are doing with (from   to  ).
 * Another thing you might want to consider is having the button generation be more error proof. This only works with Wikidata but the button generator does nothing to ensure such (the Scribunto Lua module could check Wikidata at page render time instead of the script failing at button press time). I would much prefer the interface to the script be the Wikidata item ID and not sitelink and database siteid. The button generator could allow specification of the Wikidata item via either its QID or sitelink with optional siteid (defaulting to local; see ). The latter provides for ease and backwards compatibility and it makes sense for the button generator to provide an error when it is unable to come up with a valid QID. I believe the button label should default to the Wikidata item label instead of the provided master sitelink (as it currently does).
 * And on that note, if the script has a Wikidata item edit capability it could ensure other things like the language labels be synchronized to the sitelink values (somehow; that might get tricky) and it could add claims of or  to its  statements or something too.
 * —Uzume (talk) 15:16, 16 March 2023 (UTC)
 * @Uzume Hi!
 * I just updated Synchronizer to use Wikidata IDs rather than titles. However, instead of using mw.wikibase.getEntityIdForTitle for backwards compatibility, I updated all the (few) pages that used Template:Synchronize to the new usage with Wikidata IDs. I figured that this way it'll keep the code and documentation simpler, and requiring a Wikidata ID will also help users understand that an associated Wikidata entity needs to exist (I already had someone asking why Synchronizer wouldn't work for a JS page with no Wikidata entity associated). I also added some error checking to Module:Synchronizer and started using the Wikidata label for the button, rather than the master page title. So thanks again for your ideas, they're a great step forward!
 * Regarding badges, I was surprised to find that a master version badge already exists (see the last of the list of badges). However, it doesn't pop up when editing sitelinks. It seems to be used as a regular property instead (example). It'd be nice to have it behave like the other badges, but I guess that's just a detail. Your ideas regarding the use of badges and an interface to set and change them, and using Synchronizer to add claims and language labels to Wikidata are all great and I'll try to implement them eventually, but they're a bit difficult so perhaps I'll wait until more people actually use the tool heh
 * Next I'm thinking on adding a button to update all non-forked modules at once, and another button next to each forked module to see the diff since it forked. I think that'd make the tool considerably more useful, at least for me. Thoughts?
 * Once again, thanks for all your ideas and please don't hesitate to share more! Sophivorus (talk) 20:24, 21 March 2023 (UTC)
 * @Sophivorus: Cool, that also solves a problem with the previous arrangement. Before Synchronizer is only deployed to a very few sites and the only way to specify a Wikidata item was via a local site link. What if you wanted to synchronize pages but the pages did not exist at any of the sites Synchronizer was deployed at? Now that it is specified by Wikidata item QID, the issues goes away. I also find curious. Maybe it used to be a sitelink badge but was never fully implemented or removed for some reason (otherwise why call it a badge? or possibly that is how badges worked before they were implemented as being attached to the sitelinks). —Uzume (talk) 20:37, 21 March 2023 (UTC)
 * @Uzume I just implemented a first version of the button to update all non-forked modules. Since it's a very powerful feature, the button is hidden from non-autoconfirmed users, and any feedback, testing or wise advice would be welcome. Perhaps the button should be at the bottom rather than the top? Perhaps it should be smaller, or red? Perhaps the warning when clicking should be different? Cheers! Sophivorus (talk) 00:30, 22 March 2023 (UTC)
 * @Sophivorus: I would be extremely hesitant to even test that with any real live code (unless I had been updating them all recently already). Each site has its own potentially complex dependencies that would be very hard to foresee. It looks nice though. I would probably prefer if it had the same styling as the other "Update" buttons, darker with the rounded corners. I think I would put the button in the space for the "Update" button on the master entry instead of floating above or below the main table. I don't have much of an opinion on whether you want to make it another color like red as I can see it either way. —Uzume (talk) 01:09, 22 March 2023 (UTC)
 * @Sophivorus: Okay, I tried it. I thought the safest bet was since none of the sites were far behind and none of them were forked. Wow! That is a really great way to get spammed with notifications about your first edit at a pile of sites—*laughs*. Anyway, I liked the dialog warning and it seemed to work, save some permission issues at two sites. I noticed on one of the two sites a lock icon is shown but the other did not. d:Special:GoToLinkedPage/eswiki/Q96679044 does not show a lock icon for me but it also fails to update with "No Permission". The site itself states: "No tienes permiso para editar las páginas del espacio de nombres Módulo." or "You do not have permission to edit pages in the Módulo namespace.". —Uzume (talk) 01:27, 22 March 2023 (UTC)
 * @Uzume Yes! Moving the button next to the master row was just what was needed, the interface is much better now. Thanks for testing it out! I'm glad it went ok. As to the problem with eswiki, I just improved Synchronizer to detect protected namespaces, so thanks for that too. Cheers! Sophivorus (talk) 11:17, 22 March 2023 (UTC)

@Sophivorus: I am glad to be of help. Yes, it looks much better in the "Action" column. I notice the "Update" buttons go away when the "Status" column is "Updated". Shouldn't the "Update all non-forked" also go away when all the non-forked are status "Updated"? Also, maybe this is a small nitpick but should the "Action" column be left justified? I was thinking center or right perhaps. I also think everything could use some i18n and l10n, especially the edit summaries which would help if they were done in the language matching either the page content language or the site content language for things that are forced to a single language (like Scribunto modules). I noticed you updated eswiki but the edit summary stands out in English amongst the past edit summaries. I am not sure how you would go about adding this to translatewiki.net. —Uzume (talk) 12:43, 22 March 2023 (UTC)


 * @Uzume Yes I agree, the "Update all non-forked" button should go away or not appear if there aren't any modules to update, but doing so is not trivial nor crucial so I left it for later. As to i18n and l10n, I totally agree, especially about the edit summaries. I'll tackle that next (but probably not today heh). Cheers and thanks again! Sophivorus (talk) 12:59, 22 March 2023 (UTC)
 * @Sophivorus: You might also want to put this into a real revision control system like git. That would allow you to take updates from translatewiki.net which could then be deployed by something with such rights. I know that at the moment you are doing that yourself but I would think there must be a privileged bot to do such things from git repos. —Uzume (talk) 13:07, 22 March 2023 (UTC)
 * @Sophivorus: Then you can take patches from others too (e.g., people could submit to changes in gerrit). On the i18n/l10n front, where doing an update, a diff is presented. I noticed this seems to use the default language of whatever site is being updated, however, it would be helpful if you used  to change the interface to the language of the user using the buttons or at least the page the synchronizer button is on. For example, in my case that would be "en" from User:Sophivorus/sync at mediawikiwiki but I can see how a user on eswiki (where this is also deployed) would likely want "es". Perhaps someone from here (a multilingual wiki) might also want "es" or something else. —Uzume (talk) 13:39, 22 March 2023 (UTC)
 * @Sophivorus: I may have found a bug. It seems it does not always detect "forked" properly (which I imagine would affect "Update all non-forked"). Case in point: go to User:Sophivorus/sync, use the last button "Synchronize Module:ScribuntoUnit", find "ptwiki" entry and click on "Update". Can you tell me why that sort of diff could potentially be in the history of enwiki (the master)? Those clearly contain Portugese l10n changes that I cannot imagine would every have been on the enwiki master. But the ptwiki entry is labelled as "8 revisions behind" and not as "Forked". —Uzume (talk) 15:50, 22 March 2023 (UTC)
 * @Uzume Hi! I think you may be misunderstanding what the diff shows. The diff shows the difference between the current forked version at ptwiki, and the current version at master (in other words, the change you're about to make if you hit Save), so it's reasonable ok to see Portuguese characters on the left. Perhaps you were expecting the diff between the last "shared version" (the version before the fork happened) and the current one at master? Or between the last shared version and the current one at ptwiki? They all seem relevant and useful, and my intention with the "Diff since fork" button I mentioned before was to show the latter diff. Perhaps each diff should include some text explaining exactly what is being shown. Sophivorus (talk) 19:13, 22 March 2023 (UTC)
 * @Sophivorus: It is not the diff that is the problem. It is the fact that the ptwiki entry says "8 revisions behind" and not "Forked" (not to mention what that implies for the "Update all non-forked" button). Synchronizer is treating the ptwiki version is part of the history of enwiki master but the enwiki master would never have any Portugese in it so it is clearly forked (the diff just exposes the flawed logic; the diff itself is fine). There is something wrong with your forked vs. historical revision logic. —Uzume (talk) 19:54, 22 March 2023 (UTC)
 * @Uzume Ah! I understand now! Curiously, it seems that enwiki actually did have a version with Portuguese characters exactly 8 revisions ago, lol Sophivorus (talk) 20:00, 22 March 2023 (UTC)
 * @Sophivorus: Oh, my mistake then. I should have checked that. I just assumed it couldn't have. So the logic is fine—just the revisions at enwiki are weird. I am sorry to have bothered you with a false report. —Uzume (talk) 20:04, 22 March 2023 (UTC)
 * @Sophivorus: On that note though. It might be nice to work on the "Forked" cases and compare revisions at the target as well. That could have many compares so I am not sure how to optimize the logic (since that ups things from $$O(n)$$ to potentially $$O(n \cdot m)$$ or $$O(n^2)$$; it should be much smaller on average though), but it would be really nice if it said things like "Forked 2 revisions back" or similar. This would also mean you could determine if the code is entirely different and never forked (i.e., no common ancestors) which would also be good to know (this is actually not that uncommon when having many templates/modules with similar names that get mislinked in Wikidata). —Uzume (talk) 20:28, 22 March 2023 (UTC)