-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(preprod): expose status check data through build details API #104085
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
base: master
Are you sure you want to change the base?
Conversation
src/sentry/preprod/api/models/project_preprod_build_details_models.py
Outdated
Show resolved
Hide resolved
| if isinstance(raw_checks, dict) and "size" in raw_checks: | ||
| raw_size = raw_checks["size"] | ||
| if isinstance(raw_size, dict): | ||
| if raw_size.get("success"): |
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.
Bug: Truthiness check mishandles non-boolean success values
The success field check uses truthiness rather than explicit boolean comparison. This causes {"success": "false"} to be treated as success since the string is truthy, and missing or null success fields to be treated as failures. The check should verify success is True or validate that it's a boolean before branching, ensuring corrupted data is handled consistently with other validation (skipped rather than misinterpreted).
| if isinstance(raw_size, dict): | ||
| if raw_size.get("success"): | ||
| check_id = raw_size.get("check_id") | ||
| size_check = StatusCheckResultSuccess(check_id=check_id) |
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.
Bug: Unvalidated check_id causes Pydantic validation crash
The check_id value is passed directly to StatusCheckResultSuccess without type validation. If corrupted data contains a non-string value like a dict or list, Pydantic raises ValidationError, crashing the endpoint with a 500 error. This contradicts the tests expecting corrupted data to return 200 with posted_status_checks: None. The code should validate check_id is a string or None, or wrap the Pydantic construction in try-except.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #104085 +/- ##
===========================================
- Coverage 80.61% 80.59% -0.02%
===========================================
Files 9319 9322 +3
Lines 397949 398154 +205
Branches 25424 25424
===========================================
+ Hits 320801 320902 +101
- Misses 76696 76800 +104
Partials 452 452 |
Exposes this data to our frontend so we can build a success/error UI for posted checks.