Elevate MiroFish/CrowdSight from single-container dev to a SaaS foundation: - Local memory backend (Zep-compatible): memory services/models, local graph builder + updater, AgentActivity seam, import-boundary isolation; Zep stays default, local is opt-in behind MEMORY_BACKEND. Semantic parity not yet proven. - Durable product persistence: projects/simulations/reports schema (migration 0007) + tenant/owner-scoped ProductRepository + dual-write + scoped_project read-first + ArtifactStore abstraction; durable JobQueue + worker.py. - SaaS hardening: durable RateLimiter (wired to login), UsageService (LLM accounting), redacted AuditService, idempotency, CORS allowlist, safe API errors, single-use PasswordResetService + endpoints (covers invite-pending). - Exactly 3 roles (super_admin/admin/user) with tenant authz policy. - Admin UI: GET/POST/PATCH /api/admin/users + GET/PUT /api/admin/settings (super-admin only, encrypted/masked); AdminView.vue + SettingsView.vue with admin/super-admin route guards, th/en i18n. - Production deploy topology: multi-stage Dockerfile (frontend build + gunicorn wsgi + nginx SPA-proxy + supervisord worker), backend/wsgi.py, gunicorn dep. Backend 197 passed; frontend 10 tests + build green. ruff unavailable (gap). No commit of credentials; secrets handled via env/.env.example. Deferred: Zep semantic A/B parity, object storage cutover, mobile QA, EasyPanel container build of deploy topology.
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
"""Add durable rate-limit event records."""
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = "0009_rate_limit"
|
|
down_revision = "0008_platform_settings"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"rate_limit_events",
|
|
sa.Column("id", sa.String(length=64), nullable=False),
|
|
sa.Column("operation", sa.String(length=120), nullable=False),
|
|
sa.Column("key", sa.String(length=255), nullable=False),
|
|
sa.Column("organization_id", sa.String(length=64), nullable=True),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_index("ix_rate_limit_events_key", "rate_limit_events", ["key"], unique=False)
|
|
op.create_index(
|
|
"ix_rate_limit_op_key_created",
|
|
"rate_limit_events",
|
|
["operation", "key", "created_at"],
|
|
unique=False,
|
|
)
|
|
op.create_index(
|
|
"ix_rate_limit_org_created",
|
|
"rate_limit_events",
|
|
["organization_id", "created_at"],
|
|
unique=False,
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_rate_limit_org_created", table_name="rate_limit_events")
|
|
op.drop_index("ix_rate_limit_op_key_created", table_name="rate_limit_events")
|
|
op.drop_index("ix_rate_limit_events_key", table_name="rate_limit_events")
|
|
op.drop_table("rate_limit_events")
|