Skip to content

Serve alerts.pb, weather.json and vehicles.json (production cutover blocker) - #80

Merged
aaronbrethorst merged 1 commit into
mainfrom
rider-route-extensions
Nov 21, 2026
Merged

aaronbrethorst merged 1 commit into
mainfrom
rider-route-extensions

Conversation

@aaronbrethorst

@aaronbrethorst aaronbrethorst commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Problem

The shipping iOS and Android apps request GET /api/v1/regions/{id}/alerts.pb (optionally ?test=1) and GET /api/v1/regions/{id}/weather.json (iOS: ObacoAPIService.swift, RESTAPIURLBuilder.swift; Android: donottranslate.xml). The sidecar only registered /alerts, /alerts.pbtext, /weather, /vehicles, so both requests got Go's default 404. Region-wide alerts and weather would break for every region moved to the sidecar. The Rails migrated-region redirect preserves request.fullpath, so suffixed paths arrive here unchanged.

Changes

  • alerts.pb -> same handler as /alerts (binary feed, content type, cache headers, ?test=1).
  • weather.json -> same handler as /weather (including the deliberate 403 when unavailable).
  • vehicles.json -> same handler as /vehicles (Rails routed it with format json; redirect preserves it).
  • Not added: alerts.json (Rails only answered pb/pbtext; no JSON representation exists here, stays 404, now tested). Alarms/push/live-activity/ghost-bus/survey-response paths: no client emits a suffix, so unchanged.
  • specification/openapi.yaml, specification/specification.md, README updated; deploy/smoke.sh now probes alerts.pb.

Testing

Tests written first and confirmed failing with 404, then routes added: alerts.pb vs /alerts (body + Content-Type + Cache-Control, with and without ?test=1, unknown region 404), alerts.json 404, weather.json vs /weather for 200/403/404, vehicles.json vs /vehicles. make check (fmt-check, vet, golangci-lint, generate-check, test, test-tz, test-race, web-check) passes.

Summary by CodeRabbit

  • New Features

    • Added .pb alerts and .json weather and vehicle-search endpoint variants. Each returns the same results as its corresponding existing endpoint.
    • Updated API documentation to describe the additional endpoint paths and their behavior.
  • Bug Fixes

    • Updated the cutover smoke check to use the .pb alerts path.

The shipped iOS and Android apps request GET /api/v1/regions/{id}/alerts.pb
and /weather.json, and the legacy Rails app also served /vehicles.json
(its migrated-region redirect preserves the full path). The sidecar only
registered the bare paths, so those requests hit Go's default 404 and
region-wide alerts and weather broke for any region moved to the sidecar.

Register the suffixed paths on the same handlers, keeping weather's
deliberate 403-when-unavailable. alerts.json is intentionally not served:
Rails only answered pb and pbtext. Update the OpenAPI spec, README, spec
doc, and make deploy/smoke.sh probe alerts.pb.
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The router now serves .alerts.pb, .weather.json, and .vehicles.json through the existing handlers. Tests compare these routes with their unsuffixed versions. The README, API specifications, and smoke test document or use the updated paths.

Changes: Endpoint suffix aliases

Layer / File(s) Summary
Alerts feed alias
internal/httpapi/router.go, internal/httpapi/alerts_test.go, deploy/smoke.sh, README.md, specification/openapi.yaml, specification/specification.md
The router maps .alerts.pb to the existing binary feed handler. Tests compare the alias with the bare route and check that .alerts.json returns 404. The smoke test and documentation use or describe .alerts.pb.
Weather and vehicle-search aliases
internal/httpapi/router.go, internal/httpapi/weather_test.go, internal/httpapi/vehicles_test.go, README.md, specification/openapi.yaml
The router maps .weather.json and .vehicles.json to the existing handlers. Tests compare the aliases with the bare routes. The documentation describes the aliases and their behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: omlahore

Merge Risk: Minimal · up to b2f6d

This change adds alerts.pb, weather.json and vehicles.json routes that use the existing handlers, so the shipped apps and the Rails redirect no longer hit a 404. It is low risk and ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names three suffixed routes: alerts.pb, weather.json and vehicles.json. The changeset adds exactly these routes in internal/httpapi/router.go, with tests and documentation updates. It also n…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names three suffixed routes: alerts.pb, weather.json and vehicles.json. The changeset adds exactly these routes in internal/httpapi/router.go, with tests and documentation updates. It also notes the cutover context. The title covers the main change, though it omits the explicit 404 for alerts.json.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 242d459f-935d-4eed-beea-8e0133ba2450
Commits

Reviewing files that changed from the base of the PR and between 8274f0c and b2f6daa.

Files selected for processing: 8

  • README.md
  • deploy/smoke.sh
  • internal/httpapi/alerts_test.go
  • internal/httpapi/router.go
  • internal/httpapi/vehicles_test.go
  • internal/httpapi/weather_test.go
  • specification/openapi.yaml
  • specification/specification.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@sonarqubecloud

Copy link
Copy Markdown

@aaronbrethorst

Copy link
Copy Markdown
Member Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@aaronbrethorst

Copy link
Copy Markdown
Member Author

Maintainer sweep: this one is ready to land on the merits, but I'm not merging it in this pass because it's authored by the account running the sweep, and I don't approve or merge my own PRs. It needs an approval and merge from another maintainer.

What I checked myself, beyond the automated review:

  • The three new routes (alerts.pb, weather.json, vehicles.json) are registered inside the same nil-dependency blocks as the bare paths and use the same handlers. That means the shipped-client contracts (weather 403, unknown region 404, vehicles 502) can't drift between the two forms.
  • No middleware in internal/httpapi branches on the request path, so rate limiting and logging behave the same on the aliases.
  • The alias tests compare body, Content-Type and Cache-Control against the bare path and fail if a route registration is removed. alerts.json is pinned as a 404.
  • The smoke script now checks alerts.pb, which is the path the apps actually request.
  • CI is green.

Heads-up: #81 and #83 also touch internal/httpapi/router.go, README and the spec, so whichever lands second may need a quick rebase.

@aaronbrethorst

Copy link
Copy Markdown
Member Author

PR sweep disposition: blocked — not merged.

I authored this PR, so the sweep can't approve or merge it. I re-read the full diff at b2f6daa: three literal-path aliases (alerts.pb, weather.json, vehicles.json) on the existing handlers, plus tests that compare body and headers against the bare paths and keep the 403/404 contracts. It looks ready, CI is green, and the branch merges cleanly with main.

To unblock: another maintainer approves and merges it.

@aaronbrethorst
aaronbrethorst merged commit 843a621 into main Nov 21, 2026
12 checks passed
@aaronbrethorst
aaronbrethorst deleted the rider-route-extensions branch November 21, 2026 06:23
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.

1 participant