fix: require transfers stop ids when transfer_type is empty - #2177
Open
yasumorishima wants to merge 2 commits into
Open
fix: require transfers stop ids when transfer_type is empty#2177yasumorishima wants to merge 2 commits into
yasumorishima wants to merge 2 commits into
Conversation
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Closes #2105.
The spec change in google/transit@a806576 (google/transit#591) made
transfers.from_stop_idandtransfers.to_stop_idRequired iftransfer_typeis empty,0,1,2or3— previously the reference only required them for1,2and3.TransferStopIdsConditionalValidatorwraps its per-row check inif (transfer.hasTransferType()), so rows whosetransfer_typeis empty are skipped entirely and the newly required case is never validated. An emptytransfer_typeis a recommended transfer point, which is the same astransfer_type=0— a value the validator already treats as requiring both stop ids.This drops that guard so every row is checked. In-seat transfer types (
4and5) keep their exemption through the existingisTransferTypeInSeatcheck, so the only behavior that changes is the empty case.Expected behavior:
transfers.txtrowtransfer_typeempty, nofrom_stop_id/to_stop_idmissing_required_fieldnotices, one per fieldtransfer_typeempty, both stop ids presenttransfer_type0–3, stop ids missingtransfer_type4or5, stop ids missingNo new notice type is introduced — this reuses
missing_required_field— soRULES.mdneeds no change.Two unit tests are added for the empty
transfer_typecase, which the existing tests never covered (every existing case callssetTransferType()).One note on CI: I ran the checks on my fork first.
Format code,Test Package Document(teston Java 17 for both ubuntu-latest and windows-latest) andPackage Installersare green.Rule acceptance testscannot run on a fork — itsget-reportsmatrix requires theubuntu-latest-4-coresrunner label, which forks do not have — so that comparison needs to run here. Since this rule newly fires on real feeds that leavetransfer_typeempty, the acceptance report is worth a look before merging.Please make sure these boxes are checked before submitting your pull request - thanks!
gradle testto make sure you didn't break anything