test(08-02): bot-suite encodeGraph call sites carry landmark blocks (full battery green)

webhook corridor/sparse builders + guidance-cron unnamed way compute
tiny tables through the ONE preprocessing core (@araharah/routing
farthestPointAnchors + landmarkTables) and pass the landmarks block
into the same single encodeGraph call — call-site updates, not a
second encode function. Graphs with no degree>=2 candidate (sparse,
2-node) pin their anchor explicitly; tables still come from the
integer-Dijkstra core.

FULL BATTERY at this commit: routing:test 74/74, bot 126/126, both
typechecks clean; the regenerated fixture is deterministic (byte-
identical re-run); mini-graph-arg1.bin is byte-stable vs its committed
08-01 bytes.
This commit is contained in:
araharah-executor
2026-10-25 18:50:20 +08:00
parent 32a00b5b0b
commit 9770867fd2
2 changed files with 43 additions and 9 deletions
+13 -4
View File
@@ -49,6 +49,7 @@ const { strings } = await import("../src/i18n/strings.ts");
const { encodePolyline6 } = await import("@araharah/routing/src/polyline.ts");
const { deriveCumulativeDistanceM, haversineM } = await import("@araharah/routing/src/geo.ts");
const { encodeGraph, decodeGraph } = await import("@araharah/routing/src/graph.ts");
const { LANDMARK_QUANTUM_S, landmarkTables } = await import("@araharah/routing/src/landmark.ts");
/* ————— geometry helpers (1e-6-grid-exact construction, the codec's grid law) ————— */
@@ -249,15 +250,23 @@ test("GC6b unnamed matched edge → cardStreetUnnamed ('UNNAMED ROAD') — still
// A purpose-built unnamed way through the same encodeGraph contract
// (names: [] → every edge carries the UNNAMED_NAME_ID sentinel).
const meters = haversineM({ lat: 3.15, lng: 101.69 }, { lat: 3.1505, lng: 101.69 });
const edges = [
{ from: 0, to: 1, seconds: meters / (30 / 3.6) },
{ from: 1, to: 0, seconds: meters / (30 / 3.6) },
];
// A 2-node graph has no degree>=2 farthest-point candidate (the selection
// filter), so the anchor pins directly — the tables still come from the
// ONE integer-Dijkstra core (08-02), through the ONE encode authority.
const landmarkInput = { nodeCount: 2, edges, quantumS: LANDMARK_QUANTUM_S };
const anchors = Uint32Array.of(0);
const { to, from } = landmarkTables(landmarkInput, anchors);
const buf = encodeGraph({
lat: [3.15, 3.1505],
lng: [101.69, 101.69],
edges: [
{ from: 0, to: 1, seconds: meters / (30 / 3.6) },
{ from: 1, to: 0, seconds: meters / (30 / 3.6) },
],
edges,
names: [],
maxSpeedKmh: 30,
landmarks: { quantumS: LANDMARK_QUANTUM_S, nodes: anchors, to, from },
});
const graph = decodeGraph(buf);
assert.notEqual(graph, null);