ref(releases): tighten 4 release-file-details endpoint returns to Response[T]#117208
Merged
Conversation
…ponse[T] The release-file-details endpoints (org + project flavors, each with get + put) all dispatched to mixin methods that returned bare Response. Type the mixin returns and then the endpoints follow: - ReleaseFileDetailsMixin.get_releasefile() -> Response[ReleaseFileSerializerResponse] | FileResponse | Response[None]. The download path returns FileResponse (binary file content); the metadata path returns the JSON serializer response; permission-denied returns Response(status=403) with no body. - ReleaseFileDetailsMixin.update_releasefile() -> Response[ReleaseFileSerializerResponse] | Response[ValidationErrorResponse]. Route serializer errors through as_validation_errors() and pin the success-path local to the typed shape (the registry-lookup serialize() flows Any). Endpoint annotations follow the mixin's return type, including the new FileResponse arm. The structural linter is happy — its decorator/Response[T] matching ignores non-Response[T] arms in the annotation. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2b8281d to
f7f876b
Compare
gricha
approved these changes
Jun 9, 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.
Tighten the get/put methods on
ProjectReleaseFileDetailsEndpointandOrganizationReleaseFileDetailsEndpoint. They all delegated to mixin methods onReleaseFileDetailsMixinthat returned bareResponse; typing the mixin lets the endpoints follow.get_releasefile()returnsResponse[ReleaseFileSerializerResponse] | FileResponse | Response[None]— the download path streams aFileResponse(binary file), the metadata path returns the JSON serializer shape, and the permission-denied branch returns a bodyless 403. No body changes; just declaring the existing runtime shapes.update_releasefile()returnsResponse[ReleaseFileSerializerResponse] | Response[ValidationErrorResponse]. Routesserializer.errorsthroughas_validation_errors()for the union arm and pins the success-path local to the typed shape (registry-lookupserialize()flowsAny).The structural linter accepts a
FileResponsearm sitting next toResponse[T]arms because it only matches decorator-declaredTs againstResponse[T]arms in the annotation — extra non-Response[T]arms are silently allowed.