Deprecate RemoteSettingsConfig.server_url in favor of a new, type-safe RemoteSettingsConfig.server#6191
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6191 +/- ##
==========================================
- Coverage 83.96% 83.85% -0.11%
==========================================
Files 117 117
Lines 15651 15671 +20
==========================================
Hits 13141 13141
- Misses 2510 2530 +20 ☔ View full report in Codecov by Sentry. |
6b9baa9 to
2b160fa
Compare
bendk
left a comment
There was a problem hiding this comment.
This change is great.
What's the deprecation plan for server_url? My preference would be to remove it in the near future if possible.
| }), | ||
| server_url: None, | ||
| bucket_name: None, | ||
| collection_name: collection_name.to_string(), |
There was a problem hiding this comment.
What do you think about using ..RemoteSettingsConfig::default() at the end of the struct initialization? It could be a nice way to handle server_url being deprecated and eventually being removed.
There was a problem hiding this comment.
Hmmm, I don't think that'll work, because RemoteSettingsConfig doesn't implement Default. We could have it derive Default, but we don't have a suitable default that we can use for collection_name, since that's the only setting that is required.
I wonder if moving RemoteSettingsConfig to a builder-style API would be a good long-term direction, though?
let b = RemoteSettingsConfig::with_collection_name("quicksuggest".into());
b.server(RemoteSettingsServer::Stage)?.bucket_name("main".into()); // Optional.
let client = b.build();There was a problem hiding this comment.
We could even do that in a backward-compatible way by adding that new API as RemoteSettingsBuilder, deprecating RemoteSettingsConfig, and migrating callers over to RemoteSettingsBuilder.
I'm really liking the builder pattern you added for Suggest!
Same! I think only Fenix and Desktop use it now, so we can migrate it as soon as this PR lands in a nightly, and then remove |
2b160fa to
7999f63
Compare
…ingsConfig.server_url`.
…te `remote_settings_config`.
7999f63 to
5204782
Compare
The
RemoteSettingsConfig.server_urloption has a couple of small pain points for consumers:collectionName: "quicksuggest", even though the collection name is an implementation detail of the Suggest component.This PR tries to make that situation better by:
RemoteSettingsServer, that allows specifying a well-known (Prod,Stage,Dev) orCustomserver.RemoteSettingsServer.serverandSuggestStoreBuilder.remote_settings_server().RemoteSettingsConfig.server_urlandSuggestStoreBuilder.remote_settings_config(). These APIs are still available, but can't be used together with the new APIs—consumers must specify one or the other, or neither (to use the defaultProdserver), but not both.This is the first step to wiring up Fenix's "use Remote Settings {production / stage} server" switch to Suggest (bug 1889495).
Pull Request checklist
[ci full]to the PR title.Branch builds: add
[firefox-android: branch-name]to the PR title.