Refactor AC-165 [AdsClient] Remove the UnifiedTile wrapper type - #35593
Open
Almaju wants to merge 3 commits into
Open
Refactor AC-165 [AdsClient] Remove the UnifiedTile wrapper type#35593Almaju wants to merge 3 commits into
Almaju wants to merge 3 commits into
Conversation
…HTTP provider Now that the ads client is the only way sponsored tiles are served, remove the vestiges of the previous URLSession-based MARS implementation: - UnifiedAdsProvider: drop the unused `timestamp` parameter (the ads client owns caching now) and the protocol-extension shim that only existed to give it a default value. Also removes the unused private `AdPlacement` request-body struct, a sibling of the `RequestBody` removed in mozilla-mobile#34874. - UnifiedTile: drop `format` and `blockKey` (written, never read), drop the `Decodable` conformances (nothing decodes JSON into these anymore), and drop the unused `name` parameter from `from(name:mozAdsTile:)` — callers passed the placement id but the factory always read `mozAdsTile.name`. - AppDelegate: remove the unused RustAdsClient and MozAdsEnvironment imports. No behavior change. Tests updated mechanically; no assertions changed.
UnifiedTile was a field-for-field copy of MozAdsTile that performed no transformation, and its entire lifetime was a single statement: it was built from a MozAdsTile and immediately converted into a Site. The insulation it appeared to provide was illusory, since any App Services schema change would break UnifiedTile.from all the same. UnifiedAdsProvider now vends [Site] directly, which lets both UnifiedTile and the Site+createSponsoredSite helper go away. MozAdsTile is confined to UnifiedAdsProvider.swift — the one file whose job is talking to the ads client — instead of leaking into TopSitesManager and the test mocks. - UnifiedTileResult -> SponsoredTileResult (Result<[Site], Error>) - TopSitesManager.fetchSponsoredSites() is now a passthrough; the timeout helpers are retyped from [UnifiedTile] to [Site] - MockSponsoredTileData vends [Site] via a shared makeSponsoredSite helper reused by the tests that previously built UnifiedTiles by hand No behavior change. No assertions changed.
… a Site extension UnifiedAdsProvider held a private static makeSponsoredSite(from:) that built a Site out of a MozAdsTile. That is a Site construction detail, not provider logic, so it now sits alongside the existing Site.createSponsoredSite(url:title:siteInfo:) as a second factory overload. The extension lives in the Client module because neither side can reach the other: Site belongs to Storage and MozAdsTile to MozillaAppServices. No behavior change. Tests are unaffected — MockSponsoredTileData builds Site through SponsoredSiteInfo directly and never goes through MozAdsTile.
Almaju
force-pushed
the
ahanot/ads-client-remove-unified-tile
branch
from
September 8, 2026 21:46
e50ce6b to
231f986
Compare
Almaju
force-pushed
the
ahanot/ads-client-remove-unified-tile
branch
from
September 8, 2026 21:59
231f986 to
cd4521b
Compare
Almaju
marked this pull request as ready for review
September 9, 2026 18:18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Tickets
Jira ticket
💡 Description
Three no-op refactors of the sponsored tiles path, now that the ads client is the only tile source:
timestampparam and its protocol shim, the deadAdPlacementstruct, write-onlyUnifiedTilefields,Decodableconformances nothing decodes into, and two unusedAppDelegateimports.UnifiedTile: a field-for-field copy ofMozAdsTilethat was built and immediately turned into aSite.UnifiedAdsProvidernow vends[Site]directly, soMozAdsTilestops leaking intoTopSitesManagerand the test mocks.MozAdsTile→Siteconversion ontoSiteas a factory overload besidecreateSponsoredSite(url:title:siteInfo:). It lives inClientbecauseSiteis Storage andMozAdsTileis MozillaAppServices.No behavior change. No assertions changed.
📝 Checklist