I want to make some changes to how DiscussionTools represents discussion threads internally, to better support watching/notifications.
Treat sub-threads as part of their parent threads.
In MediaWiki, sub-sections are considered to be a part of their parent sections (for example, if you click "edit source" on Yeti#History, you'll also see the text of the sub-section Yeti#Pre-19th_century). However, in DiscussionTools we didn't do that, each thread was completely separate (for example, the thread Wikipedia:Village_pump_(technical)/Archive_182#reFill_error_reports? did not include the sub-thread Wikipedia:Village_pump_(technical)/Archive_182#reFill_appears_to_be_down_again).
I started thinking about this after seeing T261370, which would probably also require this change, but the effect on watching/notifications seems more important. If you're watching the "parent" section, you should also receive notifications for comments in any sub-sections, and also if a new sub-section is added. Currently that would be difficult to implement.
Give thread headings identifiers like comments have
For T263819, we want to allow users to receive notifications for replies to a specific thread ("Event 2"), but also replies to a specific comment ("Event 1").
If thread headings and regular comments behaved the same, it should be easier to implement this in a way that works for both cases, instead of two different ways.
Distinguish comments posted in a single edit by their parent comment, rather than sequential numbers
If someone makes multiple comments in a single edit (this is not the greatest example, since it's a voting page, but like this), we currently just "number" them and distinguish them that way. This isn't great because these numbers change when an earlier thread is archived, and the comment disappears. This could result in notifications being sent for replies to the wrong comment (and in currently existing code, can already result in reply being posted in response to the wrong comment).
It seems like it would be better to distinguish them by the parent comment's identifier. (If the comment in question is a top-level comment, then the thread heading's identifier would be used, so this kind of depends on the previous point.)
Together with the previous point, if we could treat thread headings and regular comments the same, this would also allow us to distinguish subsections with identical names, e.g. consider a voting page like https://pl.wikipedia.org/wiki/Wikipedia:Głosowania/Flagi_w_zestawieniach_medalistów#Głosowanie with several proposals and for/against sections for each one.