Page MenuHomePhabricator

A subpage transcluded after a HTML-comment on the main page could causes an discussiontools-error-comment-is-transcluded
Closed, DuplicatePublic

Description

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.

Event Timeline

Lofhi renamed this task from A subpage transcluded after a h1 title and a HTML-comment on the main page could cause an error when it shouldn't? to A subpage transcluded after a HTML-comment on the main page could causes an discussiontools-error-comment-is-transcluded error.Mon, Apr 22, 4:25 PM

Tried with "real" title of sections (i.e. == Test ==) and it didn't change anything. getThreadItemsHtml from the API put the HTML-comment in "othercontent" (which is good). So, somehow, this edge case fails within CommentParser.php in computeTranscludedFrom.

Lofhi renamed this task from A subpage transcluded after a HTML-comment on the main page could causes an discussiontools-error-comment-is-transcluded error to A subpage transcluded after a HTML-comment on the main page could causes an discussiontools-error-comment-is-transcluded.Mon, Apr 22, 4:44 PM
matmarex subscribed.

Examining the faulty version's Parsoid output: https://fr.wikipedia.org/w/index.php?title=Wikipédia:Questions_techniques&oldid=176505222&useparsoid=1 I see that it shows the wikitext for categories from "Wikipédia:Questions techniques" as being a part of the transclusion. Note the data-mw value here:

<h2 about="#mwt47" typeof="mw:Transclusion" id="Module_Graph_hors_service" data-mw='{"parts":[{"template":{"target":{"wt":"Wikipédia:Questions techniques/semaine_{{CURRENTWEEK}}_{{CURRENTWEEK.YEAR}}","href":"./Wikipédia:Questions_techniques/semaine_17_2024"},"params":{},"i":0}},"\n\n[[Catégorie:Questions techniques|*]]\n[[Catégorie:Aide technique]]"]}' ...></h2>

I was able to reproduce this on a small test page. It turns out you don't even need the heading, you just need categories following a transcluded section that ends with a discussion reply (using :): https://test.wikipedia.org/wiki/Talk:T363112

This seems like a Parsoid problem, and it may be a new issue – otherwise it would have probably come up before, and I don't recall seeing this problem.

Damn, I had put my piece on the HTML comment, not the categories! I also think I was able before with this same wikicode layout to reply from the main page (the "faulty" version was the version of the page used since 2020), or at least open the reply tool. Except I can't say for sure.

Moving the HTML before the categories and after the inclusion somehow doesn't make Parsoid think that categories are included.

<h2 about="#mwt47" typeof="mw:Transclusion" id="Module_Graph_hors_service" data-mw-thread-id="h-Module_Graph_hors_service-Semaine_17_2024_(suivre)-20240422100900" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;Wikipédia:Questions techniques/semaine_{{CURRENTWEEK}}_{{CURRENTWEEK.YEAR}}&quot;,&quot;href&quot;:&quot;./Wikipédia:Questions_techniques/semaine_17_2024&quot;},&quot;params&quot;:{},&quot;i&quot;:0}}]}"><span data-mw-comment-start="" id="h-Module_Graph_hors_service-Semaine_17_2024_(suivre)-20240422100900"></span>Module Graph hors service<span data-mw-comment-end="h-Module_Graph_hors_service-Semaine_17_2024_(suivre)-20240422100900" id="mwAu0"></span></h2>

This seems like a Parsoid problem, and it may be a new issue – otherwise it would have probably come up before, and I don't recall seeing this problem.

Is this not T260093

Huh, I guess it is, I didn't remember filing that task at all. I'm still surprised that no one has complained about replying being broken on that frwiki page before, but I guess it's less urgent if it's been like this for years. (And @Lofhi, you can fix the page by moving the categories before the transcluded discussions.)