The function must have worked in part earlier if it was part of the earlier thread remapping which did obviously succeed in bringing topics / posts over to Discourse.
I’m still wondering if the partial original REGEX match somehow created corresponding Discourse thread IDs which then precluded things like the Entries threads from coming in because it was only matching up to a certain point (i.e. if the thread ID requires the number, dash, and full remaining string).
If that is the case, perhaps the threads which did not make it in could simply be modified (e.g. with an additional character or substring such as “archived”) so they could enter Discourse sans conflict?
I was also thinking, if the function issue is not yet resolved at this point, maybe it could be (if it is open source, or yours and shareable) posted here for further inspection?
Since this issue goes well beyond the WC forum, and that there are so many talented developers in our community in addition to your own expertise, this should be solvable and attract high-priority review from the community given how much information remains at risk of being lost.
Beyond that, thanks again to all those who worked on the migration thus far! It’s well worth the effort!