Skip to content

fix(PM-1169) Cancel all copilot requests when copilot added via WM #816

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

Merged
merged 8 commits into from
Jun 4, 2025

Conversation

hentrymartin
Copy link
Collaborator

What's in this PR?

Ticket link - https://topcoder.atlassian.net/browse/PM-1169

@@ -149,7 +149,7 @@ workflows:
context : org-global
filters:
branches:
only: ['develop', 'migration-setup', 'pm-1169']
only: ['develop', 'migration-setup', 'pm-1169_1']
Copy link

Choose a reason for hiding this comment

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

The branch name has been changed from 'pm-1169' to 'pm-1169_1'. Ensure that this change is intentional and that all relevant documentation and references to the branch name are updated accordingly.

}, {
where: {
copilotRequestId: {
[Op.in]: allCopilotOpportunityByRequestIds,
Copy link

Choose a reason for hiding this comment

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

The where clause should use allCopilotOpportunityByRequestIds.map(item => item.id) instead of allCopilotOpportunityByRequestIds directly. This ensures that the condition is checking against the correct data type (array of IDs).

@@ -170,6 +172,67 @@ module.exports = [
}, {
transaction: t,
});
} else if (source === INVITE_SOURCE.WORK_MANAGER) {
req.log.info("cancelling all existing requests", source);
Copy link

Choose a reason for hiding this comment

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

Consider providing more context in the log message to make it clear what specific action is being taken. For example, include the project ID or other relevant identifiers to help with debugging.

});

const requestIds = allCopilotRequestsByProjectId.map(item => item.id);
req.log.info("requestIds", requestIds);
Copy link

Choose a reason for hiding this comment

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

Consider removing or adjusting the log statement before merging. Logging sensitive information or excessive data can lead to performance issues or security concerns. If logging is necessary, ensure it is appropriately handled and does not expose sensitive information.

transaction: t,
});

req.log.info("allCopilotOpportunityByRequestIds", allCopilotOpportunityByRequestIds.length);
Copy link

Choose a reason for hiding this comment

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

Consider using a more descriptive log message to provide context about the operation being logged. For example, include information about what the length represents or the significance of this log entry.

transaction: t,
});

req.log.info("updated CopilotApplication");
Copy link

Choose a reason for hiding this comment

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

Consider providing more context in the log message to make it clear what specific changes were made to the CopilotApplication. This can help in debugging and understanding the flow of the application.

}, {
where: {
id: {
[Op.in]: allCopilotOpportunityByRequestIds.map(item => item.id),
Copy link

Choose a reason for hiding this comment

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

The change from copilotRequestId to id suggests that allCopilotOpportunityByRequestIds is now an array of objects rather than an array of IDs. Ensure that allCopilotOpportunityByRequestIds is correctly populated with objects containing an id property before this line is executed.

@hentrymartin hentrymartin requested a review from kkartunov June 3, 2025 22:52
transaction: t,
});

// Cancel the existing invites which are opened via
Copy link

Choose a reason for hiding this comment

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

The comment on line 236 is unnecessary and should be removed. Comments should not be added to the code as per the instructions.

Copy link
Contributor

@kkartunov kkartunov left a comment

Choose a reason for hiding this comment

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

Looks good.

@kkartunov kkartunov merged commit 77b0fb0 into develop Jun 4, 2025
2 checks passed
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