fragJulia
Changelog

2026-11-19 — B2C go-live map and first fix tranche

New operations page listing everything still open before a public consumer launch (voice and Knotencheck excluded), plus fixes for the code blockers that need no external access: profile privilege escalation (migration, not yet applied live), account deletion and data export, server-side Premium gating, billing portal and upgrade path, cleanup cron, email relay, Stripe redirect origin.

What changed

  • New: B2C go-live map.
  • Migration supabase/migrations/20261119_profiles_rls_hardening.sql: trigger pins is_admin, subscription_tier, feature_flags for the anon / authenticated roles; profiles_update_own gains WITH CHECK; forum post and comment inserts require author_id = auth.uid().
  • New routes: DELETE /api/account (cancel Stripe subscription → delete files → delete auth user) and GET /api/account/export. /datenschutz uses both.
  • Server-side gating: kliniken/*, studies, studies/match, timeline (GET/POST), timeline/events (POST/PUT) now enforce the Premium features the docs already listed. New helper requireFeature in apps/web/lib/subscription/server.ts.
  • Billing: /profil opens the Stripe billing portal for paying users; /preise starts checkout for signed-in Free users and the portal for paying users.
  • /api/chat/cleanup: answers GET (what Vercel Cron sends) and uses the service-role client.
  • /api/emails/send: fixed login link, sanitised names, same-origin confirmation link, recipient restricted to self for signed-in non-admins.
  • Stripe redirects: getSiteUrl() — configuration only.
  • Launch audit findings 5 and 7 annotated.

Second tranche (same day)

  • Migration supabase/migrations/20261119_post_limit_webhook_events.sql: get_user_tier() counts trialing; AFTER INSERT trigger on forum_posts increments the weekly counter; stripe_webhook_events table. The forum insert policy in the hardening migration now also requires can_community_post().
  • Webhook: idempotent on event.id; invoice.payment_failed → status = past_due; a processing error releases the id so Stripe's retry is applied. Four tests added.
  • Trialing counts as entitled in getUserTier, can-post and the cleanup cron.
  • Client: community/neu no longer increments the post counter itself.
  • SEO: sitemap reduced to public, finished pages; noindex on /wbc, /chat_nacht, /profil_nacht; public/og-home.png added, rendered from the existing OG design file.
  • Config: .env.example completed (AWS, S3, Turnstile, PostHog, rollout flag, LLM key; unused DEV_ variable removed); instrumentation.ts start-up check.
  • Impressum: § 5 TMG → § 5 DDG; ODR-platform paragraph replaced with the § 36 VSBG statement; privacy link to the docs site. No change to names.
  • Chat page: session id mirrored in state so the PDF-export button appears when a session starts (was a ref read during render).
  • Lint: 17 no-explicit-any errors in inbox routes, moderation page and lib/resend.ts replaced with types; lint step added to web-tests.yml.
  • CI: web-tests.yml used pnpm --filter apps/web, which matches no workspace package; every run since the workflow was added printed "No projects matched the filters" and passed without running a single test. Filter corrected to fragjulia-web. The job is now expected to be red on the study-data staleness test until the data is re-verified (map item A15).

Why

A code, docs and tracker review on 2026-11-18 found no go-live map and several launch-blocking defects, the most serious being that the profile update policy let any user grant themselves admin or Premium.

Behaviour changes to be aware of

  • /api/kliniken and /api/studies were public; they now need a signed-in Premium user. The only caller of GET /api/studies is components/clinical-studies.tsx on /forschung, which redirects to the docs site.
  • A user who downgrades from Premium can no longer read or add timeline events through the API, only delete them. The data export still contains them.
  • Stripe redirects go to NEXT_PUBLIC_SITE_URL, or https://fragjulia.de if unset — set the variable in preview and local environments.
  • Deleting an account now ends a running subscription immediately. If Stripe cannot be reached, the account is kept and the user is told.

Verification

  • tsc --noEmit clean; next build succeeds.
  • vitest (local): 149 of 150 pass. New: requireFeature (4), DELETE /api/account (6), webhook (4). Lint: 0 errors. The one failure is the existing study-data staleness check (studies.test.ts:169, data last verified 2026-04-03) and is left red deliberately.
  • Not verified: the migration was not run against any database; no end-to-end run against Supabase or Stripe.

Follow-ups

  • Apply and verify the migration on the live database (owner).
  • Everything under "Open" in the map, in particular A2b (public profile columns).

On this page