docbrown/spec/models
Jeremy Friesen 034ec6e3fe
Introducing the Articles::Feeds configurations (#17314)
**tl;dr** This PR is looking to provide a means to programmatically
assemble, from system configurations, what is currently the
[Articles::Feeds::WeightedQueryStrategy::SCORING_METHOD_CONFIGURATIONS][1].
Once we merge this PR, instead of having that constant, we'll initialize
the Articles::Feeds::WeightedQueryStrategy with the variant
configuration that we've assembled.

**Introduction**

This pull request has quite a bit going on, but as of now the production
code does not use any of it.

*Note: None of this code is bleeding into production code paths.*

Put your Ruby hat on and let's go for a ride.  And apologizes for not
making this a smaller pull request.  As I built this, I made many small
commits, but this became the smallest commit that provided the most
context without integrating into production code.

Before we get started, you may want to familiarize yourself with where
we're going.  The `./app/models/articles/feeds/README.md` provides
further guidance; but fair warning reader, I have not reconciled the
README's language with what emerged as I wrote this pull request.

Those of you who are part of Forem Core team, you can read the
[Refinements to Our Present Feed Configuration][2]
to provide some insight into what's happening.

**Why not reconcile?** *Because I want to have all of the language and
thoughts available for you to help consider how best to name and model
this.*

**On to the Review**

The purpose of this pull request is to provide a mechanism for
engineering to provide a series of variant query levers.  And to allow
us to easily configure those available query levers into a variant
query.

*Why the mix of Ruby configuration and JSON?*

The Ruby levers are meant to indicate that this is code we don't want to
expose in text based configuration because it might create SQL inject
points.  (More on that when we integrate the code of this PR into the
production implementation)

The JSON levers are meant to indicate that "anyone" can pick the
appropriate/available levers and configure how they are set.  In other
words, these values do not create SQL injection issues.

**What I Need from You**

I am putting this forward as a draft so you can read this code ahead of
time.  I'm then going to schedule a synchronous code review where we
record our collective walk through of the implementation.

Closes:

- forem/forem#17268
- forem/forem#17269
- forem/forem#17270
- forem/forem#17271
- forem/forem#17273

Relates to:

- forem/forem#17308
- forem/forem#17245

[1]:6818ef3ed0/app/services/articles/feeds/weighted_query_strategy.rb (L84-L231)
[2]:https://forem.team/jeremy/refinements-to-our-present-feed-configuration-1p0c
2022-04-19 16:51:18 -04:00
..
ahoy [deploy] Rubocop: fix Rails/HasManyOrHasOneDependent for Ahoy::Visit and Badge (#9565) 2020-07-31 11:43:50 -04:00
articles Introducing the Articles::Feeds configurations (#17314) 2022-04-19 16:51:18 -04:00
concerns Remove Elasticsearch ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ (#13606) 2021-05-03 11:09:45 -04:00
settings "Reply to" and "From" Email addresses for SMTP Configurations (#16499) 2022-02-16 16:14:54 +02:00
shared_examples Spelling (#15702) 2021-12-07 06:59:10 -07:00
users Patching ERB rendering of the data-info JSON (#16067) 2022-01-14 08:30:49 -05:00
ab_experiment_spec.rb Let's be friends again, Rubocop (#16294) 2022-01-25 11:58:00 -05:00
admin_menu_spec.rb Remove profile admin feature flag (#17194) 2022-04-11 09:27:35 -05:00
api_secret_spec.rb Limit the Number of API Keys a User Can Have (#7870) 2020-05-15 11:33:02 +02:00
application_record_spec.rb Patching ERB rendering of the data-info JSON (#16067) 2022-01-14 08:30:49 -05:00
article_destroy_spec.rb [deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05:00
article_spec.rb Replace links to the repo with newer URLs (#17319) 2022-04-18 22:11:31 -04:00
async_info_spec.rb Conditional rendering of "Create Post" link (#17076) 2022-04-05 12:47:12 -04:00
audit_log_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
badge_achievement_spec.rb Configure badge credits by admins (#13145) 2021-03-30 10:58:48 +03:00
badge_spec.rb Refactor cache purging (#12811) 2021-03-02 10:09:05 -05:00
banished_user_spec.rb Introduce BanishedUser table (#5589) [deploy] 2020-01-21 17:15:58 -05:00
broadcast_spec.rb Fix Rails/HasManyOrHasOneDependent for Broadcast and Collection (#9662) 2020-08-07 14:27:24 -04:00
collection_spec.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
comment_spec.rb Revert "Added a way to sort comments on an article (#16686)" (#17093) 2022-04-04 08:36:34 -04:00
consumer_app_spec.rb ForemMobile namespaced functions (#15212) 2021-11-23 15:25:29 -06:00
context_notification_spec.rb Context Notifications (#17243) 2022-04-18 10:30:30 +03:00
credit_spec.rb Flaky Spec Fix:Remove let_it_be Test Prof Helper (#9556) 2020-07-29 11:31:01 +02:00
data_update_script_spec.rb Save Data Update Script errors to database and show them on http://localhost:3000/admin/data_update_scripts (#12348) 2021-01-21 14:48:34 +01:00
device_spec.rb Add mutable flag to APNS notifcation payload (#14777) 2021-09-21 15:37:43 -05:00
discussion_lock_spec.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
display_ad_event_spec.rb Extracting constants and tidying tests (#15946) 2022-01-05 09:19:39 -05:00
display_ad_spec.rb Remove organization dependency and improve display ad UX (#14913) 2021-10-05 08:29:08 -04:00
email_authorization_spec.rb Routine Rubocop fixes (#16838) 2022-03-09 09:32:50 -05:00
email_message_spec.rb Delete old retained emails after certain period (#14949) 2021-10-12 16:27:13 -04:00
feedback_message_spec.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
follow_spec.rb Routine Rubocop fixes (#16838) 2022-03-09 09:32:50 -05:00
forem_instance_spec.rb "Reply to" and "From" Email addresses for SMTP Configurations (#16499) 2022-02-16 16:14:54 +02:00
github_issue_spec.rb Implement Unified Embeds for Github Repo, Issue, Pull-Request and Comment URLs (#16422) 2022-02-07 16:38:43 -05:00
github_repo_spec.rb POC: use Sidekiq.perform_bulk for Github repos (#16293) 2022-01-26 09:11:07 +07:00
hair_trigger_spec.rb Bump to Rails 7.0.2.2 MVP (#15908) 2022-03-30 15:00:33 -04:00
html_variant_spec.rb Routine Rubocop fixes (#16838) 2022-03-09 09:32:50 -05:00
html_variant_success_spec.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
html_variant_trial_spec.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
identity_spec.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
listing_category_spec.rb Rubocop: Fix ListingCategory has_many relation to Listing (#9853) 2020-08-19 19:23:49 +02:00
listing_spec.rb Routine Rubocop fixes (#16838) 2022-03-09 09:32:50 -05:00
mention_spec.rb Routine Rubocop fixes (#16838) 2022-03-09 09:32:50 -05:00
navigation_link_spec.rb Create/update by NavigationLink identity (#16312) 2022-01-27 13:51:41 -05:00
note_spec.rb [deploy] Add missing dependent clauses to User and cleanup relations (#10011) 2020-08-28 20:19:24 +02:00
notification_spec.rb Routine Rubocop fixes (#16838) 2022-03-09 09:32:50 -05:00
notification_subscription_spec.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
organization_membership_spec.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
organization_spec.rb Ensuring article's cache updates on org image update (#17052) 2022-04-01 10:54:55 -04:00
page_spec.rb Let override of ToS and CoC show in onboarding (#16217) 2022-01-20 19:45:39 -05:00
page_view_spec.rb Remove UserHistory Feature and PageViews from Algolia (#6127) [deploy] 2020-02-18 10:06:30 -05:00
pinned_article_spec.rb Pin posts to feed (#13807) 2021-06-04 10:54:53 +02:00
podcast_episode_appearance_spec.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
podcast_episode_spec.rb [15 min fix] Fallback to the image URL if Cloudinary/Imgproxy are not configured (#13767) 2021-05-19 15:03:20 +02:00
podcast_ownership_spec.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
podcast_spec.rb Routine Rubocop fixes (#16838) 2022-03-09 09:32:50 -05:00
poll_option_spec.rb Add missing presence validators to models (#10495) 2020-10-01 16:15:32 +02:00
poll_skip_spec.rb Refactoring poll/vote/skip logic (#15441) 2021-11-29 10:52:32 -05:00
poll_spec.rb Refactoring poll/vote/skip logic (#15441) 2021-11-29 10:52:32 -05:00
poll_vote_spec.rb Refactoring poll/vote/skip logic (#15441) 2021-11-29 10:52:32 -05:00
profile_field_group_spec.rb Remove guard clauses and update expectations (#17138) 2022-04-08 15:20:19 -05:00
profile_field_spec.rb Profile attribute names should be unique and non-empty (#16396) 2022-04-04 12:14:02 -05:00
profile_pin_spec.rb Flaky Spec Fix:Remove let_it_be Test Prof Helper (#9556) 2020-07-29 11:31:01 +02:00
profile_spec.rb Profile attribute names should be unique and non-empty (#16396) 2022-04-04 12:14:02 -05:00
rating_vote_spec.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
reaction_spec.rb Don't send notification for invalid reactions (#16721) 2022-02-28 12:36:44 -06:00
response_template_spec.rb Routine Rubocop fixes (#16838) 2022-03-09 09:32:50 -05:00
role_spec.rb ✂✂✂ Remove Connect (#14734) 2021-11-18 08:21:00 -06:00
space_spec.rb Penciling in a Default Spaces section (#16897) 2022-03-21 09:56:12 -04:00
sponsorship_spec.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
tag_adjustment_spec.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
tag_spec.rb Adding indirection for Tag#name to ease future work (#16703) 2022-02-28 16:32:04 -05:00
timeframe_spec.rb Remove timeframer from app/labor (#11782) 2020-12-08 12:52:33 +07:00
tweet_spec.rb Better error upon Tweet embed when Twitter keys missing (#16916) 2022-03-21 16:21:37 -04:00
user_block_spec.rb Fix and refactor hide user content (#12307) 2021-01-18 11:08:23 -05:00
user_role_spec.rb [Search 2.0] Users (#13453) 2021-04-24 19:06:06 +02:00
user_spec.rb Add Data (User Details, Status, etc.) to the Member Index View Columns (#17033) 2022-04-06 11:48:25 -06:00
user_subscription_spec.rb Bump to Rails 7.0.2.2 MVP (#15908) 2022-03-30 15:00:33 -04:00