fix(client): narrow the route profile and Valhalla answer types, keep the stop check reading the whole log

The built-in profile check returned the open profile key and the run request
returned an unnarrowed answer, both of which the client typecheck refused. The
new road trip tests asserted with non-null assertions where optional calls do.

The graceful stop step piped docker logs into grep -q under pipefail, so grep
leaving early after its match could fail the step with SIGPIPE although the
server had logged SIGTERM.
This commit is contained in:
Maurice
2026-10-29 12:38:35 +01:00
committed by Maurice
parent 10e0e59c3f
commit c4a39171f2
4 changed files with 12 additions and 6 deletions
+6 -1
View File
@@ -217,7 +217,12 @@ export function parsePluginProfile(profile: string): { pluginId: string; profile
/** One of the three profiles both engines know, or null for a plugin's own. */
function builtInProfile(profile: RouteProfileKey): 'driving' | 'walking' | 'cycling' | null {
return profile === 'driving' || profile === 'walking' || profile === 'cycling' ? profile : null
switch (profile) {
case 'driving': return 'driving'
case 'walking': return 'walking'
case 'cycling': return 'cycling'
default: return null
}
}
/**
+2 -1
View File
@@ -738,7 +738,8 @@ async function requestRun(
): Promise<Omit<ValhallaRun, 'snapped'> | ValhallaNoPath | TooSlow | null> {
const body = routeBody(waypoints, profile, avoid, costingOptions, searchFilter)
const data = await postRoute(base, body, signal, publicFallback)
if (data === NO_PATH || tooSlow(data)) return data
if (data === NO_PATH) return NO_PATH
if (tooSlow(data)) return data
return data === null ? null : runFrom(data)
}