Skip to content

feat: Firestore tenant host routing with cache (Functions 0.31, Console 0.6.22)#291

Open
chrisvogt wants to merge 6 commits intomainfrom
feat/firestore-tenant-host-routing
Open

feat: Firestore tenant host routing with cache (Functions 0.31, Console 0.6.22)#291
chrisvogt wants to merge 6 commits intomainfrom
feat/firestore-tenant-host-routing

Conversation

@chrisvogt
Copy link
Copy Markdown
Owner

Closes #257

Summary

  • Functions 0.31.0: tenant_hosts resolution after env map when ENABLE_FIRESTORE_TENANT_ROUTING=true, in-process TTL cache (TENANT_HOST_ROUTING_CACHE_MS, optional TENANT_HOST_ROUTING_CACHE_MAX_ENTRIES), GET /api/internal/resolve-tenant?host=, optional CHRONOGROVE_INTERNAL_API_KEY.
  • Console 0.6.22: async proxy + /internal/tenant-resolve for auth shell; useFirestoreTenantRootSlug + authless-tenant-surface; functions-app-origin for server fetches. App Hosting env defaults keep routing off until enabled.
  • Tests and Vitest coverage includes updated for patch/CI thresholds.

See changelogs: functions/CHANGELOG.md, apps/console/CHANGELOG.md, root CHANGELOG.md.

Made with Cursor

…le 0.6.22)

- Functions: tenant-host-routing, /api/internal/resolve-tenant, async widgets
- Console: async proxy, /internal/tenant-resolve, auth shell hook, tests
- Env templates, apphosting defaults, CHANGELOGs, Vitest coverage includes

Made-with: Cursor
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 94.50549% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.38%. Comparing base (5d1de51) to head (522fee0).

Files with missing lines Patch % Lines
functions/app/create-express-app.ts 83.33% 0 Missing and 3 partials ⚠️
functions/services/tenant-host-routing.ts 97.10% 0 Missing and 2 partials ⚠️

❌ Your patch check has failed because the patch coverage (94.50%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #291      +/-   ##
==========================================
- Coverage   98.49%   98.38%   -0.11%     
==========================================
  Files         102      103       +1     
  Lines        3390     3478      +88     
  Branches      907      934      +27     
==========================================
+ Hits         3339     3422      +83     
  Misses          3        3              
- Partials       48       53       +5     
Flag Coverage Δ
unittests 98.38% <94.50%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

chrisvogt and others added 3 commits April 8, 2026 23:15
Avoid parent load()/loading gate remount clearing the draft on slow CI.

Made-with: Cursor
Resolve conflicts in changelogs, package versions, and widget route:
keep async Firestore hostname resolution with resolveViewerUidForPublicOnboarding(req, res).
Console 0.6.26 / Functions 0.31.0 changelog entries on top of main.

Co-authored-by: Cursor <cursoragent@cursor.com>
- Add root "emulators" script and wire dev:full through it.
- Document local dev with pnpm run dev:full / emulators + dev only; move
  optional App Hosting emulator steps to docs/APP_HOSTING.md.
- Align App Hosting emulator hostname with firebase.json (console.dev-chronogrove.com)
  in Auth emulator wiring, baseUrl helpers, and CORS allowlist test.
- Update next-env.d.ts routes import path for Next dev types.

Co-authored-by: Cursor <cursoragent@cursor.com>
@chrisvogt chrisvogt self-assigned this May 4, 2026
@chrisvogt chrisvogt added enhancement New feature or request frontend Next.js hosting app changes infrastructure Build, deploy, CI/CD, and hosting changes labels May 4, 2026
chrisvogt and others added 2 commits May 3, 2026 23:51
dev-chronogrove.com emulator uses :8084 in the Origin header; chronogrove
regexes previously required .com at end of string and rejected ports.

Co-authored-by: Cursor <cursoragent@cursor.com>
…tenant

- Drop unreachable empty-host guard in getCachedFirestoreClaim.
- tenant-host-routing: TTL default for negative ms; blank/undefined host;
  internal API nulls for missing tenant doc, bad uid type, empty uid string.
- create-express-app: internal key match/mismatch, duplicate host query,
  catch path via spy; widget GET without query when Firestore routing resolves host.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request frontend Next.js hosting app changes infrastructure Build, deploy, CI/CD, and hosting changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PR 5: Firestore-backed tenant routing (dynamic host lookup)

1 participant