Page MenuHomePhabricator

Web2Cit fails on invalid "itemType" or empty "title" outputs instead of proceeding with fallback template
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Add two fixed selection steps ("newspaperArticle") to the itemType field
  • Remember to add the title mandatory field as well (so the template won't be ignored)
  • Attempt translation

What happens?:
Web2Cit fails with:

Target translation error. Error: newspaperArticle,newspaperArticle is not a valid value for field "itemType"

What should have happened instead?:
Web2Cit should have proceeded with using the fallback template.

See https://web2cit.toolforge.org/translate?domain=www1.folha.uol.com.br&citoid=false&debug=true&format=html&tests=true&sandbox=Diegodlh

Event Timeline

Note that this does not happen if the itemType output is an empty string. In this case the output is marked as invalid, the template as non-applicable, and translation does successfully proceed with the next template on the queue.

On the other hand, if the output of the title field is empty, translation fails similarly with an "unexpected empty output" error.

diegodlh renamed this task from Web2Cit fails on invalid itemType output instead of proceeding with fallback template to Web2Cit fails on invalid "itemType" or empty "title" outputs instead of proceeding with fallback template.Sep 9 2022, 7:48 PM

Note that once this is solved, it will become one of the silently caught errors mentioned in T317441.

The problem with "newspaperArticle,newspaperArticle" throwing an error was because it was passing field output validation, because of an error in the validation pattern. This was fixed in b45c592b.

On the other hand, if the output of the title field is empty, translation fails similarly with an "unexpected empty output" error.

This seems to be happening both for [""] (related to T313236 ) and [], but only if a test has been defined.

This was caused because, in addition to marking templates as non-applicable in case of invalid mandatory field outputs, we were also failing on such outputs on the TranslationTest's test() method. We probably don't need this. Note that we are already checking that the test goal for mandatory fields are not empty arrays.

Fixed in 72217c04.

diegodlh claimed this task.

Merged into w2c-core's v2 in 0f4e74a8.