A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.
JavaScript 3d-globecesiumflight-trackinggeospatialgeospatial-intelligencegisosintphotogrammetrysatellite-trackingspatial-intelligencewebglworldview
fix(directions): report truncation only when a maneuver was actually omitted
Rudy Celeklia140c52f847b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 7acdedf6b..e1518ce6a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -15,6 +15,8 @@the five borough cores load and `CCTV_NYC_MAX_SOURCES` changes the cap. The catalog-wide ceiling isunchanged; extra cameras share it round-robin with the other packs.+- Direction instruction limits report complete routes honestly and retain a final roundabout exit within the limit.+- Treat explicitly current, complete empty vessel coverage as a successful update,clearing obsolete contacts while retaining stale or incomplete snapshots.diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.mdindex c77d1d8e3..d6222d72e 100644--- a/docs/CURRENT-STATE.md+++ b/docs/CURRENT-STATE.md@@ -5310,3 +5310,8 @@ datacenters, dams and the Nepal locator retain that shared credit while displayeMilitary fragments stitch by source identity. Different mapped parcels merge onlywhen their footprints touch or contain one another, never across a seam tolerance gap.+++### fix(directions): report truncation only when a maneuver was actually omitted++Keep processing foldable exits after the cap and report truncation only when the next admissible independent instruction would exceed it. The returned list remains bounded to 200 steps.diff --git a/src/data/route-cap-truthfulness.test.mjs b/src/data/route-cap-truthfulness.test.mjsnew file mode 100644index 000000000..7d5d80153--- /dev/null+++ b/src/data/route-cap-truthfulness.test.mjs@@ -0,0 +1,24 @@+import test from 'node:test';+import assert from 'node:assert/strict';+import { normalizeOsrmSteps, ROUTE_STEPS_MAX } from './routeSteps.js';+const step = (type) => ({+ maneuver: { type, location: [10, 20] },+ distance: 10,+ duration: 1,+});+test('exact-cap routes remain complete and boundary exits retain their distance', () => {+ const steps = Array.from({ length: ROUTE_STEPS_MAX }, () => step('turn'));+ assert.equal(normalizeOsrmSteps({ legs: [{ steps }] }).truncated, false);+ assert.equal(+ normalizeOsrmSteps({ legs: [{ steps: [...steps, step('turn')] }] })+ .truncated,+ true,+ );+ steps[steps.length - 1] = step('roundabout');+ const result = normalizeOsrmSteps({+ legs: [{ steps: [...steps, step('exit roundabout')] }],+ });+ assert.equal(result.truncated, false);+ assert.equal(result.steps.length, ROUTE_STEPS_MAX);+ assert.equal(result.steps.at(-1).distanceM, 20);+});diff --git a/src/data/routeSteps.js b/src/data/routeSteps.jsindex 5ee11602a..e3144bdf7 100644--- a/src/data/routeSteps.js+++ b/src/data/routeSteps.js@@ -185,9 +185,9 @@ export function normalizeOsrmSteps(route) {}continue;}+ if (out.length >= ROUTE_STEPS_MAX) return { steps: out, truncated: true };step.instruction = instructionFor(step);out.push(step);- if (out.length >= ROUTE_STEPS_MAX) return { steps: out, truncated: true };}}return { steps: out, truncated: false };