Commit f667d4e49f

f667d4e49f1ee92f1f3b6505ac377bc8dffefe91

parent: f690cb4f54

Unsigned

cmc <hello@cleberg.net> · 2026-10-25 04:09 UTC

Delete the dead lookup pipeline (!28)

A3, and the first of W6's three parts.

`DomainViewModel` carried a second, older lookup pipeline: `runDNS`,
`runAvailability`, `runSSL`, `runHSTSPreload`, `runHTTPHeaders`,
`runReachability`, `runEmailSecurity`, `runOwnership`, `runReverseDNS`,
`runRedirectChain`, `runSubdomains`, `runPortScan`, `runIPGeolocation`,
`runSuggestions` and `finishDependentWithoutPrimaryIP`.

Each was defined once and called from nowhere. Checked per method across both
app targets, the widget, the share extension, `Shared`, both test targets, the
`pbxproj` and the docs — the only other mention of any of them in the
repository is the spec entry describing the problem. Swift does not warn on an
unused private method, so it kept compiling after `DomainInspectionService`
replaced it.

196 lines; the view model goes from 4,047 to 3,851. No behaviour change, and
nothing else referenced the state these methods wrote.

## On the rest of W6

The other two parts are related enough that order matters, so they follow as
their own MRs rather than joining this one:

- **A2**, the `SectionState<T>` collapse: 20 `*Loading` flags and 19 `*Error`
  strings on the view model, 35 reads of them elsewhere, plus
  `setAllLoadingStates` and the derived `resultsLoaded`.
- **A10**, the section views' 22 and 17 parameter lists, which are the same
  `(rows, loading, error, provenance, confidence)` group repeated per
  subsection. Doing this before A2 would mean writing those view-data structs
  twice, so it goes last.

## Verification

Both tiers: 233 tests, 0 failures on iOS 18.6 (iPhone 16) and iOS 27.0
(iPhone Air).

Layout: unified · split

DomainDig/DomainViewModel.swift −196
@@ -1477,202 +1477,6 @@ final class DomainViewModel {
14771477 customPortScanLoading = false
14781478 }
14791479
1480 private func runDNS(domain: String, lookupID: UUID) async {
1481 let result = await DNSLookupService.lookupAll(domain: domain)
1482 guard !Task.isCancelled, isCurrentLookup(lookupID) else { return }
1483 switch result {
1484 case let .success(sections):
1485 dnsSections = sections
1486 dnsError = nil
1487 case let .empty(message), let .error(message):
1488 dnsSections = []
1489 dnsError = message
1490 }
1491 dnsLoading = false
1492 }
1493
1494 private func runAvailability(domain: String, lookupID: UUID) async {
1495 let result = await DomainAvailabilityService.check(domain: domain)
1496 guard !Task.isCancelled, isCurrentLookup(lookupID) else { return }
1497 availabilityResult = result
1498 availabilityLoading = false
1499 updateTrackedDomainAvailability(for: result.domain, status: result.status)
1500 }
1501
1502 private func runSSL(domain: String, lookupID: UUID) async {
1503 let result = await SSLCheckService.check(domain: domain)
1504 guard !Task.isCancelled, isCurrentLookup(lookupID) else { return }
1505 switch result {
1506 case let .success(info):
1507 sslInfo = info
1508 sslError = nil
1509 case let .empty(message), let .error(message):
1510 sslInfo = nil
1511 sslError = message
1512 }
1513 sslLoading = false
1514 }
1515
1516 private func runHSTSPreload(domain: String, lookupID: UUID) async {
1517 let result = await SSLCheckService.checkHSTSPreload(domain: domain)
1518 guard !Task.isCancelled, isCurrentLookup(lookupID) else { return }
1519 hstsPreloaded = result
1520 hstsLoading = false
1521 }
1522
1523 private func runHTTPHeaders(domain: String, lookupID: UUID) async {
1524 let result = await HTTPHeadersService.fetch(domain: domain)
1525 guard !Task.isCancelled, isCurrentLookup(lookupID) else { return }
1526 switch result {
1527 case let .success(headersResult):
1528 httpHeaders = headersResult.headers
1529 httpSecurityGrade = HTTPSecurityGrade.grade(for: headersResult.headers).rawValue
1530 httpStatusCode = headersResult.statusCode
1531 httpResponseTimeMs = headersResult.responseTimeMs
1532 httpProtocol = headersResult.httpProtocol
1533 http3Advertised = headersResult.http3Advertised
1534 httpHeadersError = nil
1535 case let .empty(message), let .error(message):
1536 httpHeaders = []
1537 httpSecurityGrade = nil
1538 httpStatusCode = nil
1539 httpResponseTimeMs = nil
1540 httpProtocol = nil
1541 http3Advertised = false
1542 httpHeadersError = message
1543 }
1544 httpHeadersLoading = false
1545 }
1546
1547 private func runReachability(domain: String, lookupID: UUID) async {
1548 let result = await ReachabilityService.checkAll(domain: domain)
1549 guard !Task.isCancelled, isCurrentLookup(lookupID) else { return }
1550 switch result {
1551 case let .success(results):
1552 reachabilityResults = results
1553 reachabilityError = nil
1554 case let .empty(message), let .error(message):
1555 reachabilityResults = []
1556 reachabilityError = message
1557 }
1558 reachabilityLoading = false
1559 }
1560
1561 private func runEmailSecurity(domain: String, txtRecords: [DNSRecord], lookupID: UUID) async {
1562 let result = await EmailSecurityService.analyze(domain: domain, txtRecords: txtRecords)
1563 guard !Task.isCancelled, isCurrentLookup(lookupID) else { return }
1564 switch result {
1565 case let .success(emailResult):
1566 emailSecurity = emailResult
1567 emailSecurityError = nil
1568 case let .empty(message), let .error(message):
1569 emailSecurity = nil
1570 emailSecurityError = message
1571 }
1572 emailSecurityLoading = false
1573 }
1574
1575 private func runOwnership(domain: String, lookupID: UUID) async {
1576 let result = await DomainOwnershipService.lookup(domain: domain)
1577 guard !Task.isCancelled, isCurrentLookup(lookupID) else { return }
1578 switch result {
1579 case let .success(ownership):
1580 ownershipResult = ownership
1581 ownershipError = nil
1582 case let .empty(message), let .error(message):
1583 ownershipResult = nil
1584 ownershipError = message
1585 }
1586 ownershipLoading = false
1587 }
1588
1589 private func runReverseDNS(ip: String, lookupID: UUID) async {
1590 let result = await ReverseDNSService.lookup(ip: ip, resolverURLString: resolverURLString)
1591 guard !Task.isCancelled, isCurrentLookup(lookupID) else { return }
1592 switch result {
1593 case let .success(record):
1594 ptrRecord = record
1595 ptrError = nil
1596 case let .empty(message), let .error(message):
1597 ptrRecord = nil
1598 ptrError = message
1599 }
1600 ptrLoading = false
1601 }
1602
1603 private func runRedirectChain(domain: String, lookupID: UUID) async {
1604 let result = await RedirectChainService.trace(domain: domain)
1605 guard !Task.isCancelled, isCurrentLookup(lookupID) else { return }
1606 switch result {
1607 case let .success(hops):
1608 redirectChain = hops
1609 redirectChainError = nil
1610 case let .empty(message), let .error(message):
1611 redirectChain = []
1612 redirectChainError = message
1613 }
1614 redirectChainLoading = false
1615 }
1616
1617 private func runSubdomains(domain: String, lookupID: UUID) async {
1618 let result = await SubdomainDiscoveryService.discover(for: domain)
1619 guard !Task.isCancelled, isCurrentLookup(lookupID) else { return }
1620 switch result {
1621 case let .success(results):
1622 subdomains = results
1623 subdomainsError = nil
1624 case let .empty(message), let .error(message):
1625 subdomains = []
1626 subdomainsError = message
1627 }
1628 subdomainsLoading = false
1629 }
1630
1631 private func runPortScan(domain: String, lookupID: UUID) async {
1632 let result = await PortScanService.scanAll(domain: domain)
1633 switch result {
1634 case let .success(results):
1635 let enrichedResults = await PortScanService.withBanners(results, host: domain)
1636 guard !Task.isCancelled, isCurrentLookup(lookupID) else { return }
1637 portScanResults = enrichedResults
1638 portScanError = nil
1639 case let .empty(message), let .error(message):
1640 guard !Task.isCancelled, isCurrentLookup(lookupID) else { return }
1641 portScanResults = []
1642 portScanError = message
1643 }
1644 portScanLoading = false
1645 }
1646
1647 private func runIPGeolocation(ip: String, lookupID: UUID) async {
1648 let result = await IPGeolocationService.lookup(ip: ip)
1649 guard !Task.isCancelled, isCurrentLookup(lookupID) else { return }
1650 switch result {
1651 case let .success(geolocation):
1652 ipGeolocation = geolocation
1653 ipGeolocationError = nil
1654 case let .empty(message), let .error(message):
1655 ipGeolocation = nil
1656 ipGeolocationError = message
1657 }
1658 ipGeolocationLoading = false
1659 }
1660
1661 private func finishDependentWithoutPrimaryIP(lookupID: UUID) async {
1662 guard !Task.isCancelled, isCurrentLookup(lookupID) else { return }
1663 ptrLoading = false
1664 ptrError = "No A record available"
1665 ipGeolocationLoading = false
1666 ipGeolocationError = "No A record available"
1667 }
1668
1669 private func runSuggestions(domain: String, lookupID: UUID) async {
1670 let results = await DomainAvailabilityService.suggestions(for: domain)
1671 guard !Task.isCancelled, isCurrentLookup(lookupID) else { return }
1672 suggestions = results
1673 suggestionsLoading = false
1674 }
1675
16761480 private func applyCustomPortResult(_ result: ServiceResult<[PortScanResult]>) {
16771481 switch result {
16781482 case let .success(results):