Skip to content

Review Section 5.1.2. Canonicalized Host Names#569

Draft
colincasey wants to merge 4 commits into
masterfrom
review-512
Draft

Review Section 5.1.2. Canonicalized Host Names#569
colincasey wants to merge 4 commits into
masterfrom
review-512

Conversation

@colincasey

Copy link
Copy Markdown
Contributor

Summary

  • Restructures canonicalDomain.ts to map step-by-step to RFC 6265 Section 5.1.2
  • Extracts canonicalizedHostName.ts containing the pure RFC algorithm (steps 1-3) separate from library-specific pre-processing
  • Introduces labelToASCII helper for per-label IDNA conversion via the URL constructor's built-in UTS#46
  • Replaces flat test block with 8 grouped describe blocks covering NR-LDH labels, U-label conversion, A-label passthrough, IPv6, dot handling, non-NR-LDH ASCII, and null/empty inputs
  • Adds skipped test stubs for draft bis-22 validation (fake A-label rejection, invalid label type rejection)
  • Comprehensive JSDoc documenting RFC 6265 algorithm, Section 6.3 IDNA guidance, URL constructor rationale, and bis-22 compatibility notes

Future work

Sub-issues created under #512 for follow-up refactoring discovered during this review:

Test plan

  • All 29 canonicalDomain tests pass, 3 bis-22 stubs skipped
  • Full test suite (791 tests) passes
  • Lint clean on changed files
  • Build succeeds, API surface unchanged (api-extractor clean)
  • Type entrypoints verified (attw green)

Closes #512

… 5.1.2

Extract the pure RFC 6265 Section 5.1.2 algorithm into a new
canonicalizedHostName module with a labelToASCII helper for per-label
IDNA conversion. canonicalDomain retains library-specific pre-processing
(trimming, leading-dot removal, IPv6 handling) and delegates to the new
function for the RFC steps.
@colincasey colincasey self-assigned this Mar 12, 2026
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.

Review Draft 20 - 5.1.2. Canonicalized Host Names

1 participant