#47

Fix staging StyleX CSS for OAuth verification

MergedstylesshOwnermerged intofrom

Summary

  • inject compiled StyleX rules into the root stylesheet loaded by SSR routes
  • add an explicit production Google CTA gate for OAuth verification and launch
  • document the complete Google verification recording and resubmission flow

Why

The staging login and onboarding routes loaded only the global reset/token CSS. The compiled StyleX component rules were emitted into a route chunk that those SSR pages did not preload, leaving the Gmail OAuth recording flow visibly unstyled. Google also requires the verification video to show the exact production OAuth application rather than the staging OAuth project.

Verification

  • pnpm test (169 passing)
  • pnpm typecheck
  • pnpm lint vite.config.mts lib/env.ts lib/env.test.mjs .railway/railway.ts
  • pnpm build
  • pnpm dlx markdownlint-cli2 docs/google-oauth-verification-demo.md
  • git diff origin/main...HEAD --check
  • production build inspected in Dia; login screen renders with full StyleX CSS
  • root CSS contains the compiled rules (56.83 kB, 1,251 StyleX selectors)

Deployment

Merging to main should trigger the repository's configured Railway deployment. The staging environment should be verified independently after that deployment reaches a successful terminal state.

Activity

6
mikeyreviewed2mo ago
mikey2mo ago

Review summary

No blocking correctness or security issues found. I traced the two behavior-changing pieces of this PR against their actual dependencies rather than just reading the diff:

  • lib/env.ts / areGoogleCtasEnabled() — the new gate (getAppUrl() !== "https://redakt.app" || GOOGLE_CTA_ENABLED === "true") is a strict-equality opt-in, so it fails closed (CTAs stay hidden) unless the operator explicitly sets GOOGLE_CTA_ENABLED=true in production. Confirmed this only controls UI CTA visibility (src/server/public.functions.ts, src/server/settings.functions.ts) — the actual OAuth route registration in lib/auth-core.ts keys off getGoogleOAuthConfig() (client id/secret presence) and is untouched, so this change can't accidentally open an auth endpoint, only reveal/hide the button. Test coverage in lib/env.test.mjs correctly exercises the default-off, explicit-on, staging, and missing-credentials cases, and withEnvironment's save/restore correctly isolates state across the added blocks.
  • vite.config.mts — verified dev and cssInjectionTarget are real, correctly-typed options on @stylexjs/unplugin@0.19.1's UserOptions (checked the package's shipped .d.ts), so the config won't silently no-op. cssInjectionTarget: fileName => fileName.includes("globals-") lines up with src/routes/__root.tsx importing globals.css?url, matching the PR's stated goal of moving compiled StyleX rules into the root-loaded stylesheet.

Non-blocking, worth confirming operationally before/at merge: .railway/railway.ts sets GOOGLE_CTA_ENABLED: production ? preserve() : "true". Since GOOGLE_CTA_ENABLED is a brand-new variable, production has never had a prior value to preserve. Please confirm preserve() on a never-before-set variable leaves it absent (safe: areGoogleCtasEnabled() stays false) rather than failing the IaC apply — this is the one knob that ungates the public production OAuth CTA, so it's worth being sure about ahead of the Google verification recording rather than discovering it at deploy time.

Also verified: docs/google-oauth-verification-demo.md, docs/gmail.md, README.md, and .env.example are internally consistent with the new GOOGLE_CTA_ENABLED variable and don't contradict the code.

stylessh merged commit 96f46ac into main2mo ago

Branch stylessh/fix-staging-stylex-oauth-demo has been merged.

Checking branch