diff --git a/cmd/server/tests/sync_integration_test.go b/cmd/server/tests/sync_integration_test.go index 6b90f661..f0228c70 100644 --- a/cmd/server/tests/sync_integration_test.go +++ b/cmd/server/tests/sync_integration_test.go @@ -37,7 +37,10 @@ func setupSyncTestDB(t *testing.T) *database.Queries { // here silently destroyed a live reader's stats data on every // suite run (2026-10-14). Sync-test sessions belong to the // test-sync users; deleting those users cascades their rows. - _, _ = dbPool.Exec(ctx, "DELETE FROM sync_queue WHERE true") + // Same rule for sync_queue: a `WHERE true` wipe could discard a + // REAL device's pending offline entries — scope to the test + // devices (their cascade covers the rest). + _, _ = dbPool.Exec(ctx, "DELETE FROM sync_queue WHERE device_id IN (SELECT id FROM devices WHERE device_name LIKE 'Test %')") _, _ = dbPool.Exec(ctx, "DELETE FROM users WHERE email LIKE 'test-sync%'") _, _ = dbPool.Exec(ctx, "DELETE FROM media_items WHERE title LIKE 'Test %'") _, _ = dbPool.Exec(ctx, "DELETE FROM libraries WHERE name LIKE 'Test %'")