Files
sql-server-query-ai/app/app/layout.tsx
T
ahmed mohammedandClaude Opus 4.7 2ebfcfb7a6 fix: session cookie over plain http, console onboarding gate, webkit qa coverage
- the session cookie was Secure whenever NODE_ENV=production, so a production build on http://localhost got no cookie back in Safari: every page after signup looked signed-out. It is now Secure only when X-Forwarded-Proto says https, or when COOKIE_SECURE=1.
- /app and /app/[id] now require an analyst and a Jev key, the same rule /api/analyze enforces with a 412. Closing the guide mid-way used to leave a console that could not run anything.
- Playwright runs the production server (pree2e builds first) and gains a webkit project for session survival; chromium-only QA could never see a Secure-cookie rejection.
- tests-e2e/session.spec.ts pins both; .env.example gains COOKIE_SECURE and stops shipping a blank APP_SECRET.
- e2e: 21 passed (setup, chromium, webkit, mobile).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-09-22 10:45:12 +03:00

17 lines
783 B
TypeScript

import { redirect } from "next/navigation";
import { requireUser } from "@/lib/auth";
import { settingsView } from "@/lib/settings";
import { Rail } from "@/components/rail";
export default async function Console({ children }: { children: React.ReactNode }) {
const u = await requireUser();
const v = settingsView(u.id);
// Same requirement /api/analyze enforces (it answers 412). Without this, a user who closes the guide
// mid-way lands on a console that cannot run anything, and only finds out when Analyse turns red.
if (!v.has_analyst || !v.has_jev) redirect("/setup?step=2");
return <div className="shell">
<aside className="rail no-print" aria-label="Previous analyses"><Rail userId={u.id} /></aside>
<main className="main">{children}</main>
</div>;
}