"""Platform seal: only the public-records platform is served from this domain. Everything else — the former agency / marketing businesses — is refused at the edge, un-scheduled, and listed publicly.""" import json import logging import pathlib from datetime import datetime, timezone from fastapi import APIRouter from fastapi.responses import JSONResponse logger = logging.getLogger("platform_seal") router = APIRouter(prefix="/api/public") SEALED_AT = "2026-06-22" NOTICE = "Not part of the Alpha Covenant public-records platform. Unrelated services were removed from this domain; see /api/public/sealed." # API path prefixes (first two segments) that belong to the records platform. Anything else under /api returns 410. ALLOWED_API_PREFIXES = sorted({ "/api/health", "/api/auth", "/api/observance", "/api/unsubscribe", "/api/webhook", "/api/jobs", "/api/integrity", "/api/admin", "/api/watchdog", "/api/track", "/api/notifications", "/api/media", "/api/account", "/api/atlas", "/api/autorenew", "/api/cabinet", "/api/cite", "/api/explain", "/api/carrier-monitor", "/api/carriers", "/api/consent", "/api/corrections", "/api/directory", "/api/drug-safety", "/api/exceptions", "/api/family", "/api/free-guide", "/api/giving", "/api/gov", "/api/ledger", "/api/monthly", "/api/outreach", "/api/press-desk", "/api/public", "/api/public-record", "/api/recalls", "/api/record", "/api/recovery", "/api/rootcause", "/api/score", "/api/seal", "/api/selfcheck", "/api/seo", "/api/sponsors", "/api/standards", "/api/status", "/api/system", "/api/trust", "/api/verify", "/api/visibility", }) # Background jobs of the former businesses. Their handlers are dropped at startup and any queued job is cancelled. SEALED_JOBS = sorted({ "sienna_followup", "lead_nurture", "regen_deliverable", "gmail_poll", "daily_digest", "weekly_money_report", "content_publish", "opportunity_autopilot", "autonomy_engine", "scenario_pack_daily", "reworker_daily", "autotrader_cycle", "trial_recap", "demand_watch", "bot_run", "bot_silence_watch", "checkout_recovery", "blog_autopublish", "show_autopilot", "disruption_alerts", "guardian_overdue", "business_briefs", "social_autopost", "video_silence_watch", "brain_refresh", "voice_auto_closer", "enterprise_followup", "offer_followup", "guardrails_optimizer", "promo_autopublish", "intent_radar_refresh", "expansion_autopilot", "trucker_refresh", "dealengine_autopilot", }) # Stripe webhook `meta.source` values of the former businesses. Payments carrying them are recorded but nothing is fulfilled. SEALED_PAYMENT_SOURCES = sorted({"local_audit_selfserve", "ai_box_selfserve", "tripwire", "secmonitor", "venture_deposit"}) KEPT_PAYMENT_SOURCES = sorted({"familywatch", "sponsor", "seal", "covreport", "carrierpage", "carriermonitor"}) def api_allowed(path: str) -> bool: if not path.startswith("/api/"): return True seg = path.split("/") return "/".join(seg[:3]) in ALLOWED_API_PREFIXES def refuse(): return JSONResponse({"detail": NOTICE}, status_code=410) def _routes_manifest() -> dict: p = pathlib.Path(__file__).resolve().parents[1] / "frontend" / "src" / "App.js" kept = [] if p.exists(): import re kept = re.findall(r' list[str]: dropped = [j for j in list(handlers) if j in SEALED_JOBS] for j in dropped: handlers.pop(j, None) return dropped async def cancel_sealed_jobs(db) -> int: r = await db.jobs.update_many({"type": {"$in": SEALED_JOBS}, "status": {"$in": ["pending", "processing"]}}, {"$set": {"status": "cancelled", "cancelled_reason": "sealed off platform " + SEALED_AT}}) return r.modified_count @router.get("/sealed") async def sealed(): return {"sealed_at": SEALED_AT, "statement": "Only the public-records platform is served from this domain. The former agency and marketing businesses (media buying, creator/affiliate/agent-growth packages, Guardian, Scam Shield, Game Zone, AI Doctor, free book, Sienna assistant, lead markets, storefront, blog autopublish, voice caller and related tools) were removed from the frontend, refused at the API edge, and un-scheduled.", "api": {"allowed_prefixes": ALLOWED_API_PREFIXES, "everything_else": "HTTP 410 with this notice"}, "background_jobs_sealed": SEALED_JOBS, "payment_sources_sealed": SEALED_PAYMENT_SOURCES, "payment_sources_kept": KEPT_PAYMENT_SOURCES, **_routes_manifest(), "not_possible_from_code": "A separate database and domain for the former businesses require their own deployment; common ownership remains disclosed on /conflicts.", "verify": "Request any former path (e.g. /api/guardian/status, /api/scam-shield/check) and expect 410; open any former route (e.g. /guardian) and expect the 'Not part of this platform' page. Source: /api/public/code/platform_seal.py", "generated_at": datetime.now(timezone.utc).isoformat()}