fix(linker): scope clearHistoryData to current project only (#8814)#8815
Open
danielemoraschi wants to merge 1 commit intoapache:mainfrom
Open
fix(linker): scope clearHistoryData to current project only (#8814)#8815danielemoraschi wants to merge 1 commit intoapache:mainfrom
danielemoraschi wants to merge 1 commit intoapache:mainfrom
Conversation
) The clearHistoryData() function used a LEFT JOIN with project_name in the ON clause, causing the subquery to return all PR IDs regardless of project. This effectively wiped the entire pull_request_issues table on every linker run, deleting links from other projects sharing the same repos and links created by the GitHub converter. Fix: - Use INNER JOIN + WHERE for proper project scoping - Add issue-side subquery scoped to current project's boards - Filter by _raw_data_table/_raw_data_remark to only delete linker-created rows Add e2e test for cross-project shared repo scenario.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pr-type/bug-fix,pr-type/feature-development, etc.Summary
Fixes
clearHistoryData()in the linker plugin which was deleting allpull_request_issuesrecords instead of only the current project's linker-created rows.Root cause: The function used a
LEFT JOINwithproject_namein theONclause. With a LEFT JOIN, unmatched rows still appear in the result, so the subquery returned every PR ID in the system effectively wiping the entirepull_request_issuestable on every linker run.Impact: When two projects share a GitHub repo, running the pipeline for one project deleted all PR-issue links created by the other project's pipeline (and links from the GitHub converter).
Fix:
INNER JOIN+WHEREforproject_name(fixes the LEFT JOIN bug)_raw_data_table/_raw_data_remarkfilter to only delete linker-created rows (preserves GitHub converter rows)Tests:
TestLinkPrToIssueWithSharedRepoe2e test with CSV fixtures simulating two projects sharing a repoTestLinkPrToIssuecontinues to pass unchangedDoes this close any open issues?
Closes #8814
Screenshots
N/A — backend-only change.
Other Information
The bug was introduced in commit
a4cb023ba(May 2024, "Clear history data when running linker"). The existing e2e test did not catch it because it only covered a single project and flushed the table before running.One edge case:
If an issue is removed from a project's board between two linker runs, the old stale link for that issue won't be cleaned up (because the issue-side subquery no longer matches it). But this matches how the creation logic works, it also scopes to current board state. And the old code had the same conceptual issue (it just masked it by deleting everything).
Opening this PR since this issue is a blocker for my setup.