Skip to content

Bundle Analysis: update asset model #227

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 9 commits into from
May 29, 2024
Merged

Bundle Analysis: update asset model #227

merged 9 commits into from
May 29, 2024

Conversation

JerrySentry
Copy link
Contributor

@JerrySentry JerrySentry commented May 24, 2024

Adds 2 columns to the asset table:

  1. uuid -> this is for associating the current asset with an asset in the previous commit. when two assets with the same uuid is the same across two commits then they are considered the same.
  2. asset_type -> store the type determined via extensions, different types will need to be processed differently moving forward.

closes: codecov/engineering-team#1767

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Copy link

codecov bot commented May 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.48%. Comparing base (ae6e12f) to head (a3f0fed).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #227      +/-   ##
==========================================
- Coverage   89.52%   89.48%   -0.05%     
==========================================
  Files         325      324       -1     
  Lines       10424    10374      -50     
  Branches     1906     1904       -2     
==========================================
- Hits         9332     9283      -49     
+ Misses       1023     1020       -3     
- Partials       69       71       +2     
Flag Coverage Δ
shared-docker-uploader ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JerrySentry JerrySentry marked this pull request as ready for review May 24, 2024 20:03
@@ -183,6 +200,8 @@ def _parse_assets_event(self, prefix: str, event: str, value: str):
name=self.asset.name,
normalized_name=self.asset.normalized_name,
size=self.asset.size,
uuid=str(uuid.uuid4()),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you clarify how the uuid would be the same across commits if we are (apparently) creating random uuids?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, this is just the part 1 of the change to make linking assets across different commits work. By default we will create the uuid for an asset for this PR, for the next PR as the next step of the parsing process it will look at the previous commit's asset, if the algorithm thinks its the same then it will update the current asset's uuid to be the same as the previous, otherwise it will remain the same.

I choose to initialize an uuid on creation and then update it in the following parsing step is because the parsing code is already kind of convoluted, so setting the final uuid right now it would be a nightmare.

# Remove the dot in the extension
file_extension = file_extension[1:]
# At times file can be something like './index.js?module', remove the ?
if "?" in file_extension:
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this doing 2 passes for essentially the same thing? At least in JS, if we just did file_extension.split("?")[0] and there was no "?" it would return the same thing so I figure python would be the same.
Screenshot 2024-05-28 at 1 46 43 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aha true! updated.

def _asset_type(self, name: str) -> AssetType:
extension = get_extension(name)

if extension in ["js"]:
Copy link
Contributor

Choose a reason for hiding this comment

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

just curious, where did we compile this list of extensions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this matches how Sentry buckets its asset types.
Or defined here https://www.notion.so/sentry/Type-Filtering-and-Grouping-82d5db9fd7f84737a4792df2ae30c22f

Copy link
Contributor

Choose a reason for hiding this comment

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

perf! Thanks, exactly what I was looking for

Copy link
Contributor

@ajay-sentry ajay-sentry left a comment

Choose a reason for hiding this comment

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

lgtm!

@JerrySentry JerrySentry added this pull request to the merge queue May 29, 2024
Merged via the queue into main with commit bef1d46 May 29, 2024
6 checks passed
@JerrySentry JerrySentry deleted the may_24_ba branch May 29, 2024 14:38
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.

[Shared] Update SQLite Asset schema to store uuid
3 participants