-
Notifications
You must be signed in to change notification settings - Fork 279
Bug 2062665 - Surface new suggestion_id field in suggest component #7554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mashalifshin
wants to merge
4
commits into
main
Choose a base branch
from
spons-177-surface-suggestion-ids-in-as-suggest-component
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
49db9e2
Bug 2062665 - Surface new suggestion_id field in suggest component
mashalifshin 31954d9
Update CHANGELOG.md with PR link
mashalifshin bdeebee
Fix wrong CHANGELOG.md comment and make more concise
mashalifshin 5a011ab
Emit an error when invalid attachments are ignored
mashalifshin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,7 @@ pub enum Suggestion { | |
| raw_click_url: String, | ||
| score: f64, | ||
| fts_match_info: Option<FtsMatchInfo>, | ||
| suggestion_id: String, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above as to whether we think this should be an Option or not
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need, we can/should expect suggestions to have IDs now. |
||
| }, | ||
| Wikipedia { | ||
| title: String, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we already forwarding this to all users? If not this will probably need to be an Option to avoid a deserialization error if a client doesn't receive a
suggestion_idThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To add to this (and I'm not entirely sure how this interacts with remote settings so forgive me if this doesn't apply) but if a user had really old RS artifacts still loaded for some reason (or an old enough version of FF that they are using the legacy RS collection) would this break things if suggestion_id is required?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My rust is very basic so I got some questions about this to Claude.
The problem is serialization errors are swallowed entirely:
match serde_json::from_slice::<SuggestAttachment<T>>(&attachment_data) { Ok(attachment) => ingestion_handler(dao, &record.id, attachment.suggestions()), // If the attachment doesn't match our expected schema, just skip it. It's possible // that we're using an older version. If so, we'll get the data when we re-ingest // after updating the schema. Err(_) => Ok(()), }An attachment is a JSON array of thousands of suggestions, so a single record missing suggestion_id causes the entire attachment to be dropped — no error, no log, no metric. The user just silently gets zero sponsored suggestions for that region/form-factor.
Instead of using Option is recommends using #[serde(default)].
The cost of an issue is a silent, total loss of sponsored suggestions with no telemetry to detect it. It also protects against a mars rollback and against stale non-prod collections. Importantly, #[serde(default)] keeps the Rust type as String and leaves the public API exactly as this PR has it — so unlike switching to Option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for flagging this! It's really good to think through. I think it is okay to have it required but you let me know if the following makes sense. Being required is an important property since this is load-bearing billing telemetry, if we don't do it this iteration, we'll have to come back in again and do it later. And I think leaving it required is low risk.
The field has been populated in production for about a month, and Claude can check that it hasn't been missing in any payload -- the deserialization risk happens if some records lack the field. In this case the client would only lack sponsored suggestions until the next resync, which Claude tells me happens about daily for active clients, and client that are dormant refresh when they start up again. And afaict the way the migrations work with the
clear_database()call, it forces a fresh re-ingestion.Please see if you can confirm, I'm new to rust, also relying on Claude. (Side question: Are our Claudes just talking to each other and are we vibe coding too close to the sun?)
Today I'll post the PR for review by disco team
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using Claude on Claude is still useful. The questions we ask are different and that is where the real value comes from is as it triggers different paths within Claude. Its like having a Claude with multiple personalities (that never ends well in the movies though!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems okay to me as-is assuming that a) serialization errors cause records to be skipped rather than errors to be thrown and b) The production RS data has had this field for about a month. In that case, there's not really a risk of "total loss of sponsored suggestions". I think the only effect is that users who have extremely stale data in the RS cache and who can't download new data won't see the stale suggestions.
I do agree that silently ignoring the errors feels wrong. You could consider adding an
error_support::report_error!call to this PR or filing a issue.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with bendk, this should be fine, i.e., no need to make this an
Option. IIRC we typically don't worry about outdated RS data being ingested by updated clients. It looks like the suggestions in thequicksuggest-ampcollection already includesuggestion_idand probably have for some time I imagine?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the
suggestion_ids have been included in the prod RS collection since MARS deploy on 7/22/2026, so almost a month now. From what you're both saying that sounds like a sufficient amount of time.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's also a good chance we wouldn't have gotten paid for many of those suggestions even if we were able to show them anyway, since those ad campaigns have probably ended by now...so just piling on reasons that this is probably okay to ship as required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, agreed, the whole point of having it required is to fail loudly and early when it's missing, so that feels incomplete without an error. I'll take a swing at implementing this