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

Prevent duplicate contention migration (fix #2054) #2145

Conversation

raudabaugh
Copy link
Contributor

@raudabaugh raudabaugh commented Oct 25, 2023

What was the problem?

The merge app did not check if an EP400 contention already existed in the pending claim before migrating it.

Associated tickets or Slack threads:

How does this fix it?1

The merge job skips migrating a contention if there is already one in the pending claim with the same claimantText and contentionTypeCode.

How to test this PR

  • From the abd-vro directory, run the unit tests:
    ./gradlew :domain-ee:test

Footnotes

  1. Pull-Requests guidelines. If PR is significant, update Current Software State wiki page.

@raudabaugh raudabaugh requested a review from a team as a code owner October 25, 2023 15:31
@raudabaugh raudabaugh force-pushed the iss2054-migrate-logic branch from 9c39ebb to a48b1f2 Compare October 25, 2023 15:46
@raudabaugh raudabaugh marked this pull request as draft October 25, 2023 17:11
@raudabaugh raudabaugh force-pushed the iss2054-migrate-logic branch from 7299308 to 47311fb Compare October 25, 2023 19:50
@raudabaugh raudabaugh marked this pull request as ready for review October 25, 2023 19:50
@@ -78,6 +79,8 @@ def on_get_ep400_contentions(self, pending_contentions=None):

@running_set_temp_station_of_jurisdiction.enter
def on_set_temp_station_of_jurisdiction(self, pending_contentions=None, ep400_contentions=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

So on line 89 pending_contentions and ep400_contentions are both added to the self.process(...) function as kwargs. So they are actually available for you to use in the function signature of is_duplicate as kwargs: is_duplicate(self, pending_contentions, ep400_contentions). So you dont actually need to add them to the MergeJob class. 🪄 🧙

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking those might be useful to have for restarts/recovery when we get to converting the job store to RDS or some persistent backend. But we could definitely leave those out until we get to that point - thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Noted! I'd say for now, lets just leave them out! We can have another conversation when it comes to the data we should/can/can't store in RDS!

@@ -23,6 +25,8 @@ class MergeJob(BaseModel):
state: JobState = JobState.PENDING
error_state: JobState | None = None
messages: list[Any] | None = None
pending_contentions: list[ContentionSummary] | None = None
Copy link
Contributor

Choose a reason for hiding this comment

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

These additions are unnecessary. See comment on ep_merge_machine.py 👀

Copy link
Contributor

@dfitchett dfitchett left a comment

Choose a reason for hiding this comment

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

Very Nice! 👍 LGTM!

Copy link
Contributor

@nanotone nanotone left a comment

Choose a reason for hiding this comment

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

Approving, with two non-blocking comments:

  • The one about re-raising an exception
  • Could you go through and correct the tinitus typo to tinnitus, in code and in filenames?

try:
return [*pending_contentions.contentions, *ContentionsUtil.new_contentions(pending_contentions.contentions, ep400_contentions.contentions)]
except CompareException:
raise
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason to catch this CompareException and re-raise the original? It seems easier to just leave out the try, except, and raise lines.

@raudabaugh raudabaugh requested a review from a team as a code owner November 21, 2023 16:29
@raudabaugh raudabaugh force-pushed the iss2054-migrate-logic branch from afe407b to e48c638 Compare November 21, 2023 16:43
@raudabaugh raudabaugh force-pushed the iss2054-migrate-logic branch from e48c638 to 33b8913 Compare November 21, 2023 17:21
@raudabaugh raudabaugh merged commit ad0c62d into department-of-veterans-affairs:develop Nov 21, 2023
1 check passed
@raudabaugh raudabaugh deleted the iss2054-migrate-logic branch November 21, 2023 17:27
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