Skip to content

handle deleted integrations gracefully in report generation#37

Merged
ccbrown merged 1 commit intomainfrom
handle-deleted-integrations-in-report-gen
Jun 28, 2025
Merged

handle deleted integrations gracefully in report generation#37
ccbrown merged 1 commit intomainfrom
handle-deleted-integrations-in-report-gen

Conversation

@ccbrown
Copy link
Owner

@ccbrown ccbrown commented Jun 28, 2025

What It Does

Avoids a panic that would occur if a user deleted an integration in the middle of report generation.

Copilot AI review requested due to automatic review settings June 28, 2025 16:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR prevents a panic during report generation when an AWS integration has been deleted by adding a nil check.

  • Adds a branch to return early if the fetched integration is nil.
  • Returns nil, nil in that scenario.
Comments suppressed due to low confidence (1)

backend/app/report.go:266

  • There’s no test covering the scenario where the AWS integration is deleted mid-generation. Adding a unit or integration test for this branch will ensure the nil case continues to be handled safely.
	} else if integration == nil {

if err != nil {
return nil, fmt.Errorf("failed to get aws integration: %w", err)
} else if integration == nil {
return nil, nil
Copy link

Copilot AI Jun 28, 2025

Choose a reason for hiding this comment

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

Returning a nil report and nil error can lead to silent failures or unexpected behavior downstream. Consider returning a descriptive error or an empty but valid report object to make this case explicit.

Suggested change
return nil, nil
return nil, fmt.Errorf("integration not found for AWSIntegrationId: %s", input.AWSIntegrationId)

Copilot uses AI. Check for mistakes.
@ccbrown ccbrown merged commit d08a359 into main Jun 28, 2025
3 checks passed
@ccbrown ccbrown deleted the handle-deleted-integrations-in-report-gen branch June 28, 2025 16:07
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