feat: abort on error - #765
Conversation
- implement getter
…or and NoticeContainer.addValidationNotice methods
|
As discussed @barbeau, @maximearmstrong the first changes to this PR. Careful! Tests do not pass yet, and the functionality are not all ready.
@aababilov Do you have some recommendations to approach this? |
|
I am unsure if I understand the rationale behind that change. @lionel-nj I would be glad to discuss your the new ideas on changing the
Speaking of the "first ERROR": why would we want that and why would GTFS provider want that?
We already add all notices to noticeContainer and export them to .json files.
All those statements seem to be wrong. Do you mind to provide sample datasets when some of those statements are true? |
@aababilov In theory, the goal is to cut down on noisy and potentially confusing/invalid output from the validator that may be unpredictable after the first semantic ERROR occurs. It's the same reason why the validator currently aborts if the feed isn't parsed successfully. @lionel-nj I think this new implementation in this PR would only apply to rules that extend One challenge I see here is that we don't currently enforce any logical ordering on |
Exactly!
For now I see these ones:
|
@aababilov Indeed, I tried to explicit what should be witnessed when I should have explained what this PR should do: abort on the first error.
Running this branch in IntelliJ with the following config returns the output I described:
|
GTFS Validator is designed to run its validations in parallel - this allows to validate faster and benefit from modern multithreaded environments. Engineers should not rely on any particular order of invoking the FileValidators. All FileValidators must be independent from each other and they also should not rely on custom SingleEntityValidators. Remember that there will be more validations added in future. That would be hard to keep in mind relations between validation rules and to debug and maintain them.
I do not think that this is the best decision. Let me give you an example: you need to visit local authorities and lodge 10 documents. You come to the office and they tell you that the first document has a typo. You fix the document and come another day. They tell you that the first document is OK but the second has a typo. After ten visits to the office, you might ask: why haven't they checked all the documents on the first day? Same for GTFS validation and also for compile errors in software: you really want to know as more errors as possible during the first validation.
That works perfectly for me. The validator exits with 0 code and the ERRORS are added to the JSON reports. |
|
@aababilov A related topic - what are your thoughts on combining multiple notice checks in the same validator class? For example, looks like Some options:
Thoughts? Options 1) and 2) accomplish the same goal as this PR. |
So I suppose that solution 2 @barbeau suggested is better suited. We will have duplicate code, but each validator will be kept independant.
Would you suggest we continue the validation process after the first error is solution 2 is implemented?
Hmm @barbeau what is the output that you get when you run this config in IntelliJ:
|
Using code in this PR (branch |
@barbeau I think that introducing abort-on-first-error is going to be problematic for a couple of reasons:
The risk of some errors resulting in others and creating confusion exists indeed. In my opinion, the validator should endeavour to: Thanks! |
|
A good analogy for GTFS Validator is that of a compiler. Terminating a compiler on the first error is unlikely to be a winning feature of that compiler: the top error is not necessarily the one that a developer would want to fix first. GTFS validator is a compiler of GTFS that a data producer uses to validate their GTFS data, and fix errors in them. |
|
@dbabramov @aababilov Thanks for the feedback, I agree with your concerns. @lionel-nj I would suggest we close this PR and we can work on more targeted solutions within validators (see some thoughts in #765 (comment)) when we know that bad data could influence a validator's output. |
|
Thanks @aababilov, @dbabramov, and @barbeau for your feedback. Closing now. |
|
An interesting read indeed! |



Summary:
This PR provides support to abort the validation process on the first encountered
ERRORas proposed in #760.Expected behavior:
Theoretically:
ERRORin validation process.noticeContainerand exported in the final.jsonfile.At present:
ERRORnotice is not added to thenoticeContainerPlease make sure these boxes are checked before submitting your pull request - thanks!
gradle testto make sure you didn't break anything