Fix: Remove Crew Mock Data Fallback

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


Summary

Removed the mock data fallback in CrewService.getActiveCrews() that caused a UUID error when users tried to join a crew.


Error

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

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


Root Cause

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

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

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


Fix

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

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

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


Impact

  • Users now see an empty crew 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 crews 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.