Skip to content

Commit 73eba85

Browse files
feat(nimbus): Use lax Gecko pref validation in FmlClient (#15091)
Beacuse: - Fenix is adding support for settings prefs in Gecko; - there was a now-invalid manifest published in v149; - nimbus-cli now requires enforces stricter validation around gecko prefs unless `--lax-gecko-pref-validation` is passed; and - similarily, the `FmlClient` will perform the same validation unless disabled via the loader config this commit: - updates application-services to the latest nightly; - runs nimbus-cli with `--lax-gecko-pref-validation`; and - updates our FmlClient to use lax Gecko pref validation as well. Fixes #15073
1 parent cb647a1 commit 73eba85

File tree

6 files changed

+20
-24
lines changed

6 files changed

+20
-24
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
APPLICATION_SERVICES_BUILD_ID=151.20260328050234
1+
APPLICATION_SERVICES_BUILD_ID=151.20260330183750

experimenter/experimenter/features/manifests/nimbus_fml_loader.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing import Optional
55

66
from django.conf import settings
7-
from nimbus_megazord.fml import FmlClient, FmlError
7+
from nimbus_megazord.fml import FmlClient, FmlError, FmlLoaderConfig
88

99
from experimenter.experiments.constants import NimbusConstants
1010
from experimenter.experiments.models import NimbusFeatureVersion
@@ -66,9 +66,16 @@ def fml_client(self, version: Optional[NimbusFeatureVersion] = None) -> FmlClien
6666
@staticmethod
6767
def get_fml_client_uncached(file_path: Path, channel: str) -> FmlClient:
6868
try:
69-
return FmlClient(
69+
# TODO(15100): Remove lax gecko pref validation
70+
return FmlClient.new_with_config(
7071
str(file_path),
7172
channel,
73+
FmlLoaderConfig(
74+
cache=None,
75+
refs={},
76+
ref_files=[],
77+
lax_gecko_pref_validation=True,
78+
),
7279
)
7380
except FmlError:
7481
logger.exception(

experimenter/experimenter/features/tests/fixtures/fml/versioned_features/fenix/v119.0.0/release.fml.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,6 @@ about:
55
channels:
66
- release
77
features:
8-
cookie-banners:
9-
description: Features for cookie banner handling.
10-
variables:
11-
sections-enabled:
12-
description: This property provides a lookup table of whether or not the given section should be enabled.
13-
type: "Map<CookieBannersSection, Int>"
14-
default:
15-
dialog-re-engage-time: 4
16-
feature-setting-value: 0
17-
feature-setting-value-pbm: 0
18-
feature-ui: 0
198
extensions-process:
209
description: A feature to rollout the extensions process.
2110
variables:

experimenter/experimenter/features/tests/test_nimbus_fml_loader.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,8 @@ def test_intiate_new_fml_loader_app_and_channel_do_not_exist(self):
5151
self.assertIsNone(loader.application)
5252
self.assertIsNone(loader.channel)
5353

54-
@patch(
55-
"nimbus_megazord.fml.FmlClient.__init__",
56-
)
5754
@mock_fml_versioned_features
58-
def test_create_fml_client(self, new_client):
59-
new_client.return_value = None
55+
def test_create_fml_client(self):
6056
application = "fenix"
6157
channel = "release"
6258
version = "119.0.0"
@@ -70,10 +66,10 @@ def test_create_fml_client(self, new_client):
7066
/ f"{channel}.fml.yaml"
7167
)
7268

73-
client = loader.fml_client(version=version)
69+
self.assertEqual(loader.file_path(version), expected_path)
70+
71+
client = loader.fml_client(version)
7472
self.assertIsNotNone(client)
75-
new_client.assert_called()
76-
new_client.assert_called_with(str(expected_path), channel)
7773

7874
@mock_fml_features
7975
def test_get_local_file_path_no_version(self):
@@ -215,7 +211,7 @@ def test_return_no_errors_for_invalid_application(
215211
self.assertIn("Nimbus FML Loader: Invalid application", log.output[0])
216212

217213
@patch(
218-
"nimbus_megazord.fml.FmlClient.__init__",
214+
"nimbus_megazord.fml.FmlClient.new_with_config",
219215
side_effect=FmlError("gecko-pref and default are mutually exclusive"),
220216
)
221217
@mock_fml_features
@@ -230,7 +226,7 @@ def test_fml_client_returns_none_when_manifest_fails_to_parse(self, _mock_client
230226
)
231227

232228
@patch(
233-
"nimbus_megazord.fml.FmlClient.__init__",
229+
"nimbus_megazord.fml.FmlClient.new_with_config",
234230
side_effect=FmlError("gecko-pref and default are mutually exclusive"),
235231
)
236232
@mock_fml_features

experimenter/manifesttool/nimbus_cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def download_single_file(
9090
"fml",
9191
"--",
9292
"single-file",
93+
"--lax-gecko-pref-validation",
9394
"--channel",
9495
channel,
9596
*_repo_path_cli_args(app_config.repo, ref, fml_path),
@@ -110,6 +111,7 @@ def generate_experimenter_yaml(
110111
"fml",
111112
"--",
112113
"generate-experimenter",
114+
"--lax-gecko-pref-validation",
113115
str(_get_fml_path(manifest_dir, app_config, channel, version)),
114116
str(_get_experimenter_yaml_path(manifest_dir, app_config, version)),
115117
],

experimenter/manifesttool/tests/test_nimbus_cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def test_download_single_file(self, repo_type, version, fml_path):
124124
"fml",
125125
"--",
126126
"single-file",
127+
"--lax-gecko-pref-validation",
127128
"--channel",
128129
"channel",
129130
*(
@@ -172,6 +173,7 @@ def test_generate_experimenter_yaml(
172173
"fml",
173174
"--",
174175
"generate-experimenter",
176+
"--lax-gecko-pref-validation",
175177
str(manifest_dir / fml_path),
176178
str(manifest_dir / experimenter_yaml_path),
177179
],

0 commit comments

Comments
 (0)