feat(preprod): Add distribution error endpoint for launchpad#109497
feat(preprod): Add distribution error endpoint for launchpad#109497runningcode merged 7 commits intomasterfrom
Conversation
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
src/sentry/preprod/api/endpoints/project_preprod_distribution.py
Outdated
Show resolved
Hide resolved
0ee284d to
48cb071
Compare
Add a dedicated endpoint for launchpad to report distribution processing errors back to the monolith, mirroring the existing size analysis endpoint pattern. This sets installable_app_error_code and installable_app_error_message on the PreprodArtifact. Refs EME-842, EME-422 Co-Authored-By: Claude <noreply@anthropic.com>
Use parse_request_with_pydantic (which uses parse_obj_as) instead of manual unpacking to properly handle non-dict JSON bodies. Add Field constraint to error_code (0-3) matching the InstallableAppErrorCode enum range. Also make the shared helper's error message generic. Co-Authored-By: Claude <noreply@anthropic.com>
6c0487d to
d386294
Compare
Use getattr for model.__name__ since Annotated type aliases (like PutSize) lack __name__, causing AttributeError on validation failure. Co-Authored-By: Claude <noreply@anthropic.com>
| ProjectPreprodArtifactAssembleGenericEndpoint.as_view(), | ||
| name="sentry-api-0-project-preprod-artifact-assemble-generic", | ||
| ), | ||
| re_path( |
There was a problem hiding this comment.
is is possible to make this one just an org endpoint? I'm about to delete all the dual registered ones: #109878
Move the distribution error endpoint from preprod_internal_urlpatterns to preprod_organization_urlpatterns, dropping the project slug from the URL path to match the other migrated org-scoped endpoints (EME-735). Co-Authored-By: Claude <noreply@anthropic.com>
Backend Test FailuresFailures on
|
Add back project parameter to put() since the base class always passes it. Update test URLs to use the new org-scoped route. Co-Authored-By: Claude <noreply@anthropic.com>
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.
|
|
||
|
|
||
| class PutDistribution(BaseModel): | ||
| error_code: int = Field(ge=0, le=3) |
There was a problem hiding this comment.
Hardcoded magic number coupled to enum max value
Low Severity
The error_code field uses Field(ge=0, le=3) where 3 is a magic number implicitly coupled to the current max value of InstallableAppErrorCode (PROCESSING_ERROR=3). If a new enum member is added to InstallableAppErrorCode, this Pydantic validation will silently reject the new value with no obvious link back to the enum, making it easy to miss during future updates. Referencing the enum directly (e.g., using its max value or validating membership) would keep the validation in sync automatically.


Add a dedicated endpoint (
PUT .../files/preprodartifacts/{id}/distribution/) for launchpad to report distribution processing errors back to the monolith. This mirrors the existingProjectPreprodSizeEndpointpattern.When launchpad encounters a distribution failure (unsupported artifact type, invalid code signature, simulator build), it needs a way to set
installable_app_error_codeandinstallable_app_error_messageon the artifact so the frontend can display the reason. Previously, the only option was the generalupdateendpoint which marks the entire artifact as failed — but distribution errors shouldn't affect the artifact's overall state.Follow-up to #109062. The launchpad side that calls this endpoint is in getsentry/launchpad#567.
Refs EME-842, EME-422