fix(gps-tracks): rename health fields and fix layer insert priority (F-04, F-05)
Some checks failed
CI / lint (push) Failing after 4s
CI / test (push) Failing after 5s
CI / build (push) Has been skipped
CI / lint (pull_request) Failing after 4s
CI / test (pull_request) Failing after 5s
CI / build (pull_request) Has been skipped

F-04: rename gps_health() response fields per tester feedback:
  - total_tracks → tracks_total
  - by_activity  → tracks_by_activity
  - recent_pipeline_runs (list) → last_pipeline_run (object | null)
  Change LIMIT from 10 to 1; fetch single row instead of a list.

F-05: rewrite _findGpsInsertPosition with explicit priority order:
  1. gpx-layer-* (ET-006 GPX file layers) — highest priority
  2. route-* (ET-002 routing layers)
  Remove old combined find() that lacked clear priority semantics.

Add tests/web/gps_tracks.test.js (22 JS unit tests via node:test):
  - _findGpsInsertPosition priority logic (9 cases)
  - Filter state management — default state assertions (5 cases)
  - Color palette mapping and _buildColorExpression (8 cases)

Add tests/web/test_gps_tracks.py — Python pytest runner (8 static
  checks + node --test invocation).

Refs: ET-008

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-01 14:18:06 +00:00
parent 3a6017cc82
commit ba356ae317
6 changed files with 450 additions and 17 deletions

View File

@@ -313,10 +313,10 @@ async def test_i40_health_endpoint(db_with_tracks):
assert resp.status_code == 200
data = resp.json()
assert data["status"] == "ok"
assert "total_tracks" in data
assert data["total_tracks"] > 0
assert "by_activity" in data
assert "recent_pipeline_runs" in data
assert "tracks_total" in data
assert data["tracks_total"] > 0
assert "tracks_by_activity" in data
assert "last_pipeline_run" in data
@pytest.mark.asyncio
@@ -333,8 +333,8 @@ async def test_i40_health_empty_db(tmp_path):
assert resp.status_code == 200
data = resp.json()
assert data["total_tracks"] == 0
assert data["recent_pipeline_runs"] == []
assert data["tracks_total"] == 0
assert data["last_pipeline_run"] is None
# ─── Cache clear endpoint ─────────────────────────────────────────────────────