Algolia index replicas Sorting criteria overriden

Hello,

Currently, in our node app, we have a replica that has a configured ranking according to some fields,

This is the code for that main index

const algoliaConnection = require('../../algolia-connection');
const { ALGOLIA_FILTERS_REPLICAS_ARRAY } = require('../../constants/algolia-indexes');

const listingFilterDefault = algoliaConnection.initIndex('listingFilterDefault');

// Faceting attributes for now they are used for filtering only not grouping so the index is smaller and faster
const attributesForFaceting = [
  'filterOnly(deliveryYear)',
  'filterOnly(readyToMove)',
  'filterOnly(totalPrice)',
  'filterOnly(financialPlan.downPayment)',
  'filterOnly(financialPlan.monthlyPayment)',
  'filterOnly(financialPlan.numberOfYears)',
  'filterOnly(city.slugEnglish)',
  'filterOnly(city.slugArabic)',
  'filterOnly(district.slugEnglish)',
  'filterOnly(district.slugArabic)',
  'filterOnly(propertyTypeSlugEnglish)',
  'filterOnly(propertyTypeSlugArabic)',
  'filterOnly(developer.slugEnglish)',
  'filterOnly(developer.slugArabic)',
  'filterOnly(compound.slugEnglish)',
  'filterOnly(compound.slugArabic)',
  'filterOnly(bedrooms)',
  'filterOnly(bathrooms)',
  'filterOnly(bua)',
  'filterOnly(finishingType)',
  'filterOnly(saleType)',
];

const unretrievableAttributes = ['modelUrl'];

// Array fo numeric values only increase performance
const numericAttributesForFiltering = [
  'deliveryYear',
  'totalPrice',
  'financialPlan.downPayment',
  'financialPlan.monthlyPayment',
  'financialPlan.numberOfYears',
  'bedrooms',
  'bathrooms',
  'bua',
  'readyToMove',
];

// So far the filtering endpoint only has filters and no search attributes so this should be our ranking criteria
const ranking = [
  'desc(modelUrlScore)',
  'asc(oneListingForEveryCompoundScore)',
  'desc(updatedAtTimeStamp)',
  'filters',
  'custom',
];

const replicas = ALGOLIA_FILTERS_REPLICAS_ARRAY;

listingFilterDefault.setSettings(
  {
    attributesForFaceting,
    unretrievableAttributes,
    numericAttributesForFiltering,
    ranking,
    replicas,
  },
  {
    forwardToReplicas: true,
  },
);

module.exports = listingFilterDefault;

This index has a few replicas with different sorting criteria. This is an example for a replica

const algoliaConnection = require('../../algolia-connection');
const { ALGOLIA_FILTERS_TOTAL_PRICE_ASC_INDEX_NAME } = require('../../constants/algolia-indexes');

const listingFilterTotalPriceAsc = algoliaConnection.initIndex(ALGOLIA_FILTERS_TOTAL_PRICE_ASC_INDEX_NAME);

const ranking = [
  'asc(totalPrice)',
  'filters',
  'custom',
];

listingFilterTotalPriceAsc.setSettings({ ranking });

module.exports = listingFilterTotalPriceAsc;

for some reason every time our pipeline deploys a new version of our app the algolia replicas lose their custom ranking and and get the custom ranking of the main index and actually it happens to some of the replicas not all of them (side note this happens in our production env only, in our dev env which has the same code but a different algolia app it never happens)

Any help would be appreciated