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

5343 upgrade django in mitxonline #2387

Merged
merged 45 commits into from
Sep 19, 2024
Merged

Conversation

cp-at-mit
Copy link
Contributor

@cp-at-mit cp-at-mit commented Sep 9, 2024

What are the relevant tickets?

https://github.com/mitodl/hq/issues/5343

Description (What does it do?)

Updates Django in MITx Online along with libraries that must be updated in order to support the new version of Django.

Additional Context

Changes from using django-fsm to using viewflow for Order state management.

Updated libraries can be seen in the pyproject.toml file in this PR.

Copy link

gitguardian bot commented Sep 10, 2024

⚠️ GitGuardian has uncovered 6 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
433857 Triggered Generic Password a54e01b authentication/pipeline/user_test.py View secret
433857 Triggered Generic Password a54e01b authentication/pipeline/user_test.py View secret
433857 Triggered Generic Password a54e01b authentication/pipeline/user_test.py View secret
433857 Triggered Generic Password a54e01b authentication/pipeline/user_test.py View secret
433857 Triggered Generic Password a54e01b authentication/pipeline/user_test.py View secret
433857 Triggered Generic Password a54e01b authentication/pipeline/user_test.py View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@cp-at-mit cp-at-mit marked this pull request as ready for review September 12, 2024 11:36
@annagav annagav self-assigned this Sep 13, 2024
Copy link
Contributor

@jkachel jkachel left a comment

Choose a reason for hiding this comment

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

Some minor things to take care of - looks like there's a stray file that got added to the repo, and can the version be pulled from the Compose files? version is harmless but also deprecated so Docker emits a message about it.

Otherwise: I tested a lot of the system and a lot of it looks good to me. Automated tests passed and I was able to sign in, add courses and programs, set up a product, set up discounts, set up financial assistance, test purchasing and refunding, and test the staff dashboard. There were some things that may need addressing:

  • In the financial assistance form, the currency selector didn't render with any options. This appears to be just pulling from the CurrencyExchangeRate table - which is populated on my instance - but maybe there's something else that needs to be fixed here. It does work on RC so it may also just be my instance.
  • I had some issues with the staff dashboard (ResizeObserver loop completed with undelivered notifications) but it does appear to work? Your changes don't touch the staff dashboard so this is probably just me, but am noting it.

Some things I did not test:

  • I did not test the Google Sheets integration because I don't have that set up to test with at the moment.
  • I also didn't test the edX integration because I don't have a reasonable Tutor instance running. It did appear to try to hit it, though, since it failed a whole bunch trying to do that.
  • Furthermore, I didn't test HubSpot because I also don't have this set up (and actually don't know how to do this).

Copy link
Contributor

Choose a reason for hiding this comment

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

What is this?

@cp-at-mit
Copy link
Contributor Author

cp-at-mit commented Sep 13, 2024

  • ResizeObserver loop completed with undelivered notifications

Yeah I am getting that ResizeObserver error as well, but it doesn't really point to anything changed. Looks like there is a CORS error in the browser console that might be associated. But also, both of those pages are controlled by the CMS, so maybe I need to update Wagtail.

@cp-at-mit
Copy link
Contributor Author

In the financial assistance form, the currency selector didn't render with any options. This appears to be just pulling from the CurrencyExchangeRate table - which is populated on my instance - but maybe there's something else that needs to be fixed here. It does work on RC so it may also just be my instance.

That appears to be caused by either: not having the fields for the flexible pricing form defined in the CMS, or they are defined but out of order.

@jkachel
Copy link
Contributor

jkachel commented Sep 18, 2024

  • ResizeObserver loop completed with undelivered notifications

Yeah I am getting that ResizeObserver error as well, but it doesn't really point to anything changed. Looks like there is a CORS error in the browser console that might be associated. But also, both of those pages are controlled by the CMS, so maybe I need to update Wagtail.

I don't see any CORS errors on my end.

After doing some more debugging, this might (might) be a react-router-dom v6 issue? I found some stuff about this in this Stack Overflow post. But this isn't really conclusive - maybe Refine does something with this behind the scenes. We're pretty out of date on even the 3.x branch of Refine now, though, so maybe there's something to that. (We're 3.22.1 and latest 3.x is 3.103.0 - and that's deprecated in favor of 4.x.)

I don't see the error on RC or prod and this really seems to be out of scope for this PR (especially after testing some more - this really seems to be an issue with the Refine stack here, not with any changes in the Django app) so it might be best to punt on this, especially given that it'd also be a good idea to update to Refine 4.

@cp-at-mit cp-at-mit requested a review from jkachel September 18, 2024 20:30
Copy link
Contributor

@annagav annagav left a comment

Choose a reason for hiding this comment

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

I don't seem to be able to go to http://mitxonline.odl.local:8013/cms/

@cp-at-mit
Copy link
Contributor Author

cp-at-mit commented Sep 19, 2024

I don't seem to be able to go to http://mitxonline.odl.local:8013/cms/

@annagav Are you receiving an error?

@annagav
Copy link
Contributor

annagav commented Sep 19, 2024

Screenshot 2024-09-19 at 11 22 00 AM

@cp-at-mit
Copy link
Contributor Author

@annagav can you try running a docker compose build?

@annagav
Copy link
Contributor

annagav commented Sep 19, 2024

@annagav can you try running a docker compose build?

I did. But I can try again.

@cp-at-mit
Copy link
Contributor Author

@jkachel are you able to load the CMS while using this branch?

@jkachel
Copy link
Contributor

jkachel commented Sep 19, 2024

@jkachel are you able to load the CMS while using this branch?

Yes - there were new migrations, though, that needed to be applied.

@cp-at-mit
Copy link
Contributor Author

@jkachel so you just needed to run docker-compose run web ./manage.py migrate ?

@jkachel
Copy link
Contributor

jkachel commented Sep 19, 2024

@jkachel so you just needed to run docker-compose run web ./manage.py migrate ?

Yes, that got it working for me. I did have to do it manually though.

@annagav annagav self-requested a review September 19, 2024 17:03
Copy link
Contributor

@annagav annagav left a comment

Choose a reason for hiding this comment

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

Seems to works as expected 👍 User dashboard, cms, admin.
Google sheets request work too.

@jkachel
Copy link
Contributor

jkachel commented Sep 19, 2024

In the financial assistance form, the currency selector didn't render with any options. This appears to be just pulling from the CurrencyExchangeRate table - which is populated on my instance - but maybe there's something else that needs to be fixed here. It does work on RC so it may also just be my instance.

That appears to be caused by either: not having the fields for the flexible pricing form defined in the CMS, or they are defined but out of order.

I figured this out finally - my local version needed the fixtree command to be run because I was getting an error when creating a financial assistance form (AttributeError: 'NoneType' object has no attribute '_inc_path'). I was able to create a form, then add the fields manually and submit a new request.

However, aren't the form fields supposed to be added automatically? Did this stop at some point? FWIW, RC doesn't do it either so this is more for my curiosity.

Copy link
Contributor

@jkachel jkachel left a comment

Choose a reason for hiding this comment

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

Looks OK once I figured out some issues with Wagtail on my end. I do have questions about form fields in financial assistance forms but since this isn't a changed behavior I'm not concerned about addressing it in this PR.

@cp-at-mit cp-at-mit merged commit 955981d into main Sep 19, 2024
7 checks passed
@cp-at-mit cp-at-mit deleted the 5343-upgrade-django-in-mitxonline branch September 19, 2024 19:23
@odlbot odlbot mentioned this pull request Sep 19, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants