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: change get_or_create_author() to upsert_author(). track username/name/email changes #1058

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

matt-codecov
Copy link
Contributor

@matt-codecov matt-codecov commented Jan 31, 2025

fixes codecov/engineering-team#3289

i rearranged the function a little bit but the only change is that, if the owner already exists, we will make sure owner.username, owner.name, and owner.email are updated and then commit if anything changed.

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.

@matt-codecov matt-codecov requested a review from a team January 31, 2025 20:35
@codecov-staging
Copy link

codecov-staging bot commented Jan 31, 2025

Codecov Report

Attention: Patch coverage is 94.02985% with 4 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
services/repository.py 85.18% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

Attention: Patch coverage is 94.02985% with 4 lines in your changes missing coverage. Please review.

Project coverage is 97.52%. Comparing base (f38b28c) to head (90b5805).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
services/repository.py 85.18% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1058   +/-   ##
=======================================
  Coverage   97.52%   97.52%           
=======================================
  Files         463      463           
  Lines       38034    38073   +39     
=======================================
+ Hits        37092    37132   +40     
+ Misses        942      941    -1     
Flag Coverage Δ
integration 42.84% <32.83%> (-0.02%) ⬇️
unit 90.21% <94.02%> (+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.

⚠️ Impact Analysis from Codecov is deprecated and will be sunset on Jan 31 2025. See more

@codecov-qa
Copy link

codecov-qa bot commented Jan 31, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
1798 1 1797 9
View the top 1 failed tests by shortest run time
services/tests/test_repository_service.py::test_upsert_author_already_exists
Stack Traces | 0.03s run time
dbsession = <sqlalchemy.orm.session.Session object at 0x7f9a11bac140>

    def test_upsert_author_already_exists(dbsession):
        owner = OwnerFactory.create(
            service="bitbucket",
            service_id="975",
            email="[email protected]",
            username="whoknew",
            yaml=dict(a=["12", "3"]),
        )
        dbsession.add(owner)
        dbsession.flush()
        service = "bitbucket"
        author_id = "975"
        username = "username"
        email = "email"
        name = "name"
        author = upsert_author(dbsession, service, author_id, username, email, name)
        dbsession.flush()
        assert author.ownerid == owner.ownerid
        assert author.free == 0
        assert author is not None
        assert author.service == "bitbucket"
        assert author.service_id == "975"
        assert author.name == owner.name
>       assert author.email == "[email protected]"
E       AssertionError: assert 'email' == '[email protected]'
E         
E         - different_email@email.com
E         + email

services/tests/test_repository_service.py:772: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
1798 1 1797 9
View the top 1 failed tests by shortest run time
services/tests/test_repository_service.py::::test_upsert_author_already_exists
Stack Traces | 0.03s run time
dbsession = <sqlalchemy.orm.session.Session object at 0x7f9a11bac140>

    def test_upsert_author_already_exists(dbsession):
        owner = OwnerFactory.create(
            service="bitbucket",
            service_id="975",
            email="[email protected]",
            username="whoknew",
            yaml=dict(a=["12", "3"]),
        )
        dbsession.add(owner)
        dbsession.flush()
        service = "bitbucket"
        author_id = "975"
        username = "username"
        email = "email"
        name = "name"
        author = upsert_author(dbsession, service, author_id, username, email, name)
        dbsession.flush()
        assert author.ownerid == owner.ownerid
        assert author.free == 0
        assert author is not None
        assert author.service == "bitbucket"
        assert author.service_id == "975"
        assert author.name == owner.name
>       assert author.email == "[email protected]"
E       AssertionError: assert 'email' == '[email protected]'
E         
E         - different_email@email.com
E         + email

services/tests/test_repository_service.py:772: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link

✅ All tests successful. No failed tests were found.

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

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.

update commit author username when ingesting a new commit
2 participants