-
Notifications
You must be signed in to change notification settings - Fork 728
chore: add script to fix activityRelations with wrong memberId #3686
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: Joana Maia <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: emlimlf <[email protected]> Co-authored-by: joanagmaia <[email protected]>
… relations handling
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
1 similar comment
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
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.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
services/apps/script_executor_worker/src/bin/fix-activity-relations-memberId.ts
Outdated
Show resolved
Hide resolved
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
…ment and platform iteration
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
services/apps/script_executor_worker/src/workflows/fix-activityRelations-memberId.ts
Outdated
Show resolved
Hide resolved
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
86e3ae6 to
02b87bb
Compare
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
| correctMemberId, | ||
| record.username, | ||
| record.platform, | ||
| ) |
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.
Bug: Missing guard causes infinite loop when IDs match
The workflow calls moveActivityRelations(record.memberId, correctMemberId, ...) without checking if record.memberId === correctMemberId. Due to a race condition where data changes between the two queries (findMembersWithIncorrectActivityRelations and findMemberIdByUsernameAndPlatform), these values could be equal. When fromId === toId, the underlying moveActivityRelationsWithIdentityToAnotherMember function enters an infinite loop because the UPDATE doesn't change the memberId value, so the subquery keeps matching the same rows indefinitely. This would waste resources until Temporal's 30-minute activity timeout triggers.
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
| record.username, | ||
| record.platform, | ||
| ) | ||
| }), |
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.
Bug: Test-run mode still executes database writes in workflow
When args.testRun is true, the code logs the intended operation but then still calls moveActivityRelations because it's placed outside the if block. The bin script version correctly uses an if-else pattern to skip the write during test runs, but the workflow version logs the message and then unconditionally executes the write operation anyway. This defeats the purpose of the test-run flag and could cause unintended data modifications.
services/apps/script_executor_worker/src/bin/fix-activityRelations-memberId.ts
Show resolved
Hide resolved
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
| record.platform, | ||
| ) | ||
| }), | ||
| ) |
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.
Bug: Workflow doesn't comprehensively fix objectMemberId issues
The workflow queries only for memberId inconsistencies using findMembersWithIncorrectActivityRelations, but moveActivityRelationsWithIdentityToAnotherMember also attempts to fix objectMemberId. The objectMemberId update uses fromId (the wrong memberId) as the filter, so it only fixes objectMemberId when it coincidentally equals the wrong memberId value. The bin script correctly handles this with separate queries for both memberId and objectMemberId issues, but the workflow is missing the objectMemberId query loop, leaving many objectMemberId fixes incomplete.
Additional Locations (1)
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
services/apps/script_executor_worker/src/bin/fix-activityRelations-memberId.ts
Show resolved
Hide resolved
services/apps/script_executor_worker/src/bin/fix-activityRelations-memberId.ts
Show resolved
Hide resolved
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
Note
Adds a Temporal workflow and CLI to detect
activityRelationswith wrongmemberIdand move them to the verified member by username per platform.workflows/fix-activityRelations-memberIdto batch-fixactivityRelationswith incorrectmemberIdacross allPlatformTypevalues.findMembersWithWrongActivityRelations,findMemberIdByUsernameAndPlatform, andmoveActivityRelationswired intoactivities.ts.src/bin/fix-activityRelations-memberId.tsfor cursor-based scanning of verified username identities and moving relations; added npm scriptfix-activity-relations-memberId.IFixActivityRelationsMemberIdArgsfor batch/test-run control and platform iteration.findMembersWithIncorrectActivityRelationsandgetMemberIdByUsernameAndPlatformqueries.moveActivityRelationsWithIdentityToAnotherMembervia writer connection to transfer relations.Written by Cursor Bugbot for commit b8b732e. This will update automatically on new commits. Configure here.