Skip to content

Migrate everything, trim out (most) dead code#1

Open
jkap wants to merge 1 commit into
mainfrom
jkap/migration-part-1
Open

Migrate everything, trim out (most) dead code#1
jkap wants to merge 1 commit into
mainfrom
jkap/migration-part-1

Conversation

@jkap

@jkap jkap commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Asana Task: 🪇 Break out Glides ladder

General theory here was to keep some of the light rail specific data but also break out interfaces that can be used when this is eventually pulled into Orbit. I imagine that more work will be needed then but I think this puts us in a good place overall.

Will be adding GHA workflows to run tests and etc in another PR.

I'm sorry that this is going to suck to review. Here's a summary:

largely unchanged

  • avoidOverlaps.ts
  • trainHeight.ts
  • ladderLabel.tsx

minor changes

  • ladder.tsx
    • new optional alignsWithSegment prop, allowing non-light rail to provide its own function for determining which segment to render a train on (will be most useful for RL)
    • falls back to existing GL/Mattapan logic

new

  • types.ts
    • extracted relevant types from predictions.tsx and sideBar.tsx since these are ladderPage.tsx specific files that we didn't want to move into a shared component, but we still need to pass data from them into Ladder as props.

additional notes

  • I trimmed a lot of now-dead code from the util files, but no changes have been made otherwise.

Checklist

  • Appearance:
    • ( ) Light & dark mode
    • ( ) Desktop & mobile sizes
  • Browsers:
    • ( ) Chromium
    • ( ) Firefox
    • ( ) Safari
  • Privacy:
    • ( ) Commits free of internal data
    • ( ) PR description free of internal data
    • ( ) Logging free of internal data
  • Tests:
    • ( ) Has tests
    • ( ) Doesn't need tests
    • ( ) Tests deferred (with justification)
  • Product/Design sign off:
    • ( ) Okayed the plan for the feature (e.g. the design files, or the Asana task)
    • ( ) Reviewed the feature as implemented (e.g. on dev-green, or saw screenshots)
    • ( ) No review needed

@jkap jkap requested a review from a team as a code owner June 24, 2026 15:51
@jkap jkap closed this Jun 24, 2026
@jkap jkap reopened this Jun 24, 2026
General theory here was to keep some of the light rail specific data but also break out interfaces that can be used when this is eventually pulled into Orbit. I imagine that more work will be needed then but I think this puts us in a good place overall.
@jkap jkap force-pushed the jkap/migration-part-1 branch from b78a78d to 8881c5b Compare June 24, 2026 16:35

@andrewdolce andrewdolce left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overall this looks good to me. I appreciate the amount of things that were trimmed out in this first pass.

Most of my questions have to do with light rail / Glides-specific things that are still in here. I know that was intentional on your part, just wondering if we could get away with removing some of them? In particular dropping TripEnd from TrainLoc might be an easy win (unless I'm overlooking something.)

Ultimately though I'm OK if this stuff lands here for now and gets moved out later. Maybe we can chat about it a bit when you're next available.

Comment on lines +120 to +122
* Configuration point: Green-line-specific merge-point logic.
* Checks whether this train aligns with this segment at Kenmore, Copley, and Lechmere.
* For rail operations, pass a custom `alignsWithSegment` function to the Ladder component.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

question: Passing in alignsWithSegment from the outside makes sense to me, just curious about the thinking around leaving in this Green-line-specific default? Is this something you envision moving out of the shared repo eventually, or is there some reason I'm overlooking that would prevent us from defining this on the outside too?

Comment on lines +5 to +13
export interface PredictionsSelection {
stationId: StationId;
directionId: DirectionId;
}

export interface SideBarSelection {
routeId: RouteId;
consist: Consist;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion/thought: Feel free to push back on this if you think it would be too much work, wasted effort, or doesn't make sense, but I'm wondering if we can rename these things to be a bit more generic? Perhaps something like:

PredictionSelection --> StationSelection
SideBarSelection --> VehicleSelection

My thoughts are that since the side bar and prediction tray are not yet part of the shared ladder, from the ladder's perspective all the user is really doing is selecting a station+direction or selecting a specific vehicle, and what happens next could be left up to the application?

That said, it's possible that Glides and Orbit will be very aligned on what these selections are used for, and that we'll end up making a shared sidebar and prediction view, so leaving them as-is wouldn't be the end of the world? And I suppose we could rename them later if the use cases differ.

Comment thread src/data/stops.ts
Comment on lines +19 to +22
export const allStationsArray: Station[] = [
// GLX Medford
buildStation("place-mdftf", "Medford/Tufts", 42.408179, -71.117185, "Medford"),
buildStation("place-balsq", "Ball Square", 42.400241, -71.111278, "Ball Sq"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

question: This is again something very Green-line specific (as is the list of car numbers and the routes/segments). Do you see us pulling these things out eventually and having the application provide them as configuration?

Comment thread src/models/route.ts
Comment on lines +29 to +33
// DirectionId matches GTFS
export enum DirectionId {
Westbound = 0,
Eastbound = 1,
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

thought: I don't have a great suggestion here, but I think an unfortunate consequence of combining heavy rail and light rail is that directional terminology differs by line, e.g. pretty sure "northbound" and "southbound" are more common on the RL. But making this more generic might be a pain in the neck or add a lot of complexity. I'll think on it...

latLng: LatLng | null;
heading: number | null;
timestamp: DateTime | null;
trip: TripEnd | null;

@andrewdolce andrewdolce Jun 25, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

question: Does the ladder UI use this for anything other than determining if a vehicle is on a revenue trip? Trying to look through and see... If not then I'm wondering if we could remove any references to TripEnd since that's a Glides-specific thing, and just give TrainLoc its own revenue property?

Maybe not a change for this PR if the plan is to strip additional Glides stuff out when we start fitting this with Orbit, but thought I'd ask.

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