-
Notifications
You must be signed in to change notification settings - Fork 814
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
[Brave News]: FeedV2Builder refactor #23492
Conversation
0cf9143
to
dbb857e
Compare
This would be help fix brave/brave-browser#36137. We can filter out articles older than X days and confidently sample if a content group runs out of eligible content. Wdyt? I guess we could fix it here or as a follow up |
Lets do it as a followup 😄 I'd like to try and get this merged |
@LorenzoMinto mind taking a look? |
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.
Great refactor. What do you think about renaming FeedGenerationInfo
to FeedGenerator
as otherwise it reads more like a data class, but it's doing quite a bit that it's not just representational.
And also, what do you think about moving the generation functions GenerateBlock
, GenerateCluster/Special/ChannelBlock
etc. to the the generator and passing in the relevant arguments? Right now these are loose functions in feed_v2_builder
@@ -16,6 +16,7 @@ source_set("brave_news_unit_tests") { | |||
"//brave/components/brave_news/browser/direct_feed_controller_unittest.cc", | |||
"//brave/components/brave_news/browser/direct_feed_fetcher_unittest.cc", | |||
"//brave/components/brave_news/browser/feed_building_unittest.cc", | |||
"//brave/components/brave_news/browser/feed_generation_info_unittest.cc", |
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.
nit: How about moving brave_news_unit_tests
target to above components/brave_news_browser/BUILD.gn
?
I think target and its source files should be in the same folder.
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.
dbb857e
to
ca7fb15
Compare
[puLL-Merge] - brave/brave-core@23492 Here is my review of the PR: DescriptionThis PR adds a new ChangesChanges
Overall, the changes look good and well-structured. Encapsulating the feed generation data and logic in the Let me know if you have any other questions! |
@LorenzoMinto & @simonhong thanks for the review
Yeah, I agree the name isn't quite right, but I think
It's on my TODO list, but it's not quite that simple yet, as I'm not 100% sure the best way to set up the generation method from the FeedV2Builder. I'm keen to leave it as is for now until I get the chance to think some more. Mind both having another look? |
ca7fb15
to
e1d6e07
Compare
e1d6e07
to
897ce7a
Compare
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.
++ 👍🏼
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.
++
Resolves brave/brave-browser#38180
This PR refactors the FeedV2Builder to split out a FeedGenerationInfo struct and keep track of the number of articles available in each content group. This allows us to avoid attempting to generate from a ContentGroup with no available articles (which terminates the feed generation).
Additionally, this logic is reused for generating Channel blocks in the feed.
@LorenzoMinto to you remember what the issue for this was?
TODO
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: