siftlode/backend/app
npeter83 d610647d13 feat(stats): per-user API quota attribution + admin usage page
Track who burned how much YouTube API quota. A QuotaEvent audit log (migration
0009) records every spend with the triggering user (NULL = background/system) and
an action label, set via a request/job-scoped contextvar (quota.attribute) so no
call signatures change. User-initiated work (sync subscriptions, unsubscribe,
opt-in recent backfill, manual enrich) attributes to the user; scheduler work to
System, split by action.

- backend: QuotaEvent model + migration 0009; quota.attribute() contextvar;
  record_usage logs events; entry points wrapped (routes/sync, routes/channels,
  scheduler); GET /api/quota/my-usage + GET /api/quota/admin
- frontend: admin-only Stats page (header nav, page=stats) with daily bars +
  per-user breakdown by action and range picker; 'Your API usage' in Settings ->
  Sync for every user

Verified: attribution + endpoints compute correctly; events are per-user vs System.
2026-06-12 02:47:55 +02:00
..
routes feat(stats): per-user API quota attribution + admin usage page 2026-06-12 02:47:55 +02:00
static fix: default app UI language to English (login page) 2026-06-11 01:03:36 +02:00
sync fix(backfill): don't skip the tail of the recent/deep boundary page 2026-06-12 00:15:20 +02:00
youtube feat(m5b): optional YouTube write scope via incremental OAuth 2026-06-11 23:27:11 +02:00
__init__.py feat: M1 foundation — compose stack, FastAPI, Google OAuth, encrypted tokens 2026-06-11 01:01:37 +02:00
auth.py feat(m5c): onboarding — DB invites, request-access, admin approval, email 2026-06-12 01:43:07 +02:00
config.py feat(m5c): onboarding — DB invites, request-access, admin approval, email 2026-06-12 01:43:07 +02:00
db.py feat: M1 foundation — compose stack, FastAPI, Google OAuth, encrypted tokens 2026-06-11 01:01:37 +02:00
email.py fix(email): warmer onboarding copy + Reply-To/Date headers 2026-06-12 02:05:18 +02:00
main.py feat(stats): per-user API quota attribution + admin usage page 2026-06-12 02:47:55 +02:00
models.py feat(stats): per-user API quota attribution + admin usage page 2026-06-12 02:47:55 +02:00
quota.py feat(stats): per-user API quota attribution + admin usage page 2026-06-12 02:47:55 +02:00
scheduler.py feat(stats): per-user API quota attribution + admin usage page 2026-06-12 02:47:55 +02:00
security.py feat: M1 foundation — compose stack, FastAPI, Google OAuth, encrypted tokens 2026-06-11 01:01:37 +02:00
state.py chore: structured timestamped logging across the backend 2026-06-11 04:26:18 +02:00