Skip to content

Revert "refactor: Clean up lms/envs/production.py cruft" - #36129

Merged
robrap merged 1 commit into
masterfrom
revert-36115-kdmccormick/lms-envs-production-cleanup
Jan 17, 2025
Merged

Revert "refactor: Clean up lms/envs/production.py cruft"#36129
robrap merged 1 commit into
masterfrom
revert-36115-kdmccormick/lms-envs-production-cleanup

Conversation

@robrap

@robrap robrap commented Jan 17, 2025

Copy link
Copy Markdown
Contributor

Reverts #36115

This breaks our MFEs. On edx.org, it seems the JWT cookies are getting set with the domain .courses.stage.edx.org, making them inaccessible to <MFE>.stage.edx.org.

Additionally, we had done an immediate rollback in production, and this was the only change and it fixed the broken MFEs in production.

@robrap
robrap requested a review from kdmccormick January 17, 2025 15:55
@robrap
robrap enabled auto-merge (squash) January 17, 2025 15:58
@robrap
robrap merged commit 4035aa3 into master Jan 17, 2025
@robrap
robrap deleted the revert-36115-kdmccormick/lms-envs-production-cleanup branch January 17, 2025 16:16

@kdmccormick kdmccormick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Retroactive ✅ -- I agree with the revert logic and I am working with Robert right now to tease out the underlying bug.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot

Copy link
Copy Markdown
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

Comment thread lms/envs/production.py

# This is the domain that is used to set shared cookies between various sub-domains.
# By default, it's set to the same thing as the SESSION_COOKIE_DOMAIN, but we want to make it overrideable.
SHARED_COOKIE_DOMAIN = _YAML_TOKENS.get('SHARED_kCOOKIE_DOMAIN', SESSION_COOKIE_DOMAIN)

@robrap robrap Jan 17, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This typo (thanks Ali) is the likely problem. Do we need a unit test to ensure all _YAML_TOKENS calls make it to settings?
FYI: @kdmccormick

@kdmccormick kdmccormick Jan 17, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤦🏻

Thanks @alangsto and @robrap .

I am open to suggestions, but I am struggling to imagine how to write unit test that would generically test what we want, since:

  1. We do not know what the full set of valid YAML keys is.
  2. Different YAML keys are handled differently. Some directly become django settings. Some are additionally used to compute defaults for other YAML keys (such as this one). Some are specially merged into common settings (like JWT_AUTH). Some are just used to derive real django settings (such as XBLOCK_EXTRA_MIXINS). Some are ignored entirely (such as BROKER_POOL_LIMIT, which is overriden back to 0 after the YAML is loaded).

One thing we could do, though, is check a redacted version of 2U's production lms.yml and cms.yml into edx-platform as test data, as well as a matching lms.json and cms.json file representing the expected realized django settings. We would have a unit test to ensure that lms.yml and cms.yml yielded lms.json and cms.json, protecting against bugs like this one.

If you folks provided the redacted YAML files, I could generate the corresponding JSON files and wire up the unit test.

@robrap robrap Jan 17, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@kdmccormick

Thanks @alangsto and @robrap .

It was actually a different Ali, and I'm not sure of his github username. Maybe we'll update this later, but I'll share the rest of the name privately. :)

I like your ideas, and have comments. I am going to instead comment on the new Attempt 2 PR, and will quote from here. Thanks.
UPDATE: I'm going to discuss in Slack, and we can post an update on the PR later.

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