Skip to content

Conversation

@trevor-e
Copy link
Member

Exposes this data to our frontend so we can build a success/error UI for posted checks.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 27, 2025
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"):
Copy link
Contributor

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).

Fix in Cursor Fix in Web

if isinstance(raw_size, dict):
if raw_size.get("success"):
check_id = raw_size.get("check_id")
size_check = StatusCheckResultSuccess(check_id=check_id)
Copy link
Contributor

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.

Fix in Cursor Fix in Web

@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

❌ Patch coverage is 35.71429% with 18 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...api/models/project_preprod_build_details_models.py 35.71% 18 Missing ⚠️
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              

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