Closed Bug 1954190 Opened 1 year ago Closed 1 year ago

Ensure Remote Settings for granular overrides supports target filters

Categories

(Core :: Privacy: Anti-Tracking, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
139 Branch
Tracking Status
firefox139 --- fixed

People

(Reporter: tjr, Assigned: fklc)

References

Details

Attachments

(1 external file)

We need to ensure that target filters work for the granular overrides Remote Settings bucket so we can write rules that target only certain versions of Firefox so we can e.g. disable a target for a certain Firefox version, but stop disabling it once we fix it.

Blocks: fpp2

I tried running the following on both desktop and android and it works

const { RemoteSettings } = ChromeUtils.importESModule("resource://services-settings/remote-settings.sys.mjs")
const client = RemoteSettings("a-key");

FILTER_TO_TEST = `
    env.version|versionCompare("110.0a1")
`;

(
  async function () {
    await client.db.clear();
    await client.db.importChanges({}, 42);

    const record = await client.db.create({
      id: "68b19efa-1067-401b-b1c1-8d7b4263bb86",  // random uuidgen
      filter_expression: FILTER_TO_TEST
    });

    const filtered = await client.get();
    console.log(filtered.length == 1);
  }
)();

I also tried if we can filter by build ID, but it looks like it isn't possible. You can't do env.appinfo.platformBuildID > X, only string operations.

So if I understand it correctly, the answer is yes, we can use filter expressions. We just need to modify the schema to add filter_expression field, and add desired version checks. Do note though, we won't be able to target builds after a certain date.

I'm not concerned about targeting specific buildids. This is intended for release where we would be targeting full releases (e.g. <=131.0 with one rule and > 131.0 with another).

just need to modify the schema to add filter_expression field, and add desired version checks aligns with what I thought we had to do, so that's good.

Turns out just changing the table schema was not enough :) We also had to call .get instead of depending on raw data from sync event.

Pushed by fkilic@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/459f08ecce07 Test remote settings filters work for FPP. r=tjr

Hmm sure I'll look into it. Thank you!

Flags: needinfo?(fkilic)
Pushed by fkilic@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/61b4482e79d4 Test remote settings filters work for FPP. r=tjr
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 139 Branch
QA Whiteboard: [qa-triage-done-c140/b139]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: