Skip to content

CMR-11240: We no longer exclude concepts that are not in progress when a concept identifier is used in the search query#2405

Open
daniel-zamora wants to merge 3 commits intomasterfrom
CMR-11240
Open

CMR-11240: We no longer exclude concepts that are not in progress when a concept identifier is used in the search query#2405
daniel-zamora wants to merge 3 commits intomasterfrom
CMR-11240

Conversation

@daniel-zamora
Copy link
Copy Markdown
Contributor

@daniel-zamora daniel-zamora commented Mar 30, 2026

Overview

What is the objective?

Bypass the non-operational collection filter when searching by collection identifiers (concept-id, entry-id, entry-title, short-name+version, native-id) to fix broken client workflows.

What are the changes?

  • Modified search parameter logic to detect collection identifiers and skip default progress filter
  • Added test coverage for identifier bypass behavior
  • Updated API documentation

What areas of the application does this impact?

  • Collection search API
  • Client workflows using collection identifiers

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

Summary by CodeRabbit

  • Documentation

    • Clarified collection search filter behavior and when non-operational collection statuses are excluded
  • Improvements

    • Searches by specific collection identifiers now automatically bypass the non-operational filter, enabling direct access to all collection statuses

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

Warning

Rate limit exceeded

@daniel-zamora has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 37 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 5 minutes and 37 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 785129ba-b8bb-434e-aa98-87219b74dcad

📥 Commits

Reviewing files that changed from the base of the PR and between cd7a3c4 and b01d490.

📒 Files selected for processing (1)
  • search-app/docs/api.md
📝 Walkthrough

Walkthrough

Updated non-operational collection filtering so identifier-based searches bypass the non-operational filter. Changes touch API docs, query-parameter parsing (adds identifier detection), test URL helper, and expanded system integration tests covering filter behavior and identifier bypass cases. Removed prior "experimental" wording from docs.

Changes

Cohort / File(s) Summary
Documentation
search-app/docs/api.md
Clarified collection_progress note: default exclusion of PLANNED, DEPRECATED, PREPRINT, INREVIEW can be overridden via include-non-operational=true, and the non-operational filter is bypassed when searching by collection identifier parameters; removed previous "experimental" wording.
Parameter parsing
search-app/src/cmr/search/services/parameters/conversion.clj
Added has-identifier? detection (checks :concept-id, :entry-id, :entry-title, :native-id, or :short-name+:version) and adjusted logic so forced include-non-operational="false" is not applied when identifiers are present.
Test utilities
system-int-test/src/cmr/system_int_test/utils/url_helper.clj
Replaced hardcoded localhost with configurable es-config/*-elastic-host when building elastic-root URLs for elastic names.
System integration tests
system-int-test/test/cmr/system_int_test/search/collection/collection_progress_search_test.clj
Refactored progress-filter tests to table-driven assertions, added search-collection-progress-identifier-bypass test covering multiple identifier params and combinations, and expanded cases for include-non-operational flag ON/OFF behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

hacktoberfest-accepted

Suggested reviewers

  • jmaeng72
  • eereiter
  • jceaser

Poem

🐇 I nibble through params, quick and spry,
IDs light the path where filters can't lie.
PLANNED or INREVIEW, I'll still find the rest—
Hop, fetch, return: identifiers pass the test! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: bypassing the non-operational collection filter when using concept identifiers in search queries.
Description check ✅ Passed The description covers all required sections: objectives, changes, impacted areas, and all required checklist items are marked complete with appropriate documentation updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch CMR-11240

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@daniel-zamora daniel-zamora changed the title CMR-11240: search queries with collection identifiers no longer exclu… CMR-11240: We no longer exclude concepts that are not in progress when a concept identifier is used in the search query Mar 30, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
system-int-test/test/cmr/system_int_test/search/collection/collection_progress_search_test.clj (2)

79-100: Consider wrapping flag toggle in try-finally for test isolation.

If any assertion fails between enabling the flag (line 79) and disabling it (line 100), the flag remains enabled, potentially affecting subsequent tests in the same test run. This applies to both search-collection-progress-active-filter and search-collection-progress-identifier-bypass.

♻️ Suggested refactor using try-finally
     (testing "flag OFF - param ignored, all collections returned"
       (util/are3 [items search]
         (d/refs-match? items (search/find-refs :collection search))

         "no params"
         all-colls {}

         "include-non-operational=false"
         all-colls {:include-non-operational "false"}

         "include-non-operational=true"
         all-colls {:include-non-operational "true"}))

-    (side/eval-form `(cmr.search.config/set-enable-non-operational-collection-filter! true))
-
-    (testing "flag ON - filter applies unless overridden"
-      (util/are3 [items search]
-        (d/refs-match? items (search/find-refs :collection search))
-
-        "no params - only operational collections (excludes PLANNED, DEPRECATED, PREPRINT, INREVIEW)"
-        active-colls {}
-
-        "include-non-operational=false - only operational collections"
-        active-colls {:include-non-operational "false"}
-
-        "include-non-operational=true - all collections"
-        all-colls {:include-non-operational "true"}
-
-        "explicit collection-progress=PLANNED - PLANNED returned (filter not applied)"
-        [coll2] {:collection-progress "PLANNED"}
-
-        "collection-progress=PLANNED + include-non-operational=false - empty (explicit filter wins)"
-        [] {:collection-progress "PLANNED" :include-non-operational "false"}))
-
-    (side/eval-form `(cmr.search.config/set-enable-non-operational-collection-filter! false))))
+    (try
+      (side/eval-form `(cmr.search.config/set-enable-non-operational-collection-filter! true))
+
+      (testing "flag ON - filter applies unless overridden"
+        (util/are3 [items search]
+          (d/refs-match? items (search/find-refs :collection search))
+
+          "no params - only operational collections (excludes PLANNED, DEPRECATED, PREPRINT, INREVIEW)"
+          active-colls {}
+
+          "include-non-operational=false - only operational collections"
+          active-colls {:include-non-operational "false"}
+
+          "include-non-operational=true - all collections"
+          all-colls {:include-non-operational "true"}
+
+          "explicit collection-progress=PLANNED - PLANNED returned (filter not applied)"
+          [coll2] {:collection-progress "PLANNED"}
+
+          "collection-progress=PLANNED + include-non-operational=false - empty (explicit filter wins)"
+          [] {:collection-progress "PLANNED" :include-non-operational "false"}))
+      (finally
+        (side/eval-form `(cmr.search.config/set-enable-non-operational-collection-filter! false))))))
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@system-int-test/test/cmr/system_int_test/search/collection/collection_progress_search_test.clj`
around lines 79 - 100, Wrap the flag toggle calls to
cmr.search.config/set-enable-non-operational-collection-filter! in a try/finally
so the flag is always reset to false even if assertions fail; specifically,
around the test block that sets the flag to true (the code invoking
(side/eval-form
`(cmr.search.config/set-enable-non-operational-collection-filter! true))) put
the tests (the util/are3 block for search-collection-progress-active-filter and
similarly in search-collection-progress-identifier-bypass) inside the try and
call (side/eval-form
`(cmr.search.config/set-enable-non-operational-collection-filter! false))) in
the finally to guarantee test isolation.

156-157: Native-id correctly defaults to EntryTitle—optional clarity improvement.

The test is correct: coll3 is ingested with EntryTitle "ET3", and since no explicit :native-id is set, umm-c-collection->concept defaults it to the trimmed EntryTitle via the item->native-id function. The search {:native-id "ET3"} therefore correctly matches coll3.

This assumption is safe and consistent with the test pattern used for entry-title on line 150–151. However, to improve clarity, consider either explicitly setting :native-id "ET3" in the collection data or retrieving it from the ingested reference (e.g., (:native-id coll3)), which would make the implicit derivation explicit.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@system-int-test/test/cmr/system_int_test/search/collection/collection_progress_search_test.clj`
around lines 156 - 157, Test relies on implicit defaulting of native-id from
EntryTitle for coll3 which is correct but unclear; make it explicit by either
adding :native-id "ET3" to the collection data used to ingest coll3 or by using
the actual native-id from the ingested reference (e.g., refer to (:native-id
coll3)) in the search assertion. Update the test where coll3 is defined or where
the search vector is built to use the explicit native-id so readers don't need
to infer umm-c-collection->concept / item->native-id behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@search-app/docs/api.md`:
- Line 1944: Update the NOTE sentence to use the API's underscore-style query
parameter names instead of hyphens: replace "concept-id", "entry-id",
"entry-title", "short-name" and "native-id" with "concept_id", "entry_id",
"entry_title", "short_name" (with "version" where noted) and "native_id", and
keep the reference to the include-non-operational=true flag and the rule about
searching by collection identifiers unchanged.

---

Nitpick comments:
In
`@system-int-test/test/cmr/system_int_test/search/collection/collection_progress_search_test.clj`:
- Around line 79-100: Wrap the flag toggle calls to
cmr.search.config/set-enable-non-operational-collection-filter! in a try/finally
so the flag is always reset to false even if assertions fail; specifically,
around the test block that sets the flag to true (the code invoking
(side/eval-form
`(cmr.search.config/set-enable-non-operational-collection-filter! true))) put
the tests (the util/are3 block for search-collection-progress-active-filter and
similarly in search-collection-progress-identifier-bypass) inside the try and
call (side/eval-form
`(cmr.search.config/set-enable-non-operational-collection-filter! false))) in
the finally to guarantee test isolation.
- Around line 156-157: Test relies on implicit defaulting of native-id from
EntryTitle for coll3 which is correct but unclear; make it explicit by either
adding :native-id "ET3" to the collection data used to ingest coll3 or by using
the actual native-id from the ingested reference (e.g., refer to (:native-id
coll3)) in the search assertion. Update the test where coll3 is defined or where
the search vector is built to use the explicit native-id so readers don't need
to infer umm-c-collection->concept / item->native-id behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a57a5d0d-f659-46ee-8cfc-64940665e1e6

📥 Commits

Reviewing files that changed from the base of the PR and between d063d16 and c787b7b.

📒 Files selected for processing (4)
  • search-app/docs/api.md
  • search-app/src/cmr/search/services/parameters/conversion.clj
  • system-int-test/src/cmr/system_int_test/utils/url_helper.clj
  • system-int-test/test/cmr/system_int_test/search/collection/collection_progress_search_test.clj

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@search-app/docs/api.md`:
- Line 1944: Update the NOTE to clarify that the identifier-based bypass only
prevents the service from auto-applying the default non-operational collection
filter — it does not override an explicit query parameter; state that when
caller sets include-non-operational=false (or true) explicitly, that explicit
setting still applies even if identifier params (concept_id, entry_id,
entry_title, short_name+version, native_id) are present.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a4f722d4-d5d1-40f1-b780-810a11bbbc5b

📥 Commits

Reviewing files that changed from the base of the PR and between c787b7b and cd7a3c4.

📒 Files selected for processing (1)
  • search-app/docs/api.md

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 16.66667% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 25.46%. Comparing base (d063d16) to head (b01d490).

Files with missing lines Patch % Lines
.../src/cmr/search/services/parameters/conversion.clj 0.00% 10 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (d063d16) and HEAD (b01d490). Click for more details.

HEAD has 20 uploads less than BASE
Flag BASE (d063d16) HEAD (b01d490)
22 2
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2405       +/-   ##
===========================================
- Coverage   57.90%   25.46%   -32.44%     
===========================================
  Files        1067     1007       -60     
  Lines       73454    70014     -3440     
  Branches     2125     1041     -1084     
===========================================
- Hits        42532    17831    -24701     
- Misses      28942    51142    +22200     
+ Partials     1980     1041      -939     

☔ 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.

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.

2 participants