fix(tests): sync-integration cleanup wiped the shared reading_history table

sync_integration_test's cleanup ran DELETE FROM reading_history WHERE
true — harmless for years while the table sat empty, and a silent
stats-data destroyer the moment session capture started feeding it:
every suite run erased the shared dev accounts' captured reading
(the user's manual flip-through test data included).

The cleanup is now scoped: the sync tests' sessions belong to their
test-sync users, and deleting those users cascades their rows. Any
future table-wide cleanup DELETE is off the table (AGENTS.md test
rules updated).
This commit is contained in:
John O'Keefe committed 2026-10-14 13:53:51 -04:00
1 parent 0914c935d9
commit 199d82c613
2 files changed
+10 -3

No files matched your search

+4 -1
View File
@@ -53,7 +53,10 @@ were name-only across ALL libraries. Fixed; do not regress.
broke on 2026-10-14 within hours of session capture shipping).
Tests that need deterministic data use `setup.RegularToken` +
`getRegularUserID` (the fresh per-test user), or assert ranges
instead of equals.
instead of equals. Related: **no table-wide DELETEs in test
cleanups** — sync_integration's `DELETE FROM reading_history WHERE
true` destroyed the live reader's stats data on every suite run
until scoped to the test-sync users (cascade via user delete).
## Timezones