Skip to content

Conversation

@cka-y
Copy link
Contributor

@cka-y cka-y commented Nov 12, 2024

Summary:
This pull request introduces visibility restrictions for work-in-progress (WIP) feeds in feeds_api_impl.py and search_api_impl.py, based on user email domains. It includes a new function to determine if a user’s email is restricted, updating query filters accordingly to enforce feed visibility rules. Additionally, a new SQL script is included to update the database schema and refresh the materialized view to support these changes.

Expected Behavior:
Feeds marked with an internal status of "WIP" are only visible to users with email domains ending in @mobilitydata.org. Users with other domains will not see these WIP feeds.

Testing Instructions:

  1. Set up a local database and run the populate script.
  2. Update the internal status of selected feeds to "WIP" in the database.
  3. Run the API locally.
  4. Make requests to the gtfs, gtfs_rt, and feeds endpoints, as well as the search functionality, while setting the x-goog-authenticated-user-email header to emails ending with both @mobilitydata.org and non-@mobilitydata.org domains.
  5. Verify that only users with @mobilitydata.org emails can view WIP feeds.

Testers are encouraged to follow these instructions but are also welcome to explore other test cases to ensure robust behavior outside the listed scenarios.

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

  • Run the unit tests with ./scripts/api-tests.sh to make sure you didn't break anything
  • Add or update any needed documentation to the repo
  • 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)

@cka-y cka-y linked an issue Nov 12, 2024 that may be closed by this pull request
@cka-y cka-y marked this pull request as ready for review November 12, 2024 03:29
@cka-y
Copy link
Contributor Author

cka-y commented Nov 12, 2024

Integration tests are expected to fail for this PR due to changes in the database schema. Specifically, the error encountered is:

psycopg2.errors.UndefinedColumn: column feed.operational_status does not exist
LINE 1: ...ed_contact_email, feed.provider AS feed_provider, feed.opera...

View full logs for additional details.

@davidgamez
Copy link
Member

Integration tests are expected to fail for this PR due to changes in the database schema. Specifically, the error encountered is:

psycopg2.errors.UndefinedColumn: column feed.operational_status does not exist
LINE 1: ...ed_contact_email, feed.provider AS feed_provider, feed.opera...

View full logs for additional details.

This makes sense. When we added the integration tests pointing to QA, we predicted that in cases of schema changes, this step would fail as a guardrail for merging. However, it is still a great check for PRs that don't introduce a schema change on the main tables.

Copy link
Member

@davidgamez davidgamez left a comment

Choose a reason for hiding this comment

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

LGTM

@cka-y cka-y merged commit ca3e5cb into main Nov 12, 2024
@cka-y cka-y deleted the feat/780 branch November 12, 2024 19:15
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.

Add WIP flag to feeds

3 participants