Skip to content

Commit 2132108

Browse files
ComBbaclaude
andcommitted
fix: address expert review findings — CORS, middleware, session polling
Fixes based on 3-expert review consensus: - Add DELETE to CORS allow_methods (was blocking dashboard app deletion) - Add /api/auth/ to middleware public paths (prevent OAuth flow breakage) - Add refetchInterval={300} to SessionProvider (auto-refresh approval) - Fix TTL log default "2" → "72" to match actual default - Fix _extract_hue regex to handle fractional oklch hue values - Cap verification score at 100 (was possible to exceed) - Fix cubic-bezier parsing to use regex extraction (safer for LLM output) - Tighten middleware dot-check to match file extensions only Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 883c855 commit 2132108

6 files changed

Lines changed: 13 additions & 10 deletions

File tree

agent/nodes/deployer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,6 +2080,7 @@ def _verify_live_url(live_url: str) -> dict:
20802080
logger.warning("[DEPLOYER][VERIFY] Some assets failed to load")
20812081

20822082
# ── Phase 4: Compute final score and verdict ──────────────────────
2083+
score = min(score, 100)
20832084
result["verification_score"] = score
20842085

20852086
if score >= 80:

agent/nodes/design_tokens.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
def _extract_hue(oklch_str: str) -> int:
1616
"""Extract hue value from an oklch() string."""
17-
match = re.search(r"oklch\([^)]*\s+(\d+)\s*\)", str(oklch_str))
18-
return int(match.group(1)) if match else 250
17+
match = re.search(r"oklch\([^)]*\s+([\d.]+)\s*\)", str(oklch_str))
18+
return int(float(match.group(1))) if match else 250
1919

2020

2121
def _make_scale(hue: int, chroma_base: float = 0.15, steps: int = 12) -> list[str]:

agent/nodes/motion_tokens.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ def generate_motion_tokens(design_system: dict) -> str:
3838
# Override easing from LLM if provided
3939
llm_easing = llm_motion.get("easing", "")
4040
if llm_easing and "cubic-bezier" in llm_easing:
41-
# Convert cubic-bezier(a,b,c,d) to [a,b,c,d] for framer-motion
42-
nums = llm_easing.replace("cubic-bezier(", "").replace(")", "")
43-
intensity = {**intensity, "ease": f"[{nums}]"}
41+
import re as _re
42+
m = _re.search(r"cubic-bezier\(([^)]+)\)", llm_easing)
43+
if m:
44+
intensity = {**intensity, "ease": f"[{m.group(1)}]"}
4445
else:
4546
visual_dir = design_system.get("visual_direction", "dashboard")
4647
intensity = MOTION_INTENSITY.get(visual_dir, MOTION_INTENSITY["default"])

agent/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ async def lifespan(app: FastAPI):
614614
from .tools.digitalocean import _ttl_cleanup_loop
615615

616616
_ttl_task = asyncio.create_task(_ttl_cleanup_loop())
617-
logger.info("[TTL] App cleanup loop started (TTL=%sh)", os.environ.get("DEPLOY_APP_TTL_HOURS", "2"))
617+
logger.info("[TTL] App cleanup loop started (TTL=%sh)", os.environ.get("DEPLOY_APP_TTL_HOURS", "72"))
618618

619619
yield
620620

@@ -642,7 +642,7 @@ async def lifespan(app: FastAPI):
642642
app.add_middleware(
643643
CORSMiddleware,
644644
allow_origins=_ALLOWED_ORIGINS,
645-
allow_methods=["GET", "POST", "PUT", "OPTIONS"],
645+
allow_methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"],
646646
allow_headers=["Content-Type", "X-API-Key", "X-Vibedeploy-Ops-Token"],
647647
allow_credentials=False,
648648
max_age=600,

web/src/components/providers/session-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ export function AuthSessionProvider({
77
}: {
88
children: React.ReactNode;
99
}) {
10-
return <SessionProvider>{children}</SessionProvider>;
10+
return <SessionProvider refetchInterval={300}>{children}</SessionProvider>;
1111
}

web/src/middleware.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ const publicPaths = ["/", "/demo"];
55
function isPublicPath(pathname: string): boolean {
66
if (publicPaths.includes(pathname)) return true;
77
if (pathname.startsWith("/auth/")) return true;
8+
if (pathname.startsWith("/api/auth/")) return true;
89
if (pathname.startsWith("/_next/")) return true;
910
if (pathname === "/favicon.ico") return true;
10-
// Static assets (files with extensions)
11-
if (pathname.includes(".")) return true;
11+
// Static assets (files with extensions like .js, .css, .png)
12+
if (/\.\w+$/.test(pathname)) return true;
1213
return false;
1314
}
1415

0 commit comments

Comments
 (0)