sync: capture the production server's code, which was never committed
/root/Routes-api on 31.97.228.132 is not a git repository. Work had been done directly on the box and existed nowhere else -- a single rm -rf from being lost, and impossible to review or roll back. Deploying the previous HEAD over it would have silently reverted all of this. Most visibly the Valhalla road-backend probe in main.py, whose own comment explains why it exists: road sequencing degrades to aerial silently by design, so an unreachable backend stays invisible, "which is exactly how the expired Google key went unnoticed". Overwriting it would have reintroduced precisely the failure it was written to catch, and the service would have kept answering 200 throughout. The server had also moved from Google Maps to Valhalla for road distance (VALHALLA_URL, road_backend_status, +190 lines in route_optimizer), extended docker-compose from 44 to 95 lines, and changed rider fetching, health, dynamic config and the cache layer. Only 10 files differ in substance. The other 27 that appeared to differ were CRLF-vs-LF noise -- the server writes CRLF -- and are normalised to LF here rather than committed as spurious whole-file rewrites. Committed as-is, before any change of mine, so the diff that follows is reviewable against what is actually running. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,6 @@ from .cache import router as cache_router
|
||||
from .ml_admin import router as ml_router, web_router as ml_web_router
|
||||
from .batch_analytics import router as batch_analytics_router
|
||||
from .riders import router as riders_router
|
||||
from .doormile import router as doormile_router
|
||||
|
||||
__all__ = [
|
||||
"optimization_router",
|
||||
@@ -16,5 +15,4 @@ __all__ = [
|
||||
"ml_web_router",
|
||||
"batch_analytics_router",
|
||||
"riders_router",
|
||||
"doormile_router",
|
||||
]
|
||||
|
||||
@@ -84,6 +84,26 @@ async def readiness_check(request: Request):
|
||||
}
|
||||
|
||||
|
||||
@router.get("/road-backend")
|
||||
async def road_backend_check(request: Request):
|
||||
"""
|
||||
Status of the Valhalla road-matrix backend used for road-aware stop sequencing.
|
||||
|
||||
Deliberately separate from /ready: an unreachable backend is a degradation,
|
||||
not an outage — routing falls back to aerial ordering and keeps serving. This
|
||||
endpoint is how you notice the degradation.
|
||||
"""
|
||||
from app.services.routing.route_optimizer import road_backend_status
|
||||
|
||||
status = await road_backend_status()
|
||||
return {
|
||||
**status,
|
||||
"sequencing_mode": "road" if status.get("reachable") else "aerial",
|
||||
"timestamp": datetime.utcnow().isoformat() + "Z",
|
||||
"request_id": getattr(request.state, "request_id", None),
|
||||
}
|
||||
|
||||
|
||||
@router.get("/live")
|
||||
async def liveness_check(request: Request):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user