📄 2026-05-04-rtsport-integration-cleanup.md 2,969 bytes Monday 17:30 📋 Raw

2026-05-04 — RTSport Integration Cleanup

What Happened

Matt requested cleanup and further integration prep for the RTSport stack.

Issues Found & Fixed

1. Auth Broken — bcrypt Hash Mismatch

  • Problem: Previous DB seed stored incompatible password hashes. login/json returned 500.
  • Fix: Re-seeded DB from scratch using hash_password() from app.auth, all 6 users now auth correctly.

2. ARRAY Columns Stored as JSON Strings (SQLite)

  • Problem: sports, assigned_sports, parent_ids, active_case_ids stored as '["Football"]' string in SQLite, then Pydantic iterated it character-by-character → ['[', '"', 'F', 'o', ...]
  • Root Cause: Seed script passed sports=f'["{sport}"]' (string) instead of sports=[sport] (Python list). Custom ARRAY type's process_bind_param double-encoded it.
  • Fix 1: Re-seeded with proper Python lists
  • Fix 2: Added @field_validator('sports', 'parent_ids', 'active_case_ids', mode='before') to AthleteSchema in schemas.py to parse JSON strings → lists on read

3. Frontend Hardcoded to localhost

  • Problem: AT/parent/AD dashboards had API_BASE = 'http://127.0.0.1:8001/api/v1' — unreachable from phone
  • Fix: Changed all 4 files to https://hoffdesk.com/api/v1

4. RTSport Mock Router Pointed to Old Directory

  • Problem: rtsport_mock.py referenced /home/hoffmann_admin/rtsport/frontend (old path)
  • Fix: Updated to /home/hoffmann_admin/.openclaw/shared/build-20260501/frontend

5. Missing brand.html

  • Problem: Mock router had route for /rtsport/brand but file didn't exist in new build
  • Fix: Commented out the route

6. hoffdesk-api Crash Loop

  • Problem: Killed manual process on port 8000, systemd service couldn't bind (port in use by orphaned child)
  • Fix: Killed orphans, systemd recovered

Data Summary (Post-Seed)

  • 106 athletes across 3 sports (Football: 47, Soccer: 32, Basketball: 27)
  • 18 active cases (14 restricted, 4 out)
  • 6 users: AT (all sports), Coach FB/Soccer/BB, AD, Parent
  • 3 teams for Football (Varsity, JV, Freshman), 2 each for Soccer/Basketball

Service Status

  • hoffdesk-api (port 8000): systemd managed, running
  • rtsport-api (port 8001): manual nohup, needs systemd service
  • Service file prepared at: shared/build-20260501/backend/rtsport-api.service
  • TODO: Matt needs to sudo cp + systemctl enable the service file

Files Modified

  • shared/build-20260501/backend/app/schemas.py — Added JSON list validator
  • shared/build-20260501/frontend/templates/at/dashboard.html — API_BASE fix
  • shared/build-20260501/frontend/templates/at/sideline-entry.html — API_BASE fix
  • shared/build-20260501/frontend/templates/parent/dashboard.html — API_BASE fix
  • shared/build-20260501/frontend/templates/ad/dashboard.html — API_BASE fix
  • workspace-socrates/hoffdesk-api/rtsport_mock.py — Path update + brand route disabled