Core HealthKit workout sync for running, cycling, swimming, strength, and other standard workout types. Reliable foreground and background sync, error recovery, anchor-based incremental updates.
HealthKit data now lands in the activities table (not workouts). Key changes from the original schema:
HKWorkoutActivityType integer → canonical string slug using activity-types.jsonactivity_type = 'running') and original (source_activity_type = 'HKWorkoutActivityType:37')source = 'apple_health', external_id = healthkit_uuidsource_data JSONB stores raw HealthKit response for lossless preservationtotalEnergyBurned)activity_streams (replaces row-per-sample heart_rate_samples table)latitude/longitude Parquet streams (replaces workout_routes/route_locations)HKWorkoutActivity (iOS 16+) → child activities with parent_id pointing to parenttriathlon, children = swimming, transition, cycling, etc.sync_states table: per-athlete per-source (not single-row per-user)See docs/api-research/SYNTHESIS.md §3 (Activity Types), §4 (Sessions), §5 (Promoted Fields), §6 (Time-Series Samples).