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

CMR-9848: When submitting multiple associations, if one fails CMR returns a 400 but still makes the other associations #2174

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

sxu123
Copy link
Contributor

@sxu123 sxu123 commented Sep 18, 2024

Overview

What is the feature/fix?

Return proper status when processing association requests.

What is the Solution?

When processing association request, only return 400 status when ALL associations fail, rather than when ANY association fails. This includes all generic associations and regular associations, except for tag association. When I changed tag associations return status from 400 to 200 with only partial failure, for some mysterious reason, some ACL related stuff failed in the build, which I really don't see any connection with the fix. I'm writing a separate ticket for the tag association part since I don't have time to fix it.

What areas of the application does this impact?

CMR search.

Checklist

  • [x ] I have updated/added unit and int tests that prove my fix is effective or that my feature works
  • [ x] New and existing unit and int tests pass locally and remotely
  • clj-kondo has been run locally and all errors corrected
  • I have removed unnecessary/dead code and imports in files I have changed
  • [x ] I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • [x ] I have made corresponding changes to the documentation
  • [ x] My changes generate no new warnings
  • 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
    • refactored to reduce number of system state resets by updating fixtures (use-fixtures :each (ingest/reset-fixture {})) to be :once instead of :each

siwei xu added 21 commits June 5, 2024 10:22
@codecov-commenter
Copy link

codecov-commenter commented Sep 18, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 58.14%. Comparing base (a639272) to head (3c38e61).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...rch-app/src/cmr/search/api/generic_association.clj 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2174      +/-   ##
==========================================
- Coverage   58.15%   58.14%   -0.01%     
==========================================
  Files        1045     1045              
  Lines       70428    70430       +2     
  Branches     2001     1998       -3     
==========================================
- Hits        40959    40954       -5     
- Misses      27610    27612       +2     
- Partials     1859     1864       +5     
Flag Coverage Δ
24.43% <37.50%> (-33.73%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@eudoroolivares2016 eudoroolivares2016 changed the title Cmr 9848 association status CMR-9848: When submitting multiple associations, if one fails CMR returns a 400 but still makes the other associations Sep 27, 2024
@@ -3857,7 +3857,7 @@ curl -XDELETE -i -H "Content-Type: application/json" -H "Authorization: Bearer X
{"concept_id": "C1200000006-PROV1"},
{"concept_id": "C1200000007-PROV1"}]'

HTTP/1.1 400 Bad Request
HTTP/1.1 400 Bad Request
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
HTTP/1.1 400 Bad Request
HTTP/1.1 200 Bad Request```
Isn't this example also `200` since the `C1200000005-PROV1` in the example would have succeeded?

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