Skip to content

Refactor duplicated verifiables scope overrides back to generic ReplicableModel implementation

Problem

Currently, several Geo replicable models have nearly identical verifiables scope overrides that differ from the generic scope in ReplicableModel only in parameter handling. This creates code duplication and maintenance overhead, which are necessary for progressing the selective sync scope work.

Current State

  • Multiple replicable models override the verifiables scope with similar implementations
  • The overrides were introduced to fix query performance issues where unbounded queries were retrieving all project_ids from the database instead of limiting to a maximum of 10,000 records
  • The parameter differences are needed to properly scope the replicable_project_ids in the selective_sync_scope

Proposed Solution

Once all replicable models have been updated with the necessary parameter fixes as part of the selective sync scope epic, refactor the duplicated code back to the generic ReplicableModel implementation.

This would:

  • Eliminate code duplication across multiple replicable models
  • Centralize the logic in the appropriate base class
  • Maintain the performance improvements while reducing maintenance overhead
  • Ensure consistent behavior across all replicable models

Context

This refactoring was deferred from MR !208207 (merged) to keep that MR focused and smaller. The current approach was chosen to fix performance issues in specific models without touching every replicable model at once.

Acceptance Criteria

  • Remove duplicated verifiables scope overrides from individual replicable models
  • Update the generic scope in ReplicableModel to handle the parameter requirements
  • Ensure all existing functionality and performance improvements are preserved
  • Verify that all replicable models work correctly with the generic implementation

Reference

!208207 (comment 2809507554)

Edited by Chloe Fons