Skip to content

Comments

Debug: Revert #926 revert 1.7.0#949

Open
rchlfryn wants to merge 56 commits intorevert-926-revert-1.7.0from
fryan/revert-926-revert-1.7.0
Open

Debug: Revert #926 revert 1.7.0#949
rchlfryn wants to merge 56 commits intorevert-926-revert-1.7.0from
fryan/revert-926-revert-1.7.0

Conversation

@rchlfryn
Copy link
Collaborator

@rchlfryn rchlfryn commented Feb 17, 2026

Description

Re-applies the tenant lookup refactor from #897 (which was reverted in #926). This replaces the dynamic Edge Config / API-based tenant resolution with a hardcoded AVALANCHE_CENTERS list as the single source of truth for valid tenant slugs, making middleware synchronous and deterministic.

Also fixes a routing issue where pages were falling through to [...segmentsNotFound] in preview.

Why dynamicParams = true?

The routing works in two phases with different capabilities:

  1. Middleware (edge, no DB access) — decides "is this a valid center slug?" and rewrites the URL
  2. Layout (server, has DB access) — decides "can I actually render this center?"

With dynamicParams = false, there's a rigid third gatekeeper between them: the build-time generateStaticParams() output. That list must perfectly match what middleware sends — if it doesn't, for any reason, routes silently fall through to the catch-all instead of rendering the appropriate not-found page.

With dynamicParams = true, that rigid middle layer is removed. Middleware handles "is this slug valid?" and the layout handles "does this center have data?" Each layer does what it's best positioned to do with the information it has access to. generateStaticParams() still pre-renders centers in the DB — that's a performance optimization, not an access control mechanism.

Why notFound() instead of invariant?

invariant throws a regular error → 500-style error page. notFound() throws a Next.js-specific error → proper 404 page. With dynamicParams = true, reaching the layout with a center that has no DB data is now an expected path (not a bug), so a 404 is the correct response.

Reverts #926

Related Issues

#897

Key Changes

Newly added to fix false 404s

  • dynamicParams = true: Centers in the DB are pre-rendered at build time; others are served on-demand with graceful 404 handling d370ef0
  • invariantnotFound(): Proper 404 pages instead of 500-style crashes when a center lacks DB data c34ee93

How to test

  1. Visit a center that exists in the DB (e.g., nwac.localhost) — should render normally
  2. Visit a center in AVALANCHE_CENTERS but not in the DB — should show the not-found page, not crash
  3. Visit a completely invalid slug — should show the not-found page
  4. Verify the admin tenant selector still works correctly
  5. Test custom domain routing in a preview deployment

busbyk and others added 30 commits January 28, 2026 17:06
- Install @playwright/test and configure Chromium
- Add playwright.config.ts with admin and frontend projects
- Create test fixtures: test-users, auth, and tenant
- Add npm scripts for running E2E tests
- Update .gitignore for Playwright artifacts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Tests for relationships, validation (slug, phone, zip, URL),
formatting (authors, initials, relative time), and string/path
utilities (kebab-case, normalizePath, isAbsoluteUrl, extractID).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Smoke tests that verify all major frontend pages load without JS errors
or server errors: landing page, tenant homepage, blog, events,
observations, forecasts, weather, and embed pages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

@rchlfryn rchlfryn changed the base branch from revert-926-revert-1.7.0 to main February 17, 2026 20:15
@rchlfryn rchlfryn marked this pull request as ready for review February 17, 2026 21:01
@rchlfryn rchlfryn requested a review from busbyk February 18, 2026 19:23
@rchlfryn rchlfryn self-assigned this Feb 18, 2026
@rchlfryn rchlfryn changed the base branch from main to revert-926-revert-1.7.0 February 20, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants