fix(tests): scope the sync_queue cleanup wipe to the test devices
The cleanup in setupSyncTestDB ran DELETE FROM sync_queue WHERE true — a table-wide wipe that discards REAL devices' pending offline entries on every suite run. Same class as the 2026-10-14 reading_history incident the standing rules ban. The test's own queue items cascade from its 'Test %'-named device, so the wipe is redundant for cleanup — scoped it to those devices (defense in depth ahead of the cascade). Flagged during H1 verification: the line executed during an in- container suite run this session; any device with pending offline queue entries at that moment should re-push on its next sync.
This commit is contained in:
1 parent
721139dc16
commit
d16ca4acbe
1 file changed
+4
-1
@@ -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 %'")
|
||||
|
||||
Reference in new issue
Block a user