You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Overview
This PR addresses **issue #975** and introduces two major improvements:
---
### 1. Improved Index Usage Warning in `SQLiteStore`
**Problem:**
The previous logic for detecting index usage relied only on the first row of `EXPLAIN QUERY PLAN`. On macOS, this often corresponds to the `rtree` virtual table, so the check missed actual indexes and always warned.
**Solution:**
- Added a new helper method `_warn_if_query_not_using_index` that inspects **all rows** of the query plan.
- The method now looks for any row containing `USING INDEX` or `USING COVERING INDEX` (macOS phrasing).
- If no index is detected, a warning is logged; otherwise, it remains silent.
**Impact:**
More accurate performance warnings and better developer guidance for adding indexes.
---
### 2. Dynamic Port Allocation for Tile Server in Bokeh Tests
**Problem:**
macOS runs multiple daemons on well-known ports (e.g., `5000`). Tests hardcoded to `http://127.0.0.1:5000/...` often collided with other services, causing `HTML/403` responses and subsequent `JSONDecodeError` or `KeyError`.
**Solution:**
- Introduced dynamic port binding for the tile server:
- At test session start, a free loopback port is reserved and exported as `TIATOOLBOX_TILESERVER_PORT`.
- Both the Flask tile server and Bokeh client read this environment variable, ensuring consistent communication.
- Updated all relevant tests (`test_app_bokeh.py`, `test_json_config_bokeh.py`, `test_server_bokeh.py`) and CLI launcher to use the dynamic port.
- Added proxy bypass (`trust_env=False`) for local requests to avoid interference from system proxies.
**Impact:**
Eliminates port conflicts, stabilizes UI tests, and improves cross-platform reliability.
---
### Additional Changes
- Updated Bokeh app hooks and main logic to respect dynamic port configuration.
- Minor refactoring for clarity and maintainability.
---
✅ **Benefits:**
- More robust query performance checks.
- Reliable test execution across macOS and CI environments.
- Cleaner integration between CLI, Bokeh app, and test harness.
---
**Closes:** #975
---------
Co-authored-by: Jiaqi Lv <[email protected]>
Co-authored-by: Shan E Ahmed Raza <[email protected]>
0 commit comments