Skip to content

fix: register missing Situation endpoint route (#798)#804

Open
tejasva-vardhan wants to merge 1 commit intoOneBusAway:mainfrom
tejasva-vardhan:fix/situation-route-parity
Open

fix: register missing Situation endpoint route (#798)#804
tejasva-vardhan wants to merge 1 commit intoOneBusAway:mainfrom
tejasva-vardhan:fix/situation-route-parity

Conversation

@tejasva-vardhan
Copy link
Copy Markdown
Contributor

@tejasva-vardhan tejasva-vardhan commented Mar 28, 2026

Overview

This PR resolves #798 by properly registering the GET /api/where/situation/{id} route in the REST API. While the handler logic was present, it was not wired to the router, causing a 404/HTML fallback when requesting real-time service alerts.

Changes

  • Route Registration: Registered the missing endpoint in internal/restapi/routes.go.
  • Logic Implementation: Re-implemented the situationHandler to correctly fetch and format service alerts using api.extractAndValidateID.
  • Data Access: Added GetAllAlerts() in internal/gtfs/realtime.go to provide access to the in-memory GTFS-RT alert store.
  • Testing: Added unit tests in internal/restapi/situation_handler_test.go (verified with go test).

Verification (Before vs After)

To ensure full parity with the legacy OBA Java API, I verified the fix using both the maglev-validator and manual browser testing.

1. Maglev Validator Comparison

Local Maglev (localhost:4000) vs Production Java API (api.pugetsound.onebusaway.org).

Stage Comparison Result
Before (Gap) Screenshot 2026-03-29 020453
After (Fixed) Screenshot 2026-03-29 021558

2. Browser Manual Testing

Endpoint: /api/where/situation/1_84714.json?key=test

Stage Response Screenshot
Before (404) Screenshot 2026-03-29 013458
After (200 OK) Screenshot 2026-03-29 021511

Note for Reviewers: - Only core logic files for the fix are included in this PR.

  • Windows-specific driver changes (modernc.org/sqlite) and local performance bypasses were intentionally excluded to maintain upstream standards.

@tejasva-vardhan
Copy link
Copy Markdown
Contributor Author

@aaronbrethorst @Ahmedhossamdev would love any review on this!

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.

[Parity Gap] Orphaned handler: Missing route registration for Situation endpoint (/api/where/situation/{id}.json)

1 participant