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

fix: don't share default values in ArchiveField #67

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

giovanni-guidini
Copy link
Contributor

Passing an object as the default value to ArchiveField (such as {})
means that we always return the same reference to multiple objects. So they're shared.
(thanks @scott-codecov for pointing that out)

So instead we will pass a class and call the class, creating a new object if we have to use it.
Noticed I hacked it a little for the default of the defaults to return None.
We can do the same if we ever need more complex values, or just create a new class.

I also moved the log of dbfield and archive_field None to be DEBUG and not INFO.
We are getting that quite a lot and it's making support's work hard.

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.

Passing an object as the default value to `ArchiveField` (such as `{}`)
means that we always return the same reference to multiple objects. So they're shared.
(thanks @scott-codecov for pointing that out)

So instead we will pass a class and call the class, creating a new object if we have to use it.
Noticed I hacked it a little for the default of the defaults to return `None`.
We can do the same if we ever need more complex values, or just create a new class.

I also moved the log of dbfield and archive_field None to be DEBUG and not INFO.
We are getting that quite a lot and it's making support's work hard.
@codecov
Copy link

codecov bot commented Aug 16, 2023

Codecov Report

Merging #67 (bb82834) into main (ad044e4) will not change coverage.
The diff coverage is 100.00%.

Changes have been made to critical files, which contain lines commonly executed in production. Learn more

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #67   +/-   ##
=======================================
  Coverage   98.59%   98.59%           
=======================================
  Files         357      357           
  Lines       26004    26004           
=======================================
  Hits        25639    25639           
  Misses        365      365           
Flag Coverage Δ
integration 98.56% <100.00%> (ø)
latest-uploader-overall 98.56% <100.00%> (ø)
onlysomelabels 98.59% <100.00%> (ø)
unit 98.56% <100.00%> (ø)

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

Components Coverage Δ
NonTestCode 97.32% <100.00%> (ø)
OutsideTasks 98.33% <100.00%> (ø)
Files Changed Coverage Δ
database/models/core.py 96.92% <ø> (ø)
database/models/reports.py 99.19% <ø> (ø)
database/tests/unit/test_model_utils.py 100.00% <100.00%> (ø)
database/utils.py Critical 96.96% <100.00%> (ø)
Related Entrypoints
run/app.tasks.upload.UploadProcessor
run/app.tasks.notify.Notify
run/app.tasks.upload.Upload
run/app.tasks.upload.UploadFinisher
run/app.tasks.pulls.Sync
run/app.tasks.compute_comparison.ComputeComparison
run/app.tasks.timeseries.backfill_commits

@giovanni-guidini giovanni-guidini merged commit 76c780f into main Aug 16, 2023
12 checks passed
@giovanni-guidini giovanni-guidini deleted the gio/dont-share-default-values branch August 16, 2023 14:56
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.

None yet

2 participants