Tracksolid deployment with timescale & grafana with backup
BUG-06 (LOW-MED): _get_pool() had a TOCTOU race — two threads hitting the None pool at cold start could each create one and leak the loser's connections. Added a threading.Lock with double-checked locking. BUG-07 (LOW): clean_int truncated via int(float(s)) so "3.9" → 3. All current call sites are intrinsically-integer fields, so behaviour for production traffic is unchanged, but rounding is the safer default for any future field that arrives as a decimal. Unit test updated to match. BUG-08 (LOW): _infer_city mapped every Kenyan plate to NBO, silently misclassifying Coast/Mombasa vehicles. Now returns None for K-series plates and emits a log warning so operators can tag them explicitly. Uganda (UMA / UAG) remains unambiguous → KLA. Analytics views already COALESCE NULLs into the 'unassigned' bucket so no dashboards break. BUG-09 (LOW): clean_ts accepted "2024-04-12" verbatim → Postgres stored 00:00 UTC = 03:00 EAT, three hours off the operator's intent. Date-only strings are now anchored to Africa/Nairobi midnight (T00:00:00+03:00). Strings with a time component pass through unchanged. Unit test added. BUG-10 (LOW): rowcount counters in poll_live_positions and poll_trips were named "upserted"/"inserted" but they sum cur.rowcount from ON CONFLICT DO UPDATE statements — which always returns 1 per touch regardless of whether the row was an insert or an update. Renamed to live_pos_affected / history_inserted / trips_affected, and routed trips_affected to the rows_upserted slot of ingestion_log (it was previously logged as rows_inserted, which was misleading). BUG-11 (COSMETIC): removed the redundant conn.commit() inside the with get_conn() block of _update_token_cache — the context manager already auto-commits on __exit__. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |
||
|---|---|---|
| .forgejo/workflows | ||
| administration | ||
| backup | ||
| db_audit | ||
| docs | ||
| grafana | ||
| n8n-workflows | ||
| tests | ||
| .env | ||
| .gitignore | ||
| .python-version | ||
| 01_BusinessAnalytics.md | ||
| 02_tracksolid_docker_commands.md | ||
| 02_tracksolid_full_schema_rev.sql | ||
| 03_webhook_schema_migration.sql | ||
| 04_bug_fix_migration.sql | ||
| 05_enhancement_migration.sql | ||
| 06_business_analytics_migration.sql | ||
| 07_analytics_views.sql | ||
| 260410_baseline_report.md | ||
| 260412_baseline_report.md | ||
| 20260414_FS__Logistics - final_fixed.csv | ||
| CLAUDE.md | ||
| docker-compose.yaml | ||
| Dockerfile | ||
| grafanaDeployment.md | ||
| grafanaOperationalManual.md | ||
| import_drivers_csv.py | ||
| ingest_events_rev.py | ||
| ingest_movement_rev.py | ||
| OPERATIONS_MANUAL.md | ||
| pyproject.toml | ||
| README.md | ||
| run_migrations.py | ||
| run_migrations.sh | ||
| sync_driver_audit.py | ||
| tracksolid_DB_manual.md | ||
| tracksolidApiDocumentation.md | ||
| ts_shared_rev.py | ||
| webhook_receiver_rev.py | ||