This guide covers the verification of high-stakes safety features (Escalations, Vibe Checks) that require server-side time manipulation.
Goal: Verify the server detects you are late and allows a peer to send a "Wave".
- Set the Stage:
- Open the app and ensure you are logged in.
- Note your Rhythm time (e.g., 8:00 PM).
- Time Travel (SQL): Run this in the Supabase SQL Editor to make the server think you missed your deadline 3 hours ago:
UPDATE profiles SET schedule_time = (NOW() AT TIME ZONE 'Asia/Kolkata' - INTERVAL '3 hours')::time WHERE display_name = 'Alex'; -- Ensure no check-in exists for today DELETE FROM checkins WHERE user_id = (SELECT id FROM profiles WHERE display_name = 'Alex');
- Trigger: Wait for the next hourly Cron job or manually trigger the
heartbeatfunction via CLI/Curl. - Verification:
- Check
vibe_checkstable for a new entry. - Verify you receive a Push Notification: "A Flow Mate sent a wave."
- Check
Goal: Verify the system sends a serious warning after 24h of silence.
- Time Travel (SQL): Make the server think your last check-in was 25 hours ago:
DELETE FROM checkins WHERE user_id = (SELECT id FROM profiles WHERE display_name = 'Alex'); INSERT INTO checkins (user_id, timestamp, mood) VALUES ((SELECT id FROM profiles WHERE display_name = 'Alex'), NOW() - INTERVAL '25 hours', 'flowing');
- Trigger: Run the
heartbeatfunction. - Verification:
- Receive Push Notification: "Alex, everything okay? We haven't heard from you in 24h."
Goal: Verify your Anchor (Mom/Guardian) receives a real SMS when you go missing.
- Time Travel (SQL): Make the server think you've been silent for 49 hours:
DELETE FROM checkins WHERE user_id = (SELECT id FROM profiles WHERE display_name = 'Alex'); INSERT INTO checkins (user_id, timestamp, mood) VALUES ((SELECT id FROM profiles WHERE display_name = 'Alex'), NOW() - INTERVAL '49 hours', 'flowing');
- Trigger: Run the
heartbeatfunction. - Verification:
- CRITICAL: Check the phone of your Anchor Contact. They should receive an SMS from your Twilio number.
- Check
profilestable:last_escalated_atshould now be populated with the current timestamp.
Goal: Verify the app heals its own data when moving to a new phone.
- Simulate Corruption: Manually set your token to NULL in the DB:
UPDATE profiles SET fcm_token = NULL, timezone = 'UTC' WHERE display_name = 'Alex';
- Action: Close and re-open the app on your iPhone.
- Verification:
- Refresh the DB.
fcm_tokenshould be restored andtimezoneshould be 'Asia/Kolkata'.
- Refresh the DB.
Trigger Heartbeat Manually (Staging):
curl -X POST "https://ozbkjlxoajwjqmwgrfet.supabase.co/functions/v1/heartbeat" \
-H "Authorization: Bearer YOUR_SERVICE_ROLE_KEY" \
-H "Content-Type: application/json" \
-d '{}'