Organization push rules: execute read operations from `organization_push_rules` table
Implementation plan
We want to execute read operations using the new organization_push_rules table instead of push_rules. We want to introduce a way to redirect existing calls to the Global Push rule (is_sample = true) from the push_rules table to the new organization_push_rules.
To achieve this, we need to perform the following changes:
- Create a FF to control reading operations (i.e.: :read_organization_push_rules).
- Change the entry point for the Global Push rule:
Pseudocode:
class PushRule < ApplicationRecord
  def self.global
    if Feature.enabled?(...)
       OrganizationPushRule.find_by(organization_id: Organizations::Organization::DEFAULT_ORGANIZATION_ID)
    else
      find_by(is_sample: true)
    end
  end- Change the global?method in push_rule.rb to useorganization_push_rules:
Pseudocode:
  def global?
    if Feature.enabled?(...)
      OrganizationPushRule.exists?(organization_id: organization_id)
    else
      is_sample?
    end
  endExpectations
- Both workflows should work as expected. The current behavior should be kept if the FF is off.
- Validate that these are the only places where the Global push rule is called (using the push_rulesandis_sample = true).
- We should create separate issues to rollout and clean up the new FF.
Edited  by Javiera Tapia