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

10553: Process to update contact info fails if DAWSON is also updating other contact info at the same time #5648

Merged
merged 59 commits into from
Dec 14, 2024

Conversation

cruzjone-flexion
Copy link
Contributor

@cruzjone-flexion cruzjone-flexion commented Dec 12, 2024

nechama-krigsman and others added 30 commits November 27, 2024 11:19
…play new error message for when the request times out;
…dOnceAllUpdatesComplete" resolves with user information;
@cruzjone-flexion cruzjone-flexion marked this pull request as ready for review December 12, 2024 22:27
Comment on lines 20 to 22
user.role === ROLES.privatePractitioner ||
user.role === ROLES.irsPractitioner ||
user.role === ROLES.inactivePractitioner
Copy link
Contributor

@Mwindo Mwindo Dec 13, 2024

Choose a reason for hiding this comment

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

This comment isn't really related to your bugfix, but I've seen this check in a few places, and I feel nervous about continuing this pattern. (It is very easy for a dev to think, "Ah, let me create a User" without realizing they need to create a Practitioner instead, or it is easy for a dev to forget one of the disjuncts like ROLES.inactivePractitioner.)

My first thought is that it would be nicer if we could construct the appropriate user with a factory, but that's more complicated and outside your ticket's scope. However, I wonder about your thoughts pulling this check (here and wherever else it is used, which includes admin.ts, changePasswordInteractor, and updateAssociatedCaseWorker) into a function like "isPractitionerUser" or something, which is at least a little cleaner.

Copy link
Contributor

@Mwindo Mwindo left a comment

Choose a reason for hiding this comment

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

It is difficult for me to give a great review of this--I am definitely relying on the tests that you and Tenille have done--but it looks reasonable? I don't want to hold up code.

My main concern is that I think a lot of this work will change substantially as we move off of Dynamo and mostly off of Open Search and onto Postgres. In other words, this is a good deal of somewhat complex code to solve a problem that will likely be easier to handle in a couple of months (when we can avoid doing updates via upserts that overwrite the entire entity).

role: Role;
};

export class UserFactory {
Copy link
Contributor

@Mwindo Mwindo Dec 13, 2024

Choose a reason for hiding this comment

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

I love that you are tackling this! That said, I am a little wary given that we have Practitioner, PrivatePractitioner, and IrsPractitioner. I am not sure how these all play together, and if we only get the UserFactory halfway working, someone might call it expecting it to get the right thing in all cases when it doesn't.

Copy link
Contributor

Choose a reason for hiding this comment

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

(And then depending on complexity this maybe involves more testing, etc.)

@jimlerza jimlerza added the Mappings Change(s) Contains changes to OpenSearch mappings label Dec 13, 2024
Copy link
Contributor Author

@cruzjone-flexion cruzjone-flexion left a comment

Choose a reason for hiding this comment

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

It is true @Mwindo that once this is migrated to Postgres it will simplify this logic. That is why we decided to make sure these process do not overlap and they wait until one finishes before starting the next (instead of modifying process to work in parallel). In the worker we check that the expected count of cases are updated and then toggle the flag again. We also error handle and timeout handle to make sure user is not stuck in a update state.

@jimlerza jimlerza merged commit 545dd03 into ustaxcourt:staging Dec 14, 2024
44 checks passed
@jimlerza jimlerza deleted the 10553-bug branch December 14, 2024 00:35
@jimlerza jimlerza mentioned this pull request Dec 14, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mappings Change(s) Contains changes to OpenSearch mappings Review Please to staging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants