Skip to content

[AC-144] Initial implementation of impression capping in MAC - #7465

Draft
jonesetc wants to merge 59 commits into
mozilla:mainfrom
jonesetc:ac-144-impression-capping
Draft

[AC-144] Initial implementation of impression capping in MAC#7465
jonesetc wants to merge 59 commits into
mozilla:mainfrom
jonesetc:ac-144-impression-capping

Conversation

@jonesetc

@jonesetc jonesetc commented Jul 7, 2026

Copy link
Copy Markdown
Member

Initial implementation of opt-in impression capping.

Telemetry:

  • failure to create connection to backing data store
  • failure to perform operations with backing data store (record, count, retain)
  • impression cap hit
  • impression cap enforced or ignored

There should be no breaking changes as there is only a new option added to FFI functions, but there has been a new optional param added to native rust interface.

Documentation still needs to be updated.

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.

@jonesetc
jonesetc force-pushed the ac-144-impression-capping branch from 5b803ae to 39a27bb Compare July 7, 2026 18:01
@jonesetc
jonesetc force-pushed the ac-144-impression-capping branch from 39a27bb to afa38e4 Compare July 7, 2026 18:09
bendk and others added 25 commits August 12, 2026 10:55
I'm working on a new UniFFI parser
(mozilla/uniffi-rs#2841) and it currently
requires that types used in the exported functions are publicly
available from other crates.

I could maybe rework the parser to handle this another way, but this
feels cleaner to me anyways.  It feels weird if a type can be used by
foreign languages but not other Rust crates.
…ro. (mozilla#7464)

Seeing mozilla#7439 fly past reminded me that I was intending to try and remove the
BridgedEngine entirely - this doesn't quite achieve that, but does get closer.
Moved the code to RetryingAccount, which should give us this
functionality for free.

Also, tweaked the fxa-client example a bit.
Current behaviour is to update an existing record with the same id.
Before it was named `httpconfig` for historical reasons, this one seems
more natural.
…ozilla#7469)

Nowadays we're using the Rust error ping which is handled internally in
the Kotlin module.  We no longer need to forward these events for
recording in sentry.  The android side of this was removed in
https://bugzilla.mozilla.org/show_bug.cgi?id=1991443.
I believe this should fix our `cargo audit` CI failures.
to avoid leaks from foreign providers of the encryptor decryptor trait.
* doc: Adding details to out of date documentation for building application services

* fix: review and glean_sym step added

* Update docs/building.md

Co-authored-by: bendk <bdk@mozilla.com>

---------

Co-authored-by: bendk <bdk@mozilla.com>
The `nimbsus_events.unenrollment` metric is supposed to contain the
reason field, but it just hasn't been reported.

Additionally, this removes "is_rollout" field from the
`nimbus_events.enrollment` metric as (a) that data is not already
reported, (b) the data is not already available on the
`EnrollmentChangeEvent` (and adding it would be a breaking change), and
(c) the field is not all that useful.
…pes (mozilla#7475)

* RMST-464: remote-settings: Skip verification of unknown signatures types

* Update changelog

* Add missing field in tests
…#7474)

Split up `RemoteSettingServiceInner` into multiple structs, each with
their own Mutex and add a bit of policy around locking them.  Right now
this is just enforced by putting all the methods that lock them in one
impl block.

The issue we're trying to avoid is having `RemoteSettingService::sync`
block `RemoteSettingService::make_client`.

Also, start using `viaduct::Client` which should be possible now since
all applications are using the new backend.
…la#7481)

When queried for the list of all available Firefox Labs, the Nimbus
Client was not filtering the recipes by whether they passed targeting
and bucketing. This is now the case.

There is now a new function `can_enroll` that returns an enum,
`CanEnrollResult`, that distinguishes all the different cases that
prevent enrollment. The majority of this function was refactored out of
`evaluate_enrollment`, which is now a much simpler function.

Additionally, the `targeting(expr, helper)` function has been removed.
This function took an expression and a `NimbusTargetingHelper` and
returned an `EnrollmentStatus` if and only if the targeting evaluation
did not succeed or resulted in an error. This API was too awkward to
work into `can_enroll`. The majority of this change is test fallout from
removing this function, though the tests make more sense now that they
are testing the results of JEXL evaluation and not comparing
`EnrollmentStatus`es.

In order to remove a bunch of unnecessary clones, the
`NimbusTargetingHelper` methods now take a `&str` instead of a `String`.
The UDL has been updated to use `[ByRef]` so that the FFI contract is
unchanged.
You will probably never do that in a "real" browser window,
so make it a little clearer about the expected use.
For the run_maintenance_optimize background task, we add the 0x10000 flag in addition to the default 0x12. This causes optimization of all tables even if they were never queried by the provided connection. This fixes a rare scenario where Firefox for Android can get stuck with incorrect table stats on the moz_origins table, leading to poor address bar autocomplete performance.

For the Drop implementation on PlacesDb, we add the now-default flag 0x10, which previously didn't exist, and was being explicitly overridden in the current implementation. This adds a row limit on analyze which can help to prevent poor shutdown performance, matching the change made in the fix for bug 2017227.

Co-authored-by: Mark Hammond <mhammond@skippinet.com.au>
…on (mozilla#7490)

The connection is otherwise only closed when the Store is dropped, which on
Firefox Desktop happens during GC at shutdown -- past the late-write barrier,
so the flush crashes debug builds.

Wrap the connection in Mutex<Option<AutofillDb>> behind a fallible lock_db()
helper (mirroring LoginStore); shutdown() closes it early, and later operations
return DatabaseClosed.
Most other components are on proc-macros and most UniFFI development is
happening with proc-macros.

I checked the generated code and the only differences I could see is
were in the comment and I liked the newer versions better.  However,
it's likely I'm missing something and there will be some unintinded
breaking changes. We just started the nightly cycle, so this seems like
a good time to switch over.
alexcottner and others added 30 commits August 12, 2026 10:55
…ozilla#7492)

* RMST-472 - Make remote-settings v2 routes the default going forward

* upating changelog
…zilla#7508)

* Only build `glean-sym` on Android and iOS

* Use android-components publish.gradle for app-services components
… and `libsForTests` publication (mozilla#7509)

* Only build `glean-sym` on Android and iOS

* Use android-components publish.gradle for app-services components

* Package `libmegazord.so` into full-megazord AAR with NSS dependencies and `libsForTests` publication
…s components (mozilla#7510)

* Only build `glean-sym` on Android and iOS

* Use android-components publish.gradle for app-services components

* Package `libmegazord.so` into full-megazord AAR with NSS dependencies and `libsForTests` publication

* Remove unused `error_support` macro re-exports in application-services components
…ds (mozilla#7511)

* Only build `glean-sym` on Android and iOS

* Use android-components publish.gradle for app-services components

* Package `libmegazord.so` into full-megazord AAR with NSS dependencies and `libsForTests` publication

* Remove unused `error_support` macro re-exports in application-services components

* Skip the `kotlin-android` plugin under AGP 9 for mozilla-central builds
… append v2 (mozilla#7517)

* Bug 2058816 - updating get_base_url and get_url in remote_settings config to append v2 instead of v1 for custom url's

* Updating remote_settings unit tests

* updating search and nimbus-cli refs
PR mozilla#7508 hardcoded `"org.mozilla.appservices"`, dropping the `.nightly` suffix
on nightly builds. To fix, we add `appServicesGroupId` to resolve the proper
`groupId` based on the context (`mozilla-central` or standalone
`application-services`).

`configurePublish`'s parameters were also being shadowed in `publish.gradle`,
which this resolves too.
…mozilla#7518)

* feat(remote-settings): RMST-484: verify signatures with sync_if_empty

* Update changelog
…7487)

* test: Adds new python smoke tests for building against iOS; fenix

* test: Adds scheme, tests

* fix: Modularization and missing xcframework change

* fix: linting

* fix: Lints, docs

* fix: Adds deprecation notes

* fix: Adds regex for fenix + docs

* fix: Clarifies a todo

* fix: missed err_msg change

* feat: Adds HNT tests, fixes some review issues

* fix: Some missing docs

* fix: Small edits

* fix: adds hnt test

* fix: Build against all

* fix: Small log correction

* fix: some doc changes

* fix: some readme linting

* fix clarifies HNT acronym
…ozilla#7523)

* fix(remote-settings): Do not quote timestamps with v2 API

* Update CHANGELOG
For some reason the JSON stopped working when imported.  Adding an extra
`datasource` field fixes this.
…lla#7513)

Firefox Desktop is moving its address storage to this component and needs two
things that are not currently exposed.

Storage APIs for importing records already persisted elsewhere -
add_address_with_meta, add_many_addresses_with_meta, update_address_with_meta
and add_many_address_tombstones - taking a caller-supplied guid, timestamps and
change counter. The bulk variants run each record in a savepoint so one bad
record neither aborts the migration nor leaves a row behind. Carrying the change
counter means update_internal_address now takes a CounterUpdate of Increment,
Leave or Set(i64).

A bridged sync engine, so Desktop's Sync framework can drive address sync:
Store::addresses_bridged_engine() exposes the address engine the crate already
has, which only implemented sync15::SyncEngine and so was unreachable from
Desktop's mozIBridgedSyncEngine.

Nothing on mobile calls any of this; it is additive for the Desktop migration.
…enabled. (mozilla#7527)

Bug 2054009 added a dependency from viaduct to rusqlite, which broke
the nimbus-fml toolchain build because it doesn't have the
x86_64-linux-musl-gcc compiler.

viaduct doesn't actually need to link to sqlite outside the ohttp
feature, so properly encode that in its Cargo.toml.

Because nimbus-fml doesn't enable viaduct's ohttp feature, it won't try
to link to sqlite anymore.
* feat: Adds ads-client shutdown for sqlite and telemetry

* fix: small note

* fix: fixes clippy

* fix: Adds changelog.md update

* feat: Adds mutexes from review

* test: vendoring with telemetry removal disabled

* test: Trying vendoring with Drop

* test: remove dro

* fix: doc updates

* fix: Adds a comment

* fix: switches to RwLock, switches to Option

* fix: reorders calls, fixes changelog
I like the symmetry with `S` for `FxaState`.
A while back we purposely misspelled "Auth" as "Ath" to get around the
Sentry redaction rules.  Now that we're using the error ping and Grafana
we don't need this anymore.
There's no need or use-case for syncs queuing up. Any "immediate" requests
are time-sensitive, and the chance of a conflict is small.
Changed the `trace!` into a `breadcrumb!`.  This way when we see errors
we can know which URL it was from.  I noticed a few in the last week and
knowing the URL would have been very helpful.
Bug 2048396 removed the sync of moz.build files when vendoring
application services into the Firefox tree.

As pointed out by phabricator.services.mozilla.com/D298757#10668401,
keeping them here is potentially confusing and I ended up confused
indeed, so let's remove them as suggested.
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.