Unified Facility Hierarchy — one source of truth for device location across 15 services.
Every microservice was resolving device → facility locations its own way. Duplicate logic, inconsistent results, no multi-root zones, and no way to let tenants override global facilities without branching the data model.
In-memory tree over lookup table
O(1) parent-chain traversal beat recursive CTEs on every lookup. Redis pub/sub kept caches consistent across service replicas.
Overlay semantics
Tenant-specific facilities shadow global ones without mutation. The base tree stays canonical; tenants layer on top.
12-point validation suite
Caught 3 data-integrity issues during the 954-line PostgreSQL migration that would have caused silent incorrect lookups in prod.
Outcome
Every downstream service resolves device locations through a single, consistent hierarchy.
Enabled multi-root trees for zones — a requirement the flat model couldn't handle.
Eliminated duplicate lookup logic scattered across 15 services.
