[PR #470] [MERGED] fix: TPR zone resolution for multi-part TLD domains #596

Closed
opened 2026-05-06 13:08:59 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/470
Author: @NathanDrake2406
Created: 3/11/2026
Status: Merged
Merged: 3/11/2026
Merged by: @james-elicx

Base: mainHead: fix/tpr-domain-resolution


📝 Commits (2)

  • d02db3b fix: TPR zone resolution for multi-part TLD domains
  • 5031a67 chore: format test file

📊 Changes

2 files changed (+105 additions, -44 deletions)

View changed files

📝 packages/vinext/src/cloudflare/tpr.ts (+41 -44)
📝 tests/deploy.test.ts (+64 -0)

📄 Description

Summary

  • Replace hardcoded 12-entry MULTI_PART_TLDS list in resolveZoneId with progressive domain candidate lookup
  • For shop.example.co.uk, tries co.ukexample.co.ukshop.example.co.uk until a Cloudflare zone matches
  • Fixes zone resolution for all public suffixes (.org.au, .co.in, .gov.uk, etc.) without maintaining a TLD list
  • Common TLDs (.com, .io) still resolve on the first API call — no performance regression
  • Fixes missing fallback — previous code returned null on miss despite a TODO claiming fallback existed

Changes

  • packages/vinext/src/cloudflare/tpr.ts: Extract domainCandidates() pure function, rewrite resolveZoneId to loop over candidates
  • tests/deploy.test.ts: Add 8 tests covering candidate generation and wrangler config domain extraction

Test plan

  • domainCandidates unit tests: bare domain, simple subdomain, multi-part TLD, deeply nested
  • parseWranglerConfig tests: routes string form, custom_domains array, workers.dev filtering, KV extraction
  • CI: full Vitest + Playwright suite

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/470 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 3/11/2026 **Status:** ✅ Merged **Merged:** 3/11/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/tpr-domain-resolution` --- ### 📝 Commits (2) - [`d02db3b`](https://github.com/cloudflare/vinext/commit/d02db3b0603b27f12d0486791783b5ac5d46e8e6) fix: TPR zone resolution for multi-part TLD domains - [`5031a67`](https://github.com/cloudflare/vinext/commit/5031a67dd467fab176197a0e0829790dbc029110) chore: format test file ### 📊 Changes **2 files changed** (+105 additions, -44 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/cloudflare/tpr.ts` (+41 -44) 📝 `tests/deploy.test.ts` (+64 -0) </details> ### 📄 Description ## Summary - Replace hardcoded 12-entry `MULTI_PART_TLDS` list in `resolveZoneId` with progressive domain candidate lookup - For `shop.example.co.uk`, tries `co.uk` → `example.co.uk` → `shop.example.co.uk` until a Cloudflare zone matches - Fixes zone resolution for all public suffixes (`.org.au`, `.co.in`, `.gov.uk`, etc.) without maintaining a TLD list - Common TLDs (`.com`, `.io`) still resolve on the first API call — no performance regression - Fixes missing fallback — previous code returned `null` on miss despite a TODO claiming fallback existed ## Changes - `packages/vinext/src/cloudflare/tpr.ts`: Extract `domainCandidates()` pure function, rewrite `resolveZoneId` to loop over candidates - `tests/deploy.test.ts`: Add 8 tests covering candidate generation and wrangler config domain extraction ## Test plan - [x] `domainCandidates` unit tests: bare domain, simple subdomain, multi-part TLD, deeply nested - [x] `parseWranglerConfig` tests: routes string form, custom_domains array, workers.dev filtering, KV extraction - [x] CI: full Vitest + Playwright suite --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:08:59 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#596
No description provided.