Skip to content

CUMULUS-4534 -- Ecarton/multi provider db#4252

Open
etcart wants to merge 61 commits intofeature/multi-providerfrom
ecarton/multi-provider_db
Open

CUMULUS-4534 -- Ecarton/multi provider db#4252
etcart wants to merge 61 commits intofeature/multi-providerfrom
ecarton/multi-provider_db

Conversation

@etcart
Copy link
Contributor

@etcart etcart commented Feb 9, 2026

Summary: Summary of changes

Addresses CUMULUS-4534: Develop amazing new feature

Changes

  • add cmr_provider to collection db model

PR Checklist

  • Update CHANGELOG
  • Unit tests
  • Ad-hoc testing - Deploy changes and test manually
  • Integration tests

📝 Note:
For most pull requests, please Squash and merge to maintain a clean and readable commit history.

@Jkovarik Jkovarik changed the title Ecarton/multi provider db CUMULUS-4534 -- Ecarton/multi provider db Feb 9, 2026
t.deepEqual(targetMessage.meta.provider, fakeProvider);
});

test.serial('Sends an SQS message with default cmrProvider if not defined in collection', async (t) => {
Copy link
Member

@Jkovarik Jkovarik Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to reconsider this - if we're making CMR provider a thing that switches core behavior, we probably shouldn't have a default for collection cmr_providers. A default might be the right call for portions of the code that read - meaning for portions of the feature change-set, but I'd urge us not to allow it for migrating collections.

I realize modifying that puts us in feature branch territory as it can't be merged to main, and time is a consideration as well.

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, my reflex is backwards compatibility so that we can roll it out more reasonably. can we remove default later? once we no longer need to play well with DAACs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My general inclination is to do the right thing for moving forward with consolidation here, given the code we're merging now shouldn't make it back into Legacy (assuming they've "frozen", which I believe they have).

The impact should be on us migrating, forcing collections to have a provider when they're migrated.... which is probably a good thing? The other downside that creates is needing to set one for the integration tests. The updside is it prevents accidentally importing a collection, testing it and sending it to the wrong CMR provider.

The technical risk is limited, so I'm willing to go with team consensus on it, but my vote would probably be to do the scaffolding work here to get a integration test provider in place and config our test collections with it.

One of the reasons I was asking about ticket scope is to understand where this concern lands in our ticketed work.

Copy link
Member

@Jkovarik Jkovarik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(review in progress)

collection,
provider,
},
customMeta: merge(
Copy link
Member

@Jkovarik Jkovarik Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit^H^H^H: Is there a reason to bring in lodash/merge over using a native spread operator?

Actually not a nit - lowdash merge mutates eventCustomMeta Given we're already doing `merge(messageTemplate.meta, customMeta, ...) further down the call stack, this probably isn't desirable over something like

customMeta: { ...eventCustomMeta, ...collectionCustomMeta, collection, provider, ...(collection.cmrProvider && { cmr: { provider: collection.cmrProvider }, }), } 

if we want to keep a default cmrProvider. Obviously there's some room for explicit/terse in construction of the object. The critical thing there also is that we don't wind up with 'cmr: { provider: undefined }' as I think you might run into issues with an explicit undefined overwriting the collection default

Not nit: I don't think we should merge collection.meta with meta like this - there's no contract around meta objects, and if we're tossing that because of consolidation we should properly namespace all of it, rather than merging it in this way.

Suggest: either pull a specific field from the collection.meta (it seems like we're adding meta.cmr.provider anyway, so already doing that?) only, unless we need something else from the collection meta duplicate stored in the message (we're sending collection already, e.g. meta.collection.meta).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reason for lodash/merge rather than spreader is that it's recursive merge, and some properties we want to merge are at depth > 1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but lemme look at the meta object...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember why I added collectionCustomMeta.... I guess it just seemed right, I thought what I did was a part of keeping things the same with the switch to merge instead of ...spreader

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, I edited the comment after you'd updated- please note the mutation concern as well as the schema conflict.

t.deepEqual(targetMessage.meta.cmr.provider, fakeMessageResponse.meta.cmr.provider);
});

test.serial('Sends an SQS message with cmrProvider as overridden by collection', async (t) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider addressing the edge cases re: merge if still relevant after resolving https://github.com/nasa/cumulus/pull/4252/changes#r2789097571

@@ -0,0 +1,21 @@
import { Knex } from 'knex';

export const up = async (knex: Knex): Promise<void> => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it functionally matters given our likely number of collections, but might we want an index on this column given the odds of wanting to do queries grouping things by collection.provider?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a good idea...

});
}
};
exports.config = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional given the small table/migration failure consequences?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, this is copy-pasted from another

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually this is needed in order to index

createdAt?: number,
updatedAt?: number
updatedAt?: number,
cmrProvider?: string,
Copy link
Member

@Jkovarik Jkovarik Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: alpha sort. (not that this was set that way prior 😓 )

Copy link
Member

@Jkovarik Jkovarik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good @etcart , just a couple of comments for your consideration. 🙇🏻 Let me know if you'd like to pair/review/etc, I'm at your disposal!

@etcart etcart changed the base branch from master to feature/multi-provider February 10, 2026 17:35

### Added

- **CUMULUS-4534**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other, non-blocking thought - have we scoped doc updates in the tickets?

We need to communicate this change to the technical implementers

table.dropColumn('cmr_provider');
});
}
await knex.raw('DROP INDEX IF EXISTS collection_cmr_provider_index');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Is this a failsafe? I believe dropping the column should drop the index right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea I hemmed and hawed on keeping the parity, but decided mainly on aesthetics to keep it :) I can pull it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

5 participants