-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
base: master
Are you sure you want to change the base?
feat(project): ProjectOverview endpoint #86175
Conversation
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
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 |
} | ||
|
||
|
||
class ProjectOverviewSerializer(Serializer): |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works! TIL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, my mistake it actually does not work: https://github.com/getsentry/sentry/actions/runs/13652215539/job/38163221839?pr=86175#step:5:16
There was a problem hiding this comment.
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
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.