feat(routing): serve public landing at / and move authed index to /home #174

Merged
chihlasm merged 4 commits from feat/public-landing-routing-refactor into main 2026-05-15 05:18:37 +00:00
Owner

Summary

Stripe's compliance crawler fetches the apex URL without executing JS and declined live-mode review when https://resolutionflow.com/ returned the empty SPA shell that redirected to /landing client-side. This PR restructures the router so / serves the public landing page directly, moves the authenticated dashboard index to /home, and adds the crawlability surface Stripe expects (robots.txt, sitemap.xml, og:url).

Plan: docs/plans/2026-05-13-public-landing-routing-refactor.md

What changes

Router (router.tsx)

  • / → new PublicLanding wrapper (LandingPage for anon; <Navigate to="/home"> for authed users so there's no marketing-frame flicker before redirect).
  • Authed tree converted to a path-less layout route. All children carry absolute paths so URLs are stable. QuickStartPage moves to /home; /trees, /pilot, /admin/*, /account/*, /welcome/*, etc. keep their URLs.
  • /landing kept as a one-release stale-bookmark redirect to /. Deletion captured in the plan's follow-ups.
  • ProtectedRoute unauth redirect flipped /landing/; state.from preservation untouched.

Reference updates

  • Post-login / post-onboarding → /home: OAuthCallbackPage (incl. invitee ?welcome=teammate query), WelcomeStep1/2/3 dismiss-rest, AssistantChatPage post-escalate, WelcomeRouter completion/dismiss redirects, VerifyEmailPage's three "Go to dashboard" links.
  • Authed chrome → /home: TopBar logo, AppLayout mobile nav + drawer logo, CommandPalette Dashboard entry.
  • Dashboard onboarding → /home: NextStepCard ran_session.ctaPath, SetupChecklist ran_session.path, SessionHistoryPage empty-state CTA.
  • Public back-links → /: TermsPage, PrivacyPage, PoliciesPage, ContactPage, PromotionsPage, PublicTemplatesPage (header + footer). SharedSessionPage's to="/" left as-is — now correctly lands anon visitors on the public landing.

Crawlability

  • New frontend/public/robots.txt allowlisting public pages and disallowing the authed app.
  • New frontend/public/sitemap.xml for /, /pricing, /contact-sales, /contact, /templates, /terms, /privacy, /policies, /promotions.
  • PageMeta gains og:url (defaults to window.location.href) and switches twitter:card to summary_large_image when an ogImage is passed.

Risk + escalation

Necessary but not necessarily sufficient. If Stripe's bot executes zero JS, even a /-routed LandingPage is invisible (Vite still client-renders the marketing page). The documented next escalation is server-side prerendering of public routes via vite-plugin-ssg (captured in the plan, log the decision in .ai/DECISIONS.md once this lands).

Test plan

  • tsc --project tsconfig.app.json --noEmit clean.
  • ESLint clean on all 24 touched files + 2 new files.
  • CI runs the vitest suite (local vitest blocked by .vite-temp root-owned permission — same env issue documented in prior handoffs).
  • Manual: unauth visit / → marketing renders immediately (no JS-redirect chain).
  • Manual: authed visit / → bounces to /home without flicker.
  • Manual: unauth visit /home → redirects to /, then post-login returns to /home via state.from.
  • Manual: /landing still resolves (redirects to /).
  • Manual: OAuth callback lands authed users at /home; invitee path lands at /home?welcome=teammate.
  • Manual: welcome dismiss-rest from step-1/2/3 navigates to /home.
  • Manual: dashboard "Start a session" CTAs still pulse + focus the input (the prior PR #168 fix is intact).
  • Manual: TermsPage / PrivacyPage / PoliciesPage / ContactPage / PromotionsPage back-link returns to /.
  • Manual: curl https://resolutionflow.com/robots.txt returns the new file; curl https://resolutionflow.com/sitemap.xml returns valid XML.

Manual follow-ups (not in this PR)

  • PostHog dashboard sweep — $current_url ends with / now means anonymous marketing visit, no longer authed dashboard. Re-key any insights/funnels.
  • OG image asset for LandingPage (placeholder OK to unblock; design polish later).
  • .ai/DECISIONS.md entry capturing SSR-prerender as the documented next escalation.
  • Delete /landing redirect alias after one release.
  • After CI green: update .ai/HANDOFF.md to reflect the new resume point.

🤖 Generated with Claude Code

## Summary Stripe's compliance crawler fetches the apex URL without executing JS and declined live-mode review when `https://resolutionflow.com/` returned the empty SPA shell that redirected to `/landing` client-side. This PR restructures the router so `/` serves the public landing page directly, moves the authenticated dashboard index to `/home`, and adds the crawlability surface Stripe expects (robots.txt, sitemap.xml, `og:url`). Plan: [`docs/plans/2026-05-13-public-landing-routing-refactor.md`](../src/branch/main/docs/plans/2026-05-13-public-landing-routing-refactor.md) ## What changes **Router** (`router.tsx`) - `/` → new `PublicLanding` wrapper (LandingPage for anon; `<Navigate to="/home">` for authed users so there's no marketing-frame flicker before redirect). - Authed tree converted to a path-less layout route. All children carry absolute paths so URLs are stable. QuickStartPage moves to `/home`; `/trees`, `/pilot`, `/admin/*`, `/account/*`, `/welcome/*`, etc. keep their URLs. - `/landing` kept as a one-release stale-bookmark redirect to `/`. Deletion captured in the plan's follow-ups. - `ProtectedRoute` unauth redirect flipped `/landing` → `/`; `state.from` preservation untouched. **Reference updates** - Post-login / post-onboarding → `/home`: OAuthCallbackPage (incl. invitee `?welcome=teammate` query), WelcomeStep1/2/3 dismiss-rest, AssistantChatPage post-escalate, WelcomeRouter completion/dismiss redirects, VerifyEmailPage's three "Go to dashboard" links. - Authed chrome → `/home`: TopBar logo, AppLayout mobile nav + drawer logo, CommandPalette Dashboard entry. - Dashboard onboarding → `/home`: NextStepCard `ran_session.ctaPath`, SetupChecklist `ran_session.path`, SessionHistoryPage empty-state CTA. - Public back-links → `/`: TermsPage, PrivacyPage, PoliciesPage, ContactPage, PromotionsPage, PublicTemplatesPage (header + footer). SharedSessionPage's `to="/"` left as-is — now correctly lands anon visitors on the public landing. **Crawlability** - New `frontend/public/robots.txt` allowlisting public pages and disallowing the authed app. - New `frontend/public/sitemap.xml` for `/`, `/pricing`, `/contact-sales`, `/contact`, `/templates`, `/terms`, `/privacy`, `/policies`, `/promotions`. - `PageMeta` gains `og:url` (defaults to `window.location.href`) and switches `twitter:card` to `summary_large_image` when an `ogImage` is passed. ## Risk + escalation Necessary but not necessarily sufficient. If Stripe's bot executes zero JS, even a `/`-routed LandingPage is invisible (Vite still client-renders the marketing page). The documented next escalation is server-side prerendering of public routes via `vite-plugin-ssg` (captured in the plan, log the decision in `.ai/DECISIONS.md` once this lands). ## Test plan - [x] `tsc --project tsconfig.app.json --noEmit` clean. - [x] ESLint clean on all 24 touched files + 2 new files. - [ ] CI runs the vitest suite (local vitest blocked by `.vite-temp` root-owned permission — same env issue documented in prior handoffs). - [ ] Manual: unauth visit `/` → marketing renders immediately (no JS-redirect chain). - [ ] Manual: authed visit `/` → bounces to `/home` without flicker. - [ ] Manual: unauth visit `/home` → redirects to `/`, then post-login returns to `/home` via `state.from`. - [ ] Manual: `/landing` still resolves (redirects to `/`). - [ ] Manual: OAuth callback lands authed users at `/home`; invitee path lands at `/home?welcome=teammate`. - [ ] Manual: welcome dismiss-rest from step-1/2/3 navigates to `/home`. - [ ] Manual: dashboard "Start a session" CTAs still pulse + focus the input (the prior PR #168 fix is intact). - [ ] Manual: TermsPage / PrivacyPage / PoliciesPage / ContactPage / PromotionsPage back-link returns to `/`. - [ ] Manual: `curl https://resolutionflow.com/robots.txt` returns the new file; `curl https://resolutionflow.com/sitemap.xml` returns valid XML. ## Manual follow-ups (not in this PR) - PostHog dashboard sweep — `$current_url ends with /` now means anonymous marketing visit, no longer authed dashboard. Re-key any insights/funnels. - OG image asset for LandingPage (placeholder OK to unblock; design polish later). - `.ai/DECISIONS.md` entry capturing SSR-prerender as the documented next escalation. - Delete `/landing` redirect alias after one release. - After CI green: update `.ai/HANDOFF.md` to reflect the new resume point. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chihlasm added 1 commit 2026-05-14 05:58:47 +00:00
feat(routing): serve public landing at / and move authed index to /home
Some checks failed
Mirror to GitHub / mirror (push) Successful in 5s
CI / e2e (pull_request) Failing after 5m32s
CI / frontend (pull_request) Failing after 5m34s
CI / backend (pull_request) Successful in 10m19s
05646465b8
Stripe's compliance crawler fetches the apex URL without executing JS and
declined live-mode review when `https://resolutionflow.com/` returned the
empty SPA shell that redirected to /landing client-side. Restructure the
router so / serves LandingPage directly:

- `/` → new `PublicLanding` wrapper (LandingPage for anon; Navigate to
  /home for authed users so there's no marketing-frame flicker).
- Authed tree converted to a path-less layout route with absolute child
  paths. QuickStartPage moves to `/home`; all other children
  (`/trees`, `/pilot`, `/admin/*`, `/account/*`, etc.) keep their URLs.
- `/landing` kept as a one-release stale-bookmark redirect to /.
- `ProtectedRoute` unauth redirect flipped /landing → /; `state.from`
  preserved for post-login return.

Reference updates:
- Post-login / post-onboarding destinations → /home: OAuthCallbackPage
  (incl. `?welcome=teammate` query), WelcomeStep1/2/3 dismiss-rest,
  AssistantChatPage post-escalate, WelcomeRouter completion/dismiss
  redirects, VerifyEmailPage's three "Go to dashboard" links.
- Authed chrome → /home: TopBar logo, AppLayout mobile nav + drawer
  logo, CommandPalette Dashboard entry.
- Dashboard onboarding → /home: NextStepCard `ran_session.ctaPath`,
  SetupChecklist `ran_session.path`, SessionHistoryPage empty-state CTA.
- Public back-links → /: TermsPage, PrivacyPage, PoliciesPage,
  ContactPage, PromotionsPage, PublicTemplatesPage (header + footer).
  SharedSessionPage's `to="/"` left as-is — now correctly lands anon
  visitors on the public landing.

Crawlability:
- New `frontend/public/robots.txt` allowlisting public pages and
  disallowing the authed app.
- New `frontend/public/sitemap.xml` for /, /pricing, /contact-sales,
  /contact, /templates, /terms, /privacy, /policies, /promotions.
- `PageMeta` gains an `og:url` (defaults to `window.location.href`) and
  flips `twitter:card` to `summary_large_image` when an `ogImage` is
  passed.

Tests:
- `AppLayout.test.tsx` updated to mount at `/home`.
- New `ProtectedRoute.test.tsx` asserts unauthenticated `/home`
  redirects to `/` (not `/landing`) and preserves origin in `state.from`.

If Stripe's crawler still cannot see the site after this (zero-JS
crawler), the documented next escalation is server-side prerendering of
public routes via `vite-plugin-ssg`. Out of scope here.

Plan: docs/plans/2026-05-13-public-landing-routing-refactor.md

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
chihlasm added 1 commit 2026-05-14 21:35:54 +00:00
test(e2e): align auth + public smoke tests with new / and /home routing
Some checks failed
Mirror to GitHub / mirror (push) Successful in 5s
CI / frontend (pull_request) Failing after 2m4s
CI / e2e (pull_request) Successful in 10m8s
CI / backend (pull_request) Successful in 10m27s
13f527c4ad
Playwright specs still asserted the pre-refactor URLs and failed on CI:
- auth.spec.ts expected post-login to land at `/`; now `/home`.
- public.spec.ts expected unauth redirect to `/landing`; now `/`.
- public.spec.ts's landing-loads test navigated to `/landing` (a stale-
  bookmark redirect); point it directly at `/`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
chihlasm added 1 commit 2026-05-14 23:25:53 +00:00
test(welcome): align Router/Step1/Step2 stub routes with /home destination
Some checks failed
Mirror to GitHub / mirror (push) Failing after 5m5s
CI / frontend (pull_request) Successful in 6m24s
CI / backend (pull_request) Successful in 10m19s
CI / e2e (pull_request) Successful in 9m51s
86163a69aa
Post-refactor, WelcomeRouter and the Step1/Step2 "Skip-the-rest" handlers
navigate to /home, but the MemoryRouter test stubs still mounted the
"dashboard" marker at /. Update the stub routes (and matching it() titles)
so the assertions resolve.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
chihlasm added 1 commit 2026-05-15 04:34:25 +00:00
fix(routing): finish /home migration in WelcomeStep3 + VerifyEmailPage
All checks were successful
Mirror to GitHub / mirror (push) Successful in 5s
CI / frontend (pull_request) Successful in 6m42s
CI / e2e (pull_request) Successful in 10m12s
CI / backend (pull_request) Successful in 10m46s
f9f98b1a65
The original public-landing routing refactor migrated WelcomeRouter,
WelcomeStep1, and WelcomeStep2 post-onboarding redirects to /home, but
left four sites still pointing at the old / + query-string destinations:

  - WelcomeStep3 `completeWizardAndExit` (Send invites)
  - WelcomeStep3 `handleSkipStep` (Skip)
  - VerifyEmailPage post-verify auto-redirect (`setTimeout`)
  - VerifyEmailPage success-state "Go to dashboard" Link

These all worked by accident because PublicLanding redirects authed
users from / to /home — so users still landed on the dashboard, but
through an unnecessary mount-and-redirect flicker, and the
`?welcome=true` / `?verified=1` query markers got dropped on the way.

Drop both query markers — neither is read anywhere in the codebase
(grepped frontend/src; the dashboard's onboarding UX is driven by
`getOnboardingStatus`, not URL state). Carrying dead URL params
just invites future "is this load-bearing?" investigations.

Test stubs in WelcomeStep3.test.tsx and VerifyEmailPage.test.tsx
moved from `<Route path="/">` to `<Route path="/home">` so the
assertions verify the new destination instead of accidentally matching
the old one (the previous stubs masked the partial migration).

Out of scope: AcceptInvitePage and OAuthCallbackPage still use
`?welcome=teammate`, but that one carries an explicit "decoded by the
dashboard in Task 41" annotation and may be wired up later, so left
untouched.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
chihlasm merged commit 93ce0490e0 into main 2026-05-15 05:18:37 +00:00
Sign in to join this conversation.