Skip to main content

max / balanced_breakfast

sync: adopt synckit typed-ID newtypes at the SDK boundary synckit-client now exposes DeviceId/UserId/AppId. Convert at the call boundary (DeviceId::new / .as_uuid) so BB keeps threading bare UUIDs internally; no behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-06-22 22:16 UTC
Commit: a99def14ba02f18af85f906a07f1c333c40f9a62
Parent: 7c66daa
3 files changed, +9 insertions, -9 deletions
@@ -1,7 +1,7 @@
1 1 //! Pull remote changes and apply to local DB.
2 2
3 3 use sqlx::SqlitePool;
4 - use synckit_client::{ChangeEntry, ChangeOp, SyncKitClient};
4 + use synckit_client::{ChangeEntry, ChangeOp, DeviceId, SyncKitClient};
5 5 use tracing::{debug, instrument, warn};
6 6 use uuid::Uuid;
7 7
@@ -21,7 +21,7 @@ pub async fn pull_changes(
21 21
22 22 loop {
23 23 let (changes, new_cursor, has_more) = client
24 - .pull(device_id, cursor)
24 + .pull(DeviceId::new(device_id), cursor)
25 25 .await
26 26 .map_err(|e| ApiError::internal(format!("pull failed: {}", e)))?;
27 27
@@ -615,8 +615,8 @@ mod tests {
615 615 });
616 616 client.restore_session(
617 617 "fake-token",
618 - Uuid::parse_str("00000000-0000-0000-0000-000000000001").unwrap(),
619 - Uuid::parse_str("00000000-0000-0000-0000-000000000002").unwrap(),
618 + synckit_client::UserId::new(Uuid::parse_str("00000000-0000-0000-0000-000000000001").unwrap()),
619 + synckit_client::AppId::new(Uuid::parse_str("00000000-0000-0000-0000-000000000002").unwrap()),
620 620 );
621 621 client.set_master_key_raw(TEST_KEY);
622 622 client
@@ -113,7 +113,7 @@ pub async fn ensure_device_registered(
113 113 set_sync_state(pool, "device_id", &device.id.to_string()).await?;
114 114 info!(device_name = %device.device_name, device_id = %device.id, "Registered device");
115 115
116 - Ok(device.id)
116 + Ok(device.id.as_uuid())
117 117 }
118 118
119 119 // ── High-level sync ──
@@ -2,7 +2,7 @@
2 2
3 3 use chrono::Utc;
4 4 use sqlx::SqlitePool;
5 - use synckit_client::{ChangeEntry, ChangeOp, SyncKitClient};
5 + use synckit_client::{ChangeEntry, ChangeOp, DeviceId, SyncKitClient};
6 6 use tracing::{debug, instrument, warn};
7 7 use uuid::Uuid;
8 8
@@ -82,7 +82,7 @@ pub async fn push_changes(
82 82
83 83 if !changes.is_empty() {
84 84 client
85 - .push(device_id, changes)
85 + .push(DeviceId::new(device_id), changes)
86 86 .await
87 87 .map_err(|e| ApiError::internal(format!("push failed: {}", e)))?;
88 88 }
@@ -126,8 +126,8 @@ mod tests {
126 126 // Use a plain token (no JWT exp check when jwt_exp returns None)
127 127 client.restore_session(
128 128 "fake-token",
129 - Uuid::parse_str("00000000-0000-0000-0000-000000000001").unwrap(),
130 - Uuid::parse_str("00000000-0000-0000-0000-000000000002").unwrap(),
129 + synckit_client::UserId::new(Uuid::parse_str("00000000-0000-0000-0000-000000000001").unwrap()),
130 + synckit_client::AppId::new(Uuid::parse_str("00000000-0000-0000-0000-000000000002").unwrap()),
131 131 );
132 132 client.set_master_key_raw([42u8; 32]);
133 133 client