fix(releases): combine duplicate Author type#116358
Merged
Merged
Conversation
cvxluo
commented
May 28, 2026
| "authors": [ | ||
| { | ||
| "id": 2837091, | ||
| "id": "2837091", |
Contributor
Author
There was a problem hiding this comment.
this is the actual improvement being made - we return string types in the API, which wasn't being reflected correctly in this example. with the typing change, now this type is fixed
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3119b15. Configure here.
`release_details_types.Author` was a hand-rolled duplicate of the `UserSerializerResponse | NonMappableUser` union that `get_users_for_authors()` already returns from `models/release.py`. It declared `id: int` (runtime emits `str(obj.id)`) and made 8 fields required that the serializer omits for unmatched git committers. The published `OrganizationReleaseDetailsEndpoint` schema therefore advertised a shape never produced; clients codegen'd against it break on `authors[].id` typing or on any release with an external git committer. Move the canonical `Author` and `NonMappableUser` definitions from `models/release.py` into `release_details_types.py` (the type-only module `models/release.py` already imports `VersionInfo` from). `models/release.py`, `models/commit.py`, `models/pullrequest.py`, and `utils/committers.py` import them back from there. Single source of truth, no rename — the union is the same shape regardless of commit/PR/release context. Importing `UserSerializerResponse` here creates a cycle via `api/serializers/types.py`. Break it by moving `SerializedAvatarFields` out of `types.py` into `users/api/serializers/user.py`, where it's primarily used as `UserSerializerResponse.avatar`. Updates the `team`/`project`/`organization` serializer import paths and bumps the existing `RetrieveReleaseDetails` example (`authors[0].id` int → str) so the now-truthful schema validates. Co-authored-by: Claude <noreply@anthropic.com>
3119b15 to
32c6a0f
Compare
cvxluo
commented
May 28, 2026
| hasPasswordAuth: bool | ||
| isManaged: bool | ||
| dateJoined: str | ||
| Author = UserSerializerResponse | NonMappableUser |
Contributor
Author
There was a problem hiding this comment.
i chose to move this type to release_details_types since this is where the original definition was duplicated. we can move it somewhere else if needed
wedamija
approved these changes
May 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

We had duplicate definitions of 'Author' across releases. Consolidate them to the type
UserSerializerResponse | NonMappableUser.