SurfSense/surfsense_backend
Vonic 4eb6ed18d6 Epic 5 Complete: Billing, Subscriptions, and Admin Features
Resolve all 5 deferred items from Epic 5 adversarial code review:
- Migration 124: Add CASCADE to subscriptionstatus enum drop (prevent orphaned references)
- Stripe rate limiting: In-memory per-user limiter (20 calls/60s) on verify-checkout-session
- Subscription request cooldown: 24h cooldown before resubmitting rejected requests
- Token reset date: Initialize on first subscription activation
- Checkout URL validation: Confirmed HTTPS-only (Stripe always returns HTTPS)

Implement Story 5.4 (Usage Tracking & Rate Limit Enforcement):
- Page quota pre-check at HTTP upload layer
- Extend UserRead schema with token quota fields
- Frontend 402 error handling in document upload
- Quota indicator in dashboard sidebar

Story 5.5 (Admin Seed & Approval Flow):
- Seed admin user migration with default credentials warning
- Subscription approval/rejection routes with admin guard
- 24h rejection cooldown enforcement

Story 5.6 (Admin-Only Model Config):
- Global model config visible across all search spaces
- Per-search-space model configs with user access control
- Superuser CRUD for global configs

Additional fixes from code review:
- PageLimitService: PAST_DUE subscriptions enforce free-tier limits
- TokenQuotaService: PAST_DUE subscriptions enforce free-tier limits
- Config routes: Fixed user_id.is_(None) filter on mutation endpoints
- Stripe webhook: Added guard against silent plan downgrade on unrecognized price_id

All changes formatted with Ruff (Python) and Biome (TypeScript).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 03:54:45 +07:00
..
alembic Epic 5 Complete: Billing, Subscriptions, and Admin Features 2026-04-15 03:54:45 +07:00
app Epic 5 Complete: Billing, Subscriptions, and Admin Features 2026-04-15 03:54:45 +07:00
scripts fix: increase timeout for alembic migrations in entrypoint script to prevent premature failures 2026-03-02 23:45:24 +05:30
tests chore: merge upstream with local feature additions 2026-04-13 23:31:52 +07:00
.dockerignore feat: Added Docker Support and missing dependencies. 2025-03-20 18:52:06 -07:00
.env.example refactor: make Azure Document Intelligence an internal LLAMACLOUD accelerator instead of a standalone ETL service 2026-04-08 03:26:24 +05:30
.gitignore feat: init video presentation agent 2026-03-21 22:13:41 -07:00
.python-version feat: SurfSense v0.0.6 init 2025-03-14 18:53:14 -07:00
alembic.ini add github connector, add alembic for db migrations, fix bug updating connectors 2025-04-13 13:56:22 -07:00
backend.log feat: Add DexScreener RAG retrieval test and token validation, configure Serena project settings, and update admin guide with default admin account details. 2026-02-01 14:24:01 +07:00
celery_worker.py fix: celery_app path and gmail indexing 2025-10-21 21:11:41 -07:00
Dockerfile feat: enhance memory management and session handling in database operations 2026-02-28 23:59:28 -08:00
main.py feat: added configable summary calculation and various improvements 2026-02-26 18:24:57 -08:00
nohup.out update 2026-03-11 19:32:08 +07:00
pyproject.toml feat: bumped version to 0.0.15 2026-04-08 16:17:37 -07:00
test_chat_rag.py docs: update PRD with comprehensive extension features and UX integration strategy 2026-02-01 21:32:06 +07:00
test_dexscreener_integration.py feat(backend): Add DexScreener connector database migration 2026-01-31 17:25:31 +07:00
uv.lock feat: bumped version to 0.0.15 2026-04-08 16:17:37 -07:00