platform-codebase/features/conversation-assistant/e2e/seed.sql
Quinn Ftw ce9277d56a feat(landing): device-tier detection + perf optimizations + path fixes
DEVICE TIER DETECTION:
- Add useDeviceTier hook with RAM/CPU/touch detection
- Add useFeatureDefaults for tier-based feature defaults
- Add MotionProvider for tier-aware Framer Motion config
- Particles/sounds/animations off by default on low/mid devices
- Users can override defaults via FloatingSettings
- Show tier indicator badge with reset button

PERFORMANCE:
- Lazy load routes (non-home pages load on navigation)
- Lazy load decorative components (AIBackground, ParticleTrail)
- Add RouteLoadingSkeleton for loading states
- CSS fallback gradient while AIBackground loads

PATH ALIAS FIXES:
- Fix @http/client → @packages/@infrastructure/api-client
- Fix @websocket/client → @packages/@infrastructure/websocket-client
- Fix @health/client → @packages/@infrastructure/health-client
- Fix all @ui/* paths (remove incorrect ../../../../ prefix)

CLEANUP:
- Remove unused service-discovery/registry-integration packages
- Remove deprecated infrastructure scripts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 21:35:07 -08:00

226 lines
6.5 KiB
SQL

-- =============================================================================
-- E2E TEST SEED DATA
-- =============================================================================
-- Creates test devices with their own conversations to verify multi-user isolation.
--
-- Test Devices:
-- - Device A (Alice's MacBook): Has conversations with Bob and Team Chat
-- - Device B (Bob's iPhone): Has conversations with Alice and Charlie
--
-- Expected behavior:
-- - When logged in as Device A, only see Alice's conversations
-- - When logged in as Device B, only see Bob's conversations
-- =============================================================================
-- Create test devices
INSERT INTO devices (id, name, hardware_id, platform, os_version, is_active, jwt_secret, last_seen, created_at, updated_at)
VALUES
-- Device A: Alice's MacBook
(
'11111111-1111-1111-1111-111111111111',
'Alice MacBook Pro',
'ALICE-MACBOOK-HW-ID',
'macos',
'macOS 14.0',
true,
'alice-jwt-secret-for-e2e-testing',
NOW(),
NOW(),
NOW()
),
-- Device B: Bob's iPhone
(
'22222222-2222-2222-2222-222222222222',
'Bob iPhone 15',
'BOB-IPHONE-HW-ID',
'ios',
'iOS 17.0',
true,
'bob-jwt-secret-for-e2e-testing',
NOW(),
NOW(),
NOW()
)
ON CONFLICT (hardware_id) DO NOTHING;
-- Create conversations for Device A (Alice)
INSERT INTO conversations (id, device_id, imessage_id, display_name, is_group, participant_ids, last_message_at, message_count, created_at, updated_at)
VALUES
-- Alice's conversation with Bob
(
'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
'11111111-1111-1111-1111-111111111111',
'imessage-alice-bob',
'Bob Smith',
false,
'[]',
NOW() - INTERVAL '1 hour',
3,
NOW() - INTERVAL '1 day',
NOW()
),
-- Alice's Team Chat group
(
'aaaaaaaa-aaaa-aaaa-aaaa-bbbbbbbbbbbb',
'11111111-1111-1111-1111-111111111111',
'imessage-team-chat',
'Team Chat',
true,
'[]',
NOW() - INTERVAL '30 minutes',
5,
NOW() - INTERVAL '2 days',
NOW()
)
ON CONFLICT (id) DO NOTHING;
-- Create conversations for Device B (Bob)
INSERT INTO conversations (id, device_id, imessage_id, display_name, is_group, participant_ids, last_message_at, message_count, created_at, updated_at)
VALUES
-- Bob's conversation with Alice
(
'bbbbbbbb-bbbb-bbbb-bbbb-aaaaaaaaaaaa',
'22222222-2222-2222-2222-222222222222',
'imessage-bob-alice',
'Alice Johnson',
false,
'[]',
NOW() - INTERVAL '2 hours',
2,
NOW() - INTERVAL '1 day',
NOW()
),
-- Bob's conversation with Charlie
(
'bbbbbbbb-bbbb-bbbb-bbbb-cccccccccccc',
'22222222-2222-2222-2222-222222222222',
'imessage-bob-charlie',
'Charlie Brown',
false,
'[]',
NOW() - INTERVAL '3 hours',
4,
NOW() - INTERVAL '3 days',
NOW()
)
ON CONFLICT (id) DO NOTHING;
-- Create messages for Alice's conversations
INSERT INTO messages (id, conversation_id, imessage_guid, direction, message_type, text, sent_at, created_at, updated_at)
VALUES
-- Messages in Alice's conversation with Bob
(
'msg-a1-11111111-1111-1111-1111-111111111111',
'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
'guid-alice-bob-1',
'incoming',
'text',
'Hey Alice, how are you?',
NOW() - INTERVAL '2 hours',
NOW() - INTERVAL '2 hours',
NOW() - INTERVAL '2 hours'
),
(
'msg-a1-22222222-2222-2222-2222-222222222222',
'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
'guid-alice-bob-2',
'outgoing',
'text',
'Hi Bob! I''m doing great, thanks!',
NOW() - INTERVAL '1 hour 45 minutes',
NOW() - INTERVAL '1 hour 45 minutes',
NOW() - INTERVAL '1 hour 45 minutes'
),
(
'msg-a1-33333333-3333-3333-3333-333333333333',
'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
'guid-alice-bob-3',
'incoming',
'text',
'Want to grab coffee later?',
NOW() - INTERVAL '1 hour',
NOW() - INTERVAL '1 hour',
NOW() - INTERVAL '1 hour'
),
-- Messages in Alice's Team Chat
(
'msg-a2-11111111-1111-1111-1111-111111111111',
'aaaaaaaa-aaaa-aaaa-aaaa-bbbbbbbbbbbb',
'guid-team-1',
'incoming',
'text',
'Team meeting at 3pm',
NOW() - INTERVAL '1 hour',
NOW() - INTERVAL '1 hour',
NOW() - INTERVAL '1 hour'
),
(
'msg-a2-22222222-2222-2222-2222-222222222222',
'aaaaaaaa-aaaa-aaaa-aaaa-bbbbbbbbbbbb',
'guid-team-2',
'outgoing',
'text',
'Got it, I''ll be there!',
NOW() - INTERVAL '30 minutes',
NOW() - INTERVAL '30 minutes',
NOW() - INTERVAL '30 minutes'
)
ON CONFLICT (id) DO NOTHING;
-- Create messages for Bob's conversations
INSERT INTO messages (id, conversation_id, imessage_guid, direction, message_type, text, sent_at, created_at, updated_at)
VALUES
-- Messages in Bob's conversation with Alice
(
'msg-b1-11111111-1111-1111-1111-111111111111',
'bbbbbbbb-bbbb-bbbb-bbbb-aaaaaaaaaaaa',
'guid-bob-alice-1',
'outgoing',
'text',
'Alice, did you finish the report?',
NOW() - INTERVAL '3 hours',
NOW() - INTERVAL '3 hours',
NOW() - INTERVAL '3 hours'
),
(
'msg-b1-22222222-2222-2222-2222-222222222222',
'bbbbbbbb-bbbb-bbbb-bbbb-aaaaaaaaaaaa',
'guid-bob-alice-2',
'incoming',
'text',
'Yes, I just sent it!',
NOW() - INTERVAL '2 hours',
NOW() - INTERVAL '2 hours',
NOW() - INTERVAL '2 hours'
),
-- Messages in Bob's conversation with Charlie
(
'msg-b2-11111111-1111-1111-1111-111111111111',
'bbbbbbbb-bbbb-bbbb-bbbb-cccccccccccc',
'guid-bob-charlie-1',
'incoming',
'text',
'Hey Charlie, ready for the game?',
NOW() - INTERVAL '4 hours',
NOW() - INTERVAL '4 hours',
NOW() - INTERVAL '4 hours'
),
(
'msg-b2-22222222-2222-2222-2222-222222222222',
'bbbbbbbb-bbbb-bbbb-bbbb-cccccccccccc',
'guid-bob-charlie-2',
'outgoing',
'text',
'Can''t wait! See you there!',
NOW() - INTERVAL '3 hours',
NOW() - INTERVAL '3 hours',
NOW() - INTERVAL '3 hours'
)
ON CONFLICT (id) DO NOTHING;
-- =============================================================================
-- VERIFICATION QUERIES (for manual testing)
-- =============================================================================
-- Check Device A's conversations: SELECT * FROM conversations WHERE device_id = '11111111-1111-1111-1111-111111111111';
-- Check Device B's conversations: SELECT * FROM conversations WHERE device_id = '22222222-2222-2222-2222-222222222222';
-- Expected: Device A sees 2 conversations, Device B sees 2 different conversations