Page MenuHomePhabricator

The message group ids in AggregateMessageGroup's subgroup list should not be treated as patterns when coming from Special:AggregateGroups
Open, Needs TriagePublic

Description

Copied from T202058: Unknown modifier 'R': [/^page\-User\:BeneBot.+/RfD\-open/text$/] in /srv/mediawiki/php-1.32.0-wmf.16/extensions/Translate/stringmangler/StringMatcher.php:

[...] Second issue is that page names coming from database should not be used as patterns at all, since patterns are not allowed there currently. Patterns should continue working when coming from yaml files (not used at Wikimedia production). The design decision of 'treating anything with a * in it as a pattern with no other way to differentiate' is now causing issues.

[...]

The second issue is not as easy. I could think of different options:

  1. When creating message groups, we could add a field/method source and have AggregateMessageGroup skip line 51 (MessageGroups::expandWildcards) if source is database.
  2. When creating message groups from yaml, mark the list of subgroups in a special way and have line 51 above executed only for those.
  3. When creating message groups from database, mark the list of subgroups in a special way which the StringMatcher will not look for patterns and treat them as exact matches.
  4. When creating message groups from yaml, expand the wildcards before creating the group
  5. Make a breaking change and require explicit marking of things that are to be considered patterns

Option 4 might have issues with recursion, so I discard that immediately. Options 2-3 are kind of similar, but I think 2 is better because then the default option is safe. 1 and 2 are basically the same thing but shifting the responsibility. Both feel a bit dirty, but I think 1 is of a lesser evil. Option 5 requires most work and would be a breaking change.