gtfs-validator icon indicating copy to clipboard operation
gtfs-validator copied to clipboard

Translations.txt value mismatch not being recognized

Open westontrillium opened this issue 1 year ago • 3 comments

Describe the bug

I'm not sure if this is a bug or just a missing validation rule. No validation error results from either field_name referencing a value that doesn't exist or field_value referencing a value that doesn't exist.

Example

routes.txt ...,route_short_name,... ...,45,...

translations.txt ...,field_value,... ...,4r,...

^ Validator does not detect that "4r" is not present under routes.route_short_name.

or

...,field_name,... ...,rt_shortname,...

^ Validator does not detect that rt_shortname is not present in routes.txt.

or

...,field_name,...,field_value, ...,route_long_name,...,45,

^ Validator does not detect that 45 is not under ,route_long_name,.

Steps/Code to Reproduce

cctbus-mn-usTEST.zip

  1. Use the above dataset.
  2. Notice errors in the first two records of translations.txt (route_short_name instead of route_long_name for the first record, incorrect field_value for the second record).
  3. Run the dataset on GTFS Validator.
  4. Notice no error message about the two errors.

Expected Results

The Validator should detect these errors and produce an error message for each.

Actual Results

No detection, no error message for either.

Screenshots

No response

Files used

No response

Validator version

4.0.0

Operating system

MacOS

Java version

No response

Additional notes

No response

westontrillium avatar Apr 03 '23 16:04 westontrillium

Thanks for opening your first issue in this project! If you haven't already, you can join our slack and join the #gtfs-validators channel to meet our awesome community. Come say hi :wave:!

Welcome to the community and thank you for your engagement in open source! :tada:

welcome[bot] avatar Apr 03 '23 16:04 welcome[bot]

Upon reviewing our validation rules, it looks like this is a missing rule. We check

No rule for if a translation is for a field value that doesn't exist. Language from spec: The field must have exactly the value defined in field_value. If only a subset of the value matches field_value, the translation won’t be applied.

Proposal: new rule: translation_unknown_field_value. A translation references an unknown or missing GTFS field value. Logic: IF field_value doesn't exist as specified by table_name and field_name = ERROR

emmambd avatar Feb 26 '24 20:02 emmambd

Tasks

  • [ ] Review community contrib PR (#1436) and respond
  • [ ] Either code review + merge or implement
  • [ ] Test with Weston's example feed
  • [ ] Analyze acceptance tests
  • [ ] Assess performance implications since the rule requires cross-checking

emmambd avatar Feb 27 '24 15:02 emmambd