feat(web): stamp login_events on every gated request

The registration gate, once it resolves the authenticated subject to a tapir
user_id, calls StampLogin (store-throttled to one row per user per day). Best-
effort: a stamp failure is logged and swallowed so it never breaks the request.
This is what makes the read-side Stage-0 usage signal actually accrue.

Tests cover the happy-path stamp, the same-day throttle, and that an
unregistered subject (redirected to /register) is never stamped.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-03 23:46:03 +02:00
co-authored by Claude Opus 4.8
parent de54cd33b2
commit 2fac735837
3 changed files with 55 additions and 0 deletions
+5
View File
@@ -34,6 +34,11 @@ type Store interface {
DeleteConnection(ctx context.Context, userID, provider string) error
DeleteUser(ctx context.Context, userID string) error
DisplayName(ctx context.Context, userID string) (string, error)
// StampLogin records (throttled, one row per user per day) that the resolved
// user was active on this request — the read-side Stage-0 usage signal the
// registration gate stamps for every authenticated request.
StampLogin(ctx context.Context, userID string) error
}
// SecretRemover deletes secret material by its opaque ref. *secrets.FileStore