Skip to content

refactor(ads-client): unified ads type - #7629

Merged
Almaju merged 1 commit into
mozilla:mainfrom
Almaju:AC-188-ads-type
Sep 25, 2026
Merged

Almaju merged 1 commit into
mozilla:mainfrom
Almaju:AC-188-ads-type

Conversation

@Almaju

@Almaju Almaju commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Create some Ads type to encapsulate both types from MARS and AdsStore.

Pull Request checklist

  • Breaking changes: This PR follows our breaking change policy
    • This PR follows the breaking change policy:
      • This PR has no breaking API changes, or
      • There are corresponding PRs for our consumer applications that resolve the breaking changes and have been approved
  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGELOG.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due diligence applied in selecting them.

@Almaju
Almaju marked this pull request as ready for review September 25, 2026 16:12
@Almaju
Almaju requested a review from a team as a code owner September 25, 2026 16:12
@Almaju
Almaju requested review from copyrighthero and removed request for a team September 25, 2026 16:12
…AC-188)

The ad store kept one ad per placement in StorableAd, and the request
queue landed its own Ads enum for fetch_ads_mixed, so the crate had
three ways to hold a placement's ads. There is now one:

    pub enum Ads {
        Images(Vec<AdImage>),
        Spocs(Vec<AdSpoc>),
        Tiles(Vec<AdTile>),
    }

- The store's store_ad and lookup take and return Ads, so a placement
  keeps every ad it was served.
- fetch_ads_mixed returns HashMap<PlacementId, Ads>, ready to store.
- ads.rs holds Ads, PlacementId and the ad structs (AdImage, AdSpoc,
  AdTile and their callback, cap and ranking fields), moved out of
  mars/ad_response.rs and ads_store.rs. It is always compiled because
  the legacy path uses the structs; Ads and PlacementId stay behind the
  stateful feature.
- Store tests reuse the shared image and spoc fixtures from test_utils.
@Almaju
Almaju added this pull request to the merge queue Sep 25, 2026
Merged via the queue into mozilla:main with commit 7f0fd92 Sep 25, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants