feat(02-12.1): stamp a record-context epoch on every session

- add sessions.record_epoch, owned by a BEFORE UPDATE trigger so the
  ON DELETE SET NULL path and raw SQL writes cannot skip it
- normalise pre-existing rows so epoch zero means never switched
- project the epoch off the row getSession already loads
This commit is contained in:
Marc-André Bombeck committed 2026-08-06 17:52:10 +02:00
1 parent a08e82d0be
commit 5c9befc0ae
7 files changed
+376 -2

No files matched your search

@@ -100,6 +100,7 @@ const SESSION_OK = {
id: "sess-1",
expiresAt: new Date(Date.now() + 3_600_000),
actingAsUserId: null,
recordEpoch: 0,
},
user: SESSION_USER as never,
};
@@ -81,6 +81,7 @@ function signedIn() {
id: "s1",
expiresAt: new Date(Date.now() + 1e6),
actingAsUserId: null,
recordEpoch: 0,
},
user: { id: "user-1" } as never,
});