Commit 8d4dcf3bc1

8d4dcf3bc1b992f976fd1899d1bfd25062f482b4

parent: 98892ddc23

Verified · cmc

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

Make the intelligence gate a named capability

The intelligence breakdown was hidden behind a bare
`FeatureAccessService.currentTier != .proPlus` in two view bodies, so it
appeared in no search for hasAccess(to:) and in no part of the capability
table. P1 audited the table and missed it; it surfaced only because its
placeholder copy sat three lines from one being deleted in !11.

It stays Pro+. Unlike pricing and reputation the data is real and renders, and
unlike the ownership and DNS history derivations it is substantive analysis —
inferred provider with evidence, classification with reasons, risk signals,
ownership and hosting transitions, subdomain intelligence, a timeline. Free
already sees the computed verdict through the ungated risk and insight cards;
Pro+ sees the working.

As a capability it reaches the tier table, the paywall and
enabledFeatureLabels, and a test can assert it.

Also removes what !11's reputation deletion orphaned: scoreReputation could no
longer pass its own guard, so the function, its call site and the dead
"flagged by a configured reputation source" insight are gone.

Layout: unified · split

DomainDig/ContentView.swift +1 −1
@@ -436,7 +436,7 @@ struct ContentView: View {
436436 IntelligenceSectionView(
437437 isCollapsed: sectionCollapsedBinding(.intelligence),
438438 report: report,
439 showsPlaceholder: FeatureAccessService.currentTier != .proPlus
439 showsPlaceholder: !FeatureAccessService.hasAccess(to: .intelligenceDetail)
440440 )
441441 }
442442
DomainDig/DomainInsightEngine.swift −17
@@ -192,7 +192,6 @@ enum DomainInsightEngine {
192192 tally.add(4, "Observed risk has increased materially since the previous snapshot", .negative)
193193 }
194194 }
195 scoreReputation(snapshot, into: &tally)
196195
197196 let clampedScore = min(max(tally.score, 0), 100)
198197 let level: RiskLevel
@@ -330,19 +329,6 @@ enum DomainInsightEngine {
330329 }
331330 }
332331
333 private static func scoreReputation(_ snapshot: LookupSnapshot, into tally: inout RiskTally) {
334 guard let reputation = snapshot.reputation else { return }
335 switch reputation.status {
336 case .listed:
337 let sourceList = reputation.listedSources.isEmpty ? "" : " (\(reputation.listedSources.joined(separator: ", ")))"
338 tally.add(25, "Domain is flagged by a configured reputation source\(sourceList)", .negative)
339 case .clean:
340 tally.add(0, "Domain is clean against the configured reputation source", .positive)
341 case .unknown:
342 break
343 }
344 }
345
346332 private static func insights(
347333 for snapshot: LookupSnapshot,
348334 previousSnapshot: LookupSnapshot?,
@@ -353,9 +339,6 @@ enum DomainInsightEngine {
353339 ) -> [String] {
354340 var items: [String] = []
355341
356 if snapshot.reputation?.status == .listed {
357 items.append("Domain is flagged by a configured reputation source")
358 }
359342 if let group = subdomainGroups.first(where: { $0.label == "staging" || $0.label == "dev" }) {
360343 items.append("Multiple \(group.label) subdomains suggest non-production environments are exposed")
361344 }
DomainDig/FeatureAccessService.swift +5 −2
@@ -31,6 +31,7 @@ enum FeatureCapability: String, CaseIterable, Identifiable {
3131 case extendedSubdomains
3232 case sharedPortfolios
3333 case auditDepth
34 case intelligenceDetail
3435
3536 var id: String { rawValue }
3637
@@ -58,6 +59,8 @@ enum FeatureCapability: String, CaseIterable, Identifiable {
5859 return "Shared portfolios"
5960 case .auditDepth:
6061 return "Unlimited audits"
62 case .intelligenceDetail:
63 return "Intelligence detail"
6164 }
6265 }
6366}
@@ -169,7 +172,7 @@ enum FeatureAccessService {
169172 case .workflows, .batchOperations, .automatedMonitoring, .localAlerts, .advancedExports,
170173 .extendedSubdomains:
171174 return "Available in Pro"
172 case .sharedPortfolios, .auditDepth:
175 case .sharedPortfolios, .auditDepth, .intelligenceDetail:
173176 return "Available in Pro+"
174177 case .limitedTracking:
175178 return "Tracking is limited on Free"
@@ -231,7 +234,7 @@ enum FeatureAccessService {
231234 static func upgradePrompt(for capability: FeatureCapability) -> UpgradePromptContext {
232235 let title: String
233236 switch capability {
234 case .sharedPortfolios, .auditDepth:
237 case .sharedPortfolios, .auditDepth, .intelligenceDetail:
235238 title = "Available in Pro+"
236239 default:
237240 title = "Available in Pro"
DomainDig/HistoryView.swift +1 −1
@@ -183,7 +183,7 @@ struct HistoryDetailView: View {
183183 IntelligenceSectionView(
184184 isCollapsed: .constant(false),
185185 report: report,
186 showsPlaceholder: FeatureAccessService.currentTier != .proPlus
186 showsPlaceholder: !FeatureAccessService.hasAccess(to: .intelligenceDetail)
187187 )
188188 .padding(.top, 8)
189189 DomainSectionView(
DomainDig/PaywallView.swift +2 −1
@@ -10,7 +10,7 @@ struct PaywallView: View {
1010 NavigationStack {
1111 List {
1212 Section {
13 Text("Pro unlocks scale, background monitoring, alerts, exports, and extended subdomain discovery. Pro+ adds shared portfolios and unlimited audits.")
13 Text("Pro unlocks scale, background monitoring, alerts, exports, and extended subdomain discovery. Pro+ adds shared portfolios, unlimited audits, and the full intelligence breakdown.")
1414 .font(appDensity.font(.body, design: .default))
1515 .foregroundStyle(Color(.appTextSecondary))
1616 .fixedSize(horizontal: false, vertical: true)
@@ -29,6 +29,7 @@ struct PaywallView: View {
2929 Section("What Pro+ Unlocks") {
3030 featureRow("Shared portfolios")
3131 featureRow("Unlimited audit sessions")
32 featureRow("Intelligence detail")
3233 }
3334
3435 Section("Subscription") {
DomainDigTests/FeatureAccessTests.swift +13 −1
@@ -58,6 +58,7 @@ final class FeatureAccessTests: XCTestCase {
5858
5959 XCTAssertFalse(pro.capabilities.contains(.sharedPortfolios))
6060 XCTAssertFalse(pro.capabilities.contains(.auditDepth))
61 XCTAssertFalse(pro.capabilities.contains(.intelligenceDetail))
6162 }
6263
6364 func testProLiftsTheAllowances() {
@@ -71,11 +72,22 @@ final class FeatureAccessTests: XCTestCase {
7172
7273 // MARK: Pro+
7374
74 func testProPlusAddsSharedPortfoliosAndAuditDepth() {
75 func testProPlusAddsSharedPortfoliosAuditDepthAndIntelligence() {
7576 let proPlus = FeatureAccessService.entitlements(for: .proPlus)
7677
7778 XCTAssertTrue(proPlus.capabilities.contains(.sharedPortfolios))
7879 XCTAssertTrue(proPlus.capabilities.contains(.auditDepth))
80 XCTAssertTrue(proPlus.capabilities.contains(.intelligenceDetail))
81 }
82
83 /// The intelligence breakdown was gated by a bare `currentTier != .proPlus`
84 /// in two view bodies, which no audit of the capability table could see. It
85 /// is a capability now so the table, the paywall and `enabledFeatureLabels`
86 /// all agree, and so a test like this one can exist at all.
87 func testIntelligenceDetailIsAProPlusCapability() {
88 XCTAssertFalse(FeatureAccessService.entitlements(for: .free).capabilities.contains(.intelligenceDetail))
89 XCTAssertFalse(FeatureAccessService.entitlements(for: .pro).capabilities.contains(.intelligenceDetail))
90 XCTAssertTrue(FeatureAccessService.entitlements(for: .proPlus).capabilities.contains(.intelligenceDetail))
7991 }
8092
8193 /// The finding this table replaces: Pro+ cost twice Pro and its only