Validate the domain input before starting a lookup !8

merged merged by cmc on 2026-10-24 04:10 UTC · krz/domain-dig:domain-validation into main

Discussion

cmc

Typing something that is not a domain started a 14-section inspection that could only come back with section errors. DomainName.validate now answers at the input boundary instead.

DomainDig/DomainName.swift normalizes the host (trim, scheme, path, port, userinfo, query, case, one trailing dot), then requires at least two labels, rejects empty and hyphen-edged labels, rejects %-escapes rather than decoding them, and measures the 63-byte label and 253-byte host limits on the IDNA-encoded form. Unicode hosts are accepted and returned as typed.

Wired at the two input boundaries only:

  • run() validates the value it uses and sets domainInputError on failure.
  • bulk input splits on whitespace as well as commas and newlines, then drops tokens that fail validation.
  • ContentView shows the error under the field and clears it on the next edit.

normalizedDomain, the local API service and the portability service are left lenient. normalizedDomain is the key that matches already-stored rows in trackDomain, openInspection and workflowsContaining, so tightening it would turn those into silent no-ops for stored domains the new rules reject; the two view-model tests cover that case.

100 tests pass, up from 81.