Skip to content

fix: require transfers stop ids when transfer_type is empty - #2177

Merged
davidgamez merged 3 commits into
MobilityData:masterfrom
yasumorishima:fix/transfers-empty-transfer-type
Sep 16, 2026
Merged

davidgamez merged 3 commits into
MobilityData:masterfrom
yasumorishima:fix/transfers-empty-transfer-type

Conversation

@yasumorishima

Copy link
Copy Markdown
Contributor

Summary:

Closes #2105.

The spec change in google/transit@a806576 (google/transit#591) made transfers.from_stop_id and transfers.to_stop_id Required if transfer_type is empty, 0, 1, 2 or 3 — previously the reference only required them for 1, 2 and 3.

TransferStopIdsConditionalValidator wraps its per-row check in if (transfer.hasTransferType()), so rows whose transfer_type is empty are skipped entirely and the newly required case is never validated. An empty transfer_type is a recommended transfer point, which is the same as transfer_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 (4 and 5) keep their exemption through the existing isTransferTypeInSeat check, so the only behavior that changes is the empty case.

Expected behavior:

transfers.txt row before after
transfer_type empty, no from_stop_id / to_stop_id no notice two missing_required_field notices, one per field
transfer_type empty, both stop ids present no notice no notice
transfer_type 0–3, stop ids missing two notices unchanged
transfer_type 4 or 5, stop ids missing no notice unchanged

No new notice type is introduced — this reuses missing_required_field — so RULES.md needs no change.

Two unit tests are added for the empty transfer_type case, which the existing tests never covered (every existing case calls setTransferType()).

One note on CI: I ran the checks on my fork first. Format code, Test Package Document (test on Java 17 for both ubuntu-latest and windows-latest) and Package Installers are green. Rule acceptance tests cannot run on a fork — its get-reports matrix requires the ubuntu-latest-4-cores runner label, which forks do not have — so that comparison needs to run here. Since this rule newly fires on real feeds that leave transfer_type empty, the acceptance report is worth a look before merging.

Please make sure these boxes are checked before submitting your pull request - thanks!

@CLAassistant

CLAassistant commented Aug 26, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@emmambd
emmambd requested a review from skalexch August 27, 2026 16:24

@skalexch skalexch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on my side!

@davidgamez
davidgamez self-requested a review September 16, 2026 17:29
@davidgamez

Copy link
Copy Markdown
Member

📝 Acceptance Test Report

📋 Summary

✅ The rule acceptance has passed for commit fdc2ea4
Download the full acceptance test report here (report will disappear after 90 days).

📊 Notices Comparison

New Errors (0 out of 1001 datasets, ~0%) ✅

No changes were detected due to the code change.

Dropped Errors (0 out of 1001 datasets, ~0%) ✅

No changes were detected due to the code change.

New Warnings (0 out of 1001 datasets, ~0%) ✅

No changes were detected due to the code change.

Dropped Warnings (0 out of 1001 datasets, ~0%) ✅

No changes were detected due to the code change.

New Info Notices (0 out of 1001 datasets, ~0%) ✅

No changes were detected due to the code change.

Dropped Info Notices (0 out of 1001 datasets, ~0%) ✅

No changes were detected due to the code change.

🛡️ Corruption Check

2 out of 1003 sources (~0 %) are corrupted.
Dataset Ref Report Exists Ref Report Readable Latest Report Exists Latest Report Readable
mdb-1114 ✅ ✅ ✅ ✅
mdb-1123 ✅ ✅ ✅ ✅
🔍 System errors for mdb-1114 (reference)
[
  {
    "code": "i_o_error",
    "severity": "ERROR",
    "totalNotices": 1,
    "sampleNotices": [
      {
        "exception": "java.util.zip.ZipException",
        "message": "Archive is not a ZIP archive"
      }
    ]
  }
]
🔍 System errors for mdb-1114 (latest)
[
  {
    "code": "i_o_error",
    "severity": "ERROR",
    "totalNotices": 1,
    "sampleNotices": [
      {
        "exception": "java.util.zip.ZipException",
        "message": "Archive is not a ZIP archive"
      }
    ]
  }
]
🔍 System errors for mdb-1123 (reference)
[
  {
    "code": "i_o_error",
    "severity": "ERROR",
    "totalNotices": 1,
    "sampleNotices": [
      {
        "exception": "java.util.zip.ZipException",
        "message": "Archive is not a ZIP archive"
      }
    ]
  }
]
🔍 System errors for mdb-1123 (latest)
[
  {
    "code": "i_o_error",
    "severity": "ERROR",
    "totalNotices": 1,
    "sampleNotices": [
      {
        "exception": "java.util.zip.ZipException",
        "message": "Archive is not a ZIP archive"
      }
    ]
  }
]

💾 Out of Memory Check

No datasets experienced an OutOfMemoryError.

⏱️ Performance Assessment

📈 Validation Time

Assess the performance in terms of seconds taken for the validation process.

Time Metric Dataset ID Reference (s) Latest (s) Difference (s)
Average -- 5.27 5.39 ⬆️+0.11
Median -- 1.49 1.82 ⬆️+0.33
Standard Deviation -- 17.91 15.52 ⬇️-2.38
Minimum in References Reports mdb-1818 0.36 1.77 ⬆️+1.41
Maximum in Reference Reports mdb-2014 387.39 271.92 ⬇️-115.47
Minimum in Latest Reports mdb-6 0.48 0.49 ⬆️+0.01
Maximum in Latest Reports mdb-2014 387.39 271.92 ⬇️-115.47
📜 Memory Consumption
Metric Dataset ID Reference (s) Latest (s) Difference (s)
Average -- 574.47 MiB 588.33 MiB ⬆️+13.85 MiB
Median -- 325.93 MiB 327.93 MiB ⬆️+2.00 MiB
Standard Deviation -- 1.01 GiB 1.04 GiB ⬆️+34.21 MiB
Minimum in References Reports mdb-77 38.42 MiB 38.35 MiB ⬇️-69.98 KiB
Maximum in Reference Reports mdb-2393 9.58 GiB 9.54 GiB ⬇️-48.64 MiB
Minimum in Latest Reports mdb-77 38.42 MiB 38.35 MiB ⬇️-69.98 KiB
Maximum in Latest Reports mdb-2393 9.58 GiB 9.54 GiB ⬇️-48.64 MiB

@davidgamez davidgamez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
@yasumorishima, thanks for your time and contributions!

@davidgamez
davidgamez merged commit d7ffaa8 into MobilityData:master Sep 16, 2026
103 checks passed
@welcome

welcome Bot commented Sep 16, 2026

Copy link
Copy Markdown

🥳 Congrats on getting your first pull request merged!

@emmambd emmambd modified the milestone: 9.0 Validator Release Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Require from_stop_id and to_stop_id in recommended transfer point transfers (empty or 0)

5 participants