experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(test): deterministic profile IDs via PEEK_PROFILE_ID env var

Add apply_profile_override() that checks PEEK_PROFILE_ID env var.
When set, forces the active profile ID and skips
ensure_dev_profile_in_dev_build() — e2e tests no longer depend
on profile name matching.

Test script updated: profile name changed from 'Development' to
'E2E Test' to prove name independence, and all simulator launches
pass PEEK_PROFILE_ID.

+27 -11
+21 -6
backend/tauri-mobile/src-tauri/src/lib.rs
··· 670 670 println!("[Rust] Loaded profile config: current={}", config.current_profile_id); 671 671 // Check if we need to migrate old slug-based databases 672 672 migrate_slug_databases_to_uuid(&config); 673 - // Ensure Development profile exists in dev builds 674 - ensure_dev_profile_in_dev_build(&mut config); 673 + // Apply test profile override or ensure dev profile 674 + apply_profile_override(&mut config); 675 675 return config; 676 676 } 677 677 Err(e) => { ··· 682 682 Ok(old_config) => { 683 683 println!("[Rust] Found old format profiles.json, migrating..."); 684 684 let mut new_config = migrate_old_profile_config(old_config); 685 - // Ensure Development profile exists in dev builds 686 - ensure_dev_profile_in_dev_build(&mut new_config); 685 + // Apply test profile override or ensure dev profile 686 + apply_profile_override(&mut new_config); 687 687 save_profile_config(&new_config); 688 688 return new_config; 689 689 } ··· 701 701 } 702 702 703 703 // Create default config 704 - let config = create_default_profile_config(); 704 + let mut config = create_default_profile_config(); 705 + apply_profile_override(&mut config); 705 706 save_profile_config(&config); 706 707 config 707 708 } ··· 839 840 } 840 841 } 841 842 843 + /// Apply PEEK_PROFILE_ID env var override for e2e testing. 844 + /// When set, skips ensure_dev_profile_in_dev_build() and forces the active profile ID. 845 + fn apply_profile_override(config: &mut ProfileConfig) { 846 + match std::env::var("PEEK_PROFILE_ID") { 847 + Ok(ref id) if is_valid_uuid(id) => { 848 + println!("[Rust] PEEK_PROFILE_ID override: {}", id); 849 + config.current_profile_id = id.clone(); 850 + } 851 + _ => { 852 + ensure_dev_profile_in_dev_build(config); 853 + } 854 + } 855 + } 856 + 842 857 /// Ensure Development profile exists in dev builds 843 858 /// This handles the case where a production profiles.json was left behind (e.g., from TestFlight) 844 859 /// and we're now running a development build that should have the Development profile available ··· 1002 1017 // This ensures the database UUID is saved to profiles.json (no orphaned DBs) 1003 1018 ios_log("No profiles found, creating and saving default profile config"); 1004 1019 let mut new_config = create_default_profile_config(); 1005 - ensure_dev_profile_in_dev_build(&mut new_config); 1020 + apply_profile_override(&mut new_config); 1006 1021 save_profile_config(&new_config); 1007 1022 // Update cache 1008 1023 if let Ok(mut guard) = PROFILE_CONFIG.write() {
+6 -5
scripts/e2e-full-sync-test.sh
··· 80 80 xcrun simctl terminate booted "$IOS_BUNDLE_ID" 2>/dev/null || true 81 81 sleep 1 82 82 83 - # Launch with optional auto-sync environment variable 83 + # Launch with deterministic profile ID + optional auto-sync 84 84 if [ "$auto_sync" = "true" ]; then 85 - echo " [AUTO-SYNC] Launching with PEEK_AUTO_SYNC=true" 86 - SIMCTL_CHILD_PEEK_AUTO_SYNC=true xcrun simctl launch booted "$IOS_BUNDLE_ID" 2>/dev/null || { 85 + echo " [AUTO-SYNC] Launching with PEEK_PROFILE_ID=$IOS_PROFILE_ID PEEK_AUTO_SYNC=true" 86 + SIMCTL_CHILD_PEEK_PROFILE_ID="$IOS_PROFILE_ID" SIMCTL_CHILD_PEEK_AUTO_SYNC=true xcrun simctl launch booted "$IOS_BUNDLE_ID" 2>/dev/null || { 87 87 echo " WARNING: Failed to launch iOS app. Is it installed?" 88 88 return 1 89 89 } 90 90 else 91 - xcrun simctl launch booted "$IOS_BUNDLE_ID" 2>/dev/null || { 91 + echo " Launching with PEEK_PROFILE_ID=$IOS_PROFILE_ID" 92 + SIMCTL_CHILD_PEEK_PROFILE_ID="$IOS_PROFILE_ID" xcrun simctl launch booted "$IOS_BUNDLE_ID" 2>/dev/null || { 92 93 echo " WARNING: Failed to launch iOS app. Is it installed?" 93 94 return 1 94 95 } ··· 367 368 "profiles": [ 368 369 { 369 370 "id": "$IOS_PROFILE_ID", 370 - "name": "Development", 371 + "name": "E2E Test", 371 372 "createdAt": "2026-01-27T00:00:00.000Z", 372 373 "lastUsed": "2026-01-27T00:00:00.000Z", 373 374 "server_url": "$SERVER_URL",