The region_names dictionary was a redundant index that needed manual sync when HistoryManager modified region names. This caused bugs where resolve_query couldn't find regions by their new (history-modified) names. Instead of maintaining two data structures (regions[id] and region_names[name]), we now only use regions[id] as the single source of truth. The _resolve_region function iterates over regions.values() to find matches by name. This approach: - Eliminates the sync bug entirely - Simplifies the codebase - Has negligible performance impact (region count is small) Co-authored-by: Zihao Xu <xzhseh@gmail.com>
4.8 KiB
4.8 KiB