Make the intelligence gate a named capability !12

merged merged by cmc on 2026-10-24 05:44 UTC · krz/domain-dig:intelligence-capability into main

Discussion

cmc

Closes P5. Reads as a pair with !11, whose body says the intelligence gate was out of scope — it was, at the time, and this is the follow-up. Anyone reading !11 alone would conclude the gate is still a bare tier check.

The intelligence breakdown was hidden behind FeatureAccessService.currentTier != .proPlus in two view bodies (ContentView, HistoryView). A tier comparison in a view's argument list has four properties that matter: it appears in no search for hasAccess(to:), in no part of the capability table, on no paywall list, and in no test. That is why it survived a full-codebase review, a nine-decision pass over the tier model, and !11's dedicated capability sweep. It surfaced only because its placeholder copy sat three lines from one being deleted.

It stays Pro+

Unlike pricing and reputation the data is real and renders. Unlike the ownership and DNS history derivations it is substantive: inferred provider with evidence, classification with reasons, risk signals, ownership and hosting transitions, subdomain intelligence, and an inferred timeline — seven blocks.

The free tier is not shut out of the analysis. RiskSummaryCardView and InsightsSummaryCardView are ungated, so every tier sees the computed risk score and the insight list; Pro+ sees the working behind them. That ladder is why D1's "locally derived means free" reasoning does not transfer here: what made the five capabilities dishonest was being sold as external intelligence while returning nothing, not being computed on device.

As intelligenceDetail it now reaches the tier table, both upgrade-message groups, the paywall and enabledFeatureLabels() — and can be asserted on.

Also

Removes what !11's reputation deletion orphaned. scoreReputation opened with guard let reputation = snapshot.reputation else { return }, which can no longer pass, so the function, its call site and the dead "flagged by a configured reputation source" insight are gone. DomainInsightEngine no longer references reputation at all. Per the repo's own rule, orphans created by a change belong to that change.

Verified

  • 142 tests, 0 failures on iPhone 16 (iOS 18.6) and iPhone Air (iOS 27.0).
  • Mutation-checked: granting Pro .intelligenceDetail fails testIntelligenceDetailIsAProPlusCapability and testProDoesNotIncludeTheProPlusCapabilities, and nothing else. A red step is not available for a table change — adding an enum case breaks an exhaustiveness switch, so the run fails to compile rather than failing an assertion, which proves nothing about whether the tests discriminate.

Worth a rule

Entitlement decisions belong in FeatureAccessService and nowhere else. The grep that catches a recurrence is currentTier == or currentTier != outside that file; it is currently clean. Finding A9's re-enabled quality gates could enforce it mechanically.

cmc 2026-10-24 05:45 UTC

Correction to this MR's body: it claims the currentTier ==/!= grep outside FeatureAccessService "is currently clean". I asserted that without running it, and it is not true. Running it now returns three hits:

  • PremiumAccessService.swift:11 — currentTier != .free standing in for unlimitedTrackedDomains. A real entitlement decision outside FeatureAccessService, in the pass-through shim that finding A5 slates for deletion. The rule this MR proposes should take it out with the shim.
  • SettingsViews.swift:20 and RootTabView.swift:37 — currentTier == .free choosing what to display (an upgrade row, the initial tab). Presentational rather than permission, so outside the rule as stated, though both would read better against a capability.

The rule itself stands and so does everything else verified here; only the "currently clean" claim was wrong.