Page MenuHomePhabricator

When templatedata is missing cxserver fails to extract template params from template source code
Closed, ResolvedPublic2 Estimated Story PointsBUG REPORT

Description

The template adaptation system in cxserver mainly depends on availability of templatedata information in source and target languages to extract template parameter information. However, not all templates has templatedata defined. So cxserver fallback to regex based template param extraction from the template source code.

See https://regex101.com/r/Kxz2jd/1 for a working example of that regex. But, while fixing some edgecases regarding T208985: CX2: Support mapping templates based on their parameter names, a new regex was itroduced and used along with parameter hints that we can pass based on source parameters. I am finding this regex failing for most of the extractions, as illustrated in https://regex101.com/r/mPmftu/1

The original issue addressed in T208985: CX2: Support mapping templates based on their parameter names is not relevant now as those templates has templatedata. I propose we revert the regex to the old one {{3,}(.*?)[<|}] that is same in VisualEditor and based on https://he.wikipedia.org/wiki/%D7%9E%D7%93%D7%99%D7%94_%D7%95%D7%99%D7%A7%D7%99:Gadget-TemplateParamWizard.js

Event Timeline

Change #1186951 had a related patch set uploaded (by Santhosh; author: Santhosh):

[mediawiki/services/cxserver@master] Fix the parameter extraction regex from template source code

https://gerrit.wikimedia.org/r/1186951

santhosh changed the task status from Open to In Progress.Sep 10 2025, 10:45 AM
santhosh claimed this task.
santhosh triaged this task as High priority.
santhosh moved this task from Backlog to In Progress on the LPL Essential (2025 Jul-Oct) board.

Change #1186951 merged by jenkins-bot:

[mediawiki/services/cxserver@master] Fix the parameter extraction regex from template source code

https://gerrit.wikimedia.org/r/1186951

Change #1189381 had a related patch set uploaded (by KartikMistry; author: KartikMistry):

[operations/deployment-charts@master] Update cxserver to 2025-09-16-161231-production

https://gerrit.wikimedia.org/r/1189381

Change #1189381 merged by jenkins-bot:

[operations/deployment-charts@master] Update cxserver to 2025-09-16-161231-production

https://gerrit.wikimedia.org/r/1189381

Infobox historic site (https://www.wikidata.org/wiki/Q12857484) has templatedata in English, but no templatedata in Tamil. So cxserver has to extract template params from the template source code.

When I try to translate an article with this template from English to Tamil, I can see all template params are recognized and adapted.
Article: https://en.wikipedia.org/wiki/Ob%C3%A9lisque_d%27Arles

There is an issue about source template appearing as a template icon, but that is unrelated probably T404055: Infoboxes present in source articles disappear in CX

So this ticket can be considered resolved

image.png (903×1 px, 267 KB)
image.png (954×1 px, 169 KB)
Nikerabbit moved this task from Need QA to Done on the LPL Essential (2025 Jul-Oct) board.
Nikerabbit subscribed.

Thanks for reporting, investigating, fixing and testing!