Fix: Remove Squad Mock Data Fallback

Branch: fix/squad-mock-data Merged into: develop Date: 2026-03-17


Summary

Removed the mock data fallback in SquadService.getActiveSquads() that caused a UUID error when users tried to join a squad.


Error

invalid input syntax for type uuid: "mock-1"

Appeared in the app_issues Supabase table when a user tapped “Join” on a squad that was loaded from mock data.


Root Cause

squad_service.dart had a catch block that returned hardcoded mock squads when the squads Supabase table was unavailable:

catch (e) {
  _logger.w('squads table unavailable, using mock data: $e');
  return _mockSquads();
}

The _mockSquads() method returned squads with string IDs ('mock-1', 'mock-2', etc.). When a user tapped “Join”, joinSquad('mock-1') inserted a row into squad_members with squad_id = 'mock-1' — Supabase’s PostgreSQL rejected it because the column is a UUID type.


Fix

In lib/features/social/services/squad_service.dart:

  1. Changed the catch block to return an empty list:

    catch (e) {
      _logger.w('getActiveSquads failed: $e');
      return [];
    }
  2. Removed the entire _mockSquads() method.


Impact

  • Users now see an empty squad list if the table is unreachable (e.g., RLS not set up, network error)
  • No more UUID crashes from fake IDs flowing into real Supabase tables
  • The UI should handle an empty list gracefully (show “No squads available” state)

Lesson Learned

Mock data fallbacks in services are useful during development, but must be removed before any path that writes data to the database is used. A mock ID flowing into a UUID column will always crash at the database layer.