Skip to content

Conversation

mbani01
Copy link
Contributor

@mbani01 mbani01 commented Sep 10, 2025

Changes proposed ✍️

This pull request updates integration removal logic and environment configuration to better support the LFX Enterprise Edition and improve the handling of Git integrations. The main changes include switching the default edition to lfx-ee, enhancing the cleanup process for Git integrations, and improving robustness for segment-based operations.

Edition and environment configuration:

  • Changed the default CROWD_EDITION in .env.dist.local from community to lfx-ee, aligning the configuration with LFX Enterprise Edition requirements.

Integration removal and Git integration handling:

  • Refactored the integration removal process in IntegrationService to always use the LFX logic, removing the previous edition check and ensuring consistent behavior.
  • Enhanced the logic for removing Git integrations: if all remotes are removed, the Git integration and its repositories are now fully deleted; otherwise, only the remaining remotes are updated.
  • Improved the soft deletion of Git repositories by ensuring the correct segment and transaction context are used when finding and deleting Git integrations.

Robustness improvements for segment-based operations:

  • Added null checks for segmentId before performing operations related to insights projects and widgets, preventing potential errors when segmentId is undefined.
  • Ensured that segment repositories are only deleted if a valid segmentId is present, increasing code safety.

Checklist ✅

  • Label appropriately with Feature, Improvement, or Bug.
  • Add screenshots to the PR description for relevant FE changes
  • New backend functionality has been unit-tested.
  • API documentation has been updated (if necessary) (see docs on API documentation).
  • Quality standards are met.

@mbani01 mbani01 requested a review from ulemons September 10, 2025 15:58
@mbani01 mbani01 self-assigned this Sep 10, 2025
@mbani01 mbani01 requested a review from themarolt as a code owner September 10, 2025 15:58
@@ -1,6 +1,6 @@
# Global settings
KUBE_MODE=1
CROWD_EDITION=community
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change is out of scope for this PR, but the default should be lfx to avoid inconsistent local/prod behavior

Comment on lines 484 to 502
let insightsProject = null
if (segmentId) {
const [project] = await collectionService.findInsightsProjectsBySegmentId(segmentId)
insightsProject = project
}

const { widgets } = await collectionService.findSegmentsWidgetsById(segmentId)
let widgets = []
if (segmentId) {
const widgetsResult = await collectionService.findSegmentsWidgetsById(segmentId)
widgets = widgetsResult.widgets
}

const insightsRepo = insightsProject?.repositories ?? []

await deleteSegmentRepositories(qx, {
segmentId,
})
if (segmentId) {
await deleteSegmentRepositories(qx, {
segmentId,
})
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ulemons For some reason, this fails locally due to missing segmentId. I didn't investigate further, but the check seems to work. And from a quick test this isn't happening on staging/prod so I assume it has something to do with local setup

Copy link
Contributor

Choose a reason for hiding this comment

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

i ll do a quick test in local env. btw do you make sense to do everything inside one if (segmentId) block ? maybe it is easier to read. what do you think ?

Copy link
Contributor

Choose a reason for hiding this comment

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

approved, for me is working locally 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely makes sense 👍
It's fixed

@mbani01 mbani01 merged commit 7882fba into main Sep 11, 2025
12 checks passed
@mbani01 mbani01 deleted the fix/sync_github_deletions_to_git_integration branch September 11, 2025 09:01
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.

2 participants