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

feat(project): ProjectOverview endpoint #86175

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

constantinius
Copy link
Contributor

Contributes to https://github.com/getsentry/projects/issues/755

The idea is to have an endpoint that quickly responds with mininimal project info to make the polling of newly created projects as efficient as possible.

This new endpoint only includes data of the actual project, no additional lookups or metrics extraction is made.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 3, 2025
Copy link

codecov bot commented Mar 3, 2025

Codecov Report

Attention: Patch coverage is 97.70115% with 2 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ests/sentry/api/endpoints/test_project_overview.py 95.45% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #86175    +/-   ##
========================================
  Coverage   87.88%   87.89%            
========================================
  Files        9713     9719     +6     
  Lines      550596   551051   +455     
  Branches    21445    21445            
========================================
+ Hits       483881   484326   +445     
- Misses      66335    66345    +10     
  Partials      380      380            

@constantinius constantinius marked this pull request as ready for review March 3, 2025 09:28
@constantinius constantinius requested a review from a team as a code owner March 3, 2025 09:28
@constantinius constantinius requested a review from a team March 3, 2025 09:28
@priscilawebdev priscilawebdev changed the title featp(project): ProjectOverview endpoint feat(project): ProjectOverview endpoint Mar 3, 2025
@constantinius constantinius requested a review from a team March 3, 2025 11:47
}


class ProjectOverviewSerializer(Serializer):
Copy link
Member

Choose a reason for hiding this comment

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

This can easily get outdated because we often add new fields to the project response, can we not reuse ProjectSerializerResponse?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could, even if we will never set some of the fields. But that should be okay, as ProjectSerializerResponse has total=False

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, seems we cannot:

$ mypy src/sentry/api/endpoints/project_overview.py
src/sentry/api/endpoints/project_overview.py:81: error: Missing keys ("isBookmarked", "isMember", "features", "access", "hasAccess") for TypedDict "ProjectSerializerResponse"  [typeddict-item]
Found 1 error in 1 file (checked 1 source file)

Copy link
Member

Choose a reason for hiding this comment

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

What about inheriting from that serializer and marking it total=False?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That works! TIL

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also not with shenanigans like

class ProjectOverviewResponse(ProjectSerializerResponse, TypedDict, total=False):
    pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants