Commit 73d0a9c11c

73d0a9c11cc9547285d5034567360f75a52b0471

parent: 0cb5ee74c7

Verified · cmc

cmc <hello@cleberg.net> · 2026-10-24 05:51 UTC

Delete the entitlement shims

PremiumAccessService forwarded to FeatureAccessService and had one live caller;
its hasAccess(to:) and the whole PremiumCapability enum were dead.
DataAccessService was pure forwarding over a parallel DataCapability enum that
P1 had already reduced to a single case.

loadLookup's parameter was DataCapability?, so its gate had to translate through
capability.feature to reach a real capability. It takes FeatureCapability? now
and asks hasAccess(to:) directly; loadExtendedSubdomains' call site is unchanged
because both enums used the same case name.

This also removes the last entitlement decision living outside
FeatureAccessService: PremiumAccessService used currentTier != .free as a stand
in for unlimitedTrackedDomains, which !12 flagged and which leaves with the file.

Layout: unified · split

DomainDig/ContentView.swift +1 −1
@@ -468,7 +468,7 @@ struct ContentView: View {
468 error: viewModel.subdomainsError, 468 error: viewModel.subdomainsError,
469 provenance: viewModel.currentSnapshot.provenanceBySection[.subdomains], 469 provenance: viewModel.currentSnapshot.provenanceBySection[.subdomains],
470 confidence: viewModel.currentSnapshot.subdomainConfidence, 470 confidence: viewModel.currentSnapshot.subdomainConfidence,
471 showsExtendedPlaceholder: !DataAccessService.hasAccess(to: .extendedSubdomains), 471 showsExtendedPlaceholder: !FeatureAccessService.hasAccess(to: .extendedSubdomains),
472 extendedCount: viewModel.extendedSubdomains.count, 472 extendedCount: viewModel.extendedSubdomains.count,
473 extendedLoading: viewModel.extendedSubdomainsLoading, 473 extendedLoading: viewModel.extendedSubdomainsLoading,
474 extendedError: viewModel.extendedSubdomainsError, 474 extendedError: viewModel.extendedSubdomainsError,
DomainDig/DataAccessService.swift deleted −16
@@ -1,16 +0,0 @@
1import Foundation
2
3enum DataAccessService {
4 static func hasAccess(to capability: DataCapability) -> Bool {
5 FeatureAccessService.hasAccess(to: capability.feature)
6 }
7}
8
9extension DataCapability {
10 /// The plan feature that unlocks this data.
11 var feature: FeatureCapability {
12 switch self {
13 case .extendedSubdomains: .extendedSubdomains
14 }
15 }
16}
DomainDig/DomainViewModel.swift +5 −5
@@ -803,7 +803,7 @@ final class DomainViewModel {
803 return true 803 return true
804 } 804 }
805 805
806 guard PremiumAccessService.canAddTrackedDomain(currentCount: trackedDomains.count) else { 806 guard FeatureAccessService.canAddTrackedDomain(currentCount: trackedDomains.count) else {
807 upgradePrompt = FeatureAccessService.upgradePromptForTrackedDomains(currentCount: trackedDomains.count) 807 upgradePrompt = FeatureAccessService.upgradePromptForTrackedDomains(currentCount: trackedDomains.count)
808 return false 808 return false
809 } 809 }
@@ -1320,7 +1320,7 @@ final class DomainViewModel {
1320 /// already. With a `capability`, shows the upgrade prompt when the plan 1320 /// already. With a `capability`, shows the upgrade prompt when the plan
1321 /// doesn't include it; without one the lookup is open to every tier. 1321 /// doesn't include it; without one the lookup is open to every tier.
1322 private func loadLookup<Item>( 1322 private func loadLookup<Item>(
1323 _ capability: DataCapability? = nil, 1323 _ capability: FeatureCapability? = nil,
1324 into items: ReferenceWritableKeyPath<DomainViewModel, [Item]>, 1324 into items: ReferenceWritableKeyPath<DomainViewModel, [Item]>,
1325 loading: ReferenceWritableKeyPath<DomainViewModel, Bool>, 1325 loading: ReferenceWritableKeyPath<DomainViewModel, Bool>,
1326 error: ReferenceWritableKeyPath<DomainViewModel, String?>, 1326 error: ReferenceWritableKeyPath<DomainViewModel, String?>,
@@ -1328,8 +1328,8 @@ final class DomainViewModel {
1328 fetch: () async -> ServiceResult<[Item]> 1328 fetch: () async -> ServiceResult<[Item]>
1329 ) async { 1329 ) async {
1330 guard !searchedDomain.isEmpty else { return } 1330 guard !searchedDomain.isEmpty else { return }
1331 if let capability, !DataAccessService.hasAccess(to: capability) { 1331 if let capability, !FeatureAccessService.hasAccess(to: capability) {
1332 upgradePrompt = FeatureAccessService.upgradePrompt(for: capability.feature) 1332 upgradePrompt = FeatureAccessService.upgradePrompt(for: capability)
1333 return 1333 return
1334 } 1334 }
1335 guard self[keyPath: items].isEmpty else { return } 1335 guard self[keyPath: items].isEmpty else { return }
@@ -3576,7 +3576,7 @@ final class DomainViewModel {
3576 lines.append(" \(subdomain.hostname)\(marker)") 3576 lines.append(" \(subdomain.hostname)\(marker)")
3577 } 3577 }
3578 } 3578 }
3579 if !DataAccessService.hasAccess(to: .extendedSubdomains) { 3579 if !FeatureAccessService.hasAccess(to: .extendedSubdomains) {
3580 lines.append(" Extended subdomain discovery (Pro)") 3580 lines.append(" Extended subdomain discovery (Pro)")
3581 } 3581 }
3582 return lines 3582 return lines
DomainDig/HistoryView.swift +1 −1
@@ -229,7 +229,7 @@ struct HistoryDetailView: View {
229 error: snapshot.subdomainsError, 229 error: snapshot.subdomainsError,
230 provenance: snapshot.provenanceBySection[.subdomains], 230 provenance: snapshot.provenanceBySection[.subdomains],
231 confidence: snapshot.subdomainConfidence, 231 confidence: snapshot.subdomainConfidence,
232 showsExtendedPlaceholder: !DataAccessService.hasAccess(to: .extendedSubdomains) 232 showsExtendedPlaceholder: !FeatureAccessService.hasAccess(to: .extendedSubdomains)
233 ) 233 )
234 .padding(.top, appDensity.metrics.sectionSpacing) 234 .padding(.top, appDensity.metrics.sectionSpacing)
235 if let comparisonSnapshot = viewModel.comparisonSnapshot(for: entry) { 235 if let comparisonSnapshot = viewModel.comparisonSnapshot(for: entry) {
DomainDig/Models.swift −12
@@ -395,10 +395,6 @@ struct WorkflowRunSummary: Identifiable, Equatable {
395/// Data that a tier gates. Ownership and DNS history derive from the user's own 395/// Data that a tier gates. Ownership and DNS history derive from the user's own
396/// stored snapshots and are not gated at all; pricing and reputation were 396/// stored snapshots and are not gated at all; pricing and reputation were
397/// removed, having no local derivation and no configured provider. 397/// removed, having no local derivation and no configured provider.
398enum DataCapability: String, Codable {
399 case extendedSubdomains
400}
401
402struct DomainOwnershipHistoryEvent: Identifiable, Codable, Equatable, Sendable { 398struct DomainOwnershipHistoryEvent: Identifiable, Codable, Equatable, Sendable {
403 let id: UUID 399 let id: UUID
404 let date: Date 400 let date: Date
@@ -978,14 +974,6 @@ extension DomainHealth {
978 } 974 }
979} 975}
980 976
981enum PremiumCapability: String, Codable {
982 case unlimitedTrackedDomains
983 case automatedMonitoring
984 case pushAlerts
985 case batchTracking
986 case advancedExports
987}
988
989enum CollaborationPermission: String, Codable, Equatable { 977enum CollaborationPermission: String, Codable, Equatable {
990 case readOnly 978 case readOnly
991 case editable 979 case editable
DomainDig/PremiumAccessService.swift deleted −26
@@ -1,26 +0,0 @@
1import Foundation
2
3enum PremiumAccessService {
4 static func hasAccess(to capability: PremiumCapability) -> Bool {
5 switch capability {
6 case .advancedExports:
7 return FeatureAccessService.hasAccess(to: .advancedExports)
8 case .batchTracking:
9 return FeatureAccessService.hasAccess(to: .batchOperations)
10 case .unlimitedTrackedDomains:
11 return FeatureAccessService.currentTier != .free
12 case .automatedMonitoring:
13 return FeatureAccessService.hasAccess(to: .automatedMonitoring)
14 case .pushAlerts:
15 return FeatureAccessService.hasAccess(to: .localAlerts)
16 }
17 }
18
19 static func trackedDomainLimitMessage(currentCount: Int) -> String? {
20 FeatureAccessService.trackedDomainLimitMessage(currentCount: currentCount)
21 }
22
23 static func canAddTrackedDomain(currentCount: Int) -> Bool {
24 FeatureAccessService.canAddTrackedDomain(currentCount: currentCount)
25 }
26}