Skip to content

ref(releases): tighten 4 release-file-details endpoint returns to Response[T]#117208

Merged
azulus merged 1 commit into
masterfrom
jeremy/tighten-release-file-details
Jun 9, 2026
Merged

ref(releases): tighten 4 release-file-details endpoint returns to Response[T]#117208
azulus merged 1 commit into
masterfrom
jeremy/tighten-release-file-details

Conversation

@azulus

@azulus azulus commented Jun 9, 2026

Copy link
Copy Markdown
Member

Tighten the get/put methods on ProjectReleaseFileDetailsEndpoint and OrganizationReleaseFileDetailsEndpoint. They all delegated to mixin methods on ReleaseFileDetailsMixin that returned bare Response; typing the mixin lets the endpoints follow.

get_releasefile() returns Response[ReleaseFileSerializerResponse] | FileResponse | Response[None] — the download path streams a FileResponse (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() returns Response[ReleaseFileSerializerResponse] | Response[ValidationErrorResponse]. Routes serializer.errors through as_validation_errors() for the union arm and pins the success-path local to the typed shape (registry-lookup serialize() flows Any).

The structural linter accepts a FileResponse arm sitting next to Response[T] arms because it only matches decorator-declared Ts against Response[T] arms in the annotation — extra non-Response[T] arms are silently allowed.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 9, 2026
@azulus azulus marked this pull request as ready for review June 9, 2026 17:52
@azulus azulus requested a review from a team as a code owner June 9, 2026 17:52
…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>
@azulus azulus force-pushed the jeremy/tighten-release-file-details branch from 2b8281d to f7f876b Compare June 9, 2026 18:11
@azulus azulus merged commit c4f95cf into master Jun 9, 2026
64 checks passed
@azulus azulus deleted the jeremy/tighten-release-file-details branch June 9, 2026 19:27
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.

2 participants