Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GQL-75: Encodes native id before sending it to CMR. #134

Merged
merged 2 commits into from
Oct 3, 2024
Merged

GQL-75: Encodes native id before sending it to CMR. #134

merged 2 commits into from
Oct 3, 2024

Conversation

cgokey
Copy link
Contributor

@cgokey cgokey commented Oct 2, 2024

Overview

What is the feature?

LPDAAC ran into an issue in MMT in production and couldn't publish their draft record.
https://mmt.earthdata.nasa.gov/drafts/collections/CD3244307783-LPCLOUD
After some initial investigation it was determined that the native id was not fully URL encoded: The Original Native ID is:
"native-id" : "VIIRS/NPP BRDF/Albedo Model Parameters Daily L3 Global 1km SIN Grid V002"
The CMR request has it as:
VIIRS/NPP%20BRDF/Albedo%20Model%20Parameters%20Daily%20L3%20Global%201km%20SIN%20Grid%20V002
The non encoded slashes / are adding to the invalid URL:
/ingest/publish/CD3244307783-LPCLOUD/VIIRS/NPP%20BRDF/Albedo%20Model%20Parameters%20Daily%20L3%20Global%201km%20SIN%20Grid%20V002
So the CMR can't find the correct API endpoint.

What is the Solution?

I looked through all the files where {nativeId} was being used in a URL and now encoding the native id.

What areas of the application does this impact?

Publish endpoint
Delete endpoint
Ingest endpoint
Ingest and delete on subscription

Testing

  1. Ingest a record into CMR where its native ids have /'s
  2. Try to publish it
  3. Try deleting the record also

Note, it was not just /'s, one record had "Last of the Wild Project, Version 2, 2005 (LWP-2): Global Human Influence Index (HII) Dataset (IGHP)" as the native id which also didn't work when trying to publish.

Checklist

  • I have added automated tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Copy link

codecov bot commented Oct 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (060918b) to head (68be219).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #134   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          106       106           
  Lines         2343      2343           
  Branches       262       262           
=========================================
  Hits          2343      2343           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@macrouch macrouch left a comment

Choose a reason for hiding this comment

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

In your PR description you list:

What areas of the application does this impact?
Publish endpoint
Delete endpoint
Ingest on concepts
Ingest and delete on subscription

But you only have a test for publishing a draft, and I don't see any code that modifies the delete request. All of these use cases you listed should have an associated test

@cgokey
Copy link
Contributor Author

cgokey commented Oct 3, 2024

In your PR description you list:

What areas of the application does this impact?
Publish endpoint
Delete endpoint
Ingest on concepts
Ingest and delete on subscription

But you only have a test for publishing a draft, and I don't see any code that modifies the delete request. All of these use cases you listed should have an associated test

I'll take a closer look, the publish had a pretty clear cut way of how to add a test, the others were a little less clear based on the tests that are already there. I'll look closer but might need some suggestions as to best way to setup these tests.

@cgokey
Copy link
Contributor Author

cgokey commented Oct 3, 2024

In your PR description you list:

What areas of the application does this impact?
Publish endpoint
Delete endpoint
Ingest on concepts
Ingest and delete on subscription

But you only have a test for publishing a draft, and I don't see any code that modifies the delete request. All of these use cases you listed should have an associated test

I'll take a closer look, the publish had a pretty clear cut way of how to add a test, the others were a little less clear based on the tests that are already there. I'll look closer but might need some suggestions as to best way to setup these tests.

Please take another look, I think I covered a test for each use case now (ingest, publish, delete, subscription->ingest, subscription->delete)

@cgokey cgokey requested a review from macrouch October 3, 2024 20:10
@cgokey cgokey merged commit b9548fe into main Oct 3, 2024
8 checks passed
@cgokey cgokey deleted the GQL-75 branch October 3, 2024 20:41
eudoroolivares2016 pushed a commit that referenced this pull request Oct 11, 2024
* GQL-75: Encodes native id before sending it to CMR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants