Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

feat: Track Upload Sent events for Coverage/BA/TA#1162

Merged
spalmurray-codecov merged 8 commits intomainfrom
spalmurray/amplitude-upload-event
Mar 4, 2025
Merged

feat: Track Upload Sent events for Coverage/BA/TA#1162
spalmurray-codecov merged 8 commits intomainfrom
spalmurray/amplitude-upload-event

Conversation

@spalmurray-codecov
Copy link
Copy Markdown
Contributor

@spalmurray-codecov spalmurray-codecov commented Feb 18, 2025

Adds event tracking of 'Upload Sent' events for Coverage, Bundles, and test results.

It seems in some cases commit may not have an author set during TA/BA ingest. In these cases we've decided to attribute the events to a special anonymous user that has a special user id constant in shared.

Note that we are using commit.id instead of the commit sha because a full commit sha is functionally identifiable information (for public repos at least). No reason to use this when we have an internal id that does the same thing but is only useful to us.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.88%. Comparing base (5df99ba) to head (947a19d).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1162   +/-   ##
=======================================
  Coverage   95.88%   95.88%           
=======================================
  Files         493      493           
  Lines       16851    16857    +6     
=======================================
+ Hits        16157    16163    +6     
  Misses        694      694           
Flag Coverage Δ
unit 95.88% <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.

@codecov-staging
Copy link
Copy Markdown

codecov-staging bot commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codecov-qa
Copy link
Copy Markdown

codecov-qa bot commented Feb 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.94%. Comparing base (5fb43ea) to head (1d42fb7).

✅ All tests successful. No failed tests found.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 18, 2025

✅ All tests successful. No failed tests were found.

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

@codecov-public-qa
Copy link
Copy Markdown

❌ 75 Tests Failed:

Tests completed Failed Passed Skipped
2746 75 2671 6
View the top 3 failed tests by shortest run time
upload/tests/views/test_uploads.py::::test_uploads_post_token_required_auth_check[False-fork:branch-fork:branch-True]
Stack Traces | 0.003s run time
db = None, mocker = <pytest_mock.plugin.MockerFixture object at 0x7f19e845b0e0>
mock_redis = FakeStrictRedis<ConnectionPool<FakeConnection<server=<fakeredis._server.FakeServer object at 0x7f19e8494680>,db=0>>>
private = True, branch = 'fork:branch', branch_sent = 'fork:branch'
upload_token_required_for_public_repos = False

    @pytest.mark.parametrize("private", [False, True])
    @pytest.mark.parametrize("branch", ["branch", "fork:branch", "someone/fork:branch"])
    @pytest.mark.parametrize(
        "branch_sent", [None, "branch", "fork:branch", "someone/fork:branch"]
    )
    @pytest.mark.parametrize("upload_token_required_for_public_repos", [True, False])
    def test_uploads_post_token_required_auth_check(
        db,
        mocker,
        mock_redis,
        private,
        branch,
        branch_sent,
        upload_token_required_for_public_repos,
    ):
        presigned_put_mock = mocker.patch(
            "shared.api_archive.archive.StorageService.create_presigned_put",
            return_value="presigned put",
        )
        upload_task_mock = mocker.patch(
            "upload.views.uploads.trigger_upload_task", return_value=True
        )
        analytics_service_mock = mocker.patch("upload.views.uploads.AnalyticsService")
>       amplitude_mock = mocker.path("shared.events.amplitude.AmplitudeEventPublisher")
E       AttributeError: 'MockerFixture' object has no attribute 'path'. Did you mean: 'patch'?

.../tests/views/test_uploads.py:474: AttributeError
upload/tests/views/test_uploads.py::::test_uploads_post_token_required_auth_check[True-fork:branch-branch-True]
Stack Traces | 0.004s run time
db = None, mocker = <pytest_mock.plugin.MockerFixture object at 0x7f1a009ca4e0>
mock_redis = FakeStrictRedis<ConnectionPool<FakeConnection<server=<fakeredis._server.FakeServer object at 0x7f1a03ff8380>,db=0>>>
private = True, branch = 'branch', branch_sent = 'fork:branch'
upload_token_required_for_public_repos = True

    @pytest.mark.parametrize("private", [False, True])
    @pytest.mark.parametrize("branch", ["branch", "fork:branch", "someone/fork:branch"])
    @pytest.mark.parametrize(
        "branch_sent", [None, "branch", "fork:branch", "someone/fork:branch"]
    )
    @pytest.mark.parametrize("upload_token_required_for_public_repos", [True, False])
    def test_uploads_post_token_required_auth_check(
        db,
        mocker,
        mock_redis,
        private,
        branch,
        branch_sent,
        upload_token_required_for_public_repos,
    ):
        presigned_put_mock = mocker.patch(
            "shared.api_archive.archive.StorageService.create_presigned_put",
            return_value="presigned put",
        )
        upload_task_mock = mocker.patch(
            "upload.views.uploads.trigger_upload_task", return_value=True
        )
        analytics_service_mock = mocker.patch("upload.views.uploads.AnalyticsService")
>       amplitude_mock = mocker.path("shared.events.amplitude.AmplitudeEventPublisher")
E       AttributeError: 'MockerFixture' object has no attribute 'path'. Did you mean: 'patch'?

.../tests/views/test_uploads.py:474: AttributeError
upload/tests/views/test_uploads.py::::test_uploads_post_tokenless[fork:branch-fork:branch-False]
Stack Traces | 0.004s run time
db = None, mocker = <pytest_mock.plugin.MockerFixture object at 0x7f1a03ffb6e0>
mock_redis = FakeStrictRedis<ConnectionPool<FakeConnection<server=<fakeredis._server.FakeServer object at 0x7f1a01b5c2c0>,db=0>>>
private = False, branch = 'fork:branch', branch_sent = 'fork:branch'

    @pytest.mark.parametrize("private", [False, True])
    @pytest.mark.parametrize("branch", ["branch", "fork:branch", "someone/fork:branch"])
    @pytest.mark.parametrize(
        "branch_sent", [None, "branch", "fork:branch", "someone/fork:branch"]
    )
    def test_uploads_post_tokenless(db, mocker, mock_redis, private, branch, branch_sent):
        presigned_put_mock = mocker.patch(
            "shared.api_archive.archive.StorageService.create_presigned_put",
            return_value="presigned put",
        )
        upload_task_mock = mocker.patch(
            "upload.views.uploads.trigger_upload_task", return_value=True
        )
        analytics_service_mock = mocker.patch("upload.views.uploads.AnalyticsService")
>       amplitude_mock = mocker.path("shared.events.amplitude.AmplitudeEventPublisher")
E       AttributeError: 'MockerFixture' object has no attribute 'path'. Did you mean: 'patch'?

.../tests/views/test_uploads.py:317: AttributeError

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

@spalmurray-codecov spalmurray-codecov marked this pull request as ready for review February 18, 2025 20:11
@spalmurray-codecov spalmurray-codecov requested a review from a team as a code owner February 18, 2025 20:11
Copy link
Copy Markdown
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!

@spalmurray-codecov spalmurray-codecov force-pushed the spalmurray/amplitude-upload-event branch 2 times, most recently from bba4d0b to 6a3bb45 Compare February 24, 2025 16:10
@spalmurray-codecov spalmurray-codecov force-pushed the spalmurray/amplitude-upload-event branch from 55bc911 to 156631e Compare February 24, 2025 16:55
Copy link
Copy Markdown
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.

looks good!

Copy link
Copy Markdown
Contributor

@joseph-sentry joseph-sentry left a comment

Choose a reason for hiding this comment

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

generally lgtm but just a couple questions

@spalmurray-codecov spalmurray-codecov force-pushed the spalmurray/amplitude-upload-event branch from 947a19d to 2074673 Compare March 4, 2025 15:58
@spalmurray-codecov spalmurray-codecov added this pull request to the merge queue Mar 4, 2025
Merged via the queue into main with commit b43c765 Mar 4, 2025
23 of 24 checks passed
@spalmurray-codecov spalmurray-codecov deleted the spalmurray/amplitude-upload-event branch March 4, 2025 19:56
spalmurray-codecov pushed a commit that referenced this pull request Mar 4, 2025
@spalmurray-codecov spalmurray-codecov restored the spalmurray/amplitude-upload-event branch March 4, 2025 21:20
@seer-by-sentry
Copy link
Copy Markdown
Contributor

seer-by-sentry bot commented May 2, 2025

✅ Sentry found no issues in your recent changes ✅

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants