Skip to content

GQL-138: Reverting revision does not work for some collections#178

Merged
mandyparson merged 8 commits intomainfrom
GQL-138
Feb 10, 2026
Merged

GQL-138: Reverting revision does not work for some collections#178
mandyparson merged 8 commits intomainfrom
GQL-138

Conversation

@mandyparson
Copy link
Contributor

@mandyparson mandyparson commented Feb 5, 2026

Overview

What is the feature?

Reverting revision does not work for some collections

What is the Solution?

Looks like some revisions were private. Needed to pass an auth token to the headers in order to perform ingest mutations. Added that as well as some error handling.

What areas of the application does this impact?

datasource/collection.js

Testing

Reproduction steps

  • **Environment for testing: SIT
  • Collection to test with:

mutation RestoreCollectionRevision ( $revisionId: String!, $conceptId: String! ) { restoreCollectionRevision ( revisionId: $revisionId, conceptId: $conceptId ) { conceptId revisionId } }

{ "conceptId": "C1200485688-MMT_1", "revisionId": "3" }

That collection was previously not working. See how no data comes up with you call it directly from CMR with an auth token: https://cmr.sit.earthdata.nasa.gov/search/collections.umm_json?concept_id=C1200485688-MMT_1&all_revisions=true

You can now make revisions to both that and also public collections like this one: https://cmr.sit.earthdata.nasa.gov/search/collections.umm_json?concept_id=C1200450175-MMT_2&all_revisions=true

Attachments

Screenshot 2026-02-05 at 3 06 59 PM

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

@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f4f11ce) to head (a47c0b6).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #178   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          115       115           
  Lines         2694      2706   +12     
  Branches       328       330    +2     
=========================================
+ Hits          2694      2706   +12     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.


// First attempt: without Authorization
try {
previousRevisions = await cmrQuery({
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't we just pass the Auth header each time and if its empty the request should resolve? Seems like we'd want to leave that kind of thing to CMR API core to just return the things accessible to the client.

Copy link
Contributor Author

@mandyparson mandyparson Feb 6, 2026

Choose a reason for hiding this comment

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

fixed


// Determine if revisionId requested still exists
// CMR only stores the ten most recent revisions
const mostRecentRevisionId = parseInt(responseItems[0].meta['revision-id'], 10)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do destructuring here kind of like

Suggested change
const mostRecentRevisionId = parseInt(responseItems[0].meta['revision-id'], 10)
const [{ meta: { 'revision-id': revisionId } }] = responseItems;
const mostRecentRevisionId = parseInt(revisionId, 10);

for consistency

@mandyparson mandyparson merged commit 881c63e into main Feb 10, 2026
9 checks passed
@mandyparson mandyparson deleted the GQL-138 branch February 10, 2026 18:56
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