Skip to content

CMR-11242: Adding Toggle for Granule collections Reference validation#2446

Open
eudoroolivares2016 wants to merge 19 commits into
masterfrom
CMR-11242
Open

CMR-11242: Adding Toggle for Granule collections Reference validation#2446
eudoroolivares2016 wants to merge 19 commits into
masterfrom
CMR-11242

Conversation

@eudoroolivares2016

@eudoroolivares2016 eudoroolivares2016 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Overview

What is the objective?

This adds a feature toggle which when set to false will allow ingesting granules even if the references between keywords (namely, projects, platforms, instruments, instrument characterists , and operational modes). Instead, those will be returns as warnings from ingest response

What are the changes?

Major change: Creating the feature toggle in the common as it needed to be used in both ingest and the umm-lib. Threading that up from the validation so that warnings can be propagated down to the end user response.

Minor Changes:
Creating the feature toggle in the common as it needed to be used in both ingest and the umm-lib there were some additional validation which was dead-code that I am removing. The linter picked up a few changes that I allowed it to leave in there namely spacing. Changing imports to just make this more consistent.

What areas of the application does this impact?

Granule ingest and granule validation

Required Checklist

  • New and existing unit and int tests pass locally and remotely
  • clj-kondo has been run locally and all errors in changed files are corrected
  • I have commented my code, particularly in hard-to-understand areas
  • I have made changes to the documentation (if necessary)
  • My changes generate no new warnings

Additional Checklist

  • I have removed unnecessary/dead code and imports in files I have changed
  • I have cleaned up integration tests by doing one or more of the following:
    • migrated any are2 tests to are3 in files I have changed
    • de-duped, consolidated, removed dead int tests
    • transformed applicable int tests into unit tests
    • reduced number of system state resets by updating fixtures. Ex) (use-fixtures :each (ingest/reset-fixture {})) to be :once instead of :each

@codecov-commenter

codecov-commenter commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.91954% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.04%. Comparing base (0bcadbd) to head (f36547d).

Files with missing lines Patch % Lines
...src/cmr/ingest/services/ingest_service/granule.clj 0.00% 12 Missing ⚠️
...ngest-app/src/cmr/ingest/validation/validation.clj 25.00% 6 Missing ⚠️
...int-test/src/cmr/system_int_test/data2/granule.clj 14.28% 6 Missing ⚠️
ingest-app/src/cmr/ingest/api/granules.clj 20.00% 4 Missing ⚠️
ingest-app/src/cmr/ingest/api/collections.clj 50.00% 2 Missing ⚠️
...r/umm_spec/validation/umm_spec_validation_core.clj 33.33% 2 Missing ⚠️
common-lib/src/cmr/common/config.clj 50.00% 0 Missing and 1 partial ⚠️
...m-spec-lib/src/cmr/umm_spec/validation/granule.clj 97.14% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2446      +/-   ##
==========================================
- Coverage   58.20%   58.04%   -0.17%     
==========================================
  Files        1069     1068       -1     
  Lines       74278    74148     -130     
  Branches     2166     2160       -6     
==========================================
- Hits        43233    43036     -197     
- Misses      29028    29093      +65     
- Partials     2017     2019       +2     

☔ View full report in Codecov by Harness.
📢 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.

@eudoroolivares2016 eudoroolivares2016 changed the title CMR-11242: Adding Toggle for Granule collections validation CMR-11242: Adding Toggle for Granule collections Reference validation Jun 18, 2026
Comment thread ingest-app/src/cmr/ingest/api/granules.clj Outdated
Comment on lines -687 to -688
(let [parsed-dif (c/parse-collection all-fields-collection-xml)]
(is (empty? (v/validate-collection parsed-dif))))))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was the only place that c/parse-collection was called so its not actually being used in production

(v/validate (cons vv/variable-validations additional-validations)
variable))))

(defn validate-variable-warnings

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This wasn't being used at all anywhere

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks like it is used in umm-spec-lib/src/cmr/umm_spec/validation but it looks like perhaps that func is not being used anywhere either...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not seeing that in here but, I did notice earlier that this is kinda dead code umm-spec-lib/src/cmr/umm_spec/validation/umm_spec_variable_validation.clj we use it in prod but, I mean its just a stub

Comment thread umm-spec-lib/src/cmr/umm_spec/validation/umm_spec_validation_core.clj Outdated
Comment thread common-lib/src/cmr/common/config.clj Outdated
Comment thread ingest-app/src/cmr/ingest/api/collections.clj Outdated
Comment thread ingest-app/src/cmr/ingest/api/core.clj Outdated
Comment thread ingest-app/src/cmr/ingest/api/granules.clj Outdated
Comment thread ingest-app/src/cmr/ingest/api/granules.clj Outdated
Comment thread umm-spec-lib/src/cmr/umm_spec/validation/granule.clj
Comment thread umm-spec-lib/src/cmr/umm_spec/validation/granule.clj Outdated
Comment thread system-int-test/src/cmr/system_int_test/data2/granule.clj
Comment thread ingest-app/test/cmr/ingest/api/core_test.clj Outdated
["<example>data</example>"]
"<example>data</example>")))

(deftest format-and-contextualize-warnings-existing-errors-test

@jmaeng72 jmaeng72 Jun 19, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

when you build in bamboo, make sure this test is actually executed and you see them in the logs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So its not in the log precisely but, it did run all the unit tests in cmr-ingest-app on the log so I think thats sufficient

Comment thread ingest-app/src/cmr/ingest/api/core.clj
(constantly [parent-collection-concept
collection]))))

;; Declared because of a circular dependency in `validate granule`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

double check probably remove comment

(info (format "Validating granule %s from client %s" (api-core/concept->loggable-string concept)
(:client-id request-context)))
(ingest/validate-granule request-context concept)
{:status 200}))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am not sure that the validate endpoint is going to actually return your new warnings, because as you can see here the actual function always returns 200 because it expects the call to the ingest/validate-granule to raise if there is errors.

@zimzoom

zimzoom commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Approving assuming that it's ok that validate endpoint won't return new granule warnings as ingest endpoint does

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.

4 participants