Skip to content

[AC-154] Adds basic nimbus flag building to ads-client - #7551

Open
thesuzerain wants to merge 3 commits into
mainfrom
ads-client-adds-nimbus-flags
Open

[AC-154] Adds basic nimbus flag building to ads-client#7551
thesuzerain wants to merge 3 commits into
mainfrom
ads-client-adds-nimbus-flags

Conversation

@thesuzerain

@thesuzerain thesuzerain commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Per discussion: We don't currently have the capacity to easily check for nimbus flags in rust components at the moment (though we expect to eventually), but we want to use nimbus to experiment, so we create a small structure to allow the flags to be easily passed from the outer surfaces.

If the set of all flags (or at least all ads-client ones) are passed from the surface, that allows us to read the current set of active experiments in much the same way the surfaces can.

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.

#[derive(Clone, Hash, PartialEq, Eq)]
pub enum NimbusFlag {
// `ads-client.async-enabled`
AsyncEnabled,

@thesuzerain thesuzerain Aug 18, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not used in this PR, obviously, but it will be the first flag we use (and will be used imminently in the other async PR). Just wanted to have an actual example, but if we want to avoid that as it's not used in this PR yet, I can delete.

}
let flags = Arc::new(inner.nimbus_flags.clone().unwrap_or_default());
let inner = Mutex::new(client);
MozAdsClient { inner, flags }

@thesuzerain thesuzerain Aug 18, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense to include at the MozAdsClient level given that it's surface-passed flags, and they may be referenced at this level as well. (if we want an early branch in the FFI layer for example of which of two wholly different internal functions to call- eg: recordimpression sync vs fire-and-forget)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pictured that nimbus flags fully end at this layer actually and they are translated into whatever they actually mean do the client at the time we construct/call the client.

So in the async case this is something like not storing the NimbusFlag.AsyncEnabled, but just constructing either AsyncAdsClient or SyncAdsClient. If they were not as dramatic as needing separate implementations then they could be translated into an option to the AdsClient constructor options.

For other situations like per-request flags they would be translated into some request option and have no reason to ever be stored at all.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think there is a confusion, MozAdsClient and AdsClient are the same. MozAdsClient is only the uniffi version of it that encapsulate surface API for better tracking of breacking changes but it should not hold any feature so flags should go to AdsClient struct.

@thesuzerain
thesuzerain marked this pull request as ready for review August 18, 2026 15:57
@thesuzerain
thesuzerain requested a review from a team as a code owner August 18, 2026 15:57
@thesuzerain
thesuzerain requested review from Almaju and justindarc and removed request for a team August 18, 2026 15:57
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.

3 participants