-
Notifications
You must be signed in to change notification settings - Fork 727
feat: add lf flag on insights projects update (CM-888) #3774
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
Conversation
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.
Pull request overview
This PR adds automatic management of Linux Foundation (LF) collection connections for insights projects based on their isLF flag. When a project's isLF flag is set to true (either directly or via segment association), it automatically adds the project to the LF collection. Conversely, setting it to false removes the project from the LF collection.
Changes:
- Added a constant for the Linux Foundation collection ID
- Created a new method
manageLfCollectionConnectionto manage automatic LF collection connections - Modified
createInsightsProjectto automatically add LF projects to the LF collection during creation - Modified
updateInsightsProjectto automatically manage LF collection connections when theisLFflag changes
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gaspergrom
left a comment
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.
Code Review
🔴 Critical Issue: Inconsistent isCurrentlyConnectedToLF Logic
In manageLfCollectionConnection (collectionService.ts:598-601):
const isCurrentlyConnectedToLF = currentConnections.some(
(c) => c.collectionId === linuxFoundationCollectionId,
)
let updatedCollections = [...desiredCollections]The method checks isCurrentlyConnectedToLF based on current database state, but then operates on desiredCollections (the user's requested collections). This creates a potential logic issue:
- If
desiredCollectionsalready includes the LF collection (user explicitly added it) andisLF=true, the code correctly avoids duplicates ✅ - But if
desiredCollectionsdoesn't include the LF collection (user explicitly removed it) andisLF=true, the code will re-add it, potentially overriding user intent⚠️
Question: Should automatic LF collection management override explicit user requests to remove a project from the LF collection? If not, the logic needs adjustment to respect user intent.
Other Recommendations
-
Missing Tests - No test files included. Given the complexity of state management (isLF flag changes, collection preservation), unit tests for
manageLfCollectionConnectionwould be valuable. -
Type Safety -
existingConnections?: any[]should use a proper type likeCollectionProjectConnection[] | null -
Unnecessary ESLint Disable - Line 564 has
// eslint-disable-next-line class-methods-use-thisbut the method usesthis.log, so this appears incorrect.
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.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Summary
This pull request implements automatic management of Linux Foundation collection connections based on the
isLFflag on insights projects.What Changed
Automatic Collection Management
isLF = true, it is automatically added to the Linux Foundation collectionisLFflag changes fromtruetofalse, it is automatically removed from the Linux Foundation collectionHow It Works
Project Creation: When creating a new insights project with
isLF = true, the project is automatically connected to the Linux Foundation collectionProject Updates: When updating a project:
isLFchanges totrue→ automatically adds to LF collectionisLFchanges tofalse→ automatically removes from LF collectionisLFchanges → preserves existing collections and only manages LF connectionNote
Implements automatic Linux Foundation collection membership management for insights projects.
linuxFoundationconfig (withcollectionId) todefault.json,production.json, andstaging.jsonLinuxFoundationConfigurationtype and exportsLINUX_FOUNDATION_CONFIGandENABLE_LF_COLLECTION_MANAGEMENTCollectionServiceto auto-manage LF collection connection on project create/update viamanageLfCollectionConnection, preserving explicit or existing collections and reacting toisLFchangescollectionIdis not configuredWritten by Cursor Bugbot for commit 4005eeb. This will update automatically on new commits. Configure here.