Refactor: Globalize enrollment flows - #3509
Conversation
|
This PR adds a Django migration without updating any fixtures. Is a corresponding fixture update needed? |
e53ef82 to
f9de81d
Compare
|
This PR updates |
4ed611a to
c13bc05
Compare
|
I've pushed a commit that resolves almost all of the failing tests, but there are a few that remain that I'd like to discuss with the team. It's a series of five tests shown here: https://github.com/cal-itp/benefits/actions/runs/22327070430/job/64600237234?pr=3509 The proximate cause is clear – they are trying to get the Maybe that's OK, because they're also bringing in things like Or maybe we need some new/different assertions in these tests that factor in the Other than those tests, I think this is ready for initial review! |
We could consider modifying the asserts to check that |
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Thanks for the pointer in the right direction! The latest commit updates these tests. LMK what you think. |
|
Oops, need to rebase now. |
4c8ad5b to
163e386
Compare
|
Now fully tested! |
|
Taking a look! 👀 |
thekaveman
left a comment
There was a problem hiding this comment.
Looking really good. Couple of thoughts/questions.
9ad973d to
ddbeaff
Compare
|
@thekaveman Changes pushed! |
thekaveman
left a comment
There was a problem hiding this comment.
Very nice work on this, what a huge refactor!
I was able to go through all the following flows successfully:
✅ CST / Medicare / Switchio
✅ CST / Older Adult / Switchio
✅ CST / Agency card / Switchio
✅ CST / Medicare / Littlepay
✅ CST / Older Adult / Littlepay
✅ CST / Agency card / Littlepay
The Admin UI looks pretty good OOTB on an agency page, for selecting the supported flows:
It might be nicer if we can use checkboxes here instead of this default and kinda weird multi-select box that relies on color/highlighting, but that certainly isn't blocking.
I do want to clean up the large commented sections in the migration, and deal with the corrupted EnrollmentEvent record in prod (or at least have a solid plan) before merging though.
Agree 💯 Here's the plan as I see it:
Does that seem right? |
Sounds great. Lemme know if you want to chat about fixing the corrupted record at all. |
|
Updated plan in my comment above based on the DB repair research just completed. |
|
|
||
| @pytest.fixture | ||
| def model_EnrollmentFlow(model_TransitAgency): | ||
| # def model_EnrollmentFlow(model_TransitAgency): |
There was a problem hiding this comment.
i think this line is (harmless) detritus
There was a problem hiding this comment.
Another good catch, thanks!
| 3, | ||
| 4, | ||
| 5 | ||
| ], |
There was a problem hiding this comment.
prettier collapses this line for me. did you bypass it?
There was a problem hiding this comment.
No, I just hadn't gotten this current with main, as you now realize :) Will clean it up.
There was a problem hiding this comment.
sorry, now i understand why @thekaveman suggested that we just merge this and untangle in #3216 🍝
There was a problem hiding this comment.
iojk;hasdfiokl;hjasdfiohkl;asdfIoH;ASFIO;HKKASDFGhIkl;
I've rebased locally but Prettier is still behaving the same way. Which makes sense, because your PR didn't change anything about how VS Code handles Prettier, only pre-commit.
But still! pre-commit didn't yell at me either. I dunno, man.
I gotta run, but I'll try to figure it out in the morning.
There was a problem hiding this comment.
i'll pull down your branch and play with it but personally i don't have a problem merging this PR as-is and solving the mystery when i rebase #3216.
There was a problem hiding this comment.
I think the main issue I'm trying to avoid is: Scott's local working branch is now significantly out of date with this one.
In the best case, he can git fetch && git reset --hard origin/refactor/global-enrollment-flows to align with these updates.
In the worst case, he has some local work (either still in progress or committed locally but not pushed) that has to be dealt with to get in sync with this newly rebased branch.
Even if the underlying changes of the commits are the same, rebasing is still destructive to the commit history (SHAs change). We should try to avoid introducing additional merge conflicts or merge work for our colleagues unless they ask for help, is what I'm ultimately trying to say.
There was a problem hiding this comment.
A good point in general, Kegan. Can definitely be annoying if a branch gets rebased out from under you. Hopefully this is the last change on this PR and I won't even have to update my local branch, though :)
There was a problem hiding this comment.
understood. it was overzealous for me to -f push onto this branch without getting a greenlight from @Scotchester first. won't happen again 💂
There was a problem hiding this comment.
epilogue: @Scotchester and i were able to verify this morning that the inconsistency in formatting on his machine had nothing to do with #3520.
he had a VS Code user setting pertaining to .json files specifically that sidestepped prettier entirely in favor of 'JSON Language Features'.
- Add `enrollment_flows` many-to-many field to `TransitAgency` - Add `transit_agency` FK to `EnrollmentGroup`, since groups will now need to keep track of which agency they belong to (since the flow they belong to no longer will) - Convert `EnrollmentGroup.enrollment_flow` from `OneToOneField` to `ForeignKey`, since flows will now be used by more than one group - Remove `group_id` property from `EnrollmentFlow` since they will no longer relate to a single group - Update `EnrollmentFlow.clean()` to reflect that it no longer has a `group_id` and soon will not have a `transit_agency` - Schema and data migration to handle all of the above
Since it can no longer be retrieved from a flow.
Including taking the agency name out of the selection label template name.
Co-authored-by: Kegan Maher <kegan@compiler.la>
38e9169 to
46bcff5
Compare
46bcff5 to
d80877b
Compare
lalver1
left a comment
There was a problem hiding this comment.
Wow, this was a big refactor! Great job @Scotchester!
The code changes look good to me, and I tested locally Older Adult and Courtesy Card and saw no issues 👍
I'm almost finished reviewing, but I did notice something with the migration. As part of looking into the corrupted database row issue, I made a copy of the prod database. Since I had that copy, I ran this PR's migration on it to get a better view of how this PR changes the data model at the SQL table level. After doing that I noticed that SacRT, MST, and SBMTD were missing the Medicare flow; and NevCo was missing the Veteran flow. I may be mistaken, and I'll double check by looking at the migration code again, but wanted to see if you had noticed this too.
|
Sorry, it was my mistake 🤦♂️. I was using the |
|
@lalver1 Thank you for your diligent testing, regardless! |
Closes #3502
I think this is most of the work that needs to be done, though we still need to figure out how to handle that bad record in the
prodDB. (I left in some print statements I was using to debug that.)As discussed, it turned out to be a bit more wide-reaching change than we thought, but in the end, I think the changes are pretty straightforward. I broke them up into 3 fairly isolated commits.
I haven't touched the tests at all yet, and they'll certainly need some major updates.Successful local tests all the way through enrollment: