You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stories: 3 TDD: yes Containment: exempt (founder ruling R1.2 on #7028, 2026-08-23: capture ships live on deploy, no flag — activity days are forward-only and cannot be backfilled)
What to build
The visit-return data seam of epic #6767: one append-only D1 table user_activity_day (user_id, day, PRIMARY KEY (user_id, day)) and one memoized upsert wired at the end of Pasaport.validateSession (apps/web/worker/features/pasaport/Pasaport.ts, the success path where session?.user resolves).
Schema export in apps/web/worker/db/drizzle/schema.ts plus migration numbered off the existing sequence in apps/web/worker/db/drizzle/migrations/.
On each validated session: compute today's UTC day bucket, check an isolate-local memo (user_id → day), skip when already touched today, else upsert ON CONFLICT DO NOTHING and record the memo. The memo is load-bearing — this sits on the hottest path in the worker and must cost ~one D1 write per active user per day, never per request.
Any failure of the capture is caught, logged through the existing worker error pipeline (Effect.logError, surfaced to Sentry), and swallowed: the capture never fails a login.
a validated session for user X on day N produces exactly one user_activity_day (X, N) row, and repeated same-isolate validations that day produce no further writes
the upsert builder is .toSQL()-asserted with no engine, carrying ON CONFLICT DO NOTHING
an injected capture failure leaves validateSession returning the session unchanged, with the error visible on the worker error pipeline
no feature flag or gate stands between a deployed worker and the capture write
Stories: 3
TDD: yes
Containment: exempt (founder ruling R1.2 on #7028, 2026-08-23: capture ships live on deploy, no flag — activity days are forward-only and cannot be backfilled)
What to build
The visit-return data seam of epic #6767: one append-only D1 table
user_activity_day (user_id, day, PRIMARY KEY (user_id, day))and one memoized upsert wired at the end ofPasaport.validateSession(apps/web/worker/features/pasaport/Pasaport.ts, the success path wheresession?.userresolves).apps/web/worker/db/drizzle/schema.tsplus migration numbered off the existing sequence inapps/web/worker/db/drizzle/migrations/.user_id → day), skip when already touched today, else upsertON CONFLICT DO NOTHINGand record the memo. The memo is load-bearing — this sits on the hottest path in the worker and must cost ~one D1 write per active user per day, never per request.Effect.logError, surfaced to Sentry), and swallowed: the capture never fails a login.Acceptance criteria
user_activity_day (X, N)row, and repeated same-isolate validations that day produce no further writes.toSQL()-asserted with no engine, carryingON CONFLICT DO NOTHINGvalidateSessionreturning the session unchanged, with the error visible on the worker error pipeline