Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Feed generates error to authorize upload #1633

Merged
merged 5 commits into from
Jan 11, 2024

Conversation

davidgamez
Copy link
Member

@davidgamez davidgamez commented Jan 5, 2024

Summary:

When using the feed URL https://www.maricopa-az.gov/home/showpublisheddocument/6491/638307291320330000, it generates an "Error authorizing upload." While verifying the invalid_input_files_in_subfolder notice, an additional request is sent to the producer's URL, causing unexpected behaviors (5XX HTTP code). This PR reuses the response already loaded in memory, avoiding unnecessary external calls and removing the root cause of the original issue.
As part of this PR, the GTFS validator is sending the "User-Agent" header with the value "User-Agent: MobilityData GTFS-Validator/4.2.1 (Java 17.0.6)"

Fixes #1632
Closes #1562

How to reproduce the bug:

  1. Run the validator locally
  2. Input https://www.maricopa-az.gov/home/showpublisheddocument/6491/638307291320330000"
  3. Validate feed
  4. System error is generated with the following format:
{
  "notices": [
    {
      "code": "i_o_error",
      "severity": "ERROR",
      "totalNotices": 1,
      "sampleNotices": [
        {
          "exception": "java.io.IOException",
          "message": "Server returned HTTP response code: 503 for URL: https://www.maricopa-az.gov/home/showpublisheddocument/6491/638307291320330000"
        }
      ]
    }
  ]
}

Expected behavior:

The report is generated without generating system errors.

Screenshot of the validation report after fixed:

Screenshot 2024-01-09 at 5 01 17 PM

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

  • Run the unit tests with gradle test to make sure you didn't break anything
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

Copy link
Contributor

github-actions bot commented Jan 5, 2024

✅ Rule acceptance tests passed.
New Errors: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
New Warnings: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Warnings: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
0 out of 1477 sources (~0 %) are corrupted.
Commit: 5b730d3
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

Copy link
Contributor

github-actions bot commented Jan 9, 2024

✅ Rule acceptance tests passed.
New Errors: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
New Warnings: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Warnings: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
0 out of 1477 sources (~0 %) are corrupted.
Commit: ae465c7
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

Copy link
Contributor

github-actions bot commented Jan 9, 2024

✅ Rule acceptance tests passed.
New Errors: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
New Warnings: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Warnings: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
0 out of 1477 sources (~0 %) are corrupted.
Commit: c61b68e
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

@davidgamez davidgamez marked this pull request as ready for review January 9, 2024 22:50
Copy link
Contributor

✅ Rule acceptance tests passed.
New Errors: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
New Warnings: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Warnings: 0 out of 1477 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
0 out of 1477 sources (~0 %) are corrupted.
Commit: b919553
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

File zipFile = new File(sourceUrl.toString());
String fileName = zipFile.getName().replace(".zip", "");
if (hasSubfolderWithGtfsFile(sourceUrl)) {

if (containsGtfsFileInSubfolder(
Copy link
Contributor

Choose a reason for hiding this comment

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

After this change hasSubfolderWithGtfsFile(sourceUrl) is not use any more (except in tests). Should we get rid of it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch! Done, Thanks!

Copy link
Contributor

@jcpitre jcpitre left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

✅ Rule acceptance tests passed.
New Errors: 0 out of 1475 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Errors: 0 out of 1475 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
New Warnings: 0 out of 1475 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
Dropped Warnings: 0 out of 1475 datasets (~0%) are invalid due to code change, which is less than the provided threshold of 1%.
2 out of 1477 sources (~0 %) are corrupted.
Corrupted sources:
es-madrid-metro-de-madrid-gtfs-794
us-new-york-adirondack-trailways-pine-hill-trailways-gtfs-826
Commit: 8f7f4a6
Download the full acceptance test report here (report will disappear after 90 days).
✅ Rule acceptance tests passed.

@davidgamez davidgamez merged commit 4f49949 into master Jan 11, 2024
333 checks passed
@davidgamez davidgamez deleted the fix/1632-authorize-upload branch January 11, 2024 22:00
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.

Feed generates error to authorize upload GTFS download from URL: send a User-Agent
2 participants