Skip to content

chore: Test overwatch #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

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

chore: Test overwatch #227

wants to merge 7 commits into from

Conversation

suejung-sentry
Copy link
Contributor

another test DO NOT MERGE

Copy link

seer-by-sentry bot commented Jun 11, 2025

Sentry detected 3 potential issues in your recent changes

Suspicion that repository token authentication fails in `bundle_analysis.py:103~108` due to missing handling for `RepositoryAsUser` objects.
  • Description: The BundleAnalysisView includes RepositoryLegacyTokenAuthentication in its authentication classes. This authentication class successfully authenticates requests using repository tokens and returns a RepositoryAsUser object for request.user. However, the _handle_upload method within the same view, specifically in the code block around lines 103-108, has removed the conditional branch that checks isinstance(request.user, RepositoryAsUser) and handles this user type. Consequently, any request authenticated with a repository token will fall into the final else block, which unconditionally raises a NotAuthenticated() exception. This failure mechanism is triggered when a client uses a valid repository token, leading to an unexpected authentication failure and preventing the upload process from proceeding for these clients.
  • Code location: apps/codecov-api/upload/views/bundle_analysis.py:103~108
  • Suggested fix: Restore the handling for RepositoryAsUser objects in the _handle_upload method of BundleAnalysisView to correctly process requests authenticated with repository tokens.
Suspicion: The bundle analysis view may incorrectly reject requests authenticated with repository tokens, potentially causing authentication failures for existing users.
  • Description: The BundleAnalysisView includes RepositoryLegacyTokenAuthentication in its authentication classes, which successfully authenticates repository tokens and sets request.user to a RepositoryAsUser instance. However, the view logic explicitly checks isinstance(request.user, Owner) and raises NotAuthenticated() in the else block. This means that legitimate requests using repository tokens, which previously worked, will now fail with a 401 authentication error. This breaks compatibility for automated systems or clients relying on repository tokens for bundle analysis uploads. For example, if a request comes in with a valid repository UUID token, RepositoryLegacyTokenAuthentication will return RepositoryAsUser(repository). The view then checks isinstance(RepositoryAsUser(repository), Owner), which is false, leading to the NotAuthenticated exception. This prevents repository token users from accessing the view.
  • Code location: apps/codecov-api/upload/views/bundle_analysis.py:103~106
  • Suggested fix: Modify the view logic to correctly handle request.user being an instance of RepositoryAsUser and extract the repository object from it, similar to how other upload views handle this case.
Suspicion of a field name mismatch (`job` vs `code`) in `bundle_analysis.py:173` causing the job code to be lost, potentially leading to downstream processing issues.
  • Description: The code at apps/codecov-api/upload/views/bundle_analysis.py:173 attempts to retrieve the 'job code' using data.get("job"). However, the corresponding serializer field in UploadSerializer was renamed from job to code. This mismatch means that even if clients send the correct code field, data.get("job") will always return None. This None value is then passed as the job_code argument to the dispatch_upload_task function. Downstream worker tasks, such as those involved in creating upload records, expect a valid job_code when it was originally provided by the client. Receiving None instead of the expected job code constitutes data loss and can lead to unexpected behavior or failures in these downstream processing steps, potentially causing issues in the worker service when it attempts to use the missing data.
  • Code location: apps/codecov-api/upload/views/bundle_analysis.py:173
  • Suggested fix: Change data.get("job") to data.get("code") on line 173 of bundle_analysis.py to match the updated serializer field name.

Did you find this useful? React with a 👍 or 👎

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.

1 participant