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

Add ci_service field to upload endpoint #436

Merged
merged 5 commits into from
Mar 6, 2024

Conversation

joseph-sentry
Copy link
Contributor

Links to relevant tickets

Fixes: codecov/engineering-team#1297

What does this PR do?

  • Add a ci_service field to the UploadSerializer that is write_only

@joseph-sentry joseph-sentry requested a review from a team as a code owner March 6, 2024 15:15
@codecov-staging
Copy link

codecov-staging bot commented Mar 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

Copy link

codecov-public-qa bot commented Mar 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f8512f8) 96.04% compared to head (8ed9ae3) 96.04%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #436   +/-   ##
=======================================
  Coverage   96.04%   96.04%           
=======================================
  Files         643      643           
  Lines       17055    17057    +2     
=======================================
+ Hits        16380    16382    +2     
  Misses        675      675           
Flag Coverage Δ
unit 96.04% <100.00%> (+<0.01%) ⬆️
unit-latest-uploader 96.04% <100.00%> (+<0.01%) ⬆️

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

Files Coverage Δ
upload/serializers.py 100.00% <100.00%> (ø)

Impacted file tree graph

Comment on lines 73 to 74
if "version" in validated_data.keys():
validated_data.pop("version")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: there is a default argument on dict.pop(), you can do this in one step https://python-reference.readthedocs.io/en/latest/docs/dict/pop.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suppose I could do something like

validated_data.pop("version", default=None)

but I don't think it's clear that default is necessary or else this will throw an error if
version is not found

would it be cleaner to do what's below or to do what's above with a comment explaining that default is necessary?

try:
  validated_data.pop("version", default=None)
except KeyError:
  pass

Copy link
Contributor

Choose a reason for hiding this comment

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

personally i think validated_data.pop("version", default=None) is clear enough. you don't assign the return value to anything so it's just getting rid of the value if it's in there

there's room to disagree there, though. if you want to be more explicit, i think tweak the current approach:

if "version" in validated_data:
    validated_data.pop("version")

i think the above is more "pythonic" + probably slightly more efficient (not that it matters here). checking for it in .keys() is probably O(n), but key in dict is probably O(1) haha

@codecov-qa
Copy link

codecov-qa bot commented Mar 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.04%. Comparing base (f8512f8) to head (1040668).

❗ Current head 1040668 differs from pull request most recent head 8ed9ae3. Consider uploading reports for the commit 8ed9ae3 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #436   +/-   ##
=======================================
  Coverage   96.04%   96.04%           
=======================================
  Files         643      643           
  Lines       17055    17057    +2     
=======================================
+ Hits        16380    16382    +2     
  Misses        675      675           
Flag Coverage Δ
unit 96.04% <100.00%> (+<0.01%) ⬆️
unit-latest-uploader 96.04% <100.00%> (+<0.01%) ⬆️

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.

Copy link

codecov bot commented Mar 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.75%. Comparing base (b99b186) to head (1040668).
Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #436   +/-   ##
=====================================
  Coverage   95.75   95.75           
=====================================
  Files        765     765           
  Lines      17641   17643    +2     
=====================================
+ Hits       16892   16894    +2     
  Misses       749     749           
Flag Coverage Δ
unit 96.04% <100.00%> (+<0.01%) ⬆️
unit-latest-uploader 96.04% <100.00%> (+<0.01%) ⬆️

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.

@joseph-sentry joseph-sentry force-pushed the joseph/upload-ci-service branch from 1040668 to 8ed9ae3 Compare March 6, 2024 19:47
@joseph-sentry joseph-sentry merged commit b1c7efe into main Mar 6, 2024
17 of 18 checks passed
@joseph-sentry joseph-sentry deleted the joseph/upload-ci-service branch March 6, 2024 20:42
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.

CLI doesn't send CI info for API
2 participants