docs(routes): tighten the outage comments and notes

Shorter comments, changelog and CURRENT-STATE text for the 502 outage
path; the CURRENT-STATE paragraph now also names the 429 exception and
which budget expiry answers busy and which answers 502. Text only.
This commit is contained in:
German Khokhlov committed 2026-11-11 21:21:07 +04:00
1 parent a29611ca17
commit 82e2b716bc
7 files changed
+20 -36

No files matched your search

+2 -3
View File
@@ -21,7 +21,7 @@ export function createDirectionsSource({
signal,
headers: { Accept: 'application/json' },
});
// A failure page in front of the proxy need not be JSON.
// Proxy error pages may not be JSON.
let payload = null;
try {
payload = await response.json();
@@ -45,8 +45,7 @@ export function createDirectionsSource({
{ status: 429, refusal },
);
}
// A 5xx is a routing outage whatever its body says; only the proxy's
// refusals carry an error text worth showing.
// A 5xx body may mislabel an outage as a route refusal.
if (response.status >= 500 || (!response.ok && !payload?.error))
throw Object.assign(
new Error(`Routing unavailable (HTTP ${response.status})`),
-1
View File
@@ -236,7 +236,6 @@ test('OSRM routing preserves aliases, cache, span guards and upstream failure be
assert.equal((await request(route, url)).body.error, error);
assert.equal(calls, 1);
now += 600001;
// OSRM's own "no route" is a 400 with a JSON code, and stays one.
t.mock.method(globalThis, 'fetch', async () =>
Response.json(
{ code: 'NoRoute', message: 'Impossible route between points' },
+1 -2
View File
@@ -189,8 +189,7 @@ export function createRouteService({
} catch {
/* the status below is authoritative */
}
// A rate limit or an outage (5xx) is the routing service's failure, not
// a missing route, whatever the body says. Voice hears this message.
// Handle 429 and 5xx before route refusals, regardless of the body.
if (response.status === 429) throw httpFailure(response, 'Routing');
if (response.status >= 500)
throw new ToolError(
+1 -1
View File
@@ -283,7 +283,7 @@ test('a routing outage is reported as unavailable, not as invalid arguments', as
assert.equal(result.structuredContent.error, 'unavailable');
assert.doesNotMatch(result.content[0].text, /No walk route/);
}
// Voice passes only the message on, so it names the outage itself.
// Voice receives only the message, so it must name the outage.
const outage = createRouteService({
fetchImpl: async () =>
Response.json(