Skip to content

feat(js-loader): Only use es5/es6 bundles in v7 JS loader #66303

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

Merged
merged 3 commits into from
Mar 13, 2024

Conversation

s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented Mar 5, 2024

As the coming version of the JS SDK only uses ES2017 bundles, it is no longer necessary to differentiate between es5 and es6 bundles.

ref getsentry/sentry-javascript#10911

@s1gr1d s1gr1d self-assigned this Mar 5, 2024
@s1gr1d s1gr1d requested a review from lforst March 5, 2024 12:58
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 5, 2024
Copy link

codecov bot commented Mar 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.29%. Comparing base (0ce27d0) to head (1a73a88).
Report is 61 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #66303    +/-   ##
========================================
  Coverage   84.29%   84.29%            
========================================
  Files        5306     5309     +3     
  Lines      237041   237228   +187     
  Branches    41020    41039    +19     
========================================
+ Hits       199805   199982   +177     
- Misses      37017    37027    +10     
  Partials      219      219            
Files Coverage Δ
src/sentry/api/endpoints/project_key_details.py 94.66% <ø> (ø)
src/sentry/loader/browsersdkversion.py 90.16% <ø> (ø)
src/sentry/projectoptions/defaults.py 100.00% <ø> (ø)
src/sentry/web/frontend/js_sdk_loader.py 98.14% <100.00%> (+0.01%) ⬆️

... and 48 files with indirect coverage changes

Copy link
Contributor

@lforst lforst left a comment

Choose a reason for hiding this comment

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

It would be great to add some tests to the existing loader tests for this change.

We can probably copy & paste the implementation from here:

@mock.patch(
"sentry.loader.browsersdkversion.load_version_from_file", return_value=["6.19.7", "7.0.0"]
)
@mock.patch(
"sentry.loader.browsersdkversion.get_selected_browser_sdk_version", return_value="7.x"
)
def test_equal_to_v7_returns_es5(
self, load_version_from_file, get_selected_browser_sdk_version
):
settings.JS_SDK_LOADER_DEFAULT_SDK_URL = "https://browser.sentry-cdn.com/%s/bundle%s.min.js"
self.projectkey.data = {}
self.projectkey.save()
resp = self.client.get(self.path)
assert resp.status_code == 200
self.assertTemplateUsed(resp, "sentry/js-sdk-loader.js.tmpl")
assert b"/7.0.0/bundle.es5.min.js" in resp.content

@@ -67,7 +67,8 @@ def _get_loader_config(
"hasDebug": False,
}

is_greater_or_equal_v7_sdk = sdk_version >= Version("7.0.0")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can leave the name of is_greater_or_equal_v7_sdk as-is. Imo it doesn't add any value renaming and that way git blame is a bit more useful.

@s1gr1d s1gr1d merged commit 270a826 into master Mar 13, 2024
@s1gr1d s1gr1d deleted the sig-v8-loader-script branch March 13, 2024 10:28
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants