fix: Add podcast-only demo mode readiness patches
- Patch pricing redirect to route to podcast-maker instead of onboarding - Allow all plan tiers in demo mode (remove alpha restriction) - Add Stripe mode warning in demo when key is missing - Add startup router mount assertions for subscription and podcast - Add smoke test script for demo mode validation
This commit is contained in:
@@ -571,10 +571,39 @@ async def startup_event():
|
||||
logger.warning("⚠️ WIX_API_KEY not found in environment - Wix publishing may fail")
|
||||
|
||||
logger.info("ALwrity backend started successfully")
|
||||
|
||||
# Critical router mount assertions for podcast-only demo mode
|
||||
_assert_router_mounted("subscription")
|
||||
_assert_router_mounted("podcast")
|
||||
except Exception as e:
|
||||
logger.error(f"Error during startup: {e}")
|
||||
raise
|
||||
|
||||
|
||||
def _assert_router_mounted(router_name: str) -> None:
|
||||
"""Assert that a critical router is mounted. Fails startup if not found."""
|
||||
from fastapi import routing
|
||||
mounted_routes = [route.path for route in app.routes]
|
||||
|
||||
# Check for router-specific paths
|
||||
router_path_indicators = {
|
||||
"subscription": ["/api/subscription/plans", "/api/subscription/preflight"],
|
||||
"podcast": ["/api/podcast/projects", "/api/podcast/"],
|
||||
}
|
||||
|
||||
expected_paths = router_path_indicators.get(router_name, [])
|
||||
found = any(path in mounted_routes for path in expected_paths)
|
||||
|
||||
if found:
|
||||
logger.info(f"✅ Critical router '{router_name}' is mounted")
|
||||
else:
|
||||
error_msg = f"❌ CRITICAL: Router '{router_name}' is NOT mounted! Expected paths: {expected_paths}"
|
||||
logger.error(error_msg)
|
||||
if PODCAST_ONLY_DEMO_MODE:
|
||||
# In demo mode, podcast router MUST be mounted
|
||||
if router_name == "podcast":
|
||||
raise RuntimeError(error_msg)
|
||||
|
||||
# Shutdown event
|
||||
@app.on_event("shutdown")
|
||||
async def shutdown_event():
|
||||
|
||||
Reference in New Issue
Block a user