You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: record where each merge suggestion came from - #5073
Merge suggestions come from a few different flows, but nothing records which flow created a pair. Suggestions are deleted once they're merged or rejected, so there's no way to tell how each flow performs without heuristics.
This records the source of every suggestion when it's created, in a new mergeSuggestionSources table that outlives the suggestion. Merges and rejections per source come from joining it with mergeActions and the noMerge tables. The reasoning and the meaning of each source are in ADR-0035.
Changes
Add the mergeSuggestionSources table, keyed by type, pair and source. Pairs are stored sorted so direction doesn't matter, and there are no foreign keys, so merges and deletes don't remove the history.
Add MergeSuggestionSource with four values: global-similarity, subproject-similarity, identity-conflict and enrichment-conflict.
upsertMemberMergeSuggestions and the organization addToMerge now take a required source, so every producer has to pass one. The source is recorded in the same transaction as the suggestions it belongs to, and only for pairs that were actually stored.
Producers pass their source:
global-similarity: member and organization similarity workflows
subproject-similarity: subproject member workflow
identity-conflict: public API identity create, verify and resolve
enrichment-conflict: identity conflicts found during enrichment
A pair keeps its first source when it's rescored. A different flow suggesting the same pair adds its own row.
Add ADR-0035.
Temporal activity tasks scheduled before the deploy carry the old arguments, so a few in-flight ones may fail or record a wrong source during the rollout.
This activity passes a bare connection, so the suggestion writes commit before the source insert. A worker interruption or database error between them leaves suggestions without attribution. If an organization is merged or deleted before retry, findNonExistingIds filters out the pair and its source is permanently lost. Run this repository call in a shared transaction so suggestions and their sources commit together.
The global organization activity passes a plain connection, so the suggestion writes commit before this source insert. If the insert fails or the worker stops between writes, suggestions remain without source history. A retry cannot recover that history if an organization has since been deleted: findNonExistingIds filters out the pair. Run each chunk's raw and filtered upserts, cleanup, and source insert in one transaction, passing that transaction into the upsert helper and pgpQx, as the member path does.
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
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.
Summary
Merge suggestions come from a few different flows, but nothing records which flow created a pair. Suggestions are deleted once they're merged or rejected, so there's no way to tell how each flow performs without heuristics.
This records the source of every suggestion when it's created, in a new
mergeSuggestionSourcestable that outlives the suggestion. Merges and rejections per source come from joining it withmergeActionsand the noMerge tables. The reasoning and the meaning of each source are in ADR-0035.Changes
mergeSuggestionSourcestable, keyed by type, pair and source. Pairs are stored sorted so direction doesn't matter, and there are no foreign keys, so merges and deletes don't remove the history.MergeSuggestionSourcewith four values:global-similarity,subproject-similarity,identity-conflictandenrichment-conflict.upsertMemberMergeSuggestionsand the organizationaddToMergenow take a requiredsource, so every producer has to pass one. The source is recorded in the same transaction as the suggestions it belongs to, and only for pairs that were actually stored.global-similarity: member and organization similarity workflowssubproject-similarity: subproject member workflowidentity-conflict: public API identity create, verify and resolveenrichment-conflict: identity conflicts found during enrichmentTemporal activity tasks scheduled before the deploy carry the old arguments, so a few in-flight ones may fail or record a wrong source during the rollout.
Type of change
Related issue
Closes linuxfoundation/lfx-cdp-insights-ops#489