Skip to content

feat(alerts): Remove logic for adding parent informed entities.#1042

Open
allisonking wants to merge 2 commits into
masterfrom
aking/remove-adding-parent-entities
Open

feat(alerts): Remove logic for adding parent informed entities.#1042
allisonking wants to merge 2 commits into
masterfrom
aking/remove-adding-parent-entities

Conversation

@allisonking

@allisonking allisonking commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary of changes

Asana Ticket: 🧑‍🧒 Publish additional informed_entities for parent stops

This is the other half of https://github.com/mbta/alerts_ui/pull/1051. Alerts manager now adds parent entities itself, so we can remove the API logic. They've been running concurrently up until now, but that was causing problems because we were getting duplicate parent entities in cases where the activities differed.

I recreated the blue line shuttle issue in staging here

To confirm this fixes the duplicate parent entities issue:

  1. Point your local API to the staging alerts manager feed by editing

alert_url: {:system, "ALERT_URL", "https://cdn.mbta.com/realtime/Alerts_enhanced.json"}

to https://mbta-alerts-ui.s3.amazonaws.com/staging/alerts_feed_enhanced.json

  1. Visit localhost:4000/alerts
  2. Confirm that there are only 2 instances of place-wondl (one for each direction) and not 4 for alert 1003231

} = apply_hook(informed_entities)
end

test "handles specific case from bugfix ticket" do

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did recreate this alert to make sure alerts manager is handling this test case right and I think it is, but wouldn't mind a second pair of eyes. Here's the alert in staging: https://alerts-manager-staging.mbtace.com/alerts/edit/1003230

And here's the equivalent feed: https://mbta-alerts-ui.s3.amazonaws.com/staging/alerts_feed_enhanced.json

Search 1003230, and there should be 12 informed entities, of which 6 are parent entities, and 6 are the original child ones. The 6 original ones match what in this test is in alerts_enhanced_json_excerpt, and the 6 parent entities match what is in expected_new_informed_entities

(actually, the parent entities' activities won't match exactly, but this is a good thing—the alerts manager is a bit stricter about which activities to associate with each parent entity. for example, the activities at North Station and Oak Grove won't be all 3 activities, it'll depend on direction, since these are the beginning/end of the suspension)

The alerts manager now handles that itself, so the API should be able to just pass through what it gets from the alerts manager feed.
@allisonking allisonking force-pushed the aking/remove-adding-parent-entities branch from 9ec7616 to b536882 Compare June 29, 2026 20:04
@allisonking allisonking marked this pull request as ready for review June 29, 2026 20:16
@allisonking allisonking requested a review from a team as a code owner June 29, 2026 20:16
@allisonking allisonking requested review from jzimbel-mbta and removed request for a team June 29, 2026 20:16
@jzimbel-mbta

Copy link
Copy Markdown
Member

Hi @allisonking, thanks for the PR!

Your changes look good, I've just been slow to review because I was working on addressing the issues that mix deps.audit was raising about our hackney dep version.

I'll have a fix done for this shortly, which should stop CI from failing on this and all the other branches.

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.

2 participants