Context: I don't know if it's a bug. I don't know if it should even be fixed. I just want to share some live experience. It explains the awful title.
I was answering someone on a subpage Wikipédia:Questions techniques/semaine 17 2024. Then I came back to the main page Wikipédia:Questions techniques for some cleaning up. Then I felt like trying to reply from this page to the discussion in the subpage. Which usually works quite well. And I got hit by discussiontools-error-comment-is-transcluded.
Problem: it was the last section, representing the current week's discussions (week 17, year 2024), that wasn't working. The previous week's sub-page (week 16, year 2024) could be manipulated with the answer tool without a hitch. Here the faulty version of the page. I played a bit the page, then by moving the HTML after the transclusion made the tool happy again.
discussiontoolspageinfo API result with the faulty live version:
{ "discussiontoolspageinfo": { "transcludedfrom": { "h-Semaine_16_2024_(suivre)-20240415090400": false, [...] "h-Semaine_17_2024_(suivre)-20240422100900": false, "h-SGlad-20240422100900": true, "h-Module_Graph_hors_service-Semaine_17_2024_(suivre)-20240422100900": true, "c-SGlad-20240422100900-Module_Graph_hors_service": true, "c-SGlad-20240422100900": true, "c-Lofhi-20240422140800-SGlad-20240422100900": true, "c-Lofhi-20240422140800": true } } }
I checked the ContentThreadItemSet class to understand the two false values, but I've come to believe that it's linked to undefined bool at instanciation, which is transformed into false in PHP's truth table? And since the first section works fine even with this false, I deduced that it was the HTML comment introduced to tell editors not to modify this main page but the subpage, that was causing the problem.
discussiontoolspageinfo API result of with the working live version:
[...] "h-Module_Graph_hors_service-Semaine_17_2024_(suivre)-20240422100900": "Wikipédia:Questions techniques/semaine 17 2024", "c-SGlad-20240422100900-Module_Graph_hors_service": "Wikipédia:Questions techniques/semaine 17 2024", "c-SGlad-20240422100900": "Wikipédia:Questions techniques/semaine 17 2024", "c-Lofhi-20240422140800-SGlad-20240422100900": "Wikipédia:Questions techniques/semaine 17 2024", "c-Lofhi-20240422140800": "Wikipédia:Questions techniques/semaine 17 2024" } } }
So I guess the API is troubled by the HTML comment, and by moving/removing it the recursion find the transcluded page correctly , but I clearly don't know why.
Note: the sections of the main page are manually created.
<h1><span class="plainlinks">[[Wikipédia:Questions techniques/semaine {{CURRENTWEEK}} {{CURRENTWEEK.YEAR}}|Semaine {{CURRENTWEEK}} {{CURRENTWEEK.YEAR}}]] <small>(<span title="Ajouter la page à votre liste de suivi pour en suivre les modifications">[{{fullurl:Wikipédia:Questions techniques/semaine_{{CURRENTWEEK}}_{{CURRENTWEEK.YEAR}}|action=watch}} suivre]</span>)</small></span></h1>
Funny edge case.