Skip to content

Feature/fix in release flows dashboard#126

Draft
AlanJaeger wants to merge 3 commits into
mainfrom
feature/fix-in-release-flows-dashboard
Draft

Feature/fix in release flows dashboard#126
AlanJaeger wants to merge 3 commits into
mainfrom
feature/fix-in-release-flows-dashboard

Conversation

@AlanJaeger

Copy link
Copy Markdown
Contributor

No description provided.

cursor[bot]

This comment was marked as outdated.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Double Write to Database

Redundant database operations: project.is_allowed is set to True and saved twice consecutively, leading to unnecessary database writes.

insights/projects/viewsets.py#L83-L89

webhook_error = False
project.is_allowed = True
project.save()
try:
project.is_allowed = True
project.save()

Fix in Cursor


Bug: Webhook Error Handling Unreachable

The if webhook_error block, intended for specific webhook error handling and rollback, is unreachable. This is because exceptions are re-raised in the except blocks, causing them to propagate to the outer handler instead of allowing execution to reach this block. As a result, the webhook_error flag is set but never utilized for its intended purpose, the specific "Failed to process webhook request" HTTP 500 error response is never returned, and the rollback logic within this block is redundant since the finally block already handles the project state rollback.

insights/projects/viewsets.py#L100-L127

except requests.exceptions.RequestException as error:
logger.error(f"Failed to call webhook: {error}")
webhook_error = True
raise
except Exception as error:
logger.error(f"Error during webhook process: {error}")
raise
finally:
if rollback_needed:
try:
project.is_allowed = original_is_allowed
project.save()
logger.info(
f"Rolled back is_allowed status for project {project_uuid}"
)
except Exception as rollback_error:
logger.error(
f"Critical: Failed to rollback project state for {project_uuid}: {rollback_error}"
)
if webhook_error:
project.is_allowed = original_is_allowed
project.save()
return Response(
{"detail": "Failed to process webhook request"},
status=status.HTTP_500_INTERNAL_SERVER_ERROR,
)

Fix in Cursor


Was this report helpful? Give feedback by reacting with 👍 or 👎

@AlanJaeger AlanJaeger marked this pull request as draft June 11, 2025 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant