Closed Bug 1983377 Opened 8 months ago Closed 8 months ago

Make one class per realtime suggestion type that serves both opt-in and online suggestions

Categories

(Firefox :: Address Bar, task, P1)

task

Tracking

()

RESOLVED FIXED
144 Branch
Tracking Status
firefox143 --- fixed
firefox144 --- fixed

People

(Reporter: adw, Assigned: adw)

References

Details

(Whiteboard: [sng])

Attachments

(2 files)

The current realtime opt-in implementation in DynamicSuggestions makes it hard to selectively enable certain realtime types. There's a single realtime_opt_in dynamic Rust suggestion type, so its RS records would need to include all realtime types: stocks, sports, etc. In order to selectively choose to enable the stocks opt-in but not the sports opt-in, we'd need to add another pref/Nimbus variable that told Firefox which opt-ins to enable.

It would be nice if we could tell Firefox to enable stocks suggestions, period, and then if the user hasn't opted in yet, Firefox would show the stocks opt in, and then after the user opts in, it would show the online stocks suggestions. We could do that if we had one SuggestProvider per realtime type. Then we'd have all the usual foo.featureGate and suggest.foo prefs too.

This adds a new RealtimeSuggestProvider that is a base class for handling both
opt-in and online suggestions for a given realtime type. The idea is that each
time we add a new realtime type, we only need to subclass this new class, set
the appropriate realtimeType, and implement the dynamic view update stuff. The
base class automatically handles a bunch of things: the opt-in suggestion,
engagements, whether the feature should be enabled, and creating urlbar results.
Hopefully as we implement more realtime types, we can find opportunities for
doing more of the dynamic view updates in the base class rather than the
subclasses.

Depends on D261320

Blocks: 1982565
Pushed by dwillcoxon@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/6e4557f50f94 https://hg.mozilla.org/integration/autoland/rev/fa40fc577295 Make one class per realtime suggestion type that serves both opt-in and online suggestions. r=daisuke
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 144 Branch

This adds a new RealtimeSuggestProvider that is a base class for handling both
opt-in and online suggestions for a given realtime type. The idea is that each
time we add a new realtime type, we only need to subclass this new class, set
the appropriate realtimeType, and implement the dynamic view update stuff. The
base class automatically handles a bunch of things: the opt-in suggestion,
engagements, whether the feature should be enabled, and creating urlbar results.
Hopefully as we implement more realtime types, we can find opportunities for
doing more of the dynamic view updates in the base class rather than the
subclasses.

Original Revision: https://phabricator.services.mozilla.com/D261321

Attachment #9508000 - Flags: approval-mozilla-beta?

firefox-beta Uplift Approval Request

  • User impact if declined: This is required for the "carrots" realtime-suggestions Suggest feature in 143.
  • Code covered by automated testing: yes
  • Fix verified in Nightly: no
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing: none
  • Risk associated with taking this patch: low
  • Explanation of risk level: This is some refactoring that only affects experimental Suggest features.
  • String changes made/needed: none
  • Is Android affected?: no
Attachment #9508000 - Attachment is obsolete: true
Attachment #9508000 - Flags: approval-mozilla-beta?
Attachment #9508000 - Attachment is obsolete: false
Attachment #9508000 - Flags: approval-mozilla-beta+
QA Whiteboard: [search] [qa-triage-done-c144/b143]

Hi Valentin, FYI this bug changed how market suggestions are enabled, both the opt-in suggestion and online suggestions.

  • For both suggestion types, you'll now need to set:
    • browser.urlbar.market.featureGate = true
    • browser.urlbar.suggest.quicksuggest.nonsponsored = true
  • For the opt-in suggestion, please don't set browser.urlbar.quicksuggest.dynamicSuggestionTypes anymore, and reset it if you have a profile where you already set it (and this pref is not required for online suggestions)

We plan to follow this pattern for each new carrots/realtime type (Yelp, sports, etc.). So we'll have a featureGate pref, you don't need to set browser.urlbar.quicksuggest.dynamicSuggestionTypes, and you'll need to set the appropriate nonsponsored or sponsored pref.

In addition, the opt-in suggestion's RS record changed slightly. The suggestion_type should now be market instead of realtime_opt_in. We uploaded a new record to the dev server but I don't believe there's a record on stage or prod yet.

Flags: needinfo?(vbandac)

I can confirm that the Opt-in Section and the market suggestions are correctly enabled and displayed using the configuration mentioned in Comment 7, on the Dev server.
Tested on Latest Firefox Nightly 144.0a1 (Build ID: 20250821091952), on Windows 10 x64, Ubuntu 24.04 LTS and macOS 15.6.

Flags: needinfo?(vbandac)
Regressions: 1985956
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: