Slice Serializer Cross Floor Bug
"/home/yossef/notes/git/projects/maplibra/risks/Slice Serializer Cross Floor Bug.md"
path: maplibra/risks/Slice Serializer Cross Floor Bug.md
- **fileName**: Slice Serializer Cross Floor Bug
- **Created on**: 2026-06-16 00:48:42
Slice Serializer Cross Floor Bug
Purpose: Documents a fixed critical bug where per-floor graph slices dropped cross-floor edges.
Related: ../Home.md, ./Risk Map.md, ../modules/Pathfinding.md, ../flows/Graph Construction.md
Migrated from: obs_vault
Status: Fixed
Severity: Critical — breaks all multi-floor routing
Root Cause: graph-slice-serializer.js line 70
Summary
Per-floor routing graph slices silently strip every cross-floor edge (stairs, elevators, ramps, escalators). When the runtime loads slices instead of the monolithic binary graph, the loaded PathfinderGraph has zero connectivity between floors, causing findNearestNode to return nothing and routing to fail with "No snap candidates for target."
Affected Flows
- Any route where start and target are on different floors
- Any route where the origin is on a non-default floor (the graph only contained the active floor's nodes)
Root Cause Details
Bug 1 — Slice serializer edge filter
In src/pathfinding/graph-slice-serializer.js:70:
const nodeNeighbors = (node.neighbors || []).filter((edge) => localIndexById.has(edge.id));
localIndexById only contains nodes for the current floor. Stair/elevator edges point to nodes on other floors, so they are dropped.
Bug 2 — Slice loader uses only the primary floor
In src/pathfinding/services/graph-data-service.js:111:
nodesBuffer: primarySlice.nodes,
edgesBuffer: primarySlice.edges,
Only the active floor's binary buffers are used. Adjacent slices are cached but never merged. The graph contains nodes from one floor only.
Fix Applied
Disabled slice loading in graph-data-service.js. The monolithic binary fallback contains all floors and all edge types. It loads from routing/graph.header.json + routing/graph.nodes.bin + routing/graph.edges.bin.
Future Fix (Option B)
To restore slice-based lazy loading:
- Serializer: keep cross-floor edges using global node indices; mark them for lazy resolution
- Loader: merge adjacent slice buffers into a combined typed array before constructing
PathfinderGraph - Manifest: populate
adjacentarrays from actual connector data instead of always[]
Related
-
../modules/Pathfinding.md — load order and connection types
-
../flows/Graph Construction.md — graph build pipeline
continue:[[]]
before:[[]]